home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / GRAPHICS / DAKIT.ZIP / ASM.INC < prev    next >
Encoding:
Text File  |  1990-10-10  |  3.8 KB  |  152 lines

  1. ;-----------------------------------------------------------------
  2. ; asm.inc
  3. ; -------
  4. ; Standard macros for DPaint II MS-DOS ".asm" files.
  5. ;-----------------------------------------------------------------
  6.  
  7. ;-----------------------------------------------------------------
  8. ; Memory model configuration.
  9. ;-----------------------------------------------------------------
  10.  
  11. LPROG    equ    1        ; 1 means large (>64k) program segment
  12. LDATA    equ    0        ; 1 means large (>64k) data segment
  13.  
  14. ;-----------------------------------------------------------------
  15. ; After a standard procedure entry (push bp, mov bp,sp), the first
  16. ; parm on the stack can be accessed at ARGB[bp].
  17. ;-----------------------------------------------------------------
  18.  
  19.     if LPROG
  20. ARGB equ 6
  21.     else
  22. ARGB equ 4
  23.     endif
  24.  
  25. ;-----------------------------------------------------------------
  26. ; File header: sets up groups, segment names, etc.
  27. ;-----------------------------------------------------------------
  28.  
  29.     if LPROG
  30. HEADER macro module
  31. module&_TEXT segment word public 'CODE'
  32. module&_TEXT ends
  33. _DATA segment word public 'DATA'
  34. _DATA ends
  35. CONST segment word public 'CONST'
  36. CONST ends
  37. _BSS segment word public 'BSS'
  38. _BSS ends
  39. DGROUP group CONST, _BSS, _DATA
  40.     assume cs:module&_TEXT, ds:DGROUP, ss:DGROUP, es:DGROUP
  41.     endm
  42.     else
  43. HEADER macro 
  44. _TEXT segment word public 'CODE'
  45. _TEXT ends
  46. CONST segment word public 'CONST'
  47. CONST ends
  48. _BSS segment word public 'BSS'
  49. _BSS ends
  50. _DATA segment word public 'DATA'
  51. _DATA ends
  52. DGROUP group CONST, _BSS, _DATA
  53.     assume cs:_TEXT, ds:DGROUP, ss:DGROUP, es:DGROUP
  54.     endm
  55.     endif
  56.  
  57. ;-----------------------------------------------------------------
  58. ; Data segment start & end.
  59. ;-----------------------------------------------------------------
  60.  
  61. DSEG macro
  62. _DATA segment
  63.     endm
  64.  
  65. ;-----------------------------------------------------------------
  66.  
  67. ENDDS macro
  68. _DATA ends
  69.     endm
  70.  
  71. ;-----------------------------------------------------------------
  72. ; Program segment start & end.
  73. ;-----------------------------------------------------------------
  74.  
  75.     if LPROG
  76. PSEG macro module
  77. module&_TEXT segment
  78.     endm
  79.     else
  80. PSEG macro
  81. _TEXT    segment
  82.     endm
  83.     endif
  84.  
  85. ;-----------------------------------------------------------------
  86.  
  87.     if LPROG
  88. ENDPS macro module
  89. module&_TEXT ends
  90.     endm
  91.     else
  92. ENDPS macro module
  93. _TEXT ends
  94.     endm
  95.     endif
  96.  
  97. ;-----------------------------------------------------------------
  98. ; Procedure start & end.
  99. ;-----------------------------------------------------------------
  100.  
  101. STARTPROC macro proc_name
  102.     if LPROG
  103. proc_name proc far
  104.     else
  105. proc_name proc near
  106.     endif
  107.     endm
  108.  
  109. ;--- start a procedure and declare it public ---
  110. STARTPROC_PUBLIC macro name
  111.     public name
  112.     if LPROG
  113. name proc far
  114.     else
  115. name proc near
  116.     endif
  117.     endm
  118.  
  119. ;-----------------------------------------------------------------
  120.  
  121. ENDPROC macro proc_name
  122. proc_name endp
  123.     endm
  124.  
  125. ;-----------------------------------------------------------------
  126. ; When the 80286 is in real mode, the POPF instruction may recognize
  127. ; a pending maskable interrupt even if interrupts were off before the
  128. ; corresponding PUSHF.  This macro should be used instead of POPF.
  129. ; See "IBM Personal Computer Seminar Proceedings" v2, #4 (September '84)
  130. ; for info about the POPF bug.
  131. ;-----------------------------------------------------------------
  132.  
  133. popflags macro
  134.         jmp        $+3        ; jump around IRET
  135.         iret            ; pop CS, IP, and flags
  136.         push    cs
  137.         call    $-2        ; call within segment
  138.         endm
  139.  
  140. ;-----------------------------------------------------------------
  141. ; Offsets to low byte & high byte of a word.
  142. ;-----------------------------------------------------------------
  143. LO    = 0
  144. HI    = 1
  145.  
  146. ;-----------------------------------------------------------------
  147. ; --- miscellaneous constants
  148.  
  149. TRUE                equ 1
  150. FALSE                equ 0
  151.  
  152.