;******************************************************************************************************************************** ;* * ;* File: Boot.inc * ;* * ;* This file contains the constants, macros, and function prototypes for the bootstrap of PwnOS. * ;* * ;* Included By: * ;* * ;* * ;* Includes: * ;* * ;* * ;* See Also: * ;* * ;* * ;* Authors: * ;* - Neil G. Dickson * ;* * ;******************************************************************************************************************************** ;this include needs to be at beginning because TRUE and FALSE are undefined until it is included ;(only matters for macros with constants of those values) EXTERN_CORE_INCLUDE equ TRUE include ..\Core\Core.inc .nolist GFX_TESTING_MODE equ FALSE ;assembles with graphics testing output if TRUE (FALSE for no testing or TEXT_TESTING_MODE) TEXT_TESTING_MODE equ FALSE ;assembles with text testing output if TRUE (FALSE for standard graphics) FLOPPY_BOOT_MODE equ FALSE ;assembles for floppy disc booting if TRUE (FALSE for harddrive) IMAGE_TEST_MODE equ TRUE ;assembles for the boot image demo if TRUE (FALSE for normal boot) IF GFX_TESTING_MODE IF TEXT_TESTING_MODE echo Error: GFX Testing Mode and Text Testing Mode enabled .err ENDIF ENDIF X_RESOLUTION_WANTED equ 1024 Y_RESOLUTION_WANTED equ 768 MIN_BITS_PER_PIXEL equ 24 ;if made any lower, have to change a lot of code FOREGROUND_COLOUR equ 00000FFh ;Blue BACKGROUND_COLOUR equ 0FFFFFFh ;White NUMBER_FOREGROUND_COLOUR equ 000FF00h ;Green LINE_COLOUR equ 0FF0000h ;Red ;### SEE - TODO18: ### SZ_STORED_IDT equ (N_INTERRUPTS*8) IDT_LOAD_OFFSET equ (PA_TRACK0+SZ_STORED_GDT) ;first thing in Sector1 MAX_BOOT_PARTITIONS equ 4 TestOutputProc proto pText:DWORD,Var:DWORD,Flags:DWORD TestOutputWait MACRO text ;used only in text testing mode ;if ebx is modified, change APIC Timer Interrupt to use a different register or WaitFlag LOCAL TextData,AfterText IF TEXT_TESTING_MODE ;used only in text testing mode jmp AfterText TextData byte text,0 AfterText: push 1;NULL push NULL push offset TextData call TestOutputProc ENDIF ENDM TestOutput MACRO text ;if ebx is modified, change APIC Timer Interrupt to use a different register or WaitFlag LOCAL TextData,AfterText IF TEXT_TESTING_MODE ;used only in text testing mode push 1 push NULL push offset TextData call TestOutputProc jmp AfterText TextData byte text,0 AfterText: ENDIF ENDM TestOutputVar MACRO text,var ;var cannot be esp or anything addressed by esp LOCAL TextData,AfterText ;if ebx is modified, change APIC Timer Interrupt to use a different register or WaitFlag IF TEXT_TESTING_MODE ;used only in text testing mode push 3;2 push var push offset TextData call TestOutputProc jmp AfterText TextData byte text,0 AfterText: ENDIF ENDM GfxOutputVar MACRO text,var ;var cannot be esp or anything addressed by esp LOCAL TextData,AfterText ;if ebx is modified, change APIC Timer Interrupt to use a different register or WaitFlag IF GFX_TESTING_MODE ;used only in graphics testing mode push 3;2 push var push offset TextData call TestOutputProc jmp AfterText TextData byte text,0 AfterText: ENDIF ENDM GfxOutput MACRO text ;if ebx is modified, change APIC Timer Interrupt to use a different register or WaitFlag LOCAL TextData,AfterText IF GFX_TESTING_MODE ;used only in text testing mode push 1 push NULL push offset TextData call TestOutputProc jmp AfterText TextData byte text,0 AfterText: ENDIF ENDM INT_DESC MACRO address dw lowword (address) dw SELECTOR_CORE_CODE db 0 db DESC_S_INT_GATE_32 or DESC_PRESENT_BIT ;### SEE - TODO3: ### dw 0;highword address ENDM SetTSSDescriptor proto pTSS:DWORD ATAIdentifyDevice proto pDest:DWORD,DriveNum:DWORD ATAIdentifyPacketDevice proto pDest:DWORD,DriveNum:DWORD CompactATAIdentify proto Drive0To3:DWORD,pSource:DWORD ATAIsValidDevice proto Drive0To3:DWORD ATAReadSectors proto pDest:DWORD,Drive0To3:DWORD,SectorNumLow:DWORD,SectorNumHigh:DWORD,nSectors:DWORD ATAReadSectors28 proto pDest:DWORD,DriveNum:DWORD,SectorNum:DWORD,nSectors:DWORD ATAReadSectors48 proto pDest:DWORD,DriveNum:DWORD,SectorNumLow:DWORD,SectorNumHigh:DWORD,nSectors:DWORD MountNTFSPartition proto Drive0To3:DWORD,pPartitionEntry:DWORD,pBootSector:DWORD LogicalClusNumToSector proto pFileSystemInfo:DWORD,LCNLow:DWORD,LCNHigh:DWORD GetNTFSFileRecord proto pDest:DWORD,pFileSystemInfo:DWORD,FILERecNumLow:DWORD,FILERecNumHigh:DWORD SearchNTFSDirectory proto pFileSystemInfo:DWORD,pDirFileHeader:DWORD,pFileName:DWORD,pIndexScratch:DWORD ReadNTFSFile proto pDest:DWORD,pFileSystemInfo:DWORD,pFileHeader:DWORD .list include VBE.inc