Changeset 43 for trunk/INCLUDE/ASM.INC
- Timestamp:
- Apr 11, 2014, 11:48:01 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/INCLUDE/ASM.INC
r30 r43 35 35 EndM 36 36 37 38 ; 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 46 ; NOTE: Overlapchecking in JWasm is not as reliable as in Tasm. 47 ; Because it's a single pass assembler, the current location can be 48 ; incorrect. Tasm with multiple passes works correct. 49 ; FIXME: Get JWasm and Tasm use some common ECHO/%OUT method. 50 ; (Tasm only pases first word of non-quoted string to a macro) 51 check_overlap MACRO loc 52 53 ; Exit macro immediately if no overlap. 54 ; We don't want to assign values to z_last_... if there is no 55 ; overlap because they would then hold the values the last time this 56 ; macro was called and not those of the last overlap. 57 IF (loc - $) LE 0 58 ;~ IF ($ - loc) GE 0 59 EXITM 60 ENDIF 61 62 ; Calculate the overlap. 63 z_last_overlap_size = (loc - $) 64 z_last_overlap_location = loc - z_last_overlap_size 65 66 IFDEF JWASM 67 ; Output message. 68 ECHO 69 ECHO ** ERROR: LOCATION OVERLAP DETECTED [JWASM] ! ** 70 ECHO . THIS IS MOST LIKELY CAUSED BY CODE / DATA 71 ECHO . EXPANSION TOWARDS AN 'ORG' DIRECTIVE. 72 ECHO . LOOK AT 'z_last_overlap_location' TO SEE WHERE. 73 ECHO . LOOK AT 'z_last_overlap_size' TO SEE SIZE. 74 ECHO . FORCING ERROR... 75 ECHO 76 ENDIF 77 IFDEF TASM 78 IF2 79 ; Output message (only on pass2). 80 %OUT 81 %OUT ** ERROR: LOCATION OVERLAP DETECTED [TASM] ! ** 82 %OUT . THIS IS MOST LIKELY CAUSED BY CODE / DATA 83 %OUT . EXPANSION TOWARDS AN 'ORG' DIRECTIVE. 84 %OUT . LOOK AT 'z_last_overlap_location' TO WHERE. 85 %OUT . LOOK AT 'z_last_overlap_size' TO SEE SIZE. 86 %OUT . FORCING ERROR... 87 %OUT 88 ENDIF 89 ENDIF 90 91 ; Terminate assembly by forcing an error. 92 .ERR 93 94 ENDM 95 96 37 97 ; Shortcuts for pointer-types 38 98 bptr equ byte ptr
Note:
See TracChangeset
for help on using the changeset viewer.