]> wirehaze git hosting - MS-DOS.git/blob - v4.0-ozzie/bin/DISK2/BIOS/DEFDBUG.INC

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0-ozzie / bin / DISK2 / BIOS / DEFDBUG.INC
1 ;** DEFDBUG.ASM - Debugging Macro Definitions
2 ;
3 ;
4 ; DEBUG n,m,<format string>, <arg list>
5 ;
6 ;
7
8 .sall
9
10 DEBUG MACRO N,M,string,args
11 local b,c
12 IFDEF DEBUGFLG
13 pushf
14 DEBUGTST N,M
15 jz b
16 push ax
17 push bp
18 call c ;; push address of string
19 DB '&string',0
20 c: mov bp,sp
21 ; IFNB <args>
22 IRP Y,<args>
23 IFIDN <Y>,<ax>
24 push 4[bp]
25 ELSE
26 IFIDN <Y>,<AX>
27 push 4[bp]
28 ELSE
29 IFIDN <Y>,<bp>
30 push 2[bp]
31 ELSE
32 IFIDN <Y>,<BP>
33 push 2[bp]
34 ELSE
35 mov ax,Y
36 push ax
37 ENDIF
38 ENDIF
39 ENDIF
40 ENDIF
41 ENDM
42 ; ENDIF
43 call DPRINTF
44 mov sp,bp
45 pop ax ;; discard format string offset
46 pop bp
47 pop ax
48 b: popf
49 ENDIF
50 ENDM
51
52
53
54
55 ;** ERRNZ - generate assembly error if arg != 0
56 ;
57
58 ERRNZ MACRO EXPR
59 IF1
60 IFE expr
61 ELSE
62 RADIX 0 ; CONDITION NOT MET - ERROR
63 ENDIF
64 ENDIF
65 ENDM
66
67
68 ;** DBBEG - Start debugging range
69 ;
70
71 DBBEG MACRO N,M
72 LOCAL lab
73 IFDEF DEBUGFLG
74 pushf
75 DEBUGTST N,M
76 jnz lab ;; am to do it
77 DBJMP %DBCNT
78 lab:
79 ENDM
80
81
82
83 DBJMP MACRO N
84 jmp DBLAB&N
85 ENDM
86
87
88 ;** DEBUGTST - Test Debug Flags
89 ;
90 ; DEBUGTST n,m
91 ;
92 ; Where N and M are bit masks.
93 ;
94 ; If one or more of the bits in N is set in the high byte
95 ; of BUGBITS, and one or more of the bits in M is set in
96 ; the low byte of BUGBITS then clear the Z flag.
97 ;
98 ; In other words:
99 ;
100 ; If both masks show a "hit" clear 'Z' else set 'Z'
101 ;
102 ; USES FLAGS
103
104 DEBUGTST MACRO N,M
105 LOCAL A
106 test BYTE PTR BUGBITS,n
107 jz A
108 test BYTE PTR BUGBITS+1,m
109 A:
110 ENDM
111
112 DBEND MACRO
113 DBLAB %DBCNT
114 DBCNT = DBCNT+1
115 popf
116 ENDM
117
118 DBLAB MACRO N
119 DBLAB&N:
120 ENDM
121
122 DBCNT = 1