; **************************************************************************
;                                                                           ;
;       This program is copyrighted, but may be freely distributed          ;
;       under the terms of the Free Software Foundation's GNU General       ;
;       Public License v2 (or later.)  See the file COPYING for the         ;
;       legalities.  If you did not receive a copy of COPYING, you          ;
;       may request one from the Free Software Foundation, Inc.,            ;
;       59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           ;
;       ABSOLUTELY NO WARRANTY -- use it at your own risk!                  ;
;                                                                           ;
; **************************************************************************

EXE     EQU 0       ; 1 = program.EXE

IF (EXE)
_stack  segment word stack 'STACK'
        db      0100h DUP (05h)
_stack  ends

data    segment    ; data things here 
include \nxdos\src\tbx_data.inc
        msg1    DB '',0dh,0ah,'$' 
        msg2    DB '',0dh,0ah,'$' 
data    ends
ENDIF

code    segment byte public                               ; codesegment_A
        assume  cs:code, ds:code
IF (EXE)
        assume cs:code, ds:data
        assume es:data, ss:_stack
ENDIF

	 org	100h

program  proc    far 

start:   jmp     initialize ; main
progname db 'Grab 1.02',0

        ; include c:\mysrc\asm\asmtbx.mac ; Macro routines.. asmc0de
        ; compileid
IF (EXE)
        include \nxdos\src\tbx_code.inc 
ELSE
        include \nxdos\src\toolbox.asm 
ENDIF

initialize:  
IF (EXE)
         mov  ax, data    ; Establish data and extra segment addressability 
         mov  ds, ax      ; aka  setup the stack n' data segments   
         assume 	ds:data
         mov  es, ax
         assume  es:data
ELSE 
         ;jmp short kmain 
         push cs
         pop  es
         mov  bx, ProgramEnd
         call resize
         jc   kexitptr
         ;MOV AH,4Ah        ; Resize our memory to the "T"
         ;MOV BX,ProgramEnd + 0Fh + 0200h
         ;MOV SP,BX         ; Set's stack pointer.
         ;SHR BX,04         ; Divides .BX by 16.
         ;INT 21h
ENDIF
kmain:   ; main code go here!
         call cs:main
kexitptr: 
         call dosexit
         int 20h      ; remove this

; --- Your data goes here :) ------------------------------------------------
kdata:

program    endp

; ===========================================================================
main       proc far
; Thy rest of your proggy goes here!
; ===========================================================================
           include \nxdos\src\utils\grab\grab.inc
           ret
main       endp

code       ends

ProgramEnd EQU $-01h

	   end start
