DragonVM/extra/dss/bios/entry.dss

37 lines
No EOL
1.7 KiB
Text

.load 0x0000 ## BIOS is mapped to address 0x0000 in memory
.entry _bios_entry_point
.fixed 4096, 0xFF ## BIOS Needs to be 4096 Bytes exactly
@include <data.dss>
@include <utils.dss>
@include <drivers.dss>
@include <display.dss>
## ============================= BIOS Program =============================
.code
_bios_entry_point:
movb [VGA_Registers.VIDEO_MODE], VGA_VideoModes.TEXT_SINGLE_COLOR ## Enable Text_Single_Color graphics mode
mov FL, 0b0000000000000001 ## Zero the FL Register and enable interrupts
mov reg(S_REG_OFFSET), 0x0000 ## Zero the offset register
movb [{MemoryAddresses.INT_VEC + (0x20 * 3)}], 0xFF ## Setting up int 0x20 handler
mov [{MemoryAddresses.INT_VEC + (0x20 * 3) + 1}], $_int_20_handler ## --
mov R10, 0x00 ## Setting up int 0x30 handler by using int 0x20 functionality
mov R9, $_int_30_handler ## -Passing the handler's address
mov R8, 0x30 ## -Passing the interrupt's code to setup
int 0x20 ## -Calling int 0x20 with 0x00 as parameter, to set new handler up
push 0
call $_print_machine_info_signle_color ## Print BIOS logo and machine info
## MBR Loading
zflg Flags.InterruptsEnabled ## Disable interrupts
push 0
call $_load_mbr_data_block
sflg Flags.InterruptsEnabled ## Enable interrupts
## ----
%low INST_BIOS_NODE_TOGGLE 0x00 ## Disable BIOS Mode before leaving the BIOS
jmp MemoryAddresses.MBR ## Jump to start of MBR in memory
hlt ## Just in case somehow execution reaches this point
## ========================================================================