tons more work on modularizing the code

This commit is contained in:
2024-10-05 18:55:00 -04:00
parent 5440a1ae61
commit 8f95c8f267
19 changed files with 360 additions and 296 deletions

View File

@@ -18,6 +18,7 @@
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
; SOFTWARE.
%ifndef __INC_EXT_READ
;Offset Size Description
; 0 1 size of packet (16 bytes)
; 1 1 always 0
@@ -52,25 +53,28 @@ endstruc
; successfully transferred
;
;
; uint8_t read_disk_raw(uint16_t buf_segment, uint16_t buf_offset, uint32_t lba)
; TODO: this needs validation
; uint8_t read_stage2_raw(uint16_t buf_segment, uint16_t buf_offset,
; uint32_t lba,
; uint16_t count, uint16_t drive_num)
ALIGN 4, db 0x90
read_disk_raw:
__CDECL16_ENTRY
.func:
.func:
mov ax, 0x10
push ax ; len = 16 bytes
xor ax, ax
push ax ; val = 0
mov ax, lba_packet
push ax ; dest = lba_packet address
call kmemset ; uint8_t* kmemset(void* dest, uint8_t val, size_t len);
add sp, 0x6
call kmemset
add sp, 0x06
mov byte [lba_packet + LBAPkt_t.size], 0x10
mov word [lba_packet + LBAPkt_t.xfer_size], 0x0001
mov dword eax, [bp + 8]
mov ax, [bp + 12]
mov word [lba_packet + LBAPkt_t.xfer_size], ax
mov eax, [bp + 8]
mov dword [lba_packet + LBAPkt_t.lower_lba], eax
mov ax, [bp + 6]
@@ -81,10 +85,26 @@ read_disk_raw:
mov si, lba_packet
mov ah, 0x42
mov dl, byte [fat32_ebpb + FAT32_ebpb_t.drive_number_8]
;BUG: still working on getting this passed down correctly, going to hard set it for now.
movzx dx, byte [bp + 14]
and dx, 0x00ff
;xor dl, dl
;mov dl, 0x80
int 0x13
jnc read_disk_raw.endp
jnc .endf
%ifdef __STEVIA_MBR
ERROR MBR_ERROR_DISK_READ_ERR
%elifsef __STEVIA_VBR
ERROR VBR_ERROR_DISK_READ_ERR
%else
ERROR STAGE2_MBR_DISK_READ_ERROR
.endp:
%endif
.endf:
__CDECL16_EXIT
ret
ret
%endif
%define __INC_EXT_READ