home *** CD-ROM | disk | FTP | other *** search
- .XLIST
-
- PAGE ,132
-
- FALSE EQU 0
- TRUE EQU NOT FALSE
- NUL EQU 0
- BS EQU 8
- HT EQU 9
- TAB EQU HT
- LF EQU 10
- FF EQU 12
- CR EQU 13
- EOF EQU 26
- ESC EQU 27
- DEL EQU 127
-
- @WRD@@ STRUC
- LB DB ?; x.LB = BYTE PTR x
- HB DB ?; x.HB = BYTE PTR x + 1
- @WRD@@ ENDS
- B EQU LB; x.B = BYTE PTR x
-
- @DWD@@ STRUC
- LW DW ?; x.LW = WORD PTR x
- HW DW ?; x.HW = WORD PTR x + 2
- @DWD@@ ENDS
- W EQU LW; x.W = WORD PTR x
-
- @DDW@@ STRUC
- D DD ?; x.D = DWORD PTR x
- @DDW@@ ENDS
-
-
- @RST@@ MACRO;; initialize procedure & parameter controls
- @PAR@@ = 0;; where next parameter is in frame
- @FPA@@ = 0;; where first parameter is in frame
- @LAS@@ = 0;; controls partial parameter cleanup
- @VAR@@ = 0;; where latest variable is in frame
- @INT@@ = FALSE;; define interrupt procedure flag
- @SAV@@ = FALSE;; define existence of local frame
- ENDM
-
-
- $PASCAL MACRO;; discard parameters upon $RET
- @PAS@@ = TRUE
- ENDM
-
-
- $C MACRO;; leave parameters upon $RET
- @PAS@@ = FALSE
- ENDM
-
-
- ; begin procedure, define parameter addresses
- $PROC MACRO P1, P2, P3, P4, P5, P6, P7, P8, P9, P10
- PUBLIC P1
- IFIDN <P2>, <FAR>
- @FPA@@ = 6;; first parameter after saved caller's frame
- ELSE;; and far return address
- @FPA@@ = 4;; first parameter after saved caller's frame
- ENDIF;; and near return address
- @PAR@@ = @FPA@@;; next parm address = first parm address
- P1 PROC P2;; begin procedure
- IFNB <P3>;; if parms in proc def then execute $PARM
- $PARM P3 P4 P5 P6 P7 P8 P9 P10
- ENDIF
- ENDM
-
-
- ; begin interrupt procedure, define flags option
- $IPROC MACRO P1, FLAGS
- @INT@@ = TRUE;; flag interrupt procedure
- @FPA@@ = 6
- P1 PROC FAR
- IFNB <FLAGS>;; if flags parm not blank then define it
- @PAR@@ = 6
- $PARM FLAGS 2
- ELSE;; else set @PAR@@ as if defined
- @PAR@@ = 8
- ENDIF
- ENDM
-
-
- $PARM MACRO P1, P2, P3, P4, P5, P6, P7, P8, P9, P10
- LOCAL PARM
- IFIDN <P1>, <$LAST>;; if keyword $LAST then
- IF @PAS@@;; if pascal call then
- @LAS@@ = @PAR@@;; define partial stack cleanup
- ENDIF
- IFNB <P2>;; if more then execute $PARM
- $PARM P2 P3 P4 P5 P6 P7 P8 P9
- ENDIF
- ELSE;; else define parameter address
- PARM = @PAR@@
- P1 EQU [BP + PARM]
- .XCREF PARM, P1
- @PAR@@ = @PAR@@ + P2;; address of next parameter
- IFNB <P3>;; if more then execute $PARM
- $PARM P3 P4 P5 P6 P7 P8 P9 P10
- ENDIF
- ENDIF
- ENDM
-
-
- $VAR MACRO V1, V2, V3, V4, V5, V6, V7, V8, V9, V10
- LOCAL VAR
- @VAR@@ = @VAR@@ - V2;; subtract length of current variable
- VAR = @VAR@@;; create new symbol = to current @VAR@@
- V1 EQU [BP + VAR];; frame offset for variable
- .XCREF VAR, V1
- IFNB <V3>;; then another variable exists
- $VAR V3 V4 V5 V6 V7 V8 V9 V10;; recursive call
- ENDIF
- ENDM
-
-
- @SUB@@ MACRO P1;; cosmetic macro lists value
- SUB SP, P1;; of P1 in .LST file
- ENDM
-
-
- $SAVE MACRO
- @SAV@@ = TRUE
- PUSH BP;; save caller's frame pointer
- MOV BP, SP;; set up new frame pointer
- IF @VAR@@;; if local variable(s) exist
- IF @VAR@@ EQ -1 OR @VAR@@ EQ -2;; if 1 or 2 bytes
- DEC SP
- IF @VAR@@ EQ -2;; if 2 bytes
- DEC SP
- ENDIF
- ELSE
- @SUB@@ %-@VAR@@;; make room on stack for
- ENDIF;; local variable(s)
- ENDIF
- ENDM
-
-
- @RET@@ MACRO P1;; cosmetic macro lists value
- RET P1;; of P1 in .LST file
- ENDM
-
-
- @RFR@@ MACRO;; restore frame if necessary
- IF @SAV@@;; if local frame exists
- IF @VAR@@;; if local variable(s) exist then
- MOV SP, BP;; restore stack pointer
- ENDIF
- POP BP;; restore caller's frame pointer
- ENDIF
- ENDM
-
-
- $RET MACRO R1;; return selected by @INT@@
- IF @INT@@
- $IRET R1
- ELSE
- $PRET R1
- ENDIF
- ENDM
-
-
- $PRET MACRO R1;; return from procedure call
- @RFR@@
- IF @LAS@@
- @PAR@@ = @LAS@@;; set @PAR@@ for partial cleanup
- ENDIF
- IF @PAS@@ AND @PAR@@ NE @FPA@@
- @RET@@ %@PAR@@ - @FPA@@;; RET n
- ELSE
- RET
- ENDIF
- IFNB <R1>;; if R1 not empty then end procedure
- $TERM R1
- ENDIF
- ENDM
-
-
- $IRET MACRO R1;; return from interrupt
- @RFR@@
- IRET
- IFNB <R1>;; if R1 not empty then end procedure
- $TERM R1
- ENDIF
- ENDM
-
-
- $RETURN MACRO R1;; same as $RET
- $RET R1
- ENDM
-
-
- $TERM MACRO R1;; end procedure
- R1 ENDP
- @RST@@;; reset macro variables
- ENDM
-
-
- $LIST MACRO;; does not print .LIST
- .LIST
- ENDM
-
-
- @PAS@@ = TRUE; define pascal calling flag
-
- .XCREF FALSE, TRUE, BS, HT, TAB, LF, FF, CR
- .XCREF EOF, ESC, @WRD@@, LB, HB, B, @DWD@@
- .XCREF LW, HW, W, @DDW@@, D, @RST@@, @PAR@@
- .XCREF @FPA@@, @LAS@@, @VAR@@, @INT@@
- .XCREF $PASCAL, @PAS@@, $C, $PROC
- .XCREF $IPROC, $PARM, $VAR, @SUB@@, $SAVE
- .XCREF @RET@@, @RFR@@, $RET, $PRET, $IRET
- .XCREF $RETURN, $TERM, $LIST, NUL, DEL
-
- @RST@@; set up defaults for first procedure
-
- $LIST
-