From 201a6c7cbc9a6fc7f7d4126cd4e41eff658818a3 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Wed, 11 Apr 2018 18:30:15 +0300 Subject: [PATCH] more debugging --- src/boot/boot.s | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/boot/boot.s b/src/boot/boot.s index 8ba4a11..4ab605c 100644 --- a/src/boot/boot.s +++ b/src/boot/boot.s @@ -1,12 +1,15 @@ .code16 .section .boot,"a" + .set scratchbuf, 0x7b00 + +boot: cli cld # move stack to just below the code xor %ax, %ax mov %ax, %ss - mov $0x7c00, %sp + mov $0x7b00, %sp # use the code segment for data access mov %cs, %ax mov %ax, %ds @@ -16,9 +19,6 @@ call setup_serial - mov $_boot2_size, %eax - call print_num - # load the second stage boot loader and jump to it mov $_boot2_size, %eax mov %eax, %ebx @@ -37,9 +37,6 @@ call read_sectors jmp boot2_addr - cli - hlt - .set SECT_PER_TRACK, 18 .set ARG_NSECT, 6 @@ -141,6 +138,11 @@ read_sector: jmp abort_read .Lread_ok: + # DBG print first dword + mov $str_read_error + 4, %si + mov %es:(%bx), %eax + call print_str_num + # increment es:bx accordingly (advance es if bx overflows) add $512, %bx jno 0f @@ -154,12 +156,11 @@ read_sector: pop %bp ret -str_read_error: .asciz "err read sector: " +str_read_error: .asciz "err read sect: " abort_read: mov $str_read_error, %si call print_str_num16 - cli hlt cursor_x: .byte 0 @@ -170,6 +171,8 @@ print_str_num: call print_str pop %eax call print_num + mov $13, %al + call ser_putchar mov $10, %al call ser_putchar ret @@ -216,7 +219,7 @@ print_num: pusha xor %cx, %cx - movw $numbuf, %si + movw $scratchbuf, %si mov $10, %ebx 0: xor %edx, %edx @@ -328,7 +331,6 @@ ser_putstr: drive_number: .byte 0 -numbuf: .space 8 .org 510 .byte 0x55 .byte 0xaa -- 1.7.10.4