home *** CD-ROM | disk | FTP | other *** search
- comment !
- ***** *****
- ***** PROLOGUE FOR ASSEMBLY LANGUAGE *****
- ***** *****
-
- This sets up the assembler for a small model -- two 64k segments --
- one for code and one for data. Also contains miscellaneous macros
- for (1) abbreviating keywords (2) switching assembly segments and
- (3) starting an exe program and forcing stack to DS segment.
-
- After inclusion of this model, the code segment is the active segment.
-
- Things found in here are:
- abbreviations WO BY DWO OFS ODG OTX
- constants TRUE FALSE
- assembly seg switchers CSEG DSEG
- end of module cleanup END_MOD
- int 21 macro DOS
- far ret macro retf
- push/pop register list PUSHM POPM
- !
-
- ;define segments and their order in memory
-
- _TEXT segment word public 'CODE'
- _TEXT ends
- CONST segment word public 'CONST'
- CONST ends
- _BSS segment word public 'BSS'
- _BSS ends
- _DATA segment word public 'DATA'
- _DATA ends
- STACK segment para stack 'STACK'
- STACK ends
-
- ;all data in one group
- DGROUP group CONST, _BSS, _DATA
-
-
- ;short-hand
- WO equ word ptr
- BY equ byte ptr
- DWO equ dword ptr
- OFS equ offset
- ODG equ offset DGROUP:
- OTX equ offset _TEXT:
-
- TRUE = -1
- FALSE = 0
-
-
- ;macro to revert to _TEXT segment
- CSEG macro
- if @dataflag
- _DATA ends
- @dataflag = FALSE
- endif
- endm
-
- ;macro to switch to _DATA segment
- DSEG macro
- if not @dataflag
- _DATA segment
- @dataflag = TRUE
- endif
- endm
-
- ;macro put at end to cleanup
- END_MOD macro
- CSEG
- _TEXT ends
- endm
-
-
-
- ;dos function call
- DOS macro n
- if (0ff00h and n) ne 0
- mov ax,n
- else
- mov ah,n
- endif
- int 21h
- endm
-
- ;far ret macro
- retf macro n
- local p1
- p1 proc far
- ret n
- p1 endp
- endm
-
- ;pushm regs macro
- ; PUSHM <r1,r2,...>
-
- PUSHM macro rlist
- irp x,<rlist>
- push x
- endm
- endm
-
- ;popm regs macro
- ; POPM <r1,r2,...>
-
- POPM macro rlist
- irp x,<rlist>
- pop x
- endm
- endm
-
-
- ;leave includer in code segment, with cs,ds assumed set
- @dataflag = FALSE ;flag for seg switching macros
- _TEXT segment
- assume cs:_TEXT, ds:DGROUP
-
-