]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/BIOS/MSMACRO.INC

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / BIOS / MSMACRO.INC
1 ;
2 ; This file contains three macros used in debugging the system. If the
3 ; variable "itest" (in msbio.asm) is nonzero code is included in the
4 ; modules to print debugging messages. The level of debugging is controlled
5 ; by the value of the variable fTestBits in msbio.asm. Specific bits in
6 ; the variable determine which messages to print. The equ's below tell
7 ; which bits control which funcitons. For example the fifth bit
8 ; cooresponds to disk activity (see fTestDisk equ below).
9 ;
10 ; The macros in the file are:
11 ;
12 ; message Prints an ascii string on the screen.
13 ; Example usage:
14 ;
15 ; message fTestDisk, <"Start Disk Write", CR, LF>
16 ; message fTestINIT, <"Begin BDS initialization">
17 ;
18 ;
19 ; MNUM Print the value in a register or memory location on
20 ; the screen. Value is displayed in hex.
21 ; Usage:
22 ; MNUM bitpattern, valueLocation
23 ;
24 ; valueLocation is typically a regester:
25 ;
26 ; mnum fTestCom, AX
27 ; mnum fTestDisk, DX
28 ;
29 ; ValueLocation can also be a memory location:
30 ;
31 ; mnum fTestINIT, Final_Dos_Location
32 ;
33 ; If no valueLocation is given the macro defaults to
34 ; the BX register.
35 ;
36 ; ZWAIT Stops the program until any key is pressed.
37 ;
38 ;
39 ; The three macros preserve all register values. If "test" is zero
40 ; defined during assembly then the marco produce no code.
41 ;
42
43 IF iTEST ;3.30
44 IFNDEF MSGOUT ;3.30
45 EXTRN MSGOUT:NEAR,MSGNUM:NEAR ;3.30
46 ENDIF ;3.30
47 IFNDEF NUMBUF ;3.30
48 EXTRN NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD ;3.30
49 ENDIF ;3.30
50 IFNDEF DUMPBYTES ;3.30
51 EXTRN DUMPBYTES:NEAR,OUTCHAR:NEAR,HEX_TO_ASCII:NEAR ;3.30
52 ENDIF ;3.30
53
54
55
56 fTestALL equ 1111111111111111b ; watch everything
57 fTestHARD equ 0000000000000001b ; watch hard disk initialization
58 fTest96 equ 0000000000000010b ; watch 96 tpi activity
59 FTEST13 EQU 0000000000000100B ; WATCH INT 13 ACTIVITY ;3.30
60 FTESTCOM EQU 0000000000001000B ; WATCH PACKET ACTIVITY ;3.30
61 FTESTINIT EQU 0000000000010000B ; WATCH INITIALIZATION MESSAGES ;3.30
62 FTESTDISK EQU 0000000000100000B ; WATCH DISK DEVICE DRIVER CALLS ;3.30
63 FTESTCON EQU 0000000001000000B ; WATCH SYSTEM WAIT ACTIVITY IN CO;3.30 NSOLE
64 FtestClock equ 0000000010000000b ; wathc clock device 5/2/86 ;3.30
65
66
67 ;
68 ; message macro -- see above for description
69 ;
70
71 MESSAGE MACRO Bits,msg
72 LOCAL A,B ;3.30
73 jmp SHORT b
74 a: db msg,0
75 b: push SI
76 push AX
77 mov AX,Bits
78 mov SI,OFFSET a
79 call MSGOUT
80 pop AX
81 pop SI
82 endm
83
84
85 ;
86 ; mnum macro -- see above for description
87 ;
88
89 MNum MACRO Bits,num
90 push AX
91 ifb <num>
92 mov AX,Bits
93 call MSGNUM
94 else
95 push BX
96 mov BX,num
97 mov AX,Bits
98 call MSGNUM
99 pop BX
100 endif
101 pop AX
102 endm
103
104
105 ;
106 ; zwait macro -- see above for description
107 ;
108
109 ZWAIT MACRO
110 Message fTestALL,<"? ">
111 CALL ZWAITrtn
112 ENDM
113
114 ZWAITrtn:
115 pushf ; save the flags
116 push AX ; preserve AX
117 xor AH, AH ; set command to get character ;3.30*
118 int 16h ; call rom keyboard routine ;3.30*
119 pop AX ; restore AX
120 popf ; restore the flags
121 ret
122
123 ;Dump_byte dumps the memory contents in hex. ;3.30
124 ;DUMPOFFLABEL should be a label or a variable defined in DUMPSEG. ;3.30
125 DUMP_BYTE MACRO DUMPSEG, DUMPOFFLABEL, BYTELENGTH ;3.30
126 push es ;3.30
127 PUSH DS ;3.30
128 PUSH SI ;3.30
129 PUSH CX ;3.30
130 ;3.30
131 MOV CX, DUMPSEG ;3.30
132 MOV DS, CX ;3.30
133 MOV SI, OFFSET DUMPOFFLABEL ;3.30
134 MOV CX, BYTELENGTH ;3.30
135 call dumpbytes ;3.30
136 ;3.30
137 POP CX ;3.30
138 POP SI ;3.30
139 POP DS ;3.30
140 pop es ;3.30
141 ENDM ;3.30
142 ;3.30
143 ;Dump_Byte_Reg dumps the memory contents in hex. - 4/9/86 ;3.30
144 ;DUMPOFFREG should be a register contains the offset value in DUMPSEG. ;3.30
145 DUMP_BYTE_REG MACRO DUMPSEG, DUMPOFFREG, BYTELENGTH ;3.30
146 push es ;3.30
147 PUSH DS ;3.30
148 PUSH SI ;3.30
149 PUSH CX ;3.30
150 ;3.30
151 MOV CX, DUMPSEG ;3.30
152 MOV DS, CX ;3.30
153 MOV SI, DUMPOFFREG ;3.30
154 MOV CX, BYTELENGTH ;3.30
155 call dumpbytes ;3.30
156 ;3.30
157 POP CX ;3.30
158 POP SI ;3.30
159 POP DS ;3.30
160 pop es ;3.30
161 ENDM ;3.30
162
163 else
164 ; if test is not defined then make macro into null statements
165 Message macro
166 ENDM
167
168 MNUM macro
169 ENDM
170
171 ZWAIT macro
172 ENDM
173
174 DUMP_BYTE MACRO ;3.30
175 ENDM ;3.30
176 DUMP_BYTE_REG MACRO ;3.30
177 ENDM ;3.30
178 ENDIF ;3.30
179 ;3.30
180 PATHSTART MACRO INDEX,ABBR ;3.30
181 IFDEF PATHGEN ;3.30
182 PUBLIC ABBR&INDEX&S,ABBR&INDEX&E ;3.30
183 ABBR&INDEX&S LABEL BYTE ;3.30
184 ENDIF ;3.30
185 ENDM ;3.30
186 ;3.30
187 PATHEND MACRO INDEX,ABBR ;3.30
188 IFDEF PATHGEN ;3.30
189 ABBR&INDEX&E LABEL BYTE ;3.30
190 ENDIF ;3.30
191 ENDM ;3.30
192