Changeset 45 for trunk/INCLUDE/ASM.INC
- Timestamp:
- Apr 12, 2014, 12:36:45 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/INCLUDE/ASM.INC
r43 r45 30 30 EndM 31 31 32 callfar Macro destination 33 push cs 34 call &destination 35 EndM 32 33 ; Rousseau: 34 ; My editor (Geany) keeps auto-completing 'call' to 'callfar' because 35 ; of this definition. Since it's not used anywhere I disabled it. 36 ;~ callfar Macro destination 37 ;~ push cs 38 ;~ call &destination 39 ;~ EndM 36 40 37 41 38 42 ; 39 ; An ORG directive resets the location counter where code and data is 40 ; generated. If the location counter is reset back to a point where 41 ; code or data already has been generated, this will be overwritten 42 ; without warning. 43 ; This macro can be used with every ORG directive to check for this condition, 44 ; and when it occurs further assembly is terminated. 45 43 ; OLD OVERLAP CHECKER, DOES NOT WORK WELL WITH JWASM. 44 ; 46 45 ; NOTE: Overlapchecking in JWasm is not as reliable as in Tasm. 47 46 ; Because it's a single pass assembler, the current location can be … … 91 90 ; Terminate assembly by forcing an error. 92 91 .ERR 92 ENDM 93 93 94 95 ; 96 ; A normal ORG directive resets the location counter where code and data is 97 ; going to be emitted. If the location counter is reset back to a point 98 ; where code or data already has been emitted, this will be overwritten 99 ; without warning. 100 ; This macro does a check for this condition and aborts if it exists. 101 ; If there is space between the new location and the last emitted code or data 102 ; will be filled. 103 ; 104 ; There are differences between assemblers on when and how labels and values 105 ; are evaluated. Since JWasm is a single-pass assembler, some expressions 106 ; do not work that do work in multi-pass Tasm. 107 ; That's why the actual check for overlap is done by db getting a negative 108 ; value if an overlap occured. 109 ; So don't change the (after - before) calculations by assigning it to a 110 ; variable; that will break this macro. 111 ; 112 ORIGIN MACRO loc 113 ;~ IFDEF JWASM 114 ;~ db (@F - $) dup('X') 115 ;~ ORG loc 116 ;~ @@: 117 ;~ ENDIF 118 119 ; Use this value to fill the gap between the new origin and the last 120 ; emitted code or data. 121 fillchar = 'X' 122 123 ; Mark the location of the last emitted code or data. 124 z_&loc&_1before: 125 126 ; JWasm can do db 0 dup (0). 127 IFDEF JWASM 128 db (z_&loc&_2after - z_&loc&_1before) dup(fillchar) 129 ENDIF 130 131 ; Tasm cannot. 132 IFDEF TASM 133 IF (z_&loc&_2after - z_&loc&_1before) NE 0 134 db (z_&loc&_2after - z_&loc&_1before) dup(fillchar) 135 ENDIF 136 ENDIF 137 138 ; Set the new origin. 139 ORG loc 140 141 ; Mark the new location. 142 z_&loc&_2after: 143 144 ; Calculate the gap. 145 z_&loc&_3gap = z_&loc&_2after - z_&loc&_1before 146 147 ; 148 ; Note that the variables are prefixed with z_ so they appear 149 ; at the end of the list-file. 150 ; 94 151 ENDM 152 95 153 96 154
Note:
See TracChangeset
for help on using the changeset viewer.