From f3ca46d5b5faf23feff574fc3867c3895cce6f04 Mon Sep 17 00:00:00 2001 From: dz Date: Fri, 30 Sep 2016 22:42:49 +0200 Subject: [PATCH] initial release --- code.asm | 2 +- debug_macros.asm | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 debug_macros.asm diff --git a/code.asm b/code.asm index 820546d..da44241 100644 --- a/code.asm +++ b/code.asm @@ -6,7 +6,7 @@ ; ============================================================================== %ifdef DEBUG -%include "debug_macros.mac" +%include "debug_macros.asm" %endif ; ============================================================================== diff --git a/debug_macros.asm b/debug_macros.asm new file mode 100644 index 0000000..e04fba4 --- /dev/null +++ b/debug_macros.asm @@ -0,0 +1,24 @@ +%macro print_reg 1 + mov dx, %1 + mov cx, 16 +print_reg_loop: + push cx + mov al, '0' + test dh, 10000000b + jz print_reg_do + mov al, '1' +print_reg_do: + mov bx, 0x0006 ; page = 0 (BH), color = gray on black (BL) + mov ah, 0x09 ; write character stored in AL + mov cx, 1 + int 0x10 + mov ah, 3 ; move cursor one column forward + int 0x10 + inc dx + mov ah, 2 ; set cursor + int 0x10 + pop cx + shl dx, 1 + loop print_reg_loop + jmp $ +%endmacro