File: debug.h

package info (click to toggle)
sbm 3.7.1-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,060 kB
  • ctags: 1,590
  • sloc: asm: 11,940; ansic: 2,870; makefile: 531
file content (96 lines) | stat: -rw-r--r-- 1,301 bytes parent folder | download | duplicates (4)
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
%include "helptool.h"

%macro debug_iprint 1+
%ifdef DEBUG
	push ds

	push cs
	pop ds
	printf %1
	pop ds
%endif
%endmacro

%macro debug_print 1+
%ifdef DEBUG
	push ds
	push cs
	pop ds
	printf %1
	pop ds
%endif
%endmacro


%macro print_stat 2+ 
%ifdef DEBUG
	pusha
	mov al,%1
	call set_stat_buff
	%if %0 > 1
		debug_print %2
	%endif
	popa
%endif
%endmacro


%ifdef DEBUG
%include "printf.h"

	section .text
proc set_stat_buff
	mov di, STAT_BUF
	if {test al, 0x80},nz
		mov si,__BSY   ; busy
		mov cx,4
		rep movsb
	endif
	if {test al, 0x40},nz
		mov si,__RDY   ; ready
		mov cx,4
		rep movsb
	endif
	if {test al, 0x20},nz
		mov si,__DF   ; write fault (old name)
		mov cx,7
		rep movsb
	endif
	if {test al, 0x10},nz
		mov si,__SKC  ; service
		mov cx,8
		rep movsb
	endif
	if {test al, 0x08},nz
		mov si,__DRQ   ; data request
		mov cx,4
		rep movsb
	endif
	if {test al, 0x04},nz
		mov si,__CRR  ; corrected
		mov cx,4
		rep movsb
	endif
	if {test al, 0x02},nz
		mov si,__IDX   ; index
		mov cx,4
		rep movsb
	endif
	if {test al, 0x01},nz
		mov si,__ERR   ; error
		mov cx,4
		rep movsb
	endif
	mov byte [di],0
endp
	section .data
__BSY   db "BSY "
__RDY   db "RDY "
__DF   db "DF/WFT "
__SKC   db "SKC/SRV "
__DRQ   db "DRQ "
__CRR  db "CRR "
__IDX   db "IDX "
__ERR   db "ERR "
	section .text
%endif