[41] | 1 | ; File name : Debug.inc
|
---|
| 2 | ; Project name : Assembly Library
|
---|
| 3 | ; Created date : 8.8.2010
|
---|
| 4 | ; Last update : 8.8.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 | push di
|
---|
| 23 | push bx
|
---|
| 24 | push ax
|
---|
| 25 |
|
---|
| 26 | mov ax, %1
|
---|
| 27 | mov bx, %2
|
---|
| 28 | CALL_DISPLAY_LIBRARY PrintWordFromAXwithBaseInBX
|
---|
| 29 | call Keyboard_RemoveAllKeystrokesFromBuffer
|
---|
| 30 | call Keyboard_GetKeystrokeToAXandWaitIfNecessary
|
---|
| 31 |
|
---|
| 32 | pop ax
|
---|
| 33 | pop bx
|
---|
| 34 | pop di
|
---|
| 35 | %endmacro
|
---|
| 36 |
|
---|
| 37 |
|
---|
| 38 | ;--------------------------------------------------------------------
|
---|
| 39 | ; DISPLAY_DEBUG_CHARACTER_AND_WAIT_ANY_KEY
|
---|
| 40 | ; Parameters:
|
---|
| 41 | ; %1: Character to print
|
---|
| 42 | ; Returns:
|
---|
| 43 | ; Nothing
|
---|
| 44 | ; Corrupts registers:
|
---|
| 45 | ; Nothing
|
---|
| 46 | ;--------------------------------------------------------------------
|
---|
| 47 | %macro DISPLAY_DEBUG_CHARACTER_AND_WAIT_ANY_KEY 1
|
---|
| 48 | push di
|
---|
| 49 | push ax
|
---|
| 50 |
|
---|
| 51 | mov al, %1
|
---|
| 52 | CALL_DISPLAY_LIBRARY PrintCharacterFromAL
|
---|
| 53 | call Keyboard_RemoveAllKeystrokesFromBuffer
|
---|
| 54 | call Keyboard_GetKeystrokeToAXandWaitIfNecessary
|
---|
| 55 |
|
---|
| 56 | pop ax
|
---|
| 57 | pop di
|
---|
| 58 | %endmacro
|
---|
| 59 |
|
---|
| 60 |
|
---|
| 61 | ;--------------------------------------------------------------------
|
---|
| 62 | ; DISPLAY_DEBUG_CHARACTER
|
---|
| 63 | ; Parameters:
|
---|
| 64 | ; %1: Character to print
|
---|
| 65 | ; Returns:
|
---|
| 66 | ; Nothing
|
---|
| 67 | ; Corrupts registers:
|
---|
| 68 | ; Nothing
|
---|
| 69 | ;--------------------------------------------------------------------
|
---|
| 70 | %macro DISPLAY_DEBUG_CHARACTER 1
|
---|
| 71 | push di
|
---|
| 72 | push ax
|
---|
| 73 | mov al, %1
|
---|
| 74 | CALL_DISPLAY_LIBRARY PrintCharacterFromAL
|
---|
| 75 | pop ax
|
---|
| 76 | pop di
|
---|
| 77 | %endmacro
|
---|
| 78 |
|
---|
| 79 |
|
---|
| 80 | ;--------------------------------------------------------------------
|
---|
| 81 | ; WAIT_ANY_KEY_TO_CONTINUE
|
---|
| 82 | ; Parameters:
|
---|
| 83 | ; Nothing
|
---|
| 84 | ; Returns:
|
---|
| 85 | ; Nothing
|
---|
| 86 | ; Corrupts registers:
|
---|
| 87 | ; Nothing
|
---|
| 88 | ;--------------------------------------------------------------------
|
---|
| 89 | %macro WAIT_ANY_KEY_TO_CONTINUE 0
|
---|
| 90 | push ax
|
---|
| 91 | call Keyboard_RemoveAllKeystrokesFromBuffer
|
---|
| 92 | call Keyboard_GetKeystrokeToAXandWaitIfNecessary
|
---|
| 93 | pop ax
|
---|
| 94 | %endmacro
|
---|
| 95 |
|
---|
| 96 |
|
---|
| 97 |
|
---|
| 98 | %endif ; DEBUG_INC
|
---|