%define BOOT0_LOADPOINT 0x7c00 %define BOOT1_LOADPOINT 0x8200 %define MEMMAP 0x6a00 %define MEMMAP_END BOOT0_LOADPOINT %define MEMMAP_ENT_SIZE 32 %define MEMMAP_CAP ((MEMMAP_END - MEMMAP) / MEMMAP_ENT_SIZE) %define GLOBALS 0x4000 %define GLOBALS_END MEMMAP %define STACK_BASE GLOBALS %define EBDA_START 0x080000 %define VGA_SEG 0xb800 %define BOOT1_MAGIC 0x544e4150 %define VGA_WIDTH 80 %define VGA_HEIGHT 25 %define INTEL_8042_IO_DATA 0x60 %define INTEL_8042_IN_STATUS 0x64 %define INTEL_8042_OUT_CMD 0x64 %define INTEL_8042_STATUS_BIT_OBUF 0 %define INTEL_8042_STATUS_BIT_IBUF 1 %define INTEL_8042_STATUS_MASK_OBUF (1 << INTEL_8042_STATUS_BIT_OBUF) %define INTEL_8042_STATUS_MASK_IBUF (1 << INTEL_8042_STATUS_BIT_IBUF) %define INTEL_8042_CMD_PS2_1_DISABLE 0xad %define INTEL_8042_CMD_PS2_1_ENABLE 0xae %define INTEL_8042_CMD_CONTROLLER_OUT_PORT_READ 0xd0 %define INTEL_8042_CMD_CONTROLLER_OUT_PORT_WRITE 0xd1 ; ASCII string "SMAP", which is used by e820 as a magic number argument and return value. %define E820_MAGIC 0x534d4150 ; Size of entry returned by e820. This is less than MEMMAP_ENT_SIZE because we add some fields of ; our own. %define E820_ENTRY_SIZE 24 %define MEMMAP_ENT_FIELD_BASE 0x00 %define MEMMAP_ENT_FIELD_LEN 0x08 %define MEMMAP_ENT_FIELD_TYPE 0x10 %define MEMMAP_ENT_FIELD_EXT 0x14 %define MEMMAP_ENT_FIELD_END 0x18 %define GDT_DESCRIPTOR_SIZE 0x08 ; boot0 base stack frame variable offsets / globals ; (we use the same offsets once we copy the variables to the globals section) ; ------------------------------------------------------------------------------------------------- ; The boot drive number given to us by the BIOS. %define BOOT_DRIVE 0x02 ; Boot drive geometry %define SECTORS_PER_TRACK 0x04 %define N_HEADS 0x06 ; Starting LBA of the GPT partition entries array. %define GPT_ENTRIES_START_LBA 0x08 ; Number of GPT entries, saturated to 16 bits. %define GPT_N_ENTRIES_16 0x0a ; Number of sectors to advance by once we've read every GPT entry in the current sector. %define GPT_SECTOR_STRIDE 0x0c ; Number of bytes to advance by in the current sector once we've read a GPT entry. %define GPT_BYTE_STRIDE 0x0e ; Number of GPT entries which can fit in a single sector. %define GPT_ENTRIES_PER_SECTOR 0x10 %define GPT_CURRENT_ENTRY_IDX 0x12 %define GPT_SECTOR_ENTRY_IDX 0x14 %define GPT_SECTORS_LOADED 0x16 %define GPT_CURRENT_LBA 0x18 %define BOOT1_GPT_ENTRY_ADDR 0x1a ; Globals ; ------------------------------------------------------------------------------------------------ %define VGA_COL 0x1c %define TEXTBUF_LINE 0x1e %define MEMMAP_ENTRIES 0x20 %macro fnstart 0 push bp mov bp, sp %endmacro %macro fnret 0 pop bp ret %endmacro