From 4420a1bc0b335221680346af6ad7082ff2fd0273 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 17 Mar 2013 18:08:13 -0700 Subject: printmsg.asm: add support for 2-digit hex debug messages --- printmsg.asm | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'printmsg.asm') diff --git a/printmsg.asm b/printmsg.asm index 516b5e2..231f568 100644 --- a/printmsg.asm +++ b/printmsg.asm @@ -250,21 +250,33 @@ GPROC(debug_printnum) END(debug_printnum) /* ------------------------------------------------------------------------- * - * debug_printhex4 + * debug_printhex2/4 * - * Print an hexadecimal 4-digit number from the stack + * Print an hexadecimal 2/4-digit number from the stack * ------------------------------------------------------------------------- */ +GPROC(debug_printhex2) + pushw %cx + movw $0x208,%cx + jmp debug_printhexn +END(debug_printhex2) + GPROC(debug_printhex4) - pushw %ax pushw %cx + movw $0x400,%cx + /* jmp debug_printhexn */ +END(debug_printhex4) + +LPROC(debug_printhexn) + pushw %ax pushw %dx pushw %di cld subw $6,%sp movw %sp,%di movw (2+4*2+6)(%di),%dx - movw $4,%cx + shlw %cl,%dx + shrw $8,%cx 1: rolw $4,%dx movb %dl,%al @@ -283,10 +295,10 @@ GPROC(debug_printhex4) addw $6,%sp popw %di popw %dx - popw %cx popw %ax + popw %cx retw $2 -END(debug_printhex4) +END(debug_printhexn) /* ------------------------------------------------------------------------- * * debug_printhex8 -- cgit