rev |
line source |
pascal@11674
|
1 // Usage:
|
pascal@11674
|
2 //
|
pascal@11674
|
3 // f DX:CX load one CHS sector to 0000:7C00
|
pascal@11674
|
4 // t trace one step
|
pascal@11674
|
5 // g <address> go to adrs
|
pascal@11674
|
6 // d <address> display 16 bytes, CR for next 16 bytes...
|
pascal@11674
|
7 // e <address> <words>... enter memory byte/word/dword
|
pascal@11674
|
8 // m <segment> self move
|
pascal@11674
|
9 // + <segment> default segment offset
|
pascal@11674
|
10 //
|
pascal@11674
|
11 // Example:
|
pascal@11674
|
12 // m 0FC0 move debugger to 0FC0:0000 0FC0:01FF
|
pascal@11674
|
13 // f 1 read floppy boot sector to 0000:7C00
|
pascal@13055
|
14 // f 80:1 read hard disk master boot sector to 0000:7C00
|
pascal@11674
|
15 // g 7C0E ...
|
pascal@11674
|
16
|
pascal@11674
|
17 #define ADJESDI 16 bytes add segment overflow support for e and d
|
pascal@11674
|
18 #define ASCIIDUMP 20 bytes display hexa and ascii datas
|
pascal@11674
|
19 #define INPUTBUFFER 2 bytes overload init code with a 32+ bytes input buffer
|
pascal@11674
|
20 //#define CPU186 -26 bytes 80186+ CPU
|
pascal@11674
|
21
|
pascal@11674
|
22 .macro pusham
|
pascal@11674
|
23 pushw %ax
|
pascal@11674
|
24 pushw %cx
|
pascal@11674
|
25 pushw %dx
|
pascal@11674
|
26 pushw %bx
|
pascal@11674
|
27 movw %sp, %bx
|
pascal@11674
|
28 leaw 14(%bx), %bx # adjust SP with [FLAGS CS IP AX CX DX BX] size
|
pascal@11674
|
29 pushw %bx # %sp
|
pascal@11674
|
30 pushw %bp
|
pascal@11674
|
31 pushw %si
|
pascal@11674
|
32 pushw %di
|
pascal@11674
|
33 .endm
|
pascal@11674
|
34
|
pascal@11674
|
35 .macro popam
|
pascal@11674
|
36 popw %di
|
pascal@11674
|
37 popw %si
|
pascal@11674
|
38 popw %bp
|
pascal@11674
|
39 popw %ax # %sp
|
pascal@11674
|
40 popw %bx
|
pascal@11674
|
41 popw %dx
|
pascal@11674
|
42 popw %cx
|
pascal@11674
|
43 popw %ax
|
pascal@11674
|
44 .endm
|
pascal@11674
|
45
|
pascal@11674
|
46 #ifdef INPUTBUFFER
|
pascal@11674
|
47 //#define ABS(x) (x-(setvectors-_start))
|
pascal@11674
|
48 #define ABS(x) (x-30)
|
pascal@11674
|
49 #else
|
pascal@11674
|
50 #define ABS(x) (x)
|
pascal@11674
|
51 #endif
|
pascal@11674
|
52
|
pascal@11674
|
53 #define SEGREGSZ 6
|
pascal@11674
|
54 #define REGSZ 16
|
pascal@11674
|
55 #define USER_SP REGSZ+SEGREGSZ-10(%bp)
|
pascal@11674
|
56 #define USER_FLAGS REGSZ+SEGREGSZ+4(%bp)
|
pascal@11674
|
57 #define USER_FLAGS_HIGH REGSZ+SEGREGSZ+5(%bp)
|
pascal@11674
|
58 #define USER_IP REGSZ+SEGREGSZ(%bp)
|
pascal@11674
|
59 #define USER_CS REGSZ+SEGREGSZ+2(%bp)
|
pascal@11674
|
60 #define USER_CSIP REGSZ+SEGREGSZ(%bp)
|
pascal@11674
|
61
|
pascal@11674
|
62 .macro initcode
|
pascal@11674
|
63 movw $0x0FC0, %di # move (and jump) to 0FC0:0000
|
pascal@11674
|
64 subw $_startz-_start, USER_IP
|
pascal@11674
|
65 movw USER_IP, %ax
|
pascal@11674
|
66 #ifdef CPU186
|
pascal@11674
|
67 cld # ensure movsb will work
|
pascal@11674
|
68 shrw $4, %ax # _start MUST be aligned on paragraph
|
pascal@11674
|
69 #else
|
pascal@11674
|
70 movb $4, %cl
|
pascal@11674
|
71 shrw %cl, %ax # _start MUST be aligned on paragraph
|
pascal@11674
|
72 #endif
|
pascal@11674
|
73 addw USER_CS, %ax # normalize %cs to have _start=0
|
pascal@11674
|
74 movw %ax, %ds
|
pascal@11674
|
75 .endm
|
pascal@11674
|
76 .text
|
pascal@11674
|
77 .code16
|
pascal@11674
|
78 #ifdef CPU186
|
pascal@11674
|
79 .arch i186
|
pascal@11674
|
80 #else
|
pascal@11674
|
81 .arch i8086
|
pascal@11674
|
82 #endif
|
pascal@11674
|
83 .org 0
|
pascal@11674
|
84
|
pascal@11674
|
85 .globl _start
|
pascal@11674
|
86 _start:
|
pascal@11674
|
87 pushf
|
pascal@11674
|
88 pushw %cs
|
pascal@11674
|
89 stc
|
pascal@11674
|
90 call init # the start code will be overwritten by the input buffer
|
pascal@11674
|
91 _startz:
|
pascal@11674
|
92
|
pascal@11674
|
93 #ifdef INPUTBUFFER
|
pascal@11674
|
94 isinit:
|
pascal@11674
|
95 initcode
|
pascal@11674
|
96 movw $setvectors, %si
|
pascal@11674
|
97 jmp moveself
|
pascal@11674
|
98 #endif
|
pascal@11674
|
99
|
pascal@11674
|
100 setvectors:
|
pascal@11674
|
101 xorw %si, %si # set interrupt vectors in 0 segment
|
pascal@11674
|
102 movw %si, %ds
|
pascal@11674
|
103 movb $0xF9, %ch # skip nmi
|
pascal@11674
|
104 hooklp: # interrupts: 0=div0 1=step 2=nmi 3=brk 4=ov 5=bound 6=invalid
|
pascal@11674
|
105 movw $ABS(dbgstart), (%si) # set %cs:dbgstart
|
pascal@11674
|
106 lodsw # %si += 2
|
pascal@11674
|
107 movw %cs, (%si) # to interrupt vector
|
pascal@11674
|
108 skiphook:
|
pascal@11674
|
109 lodsw # %si += 2
|
pascal@11674
|
110 shrb $1,%ch
|
pascal@11674
|
111 jnc skiphook
|
pascal@11674
|
112 jnz hooklp # note %cx will be cleared: SP will be untouched
|
pascal@11674
|
113 #ifdef CPU186
|
pascal@11674
|
114 decw (3-7)*4(%si) # update int3 vector
|
pascal@11674
|
115 #else
|
pascal@11674
|
116 movb $ABS(int3), (3-7)*4(%si) # update int3 vector
|
pascal@11674
|
117 #endif
|
pascal@11674
|
118 jmp dbgstartz # registers are already pushed by startup code
|
pascal@11674
|
119
|
pascal@11674
|
120 regs:
|
pascal@11674
|
121 .ascii "ss"
|
pascal@11674
|
122 .ascii "es"
|
pascal@11674
|
123 .ascii "ds"
|
pascal@11674
|
124 .ascii "di"
|
pascal@11674
|
125 .ascii "si"
|
pascal@11674
|
126 .ascii "bp"
|
pascal@11674
|
127 .ascii "sp"
|
pascal@11674
|
128 .ascii "bx"
|
pascal@11674
|
129 .ascii "dx"
|
pascal@11674
|
130 .ascii "cx"
|
pascal@11674
|
131 .ascii "ax"
|
pascal@11674
|
132 .ascii "ip"
|
pascal@11674
|
133 .ascii "cs"
|
pascal@11674
|
134 # Bit Label Desciption
|
pascal@11674
|
135 # ---------------------------
|
pascal@11674
|
136 # 0 CF Carry flag
|
pascal@11674
|
137 # 2 PF Parity flag
|
pascal@11674
|
138 # 4 AF Auxiliary carry flag
|
pascal@11674
|
139 # 6 ZF Zero flag
|
pascal@11674
|
140 # 7 SF Sign flag
|
pascal@11674
|
141 # 8 TF Trap flag
|
pascal@11674
|
142 # 9 IF Interrupt enable flag
|
pascal@11674
|
143 # 10 DF Direction flag
|
pascal@11674
|
144 # 11 OF Overflow flag
|
pascal@11674
|
145 .ascii "oditsz?a?p c=" # flags bits
|
pascal@11674
|
146
|
pascal@11674
|
147 int3:
|
pascal@11674
|
148 #ifdef CPU186
|
pascal@11674
|
149 .byte 0x68 # push $0x086A OV UP DI NT PL ZR - NA - PO - NC
|
pascal@11674
|
150 # interrupt entry point: the registers [FLAGS CS IP] are already pushed
|
pascal@11674
|
151 dbgstart:
|
pascal@11674
|
152 .byte 0x6A, 0x08 # push $0x08 NV UP DI NT PL NZ - NA - PO - NC
|
pascal@11674
|
153 popf
|
pascal@11674
|
154 init:
|
pascal@11674
|
155 pushaw # [FLAGS CS IP] AX CX DX BX SP BP SI DI [DS ES SS]
|
pascal@11674
|
156 #else
|
pascal@11674
|
157 stc
|
pascal@11674
|
158 .byte 0x73 # jnc
|
pascal@11674
|
159 # interrupt entry point: the registers [FLAGS CS IP] are already pushed
|
pascal@11674
|
160 dbgstart:
|
pascal@11674
|
161 clc
|
pascal@11674
|
162 pushw %ax
|
pascal@11674
|
163 sbbw %ax,%ax # copy CF to SF
|
pascal@11674
|
164 clc
|
pascal@11674
|
165 popw %ax
|
pascal@11674
|
166 init:
|
pascal@11674
|
167 cld # ensure movsb will work
|
pascal@11674
|
168 pusham # [FLAGS CS IP] AX CX DX BX SP BP SI DI [DS ES SS]
|
pascal@11674
|
169 #endif
|
pascal@11674
|
170 pushw %ds
|
pascal@11674
|
171 pushw %es
|
pascal@11674
|
172 pushw %ss
|
pascal@11674
|
173 movw %sp, %bp
|
pascal@11674
|
174 #ifdef CPU186
|
pascal@11674
|
175 pushf
|
pascal@11674
|
176 addw $6, USER_SP # adjust SP with [FLAGS CS IP] size
|
pascal@11674
|
177 popf
|
pascal@11674
|
178 #endif
|
pascal@11674
|
179 jc isinit
|
pascal@11674
|
180 jns notint3
|
pascal@11674
|
181 decw USER_IP
|
pascal@11674
|
182 lesw USER_CSIP, %di
|
pascal@11674
|
183 #define OPCODE_BRK 0xCC
|
pascal@11674
|
184 .byte 0xB0 # movb $IM, %al
|
pascal@11674
|
185 break:
|
pascal@11674
|
186 .byte 0xCC
|
pascal@11674
|
187 stosb
|
pascal@11674
|
188 notint3:
|
pascal@11674
|
189 dbgstartz:
|
pascal@11674
|
190 dbgregslp:
|
pascal@11674
|
191 call getcmd
|
pascal@11674
|
192 .byte 0x81, 0xC3 # addw $0, %bx
|
pascal@11674
|
193 offset_value:
|
pascal@11674
|
194 .word 0
|
pascal@11674
|
195 movw %bx, %es
|
pascal@11674
|
196 xchgw %ax, %di
|
pascal@11674
|
197 subb $'m', %al
|
pascal@11674
|
198 jne isinotmove
|
pascal@11674
|
199 #ifdef INPUTBUFFER
|
pascal@11674
|
200 ismove:
|
pascal@11674
|
201 xchgw %ax, %si
|
pascal@11674
|
202 moveself:
|
pascal@11674
|
203 #else
|
pascal@11674
|
204 isinit:
|
pascal@11674
|
205 jmp ismove
|
pascal@11674
|
206 initcode
|
pascal@11674
|
207 ismove:
|
pascal@11674
|
208 #endif
|
pascal@11674
|
209 movw %di, %es # move code to %di:0
|
pascal@11674
|
210 pushw %di
|
pascal@11674
|
211 #ifdef INPUTBUFFER
|
pascal@11674
|
212 xorw %di, %di # and jmp into (%di:setvectors) with retf
|
pascal@11674
|
213 #else
|
pascal@11674
|
214 movw $setvectors, %di # and jmp into (%di:setvectors) with retf
|
pascal@11674
|
215 movw %di, %si
|
pascal@11674
|
216 #endif
|
pascal@11674
|
217 movw $_end-setvectors, %cx
|
pascal@11674
|
218 pushw %di
|
pascal@11674
|
219 rep movsb
|
pascal@11674
|
220 retf
|
pascal@11674
|
221
|
pascal@11674
|
222 isinotmove:
|
pascal@11674
|
223 subb $'+'-'m', %al
|
pascal@11674
|
224 jne not_offset
|
pascal@11674
|
225 movw %di, ABS(offset_value)
|
pascal@11674
|
226 not_offset:
|
pascal@11674
|
227 orb $1, USER_FLAGS_HIGH # set TF
|
pascal@11674
|
228 subb $'t'-'+', %al
|
pascal@11674
|
229 je done
|
pascal@11674
|
230 subb $'d'-'t', %al
|
pascal@11674
|
231 xchgw %ax, %cx
|
pascal@11674
|
232 jcxz dump # 'd' ?
|
pascal@11674
|
233 loop noenter # 'e' ?
|
pascal@11674
|
234 nextval:
|
pascal@11674
|
235 call getval
|
pascal@11674
|
236 jcxz dbgregslp
|
pascal@11674
|
237 xchgb %dl, %dh
|
pascal@11674
|
238 mextmsb:
|
pascal@11674
|
239 stosb
|
pascal@11674
|
240 xchgw %ax, %dx
|
pascal@11674
|
241 xchgb %al, %dh
|
pascal@11674
|
242 #ifdef ADJESDI
|
pascal@11674
|
243 call adjustESDI
|
pascal@11674
|
244 #endif
|
pascal@11674
|
245 decw %cx
|
pascal@11674
|
246 loopne mextmsb
|
pascal@11674
|
247 jmp nextval
|
pascal@11674
|
248 noenter:
|
pascal@11674
|
249 loop not_floppy_load # f DX:CX ?
|
pascal@11674
|
250 movw %es, %dx
|
pascal@11674
|
251 movw %cx, %es
|
pascal@11674
|
252 movw %di, %cx
|
pascal@11674
|
253 movw $0x0201, %ax
|
pascal@11674
|
254 movw $0x7C00, %bx
|
pascal@11674
|
255 pushw %bx
|
pascal@11674
|
256 int $0x13
|
pascal@11674
|
257 popw %di
|
pascal@11674
|
258 godbgregslpifc:
|
pascal@11674
|
259 jc dbgregslp
|
pascal@11674
|
260 dump:
|
pascal@11674
|
261 movw %es, %ax
|
pascal@11674
|
262 call putax
|
pascal@11674
|
263 movw %di, %ax
|
pascal@11674
|
264 call putax
|
pascal@11674
|
265 movw $16, %cx
|
pascal@11674
|
266 dhex:
|
pascal@11674
|
267 movb %es:(%di), %ah
|
pascal@11674
|
268 #ifdef ASCIIDUMP
|
pascal@11674
|
269 movb %ah, (%si)
|
pascal@11674
|
270 incw %si
|
pascal@11674
|
271 #endif
|
pascal@11674
|
272 #ifdef ADJESDI
|
pascal@11674
|
273 call incESDI
|
pascal@11674
|
274 #else
|
pascal@11674
|
275 incw %di
|
pascal@11674
|
276 #endif
|
pascal@11674
|
277 movb $0x01, %dh # the data has 2 digits
|
pascal@11674
|
278 call putx
|
pascal@11674
|
279 loop dhex
|
pascal@11674
|
280 #ifdef ASCIIDUMP
|
pascal@11674
|
281 movb $16, %cl
|
pascal@11674
|
282 subw %cx, %si
|
pascal@11674
|
283 dascii:
|
pascal@11674
|
284 lodsb
|
pascal@11674
|
285 cmpb $0x7F, %al
|
pascal@11674
|
286 jnc skipascii
|
pascal@11674
|
287 cmpb $0x20, %al
|
pascal@11674
|
288 cmc
|
pascal@11674
|
289 skipascii:
|
pascal@11674
|
290 call dbgputcbit
|
pascal@11674
|
291 loop dascii
|
pascal@11674
|
292 #endif
|
pascal@11674
|
293 call dbgputcr
|
pascal@11674
|
294 int $0x16
|
pascal@11674
|
295 cmpb $13, %al
|
pascal@11674
|
296 je dump
|
pascal@11674
|
297 notdump:
|
pascal@11674
|
298 not_floppy_load:
|
pascal@11674
|
299 stc
|
pascal@11674
|
300 loop godbgregslpifc # g ?
|
pascal@11674
|
301 isgo:
|
pascal@11674
|
302 andb $0xfe, USER_FLAGS_HIGH # clear TF
|
pascal@11674
|
303 xchgw %ax, %cx
|
pascal@11674
|
304 jcxz done
|
pascal@11674
|
305 setbreak:
|
pascal@11674
|
306 movb $OPCODE_BRK, %al
|
pascal@11674
|
307 xchgb %al, %es:(%di)
|
pascal@11674
|
308 movb %al, ABS(break)
|
pascal@11674
|
309 done:
|
pascal@11674
|
310 popw %ax # %ss
|
pascal@11674
|
311 popw %es
|
pascal@11674
|
312 popw %ds
|
pascal@11674
|
313 #ifdef CPU186
|
pascal@11674
|
314 popaw
|
pascal@11674
|
315 #else
|
pascal@11674
|
316 popam
|
pascal@11674
|
317 #endif
|
pascal@11674
|
318 iret
|
pascal@11674
|
319
|
pascal@11674
|
320 #ifdef ADJESDI
|
pascal@11674
|
321 adjustESDI:
|
pascal@11674
|
322 decw %di
|
pascal@11674
|
323 incESDI:
|
pascal@11674
|
324 incw %di
|
pascal@11674
|
325 jnz esok
|
pascal@11674
|
326 pushw %es
|
pascal@11674
|
327 addb $0x10,-3(%bp)
|
pascal@11674
|
328 popw %es
|
pascal@11674
|
329 esok:
|
pascal@11674
|
330 ret
|
pascal@11674
|
331 #endif
|
pascal@11674
|
332
|
pascal@11674
|
333 putreg:
|
pascal@11674
|
334 call dbgput2c
|
pascal@11674
|
335 movb $'=', %al
|
pascal@11674
|
336 call dbgputc
|
pascal@11674
|
337 putr16:
|
pascal@11674
|
338 # movw _start-ABS(regs)-2(%bp,%si), %ax
|
pascal@11674
|
339 .byte 0x8b, 0x42, _start-ABS(regs)-2
|
pascal@11674
|
340 putax:
|
pascal@11674
|
341 movb $0x07, %dh # the data has 4 digits
|
pascal@11674
|
342 putx:
|
pascal@11674
|
343 putxlp:
|
pascal@11674
|
344 #ifdef CPU186
|
pascal@11674
|
345 rolw $4, %ax
|
pascal@11674
|
346 #else
|
pascal@11674
|
347 pushw %cx
|
pascal@11674
|
348 movb $4, %cl
|
pascal@11674
|
349 rolw %cl, %ax
|
pascal@11674
|
350 popw %cx
|
pascal@11674
|
351 #endif
|
pascal@11674
|
352 pushw %ax
|
pascal@11674
|
353 andb $0xf, %al
|
pascal@11674
|
354 addb $0x90, %al
|
pascal@11674
|
355 daa
|
pascal@11674
|
356 adcb $0x40, %al
|
pascal@11674
|
357 daa
|
pascal@11674
|
358 call dbgputc
|
pascal@11674
|
359 popw %ax
|
pascal@11674
|
360 shrb $1, %dh
|
pascal@11674
|
361 jc putxlp
|
pascal@11674
|
362 dbgputcbit:
|
pascal@11674
|
363 jc dbgputc
|
pascal@11674
|
364 mov $0x20, %al
|
pascal@11674
|
365 dbgputc:
|
pascal@11674
|
366 movw $7, %bx
|
pascal@11674
|
367 mov $0xE, %ah
|
pascal@11674
|
368 int $0x10
|
pascal@11674
|
369 xchgw %ax, %bx
|
pascal@11674
|
370 ret
|
pascal@11674
|
371
|
pascal@11674
|
372 getline:
|
pascal@11674
|
373 movw $ABS(regs), %si
|
pascal@11674
|
374 movw $13, %cx
|
pascal@11674
|
375 regslp:
|
pascal@11674
|
376 call putreg # display register name and value
|
pascal@11674
|
377 loop regslp
|
pascal@11674
|
378 movw USER_FLAGS, %dx
|
pascal@11674
|
379 pushw %si
|
pascal@11674
|
380 movb $13, %cl
|
pascal@11674
|
381 stc # add trailing =
|
pascal@11674
|
382 rcrw %cl, %dx
|
pascal@11674
|
383 nextbit:
|
pascal@11674
|
384 lodsb
|
pascal@11674
|
385 shlw $1, %dx
|
pascal@11674
|
386 call dbgputcbit # display active flags bits
|
pascal@11674
|
387 loop nextbit
|
pascal@11674
|
388 popw %si
|
pascal@11674
|
389 movb $8, %cl
|
pascal@11674
|
390 stacklp:
|
pascal@11674
|
391 lodsw # si += 2
|
pascal@11674
|
392 call putr16 # display flags and the beginning of the stack
|
pascal@11674
|
393 loop stacklp
|
pascal@11674
|
394 call dbgputcr
|
pascal@11674
|
395 getlinebs:
|
pascal@11674
|
396 cmpw $ABS(buffer), %si
|
pascal@11674
|
397 je getc
|
pascal@11674
|
398 decw %si
|
pascal@11674
|
399 getlinelp:
|
pascal@11674
|
400 call dbgputc
|
pascal@11674
|
401 getc:
|
pascal@11674
|
402 int $0x16
|
pascal@11674
|
403 cmpb $8, %al
|
pascal@11674
|
404 je getlinebs
|
pascal@11674
|
405 orb $0x20, %al
|
pascal@11674
|
406 movb %al, (%si)
|
pascal@11674
|
407 inc %si
|
pascal@11674
|
408 cmpb $0x2D, %al
|
pascal@11674
|
409 jne getlinelp
|
pascal@11674
|
410 dbgputcr:
|
pascal@11674
|
411 movw $ABS(crlf), %si
|
pascal@11674
|
412 dbgput2c:
|
pascal@11674
|
413 call dbgput1c
|
pascal@11674
|
414 dbgput1c:
|
pascal@11674
|
415 lodsb
|
pascal@11674
|
416 jmp dbgputc
|
pascal@11674
|
417
|
pascal@11674
|
418 getcmd:
|
pascal@11674
|
419 pushw %cs
|
pascal@11674
|
420 popw %ds
|
pascal@11674
|
421 call getline
|
pascal@11674
|
422 lodsb
|
pascal@11674
|
423 xchgw %ax, %di
|
pascal@11674
|
424 # get value in DX:AX, BX is segment CX is digits count.
|
pascal@11674
|
425 getval:
|
pascal@11674
|
426 xorw %bx, %bx
|
pascal@11674
|
427 xorw %cx, %cx
|
pascal@11674
|
428 getvalz:
|
pascal@11674
|
429 pushw %bx # save segment
|
pascal@11674
|
430 xorw %bx, %bx
|
pascal@11674
|
431 mul %bx # clear %dx:%ax
|
pascal@11674
|
432 decw %cx
|
pascal@11674
|
433 isx:
|
pascal@11674
|
434 incw %cx
|
pascal@11674
|
435 orb $0xE0, %dh
|
pascal@11674
|
436 getvalbit:
|
pascal@11674
|
437 shlw $1, %bx
|
pascal@11674
|
438 rclw $1, %dx
|
pascal@11674
|
439 jc getvalbit
|
pascal@11674
|
440 orb %al, %bl
|
pascal@11674
|
441 gotspc:
|
pascal@11674
|
442 lodsb
|
pascal@11674
|
443 cmpb $0x20, %al # space ?
|
pascal@11674
|
444 jne notspc
|
pascal@11674
|
445 jcxz gotspc
|
pascal@11674
|
446 notspc:
|
pascal@11674
|
447 sub $'0', %al
|
pascal@11674
|
448 cmpb $10, %al # in 0..9 ?
|
pascal@11674
|
449 jb isx
|
pascal@11674
|
450 sub $'a'-'0'-10, %al
|
pascal@11674
|
451 cmpb $16, %al # in a..f ?
|
pascal@11674
|
452 jb isx
|
pascal@11674
|
453 cmpb $':'-'a'+10, %al
|
pascal@11674
|
454 popw %ax
|
pascal@11674
|
455 je getvalz # store segment in %bx
|
pascal@11674
|
456 xchgw %ax, %bx
|
pascal@11674
|
457 pushw %dx
|
pascal@11674
|
458 #ifdef CPU186
|
pascal@11674
|
459 shlw $12, %dx
|
pascal@11674
|
460 #else
|
pascal@11674
|
461 pushw %cx
|
pascal@11674
|
462 movb $12, %cl
|
pascal@11674
|
463 shlw %cl, %dx
|
pascal@11674
|
464 popw %cx
|
pascal@11674
|
465 #endif
|
pascal@11674
|
466 addw %dx, %bx
|
pascal@11674
|
467 popw %dx
|
pascal@11674
|
468 ret
|
pascal@11674
|
469
|
pascal@11674
|
470 crlf:
|
pascal@11674
|
471 .byte 13,10
|
pascal@11674
|
472 _end:
|
pascal@11674
|
473 buffer:
|
pascal@11674
|
474
|
pascal@11674
|
475 .org 510
|
pascal@11674
|
476 .byte 0x55, 0xAA
|
pascal@11674
|
477
|