1 | ; File name : Debug.inc
|
---|
2 | ; Project name : Assembly Library
|
---|
3 | ; Created date : 8.8.2010
|
---|
4 | ; Last update : 29.9.2010
|
---|
5 | ; Author : Tomi Tilli
|
---|
6 | ; Description : Debugging macros.
|
---|
7 | %ifndef DEBUG_INC
|
---|
8 | %define DEBUG_INC
|
---|
9 |
|
---|
10 |
|
---|
11 | ;--------------------------------------------------------------------
|
---|
12 | ; DISPLAY_DEBUG_WORD_AND_WAIT_ANY_KEY
|
---|
13 | ; Parameters:
|
---|
14 | ; %1: Debug word
|
---|
15 | ; %2: Numeric base (2, 10, 16)
|
---|
16 | ; Returns:
|
---|
17 | ; Nothing
|
---|
18 | ; Corrupts registers:
|
---|
19 | ; Nothing
|
---|
20 | ;--------------------------------------------------------------------
|
---|
21 | %macro DISPLAY_DEBUG_WORD_AND_WAIT_ANY_KEY 2
|
---|
22 | pushf
|
---|
23 | push di
|
---|
24 | push bx
|
---|
25 | push ax
|
---|
26 |
|
---|
27 | mov ax, %1
|
---|
28 | mov bx, %2
|
---|
29 | CALL_DISPLAY_LIBRARY PrintWordFromAXwithBaseInBX
|
---|
30 | call Keyboard_RemoveAllKeystrokesFromBuffer
|
---|
31 | call Keyboard_GetKeystrokeToAXandWaitIfNecessary
|
---|
32 |
|
---|
33 | pop ax
|
---|
34 | pop bx
|
---|
35 | pop di
|
---|
36 | popf
|
---|
37 | %endmacro
|
---|
38 |
|
---|
39 |
|
---|
40 | ;--------------------------------------------------------------------
|
---|
41 | ; DISPLAY_DEBUG_CHARACTER_AND_WAIT_ANY_KEY
|
---|
42 | ; Parameters:
|
---|
43 | ; %1: Character to print
|
---|
44 | ; Returns:
|
---|
45 | ; Nothing
|
---|
46 | ; Corrupts registers:
|
---|
47 | ; Nothing
|
---|
48 | ;--------------------------------------------------------------------
|
---|
49 | %macro DISPLAY_DEBUG_CHARACTER_AND_WAIT_ANY_KEY 1
|
---|
50 | pushf
|
---|
51 | push di
|
---|
52 | push ax
|
---|
53 |
|
---|
54 | mov al, %1
|
---|
55 | CALL_DISPLAY_LIBRARY PrintCharacterFromAL
|
---|
56 | call Keyboard_RemoveAllKeystrokesFromBuffer
|
---|
57 | call Keyboard_GetKeystrokeToAXandWaitIfNecessary
|
---|
58 |
|
---|
59 | pop ax
|
---|
60 | pop di
|
---|
61 | popf
|
---|
62 | %endmacro
|
---|
63 |
|
---|
64 |
|
---|
65 | ;--------------------------------------------------------------------
|
---|
66 | ; DISPLAY_DEBUG_CHARACTER
|
---|
67 | ; Parameters:
|
---|
68 | ; %1: Character to print
|
---|
69 | ; Returns:
|
---|
70 | ; Nothing
|
---|
71 | ; Corrupts registers:
|
---|
72 | ; Nothing
|
---|
73 | ;--------------------------------------------------------------------
|
---|
74 | %macro DISPLAY_DEBUG_CHARACTER 1
|
---|
75 | pushf
|
---|
76 | push di
|
---|
77 | push ax
|
---|
78 | mov al, %1
|
---|
79 | CALL_DISPLAY_LIBRARY PrintCharacterFromAL
|
---|
80 | pop ax
|
---|
81 | pop di
|
---|
82 | popf
|
---|
83 | %endmacro
|
---|
84 |
|
---|
85 |
|
---|
86 | ;--------------------------------------------------------------------
|
---|
87 | ; WAIT_ANY_KEY_TO_CONTINUE
|
---|
88 | ; Parameters:
|
---|
89 | ; Nothing
|
---|
90 | ; Returns:
|
---|
91 | ; Nothing
|
---|
92 | ; Corrupts registers:
|
---|
93 | ; Nothing
|
---|
94 | ;--------------------------------------------------------------------
|
---|
95 | %macro WAIT_ANY_KEY_TO_CONTINUE 0
|
---|
96 | push ax
|
---|
97 | call Keyboard_RemoveAllKeystrokesFromBuffer
|
---|
98 | call Keyboard_GetKeystrokeToAXandWaitIfNecessary
|
---|
99 | pop ax
|
---|
100 | %endmacro
|
---|
101 |
|
---|
102 |
|
---|
103 |
|
---|
104 | %endif ; DEBUG_INC
|
---|