tons more work on modularizing the code
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
; SOFTWARE.
|
||||
|
||||
%ifndef __INC_E820MEMORY_MAP
|
||||
|
||||
; Address Range Descriptor Structure
|
||||
;
|
||||
@@ -116,6 +117,7 @@ struc AddressRangeDescStruct_t
|
||||
.ExtType resd 1
|
||||
endstruc
|
||||
|
||||
ALIGN 4, db 0x90
|
||||
GetMemoryMap:
|
||||
__CDECL16_ENTRY
|
||||
push es ; save segment register
|
||||
@@ -158,4 +160,7 @@ GetMemoryMap:
|
||||
.endp:
|
||||
pop es
|
||||
__CDECL16_EXIT
|
||||
ret
|
||||
ret
|
||||
|
||||
%endif
|
||||
%define __INC_E820MEMORY_MAP
|
||||
@@ -18,6 +18,7 @@
|
||||
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
; SOFTWARE.
|
||||
|
||||
%ifndef __INC_A20ENABLE
|
||||
;
|
||||
;INT 0x15 Function 2400 - Disable A20
|
||||
;Returns:
|
||||
@@ -66,6 +67,7 @@
|
||||
; Bit 3 - power on password bytes (CMOS bytes 0x38-0x3f or 0x36-0x3f). 0: accessible, 1: inaccessible
|
||||
; Bits 4-5 - Manufacturer defined
|
||||
; Bits 6-7 - 00: HDD activity LED off; any other value is "on"
|
||||
ALIGN 4, db 0x90
|
||||
EnableA20:
|
||||
__CDECL16_ENTRY
|
||||
push ds
|
||||
@@ -136,4 +138,7 @@ EnableA20:
|
||||
pop es
|
||||
pop ds
|
||||
__CDECL16_EXIT
|
||||
ret
|
||||
ret
|
||||
|
||||
%endif
|
||||
%define __INC_A20ENABLE
|
||||
@@ -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
|
||||
@@ -18,9 +18,11 @@
|
||||
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
; SOFTWARE.
|
||||
|
||||
%ifndef __INC_VIDEO
|
||||
; Sets output to 80x25 16 color text mode via BIOS call
|
||||
; also clears screen
|
||||
; void SetTextMode(void)
|
||||
ALIGN 4, db 0x90
|
||||
SetTextMode:
|
||||
.prolog:
|
||||
__CDECL16_ENTRY
|
||||
@@ -39,6 +41,7 @@ SetTextMode:
|
||||
ret
|
||||
|
||||
; disables blinking text mode cursor
|
||||
ALIGN 4, db 0x90
|
||||
disable_cursor:
|
||||
__CDECL16_ENTRY
|
||||
.func:
|
||||
@@ -51,4 +54,7 @@ disable_cursor:
|
||||
out dx, al
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
ret
|
||||
ret
|
||||
|
||||
%endif
|
||||
%define __INC_VIDEO
|
||||
Reference in New Issue
Block a user