DragonVM/extra/dss/bios/entry.dss
2024-06-22 00:20:17 +02:00

45 lines
1.9 KiB
Text

.load 0x0000 ## BIOS is mapped to address 0x0000 in memory
@include <data.dss>
## ============================= BIOS Program =============================
.code
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
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 ## Print BIOS logo and machine info
## MBR Loading
and FL, 0b1111111111111110 ## Disable interrupts
mov FL, ACC
push 0
call $_load_mbr_data_block
or FL, 0b0000000000000001 ## Enable interrupts
mov FL, ACC
## ----
mov reg(S_REG_OFFSET), 0x0000 ## Zero the offset register
or FL, 0b0000000000000010 ## Enable offset mode for memory addressing
mov FL, ACC
%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
## ========================================================================
@include <drivers.dss>
@include <display_info.dss>
## This file contains the .data section, so it needs to be the last thing included
@include <utils.dss>
## ===============================================================================
.fixed 4096, 0xFF ## BIOS Needs to be 4096 Bytes exactly