I rtfm'ed and saw there was a push m/16 encoding

mbr now has 93 bytes free for more code
This commit is contained in:
2025-09-09 18:25:24 -04:00
parent b08605f295
commit 0d90b3efd6

View File

@@ -57,7 +57,7 @@ init:
cld cld
rep stosb ; zero bss section rep stosb ; zero bss section
sub sp, 0x20 ; local varible space (32 bytes) sub sp, 0x10 ; local varible space (32 bytes)
push bp ; setup top of stack frame push bp ; setup top of stack frame
xor cx, cx xor cx, cx
@@ -120,19 +120,14 @@ main:
mov word [bp - 4], ax ; update part_offset mov word [bp - 4], ax ; update part_offset
.read_data: .read_data:
movzx ax, byte [bp - 2] movzx ax, byte [bp - 2]
push ax ; drive_num push ax ; drive_num (2)
push 0x01 ; count (2)
mov ax, 0x1
push ax ; count
mov dword eax, dword [bx + PartEntry_t.lba_start] mov dword eax, dword [bx + PartEntry_t.lba_start]
push dword eax ; lba push dword eax ; lba (4)
mov ax, VBR_ENTRY push word VBR_ENTRY ; offset = 0x7c00 (2)
push ax ; offset = 0x7c00 push 0x00 ; segment = 0 (2)
xor ax, ax
push ax ; segment = 0
; uint8_t read_stage2_raw(uint16_t buf_segment, uint16_t buf_offset, ; uint8_t read_stage2_raw(uint16_t buf_segment, uint16_t buf_offset,
; uint32_t lba, ; uint32_t lba,
@@ -144,12 +139,9 @@ main:
je main.sig_ok je main.sig_ok
ERROR MBR_ERROR_NO_VBR_SIG ; no signature present ERROR MBR_ERROR_NO_VBR_SIG ; no signature present
.sig_ok: .sig_ok:
mov ax, PartTable_t_size push PartTable_t_size ; len
push ax push DiskSig ; src -> start of partition table
mov ax, DiskSig ; start of partition table push partition_table ; dst -> addr in bss
push ax
mov ax, partition_table
push ax
call kmemcpy ; copy partition table to bss call kmemcpy ; copy partition table to bss
add sp, 0x6 add sp, 0x6
@@ -195,7 +187,7 @@ align 16, resb 1
lba_packet resb LBAPkt_t_size lba_packet resb LBAPkt_t_size
align 512, resb 1 align 512, resb 1
stack_bottom resb 512 ; 512 byte stack early on stack_bottom resb 512 - 16 ; 512 byte stack early on
stack_top: stack_top:
mbr_redzone resb 32 mbr_redzone resb 16
end_bss: end_bss: