;;=======================================================================75
;; File: PROLOG.NSM  By: s_dubrovich@yahoo.com
;; Last: Sun 14 Aug 2011 03:54:18 PM CDT
;; Prev: 08-May-11 10:12:47 AM, Tue 26 Jul 2011 09:32:58 PM CDT
;; Init: 10-Jan-10 10:11:21 PM
;; Vers: 4r2
;; Note: target gnuLinux, nasm -f elf
;; Sun 14 Aug 2011 03:54:18 PM CDT - v.4r2 chg main: to _main for
;;  ccna32 v.0r3
;;=======================================================================75
;;  Build using these commands:
;;    nasm -f elf -o file.o file.nsm
;;    ld -o file file.o
;; -or- if linking in an extern..
;;    ld --dynamic-linker /lib/ld-linux.so.2 -lc -o file file.o
;;  ex. extern puts
;;
;;  To run: prepend ./ to /file
;;=======================================================================75
;; -= sys functions =-

	SYS_READ_FN	equ 3
	SYS_WRITE_FN	equ 4

	FP_STD_ERR	equ 3
	FP_STD_IN	equ 0
	FP_STD_OUT	equ 1

	%include "asm/io_clib.asm"

;;=======================================================================75
;; CPU PENTIUM

  [SECTION .text]

global 	start

start:
  nop				;; no-op for gdb...

  mov  esp, stacktop

;; -= MAIN =-
global _main

call _main	;; internally generated label with leading underscore for main()

Done:
  mov  eax, SYS_WRITE_FN	;; sys_write fn
  mov  ebx, FP_STD_OUT		;; Specify File Descriptor stdout
  mov  ecx, Msg				;; offset, message
  mov  edx, Msg_Len			;; length, message
  int  80h

Exit:
  mov  eax, 1				;; Code for Exit Syscall
  mov  ebx, 0				;; Return a code of zero	
  int  80H					;; Make kernel call

;;=======================================================================75
;; --== Define Data Section as following Code Section ==--
;; -= F I R S T   D A T A =-
;;=======================================================================75
  [SECTION .data] ;; first .dseg
SN_CTRL:  DB  0,0,0,0,0,0,0,0  ;; - S/N, or Control Number -

Msg: db 10,"-program terminated normally-",10,10
Msg_Len: equ $-Msg
;;=======================================================================75
;; - =   E O   P R O L O G _ E   = -
;;=======================================================================75