summaryrefslogtreecommitdiffstats
path: root/printmsg.asm
diff options
context:
space:
mode:
Diffstat (limited to 'printmsg.asm')
-rw-r--r--printmsg.asm70
1 files changed, 47 insertions, 23 deletions
diff --git a/printmsg.asm b/printmsg.asm
index 231f568..6e38dfb 100644
--- a/printmsg.asm
+++ b/printmsg.asm
@@ -211,6 +211,27 @@ GPROC(debug_puts)
retw $2
END(debug_puts)
+GPROC(debug_puts_far)
+ pushw %bp
+ movw %sp,%bp
+ pushw %ds
+ pushw %si
+ pushw %ax
+ ldsw 4(%bp),%si
+1:
+ lodsb
+ andb %al,%al
+ jz 2f
+ outb %al,$DEBUG_PORT
+ jmp 1b
+2:
+ popw %ax
+ popw %si
+ popw %ds
+ popw %bp
+ retw $4
+END(debug_puts_far)
+
/* ------------------------------------------------------------------------- *
* debug_printnum
*
@@ -221,28 +242,29 @@ GPROC(debug_printnum)
pushl %eax
pushl %edx
pushl %ecx
- pushw %di
- movw %sp,%di
- movl (2+1*2+3*4)(%di),%eax
+ pushw %bp
+ movw %sp,%bp
+ movl (2+1*2+3*4)(%bp),%eax
subw $12,%sp
- decw %di
+ decw %bp
xorl %ecx,%ecx
- movb %cl,(%di)
+ movb %cl,(%bp)
movb $10,%cl
1:
xorl %edx,%edx
divl %ecx
- decw %di
+ decw %bp
addb $0x30,%dl
- movb %dl,(%di)
+ movb %dl,(%bp)
andl %eax,%eax
jnz 1b
- pushw %di
- call debug_puts
+ pushw %ss
+ pushw %bp
+ call debug_puts_far
addw $12,%sp
- popw %di
+ popw %bp
popl %ecx
popl %edx
popl %eax
@@ -257,28 +279,27 @@ END(debug_printnum)
GPROC(debug_printhex2)
pushw %cx
- movw $0x208,%cx
+ movw $2,%cx
jmp debug_printhexn
END(debug_printhex2)
GPROC(debug_printhex4)
pushw %cx
- movw $0x400,%cx
+ movw $4,%cx
/* jmp debug_printhexn */
END(debug_printhex4)
LPROC(debug_printhexn)
pushw %ax
pushw %dx
- pushw %di
+ pushw %bp
cld
+ movw %sp,%bp
subw $6,%sp
- movw %sp,%di
- movw (2+4*2+6)(%di),%dx
- shlw %cl,%dx
- shrw $8,%cx
+ movw (2+4*2)(%bp),%dx
+ decw %bp
+ movb %ch,(%bp) /* %ch == 0 */
1:
- rolw $4,%dx
movb %dl,%al
andb $0x0f,%al
addb $0x30,%al
@@ -286,14 +307,17 @@ LPROC(debug_printhexn)
jb 2f
addb $(0x41-0x3a),%al
2:
- stosb
+ decw %bp
+ movb %al,(%bp)
+ shrw $4,%dx
loopw 1b
- movb %cl,(%di) /* %cl == 0 */
- pushw %sp /* %sp -> address of buffer */
- call debug_puts
+
+ pushw %ss
+ pushw %bp /* %bp -> first character */
+ call debug_puts_far
addw $6,%sp
- popw %di
+ popw %bp
popw %dx
popw %ax
popw %cx