-
Notifications
You must be signed in to change notification settings - Fork 0
/
DOSMAC.INC
1591 lines (1370 loc) · 29.8 KB
/
DOSMAC.INC
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;ifdef _16BIT
;
; Macro file for MSDOS.
;
; SCCSID = @(#)dosmac.inc 11.12 88/07/13
;
FALSE equ 0
;;;;TRUE equ not FALSE
TRUE equ -1 ; masm 5.10 bug
AsmVars macro varlist, value
irp var,<varlist>
AsmVar var, value
endm
endm
AsmVar macro var, value
ifndef var
ifb <value>
var = FALSE
else
var = value
endif
endif
endm
; Check if all (or most) the checking flags are to be enabled.
ifdef ALLSTRICT
AsmVar MISCSTRICT, TRUE
AsmVar VMSTRICT, TRUE
AsmVar DEVSTRICT, TRUE
AsmVar VOLPTRCHK, TRUE
AsmVar INTERRPRT, TRUE
AsmVar DHSTRICT, TRUE
AsmVar SELSTRICT, TRUE
AsmVar FSSTRICT, TRUE
endif
;* Values for ?farcode, set by FARCODE macro to indicate which
; code segment is being assembled.
FC_DosCode EQU 0 ; DosCode
FC_InitCode EQU 1 ; DosInitCode
FC_HighCode EQU 2 ; DosHighCode
FC_High2Code EQU 3 ; DosHigh2Code
FC_High3Code EQU 4 ; DosHigh3Code
FC_Ring3Code EQU 5 ; DosRing3Code
FC_InitRMCode EQU 6 ; DosInitRMCode
.xcref ?mode386
?mode386 = FALSE
SUBTTL BREAK a listing into pages and give new subtitles
PAGE
BREAK MACRO subtitle
SUBTTL subtitle
PAGE
ENDM
.xcref BREAK
;
; call a procedure that may be external. The call will be short.
;
invoke MACRO name
.xcref
IF2
IFNDEF name
EXTRN name:NEAR
ENDIF
ENDIF
.cref
CALL name
ENDM
.xcref invoke
PAGE
;
; jump to a label that may be external. The jump will be near.
;
transfer MACRO name
.xcref
IF2
IFNDEF name
EXTRN name:NEAR
ENDIF
ENDIF
.cref
JUMP name
ENDM
.xcref transfer
;
; get a short code address in a word
;
CSOFFSET EQU OFFSET DosCode:
short_addr MACRO name
IFDIF <name>,<?>
.xcref
IF2
IFNDEF name
EXTRN name:NEAR
ENDIF
ENDIF
.cref
DW CSOFFSET name
ELSE
DW ?
ENDIF
ENDM
.xcref short_addr
;
; get a long address in a dword
;
long_addr MACRO name
.xcref
IF2
IFNDEF name
EXTRN name:NEAR
ENDIF
ENDIF
.cref
DD name
ENDM
.xcref long_addr
; Declare a Procedure:
; Parameters:
; name: procedure_name
; distance: near,far,hybrid,faronly
; scope: local,farlocal,nearlocal
; treg: scratch register
; If non-blank, this register is used to optimizize far calls
; to hybrid procedures, at the expense of near calls.
; By default, near calls are the more efficient of the two.
; abase: the number of bytes to skip for calculating the ArgVar
; offsets. The default (if this is blank) depends on the
; "distance" variable. "NEAR" is 4 and "FAR" is 6.
.xcref ?frame
.xcref ?aframe
.xcref ?abase
.xcref ?stackdepth
.xcref ?initstack
?frame = 0 ; initial
?aframe = 0 ; initial
?abase = 0 ; initial
?stackdepth = 0 ; initial stack size
?initstack = 0 ; initial stack size
?local = 0 ; local proc flag
?near = 0 ; near proc flag
?faronly = 0 ; faronly proc flag
?oldfaronly = 0 ; outer scope faronly proc flag
?depth = 0 ; procedure nesting level
?call386 = 0 ; 386 call (32-bit near or 48-bit far)
Procedure macro name,distance,scope,treg,abase
if2
if ?depth gt 1
%out Nesting too deep in Procedure name
.err
endif
endif
?depth = ?depth + 1
?oldfaronly = ?faronly ;; save previous value
?frame = 0
?aframe = 0
?faronly = 0 ;; default to near/hybrid
?near = 1 ;; default to near
?initstack = ?stackdepth ;; beginning of procedure
?local = 0 ;; default to public
?call386 = 0 ;; default to 286-mode call
ifnb <scope>
?local = 1 ;; local if non-blank scope
if2
?x = 0
irp x,<LOCAL,local,farlocal,nearlocal>
ifidn <x>,<scope>
?x = 1
endif
endm
ife ?x
%out Bad scope_arg scope in Procedure name
;;.err
endif
endif
endif
ifnb <distance> ;; if nonblank, is hybrid, near, faronly or far
if2
?x = 0
irp x,<HYBRID,hybrid,NEAR,near,FAR,far,FARONLY,faronly,far386>
ifidn <x>,<distance>
?x = 1
endif
endm
ife ?x
%out Bad distance_arg distance in Procedure name
;;.err
endif
endif
irp x,<HYBRID,hybrid>
?local = 0
ifidn <scope>,<local>
?local = 1 ;; local if scope is 'local'
endif
ifidn <scope>,<LOCAL>
?local = 1 ;; local if scope is 'LOCAL'
endif
ifidn <distance>,<x>
ifb <treg>
ifidn <scope>,<nearlocal>
GENHYBRID name ;; generate far public thunk
?local = 1 ;; but near label is local
else
GENHYBRID name,<scope> ;; generate far thunk
endif
else
ifidn <scope>,<farlocal>
Entry name ;; generate near public label
?local = 1 ;; but far label is local
else
Entry name,,<scope>
endif
pop treg
push cs
push treg
?faronly = 1 ;; pretend to be faronly
?near = 0 ;; not near
endif
endif
endm
irp x,<FAR,far>
ifidn <distance>,<x>
?near = 0 ;; is far
endif
endm
irp x,<FARONLY,faronly>
ifidn <distance>,<x>
?faronly = 1 ;; is faronly
?near = 0 ;; not near
endif
endm
ifidn <distance>,<far386>
?near = 0 ;; is far
?call386 = 1 ;; is 48-bit call
endif
endif
if ?faronly
if ?local
GENPUBLIC hy_&name,<local>,code
else
GENPUBLIC hy_&name,,code
endif
else
if ?local
GENPUBLIC name,<local>,code
else
GENPUBLIC name,,code
endif
endif
if ?near
?abase = 2+2 ;; remember the pushed BP
if ?call386
?abase = ?abase + 2 ;; return address is 32-bit offset
endif
name proc near ;; is near or hybrid
else
?abase = 4+2 ;; remember the pushed BP
if ?call386
?abase = ?abase + 4 ;; return is 48-bit pointer plus 16-bit pad
endif
if ?faronly
hy_&name proc far ;; is faronly
else
name proc far ;; else must be far
endif
endif
ifnb <abase> ;; if abase is not blank, then use it
?abase = abase
endif
endm
.xcref procedure
;
; end a procedure and check that stack depth is preserved
;
EndProc macro name, chk
ifdif <chk>,<NoCheck> ;; check the stack size
if2
if ?initstack ne ?stackdepth ;; is it different?
%out ***** Possible stack size error in name *****
endif
endif
endif
if ?faronly
hy_&name endp ;; is faronly
else
name endp ;; else near, far or hybrid
endif
ife ?depth
if2
%out EndProc without matching Procedure name
.err
endif
else
?depth = ?depth - 1
?faronly = ?oldfaronly ;; restore previous value
endif
ifdef KILLASSUMES
assume ds:nothing, es:nothing, ss:nothing
endif
endm
.xcref EndProc
;** GENPUBLIC - generate a public symbol in all cases, but first
; pervert the name if it really is a local symbol. For symbolic
; debugger support only.
?lcnt = 0
GENPUBLIC macro name,local,code ;; generate a public or local symbol
ifb <local> ;; if local symbol not requested
public name
else
ifndef TRUELOCAL ;; if we want some public name
ifdef NOLOCAL ;; if all symbols should be public
public name
else
?GENLOCAL %?lcnt,name,<code> ;; else croft a pseudo public
?lcnt = ?lcnt + 1
endif
endif
endif
endm
?GENLOCAL macro cnt,name,code ;; generate a public local symbol
??GENLOCAL %@FILENAME,name,code
endm
??GENLOCAL macro file,name,code ;; generate a public local symbol
public file&$&name
ifb <code>
file&$&name label byte ;; allow masm PUBDEF DS association
else
file&$&name: ;; avoid masm PUBDEF DS association
endif
endm
;** EXTRNFAR - generate an EXTRN for the hybrid symbol if it
; has not yet been defined, and the skip argument is blank.
EXTRNFAR macro name,skip
ifb <skip>
ifndef hy_&name
extrn hy_&name:far
endif
endif
endm
; generate a far pointer to a hybrid procedure
DDFAR macro name
dd hy_&name
endm
; move the offset of a hybrid procedure into a register or memory
MOVFAROFFSET macro target,name,group
ifb <group>
mov target,offset cs:hy_&name
else
mov target,offset group:hy_&name
endif
endm
; generate an intersegment call or jmp to a hybrid procedure
CALLFAR macro name
call far ptr hy_&name
endm
JMPFAR macro name
jmp far ptr hy_&name
endm
; generate a hybrid procedure linkage procedure
GENHYBRID macro name,lcl
local farproc
farproc proc far
ret
GENPUBLIC hy_&name,<lcl> ;; generate a public or local symbol
hy_&name label far
push offset cs:farproc ;; near-code must immediately follow
farproc endp
endm
; generate a near/far/hybrid entry into a procedure
Entry macro name,distance,scope
local a
a = 0 ;; assume near label
ifnb <scope>
if2
?x = 0
irp x,<local,LOCAL>
ifidn <x>,<scope>
?x = 1
endif
endm
ife ?x
%out Bad scope_arg scope in Entry name
;;.err
endif
endif
endif
ifnb <distance>
if2
?x = 0
irp x,<faronly,hybrid,HYBRID>
ifidn <x>,<distance>
?x = 1
endif
endm
ife ?x
%out Bad distance_arg distance in Entry name
;;.err
endif
endif
ifidn <distance>,<faronly> ;; was it far only?
a = 1 ;; then generate far label
else ;; else must be hybrid
jmp short name ;; previous callers skip hybrid linkage
GENHYBRID name,<scope>
endif
endif
if a ;; generate far label?
GENPUBLIC hy_&name,<scope> ;; generate a public or local symbol
hy_&name:
else ;; else generate near label
GENPUBLIC name,<scope> ;; generate a public or local symbol
name:
endif
endm
.xcref Entry
BREAK <ERROR - store an error code then jump to a label>
error macro code
.xcref
mov al,code
transfer Sys_Ret_Err_AL
.cref
ENDM
.xcref error
BREAK <JUMP - real jump that links up shortwise>
;
; given a label <lbl> either 2 byte jump to another label <lbl>_J
; if it is near enough or 3 byte jump to <lbl>
;
jump macro lbl
local a
.xcref
ifndef lbl&_J ;; is this the first invocation
a: JMP lbl
ELSE
IF (lbl&_J GE $) OR ($-lbl&_J GT 126)
a: JMP lbl ;; is the jump too far away?
ELSE
a: JMP lbl&_J ;; do the short one...
ENDIF
ENDIF
lbl&_J = a
.cref
endm
.xcref jump
BREAK <RETURN - return from a function>
return macro x
RET x
endm
.xcref return
ifdef NEVERNEVERNEVER
BREAK <CONDRET - conditional return>
condret macro cc,ncc
local a
.xcref
.xcref a
.cref
ifdef ret_l ;; if ret_l is defined
if (($ - ret_l) le 126) and ($ gt ret_l)
;; if ret_l is near enough then
a: j&cc ret_l ;; a: j<CC> to ret_l
ret_&cc = a ;; define ret_<CC> to be a:
exitm
endif
endif
ifdef ret_&cc ;; if ret_<CC> defined
if (($ - ret_&cc) le 126) and ($ gt ret_&cc)
;; if ret_<CC> is near enough
a: j&cc ret_&cc ;; a: j<CC> to ret_<CC>
ret_&cc = a ;; define ret_<CC> to be a:
exitm
endif
endif
j&ncc a ;; j<NCC> a:
return ;; return
a: ;; a:
ret_&cc = ret_l ;; define ret_<CC> to be ret_l
endm
.xcref condret
BREAK <RETZ - return if zero, links up shortwise if necessary>
retz macro
condret z,nz
endm
.xcref retz
BREAK <RETNZ - return if not zero, links up shortwise if necessary>
retnz macro
condret nz,z
endm
.xcref retnz
BREAK <RETC - return if carry set, links up shortwise if necessary>
retc macro
condret c,nc
endm
.xcref retc
BREAK <RETNC - return if not carry, links up shortwise if necessary>
retnc macro
condret nc,c
endm
.xcref retnc
endif
BREAK <CONTEXT - set the DOS context to a particular register>
Dos3Mac MACRO name
IF2
%out Warning - DOS 3 macro name called
ENDIF
ENDM
SegContext macro srl,gr,noassume,base,grpnam
IFB <gr> ;; push and pop if no general register
IRP sr,<srl> ;; for each register
PUSH base ;; push base
POP sr ;; pop into the register
IFB <noassume> ;; if ASSUME not inhibited
ASSUME sr:grpnam
ENDIF
ENDM
ELSE ;; else if we have a helper register
MOV gr,base ;; load helper with base
IRP sr,<srl> ;; for each register in list
MOV sr,gr ;; load the register from the helper
IFB <noassume> ;; if ASSUME not inhibited
ASSUME sr:grpnam
ENDIF
ENDM
ENDIF
endm
.xcref SegContext
DosContext macro srl,gr,noassume
LOCAL i
IFNB <gr> ;; if intermediate general register
mov gr,DosGroup
IRP sr,<srl>
mov sr,gr
ENDM
ELSE
IRP sr,<srl> ;; for sr = *first* segreg in list
i = 0
IRP r,<srl> ;; for r = each segreg in list
i = i + 1
IF i EQ 1 ;; if r is first in list
push DosGroup ;; do push immediate
ELSE ;; else r is second (or later) in list
push sr ;; and sr contains desired value
ENDIF
pop r
ENDM
EXITM ;; quit after sr = first in list
ENDM
ENDIF
IFB <noassume>
IRP sr,<srl>
ASSUME sr:DosGroup
ENDM
ENDIF
endm
.xcref DosContext
ArenaContext macro srl,gr,noassume
SegContext <srl>,gr,noassume,ARENADATA,ARENADATA
endm
.xcref ArenaContext
DosHighContext macro srl,gr,noassume
SegContext <srl>,gr,noassume,DGROUP,DGROUP
endm
.xcref DosHighContext
TaskContext macro srl,gr,noassume
SegContext <srl>,gr,noassume,SS,TaskArea
endm
.xcref TaskContext
DosInitContext macro srl,gr,noassume
SegContext <srl>,gr,noassume,DosInitData,DosInitData
endm
.xcref DosInitContext
BREAK <SaveReg/RestoreReg - save or restore a set of registers>
SaveReg MACRO reglist ;; push those registers
IRP reg,<reglist>
?stackdepth = ?stackdepth + 1
PUSH reg
ENDM
ENDM
.xcref SaveReg
RestoreReg MACRO reglist ;; pop those registers
IRP reg,<reglist>
?stackdepth = ?stackdepth - 1
POP reg
ENDM
ENDM
.xcref RestoreReg
BREAK <Critical section macros>
ifdef INTERRPRT
IntErrF = TRUE
endif
AsmVars <Debug,IntErrF,ShareF,Redirector>
BREAK <ASSERT - make assertions about registers>
;* Assert - sanity checks (contolled by DEBUG switch)
;
; kind: one of Z, NZ, ISBUF, ISCURBUF, ISSFT, ISVPB (case is
; significant)
; objs: register pair which should point to given structure
; for IS???; an expression for Z or NZ
; message: message printed if assertion fails; should identify
; the calling routine
IF Debug
Assert MACRO kind, objs, message
LOCAL a,b
IFIDN <kind>,<Z>
CMP objs,0
JZ a
DBPRT <>,<>,<message>
a:
ELSE
IFIDN <kind>,<NZ>
CMP objs,0
JNZ a
DBPRT <>,<>,<message>
a:
ELSE
IFIDN <kind>,<ISDPB>
%out ISDPB referenced... Needs to be examined (someday) and changed to ISVPB
EXITM
ENDIF
PUSH AX
IRP obj,<objs>
PUSH obj
ENDM
IF ShareF
MOV AX,OFFSET b
ELSE
MOV AX,OFFSET DosGroup:b
ENDIF
PUSH AX
IFIDN <kind>,<ISBUF>
Invoke BUFCheck
ENDIF
IFIDN <kind>,<ISCURBUF>
Invoke CURBUFCheck
ENDIF
IFIDN <kind>,<ISSFT>
Invoke SFTCheck
ENDIF
IFIDN <kind>,<ISVPB>
Invoke xVPBCheck
ENDIF
POP AX
IF ShareF
JMP SHORT a
b DB message,0
a:
ELSE
Table segment
b DB message,0
Table ends
ENDIF
ENDIF
ENDIF
ENDM
ELSE
Assert Macro
ENDM
ENDIF
BREAK <CallInstall - hook to installable pieces>
CallInstall MACRO name,save,restore
IFNB <save>
SaveReg <save>
ENDIF
push name ;; index of routine to call
call Redir_Dispatcher ;; go dispatch to redirector
ifnb <restore>
RestoreReg <restore>
endif
ENDM
; The Redir_Dispatcher routine is common low code and will
; merely perform an indirect call through the redirector-supplied
; address
BREAK <CallPCache - hook to installable PathCacher, distinct from redir.>
CallPCache MACRO name
push name
call PathCache_Dispatcher
endm
; The PathCache_Dispatcher is a jump-stub, which must be called far
; because it may had off to the PathCacher, which resides in a separate
; segment when installed. When the PathCacher is not installed, all
; that happens is a clear-carry and a far ret.
BREAK <LJcc - Long Conditional Jumps>
LJE macro l
LJ JE JNE l
endm
LJNE macro l
LJ jne JE l
endm
LJZ macro l
LJE l
endm
LJNZ macro l
LJNE l
endm
LJC macro l
LJ jc JNC l
endm
LJNC macro l
LJ jnc JC l
endm
LJA macro l
LJ ja JNA l
endm
LJNA macro l
LJ jna JA l
endm
LJB macro l
LJ jb JNB l
endm
LJNB macro l
LJ jnb JB l
endm
LJS macro l
LJ js JNS l
endm
LJNS macro l
LJ jns JS l
endm
LJAE macro l
LJ jae JNAE l
endm
LJBE macro l
LJ jbe JNBE l
endm
LJL macro l
LJ jl JNL l
endm
LJG macro l
LJ jg JNG l
endm
LJLE macro l
LJ jle JNLE l
endm
DLJE macro l
DLJ JE JNE l
endm
DLJNE macro l
DLJ jne JE l
endm
DLJZ macro l
DLJE l
endm
DLJNZ macro l
DLJNE l
endm
DLJC macro l
DLJ jc JNC l
endm
DLJNC macro l
DLJ jnc JC l
endm
DLJA macro l
DLJ ja JNA l
endm
DLJNA macro l
DLJ jna JA l
endm
DLJB macro l
DLJ jb JNB l
endm
DLJNB macro l
DLJ jnb JB l
endm
DLJS macro l
DLJ js JNS l
endm
DLJNS macro l
DLJ jns JS l
endm
DLJAE macro l
DLJ jae JNAE l
endm
DLJBE macro l
DLJ jbe JNBE l
endm
DLJG macro l
DLJ jg JNG l
endm
DLJL macro l
DLJ jl JNL l
endm
DLJLE macro l
DLJ jle JNLE l
endm
;* LJ - generate long conditional jump
;
; if target preceeds us and is in range just use a short jump
; else use a long jump
;
; LJ <direct jmp>,<skip jmp>,<label>
LJ MACRO dirop,idirop,l
local a
IF ?mode386
dirop l
ELSE
IF ((.TYPE l) XOR 20h) AND 0A0h
idirop short a ;; not defined or is external
jmp l
a:
ELSE ;; is local definied
IF (($-l) LT 124) AND ($ GT l)
dirop short l ;; is before and within range
ELSE
idirop short a ;; is out of range or forward (pass 2)
jmp l
a:
ENDIF
ENDIF
ENDIF
ENDM
;* DLJ - generate debug long conditional jump
;
; If DEBUG is defined then we generate a long jump, else a short
; one.
;
; DLJ <direct jmp>,<skip jmp>,<label>
DLJ MACRO dirop,idirop,l
local a
IF Debug
idirop a
jmp l
a:
ELSE
dirop l
ENDIF
ENDM
;* DLJMP - generate debug long jump
;
; If Debug is defined then generate long jump, else a short one.
;
; DLJMP <label>
DLJMP macro lbl
IF Debug
jump lbl
ELSE
jmp short lbl
ENDIF
ENDM
.xcref LJE, LJNE, LJZ, LJNZ, LJC, LJNC, LJA, LJNA
.xcref LJB, LJNB, LJS, LJNS, LJAE, LJBE, LJG, LJL, LJLE
.xcref DLJE, DLJNE, DLJZ, DLJNZ, DLJC, DLJNC, DLJA, DLJNA
.xcref DLJB, DLJNB, DLJS, DLJNS, DLJAE, DLJBE, DLJG, DLJL, DLJLE
.xcref LJ,DLJ
BREAK <NEW MACROS FOR 4.0>
ReferGlobal macro sym, symtype
GENEXTRN CONSTANTS, <sym>, <symtype>
endm
ReferHighGlobal macro sym, symtype
GENEXTRN HIGHDATA, <sym>, <symtype>
endm
ReferInitGlobal macro sym, symtype
GENEXTRN InitData, <sym>, <symtype>