summaryrefslogtreecommitdiff
path: root/v4.0-ozzie/bin/DISK2/BIOS/DEFDBUG.INC
blob: 590e376dc29fd450cee8cacda8dde8804560b67c (plain) (blame)
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
;**	DEFDBUG.ASM - Debugging Macro Definitions
;
;
;	DEBUG	n,m,<format string>, <arg list>
;
;

.sall

DEBUG	MACRO	N,M,string,args
 local b,c
 IFDEF DEBUGFLG
  pushf
  DEBUGTST N,M
  jz	b
  push ax
  push bp
  call	c		;; push address of string
  DB	'&string',0
c:	mov	bp,sp
; IFNB	    <args>
 IRP	 Y,<args>
  IFIDN	  <Y>,<ax>
    push 4[bp]
  ELSE
  IFIDN	  <Y>,<AX>
    push 4[bp]
  ELSE
  IFIDN	  <Y>,<bp>
    push 2[bp]
  ELSE
  IFIDN	  <Y>,<BP>
    push 2[bp]
  ELSE
    mov	    ax,Y
    push ax
   ENDIF
   ENDIF
   ENDIF
   ENDIF
 ENDM
; ENDIF
  call	  DPRINTF
  mov	  sp,bp
  pop	  ax		  ;; discard format string offset
  pop	  bp
  pop	  ax
b:	popf
   ENDIF
ENDM




;**	ERRNZ - generate assembly error if arg != 0
;

ERRNZ	MACRO	EXPR
 IF1
  IFE	  expr
  ELSE
  RADIX	  0	  ; CONDITION NOT MET - ERROR
  ENDIF
 ENDIF
	ENDM


;**	DBBEG - Start debugging range
;

DBBEG	MACRO	N,M
 LOCAL	 lab
 IFDEF	 DEBUGFLG
  pushf
  DEBUGTST N,M
  jnz	  lab			  ;; am to do it
  DBJMP	  %DBCNT
lab:
    ENDM



DBJMP	MACRO	N
 jmp DBLAB&N
	ENDM


;**	DEBUGTST - Test Debug Flags
;
;	DEBUGTST   n,m
;
;	Where N and M are bit masks.
;
;	If one or more of the bits in N is set in the high byte
;	of BUGBITS, and one or more of the bits in M is set in
;	the low byte of BUGBITS then clear the Z flag.
;
;	In other words:
;
;	If both masks show a "hit" clear 'Z' else set 'Z'
;
;	USES	FLAGS

DEBUGTST    MACRO   N,M
	LOCAL	A
	test	BYTE PTR BUGBITS,n
	jz	A
	test	BYTE PTR BUGBITS+1,m
A:
	ENDM

DBEND	MACRO
	DBLAB	%DBCNT
DBCNT	=	DBCNT+1
	popf
	ENDM

DBLAB	MACRO	N
DBLAB&N:
	ENDM

  DBCNT = 1