source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Main.asm@ 174

Last change on this file since 174 was 165, checked in by aitotat@…, 13 years ago

Changes to XTIDE Universal BIOS:

  • Hopefully this commit is successful. Sorry for the mess.
File size: 9.0 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Authors : Tomi Tilli
3; : aitotat@gmail.com
4; :
5; : Krister Nordvall
6; : krille_n_@hotmail.com
7; :
8; Description : Main file for BIOS. This is the only file that needs
9; to be compiled since other files are included to this
10; file (so no linker needed, Nasm does it all).
11
12ORG 000h ; Code start offset 0000h
13
14
15; Included .inc files
16%include "AssemblyLibrary.inc" ; Assembly Library. Must be included first!
17%include "IntController.inc" ; For Interrupt Controller equates
18%include "ATA_ID.inc" ; For ATA Drive Information structs
19%include "IdeRegisters.inc" ; For ATA Registers, flags and commands
20%include "Int13h.inc" ; Equates for INT 13h functions
21%include "EBIOS.inc" ; Equates for EBIOS functions
22%include "CustomDPT.inc" ; For Disk Parameter Table
23%include "RomVars.inc" ; For ROMVARS and IDEVARS structs
24%include "RamVars.inc" ; For RAMVARS struct
25%include "BootVars.inc" ; For BOOTVARS and BOOTNFO structs
26%include "BootMenu.inc" ; For Boot Menu
27%include "IDE_8bit.inc" ; For IDE 8-bit data port macros
28%include "DeviceIDE.inc" ; For IDE device equates
29
30
31; Section containing code
32SECTION .text
33
34; ROM variables (must start at offset 0)
35CNT_ROM_BLOCKS EQU 16 ; 16 * 512B = 8kB BIOS
36istruc ROMVARS
37 at ROMVARS.wRomSign, dw 0AA55h ; PC ROM signature
38 at ROMVARS.bRomSize, db CNT_ROM_BLOCKS ; ROM size in 512B blocks
39 at ROMVARS.rgbJump, jmp Initialize_FromMainBiosRomSearch
40 at ROMVARS.rgbSign, db "XTIDE120" ; Signature for flash program
41 at ROMVARS.szTitle
42 db "-=XTIDE Universal BIOS"
43%ifdef USE_AT
44 db " (AT)=-",NULL
45%elifdef USE_186
46 db " (XT+)=-",NULL
47%else
48 db " (XT)=-",NULL
49%endif
50 at ROMVARS.szVersion, db "v1.2.0_wip (",__DATE__,")",NULL
51
52;---------------------------;
53; AT Build default settings ;
54;---------------------------;
55%ifdef USE_AT
56 at ROMVARS.wFlags, dw FLG_ROMVARS_FULLMODE | FLG_ROMVARS_DRVXLAT
57 at ROMVARS.wDisplayMode, dw DEFAULT_TEXT_MODE
58 at ROMVARS.wBootTimeout, dw 30 * TICKS_PER_SECOND ; Boot Menu selection timeout
59 at ROMVARS.bIdeCnt, db 4 ; Number of supported controllers
60 at ROMVARS.bBootDrv, db 80h ; Boot Menu default drive
61 at ROMVARS.bMinFddCnt, db 0 ; Do not force minimum number of floppy drives
62 at ROMVARS.bStealSize, db 1 ; Steal 1kB from base memory
63
64 at ROMVARS.ideVars0+IDEVARS.wPort, dw 1F0h ; Controller Command Block base port
65 at ROMVARS.ideVars0+IDEVARS.wPortCtrl, dw 3F0h ; Controller Control Block base port
66 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_16BIT_ATA
67 at ROMVARS.ideVars0+IDEVARS.bIRQ, db 0
68 at ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
69 at ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
70
71 at ROMVARS.ideVars1+IDEVARS.wPort, dw 170h ; Controller Command Block base port
72 at ROMVARS.ideVars1+IDEVARS.wPortCtrl, dw 370h ; Controller Control Block base port
73 at ROMVARS.ideVars1+IDEVARS.bDevice, db DEVICE_16BIT_ATA
74 at ROMVARS.ideVars1+IDEVARS.bIRQ, db 0
75 at ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
76 at ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
77
78 at ROMVARS.ideVars2+IDEVARS.wPort, dw 300h ; Controller Command Block base port
79 at ROMVARS.ideVars2+IDEVARS.wPortCtrl, dw 308h ; Controller Control Block base port
80 at ROMVARS.ideVars2+IDEVARS.bDevice, db DEVICE_8BIT_DUAL_PORT_XTIDE
81 at ROMVARS.ideVars2+IDEVARS.bIRQ, db 0
82 at ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
83 at ROMVARS.ideVars2+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
84
85 at ROMVARS.ideVars3+IDEVARS.wPort, dw 168h ; Controller Command Block base port
86 at ROMVARS.ideVars3+IDEVARS.wPortCtrl, dw 368h ; Controller Control Block base port
87 at ROMVARS.ideVars3+IDEVARS.bDevice, db DEVICE_16BIT_ATA
88 at ROMVARS.ideVars3+IDEVARS.bIRQ, db 0
89 at ROMVARS.ideVars3+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
90 at ROMVARS.ideVars3+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
91%else
92;-----------------------------------;
93; XT and XT+ Build default settings ;
94;-----------------------------------;
95 at ROMVARS.wFlags, dw FLG_ROMVARS_DRVXLAT
96 at ROMVARS.wDisplayMode, dw DEFAULT_TEXT_MODE
97 at ROMVARS.wBootTimeout, dw 30 * TICKS_PER_SECOND ; Boot Menu selection timeout
98 at ROMVARS.bIdeCnt, db 1 ; Number of supported controllers
99 at ROMVARS.bBootDrv, db 80h ; Boot Menu default drive
100 at ROMVARS.bMinFddCnt, db 1 ; Assume at least 1 floppy drive present if autodetect fails
101 at ROMVARS.bStealSize, db 1 ; Steal 1kB from base memory in full mode
102
103 at ROMVARS.ideVars0+IDEVARS.wPort, dw 300h ; Controller Command Block base port
104 at ROMVARS.ideVars0+IDEVARS.wPortCtrl, dw 308h ; Controller Control Block base port
105 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_8BIT_DUAL_PORT_XTIDE
106 at ROMVARS.ideVars0+IDEVARS.bIRQ, db 0 ; IRQ
107 at ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
108 at ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
109
110 at ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
111 at ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
112
113 at ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
114 at ROMVARS.ideVars2+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
115
116 at ROMVARS.ideVars3+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
117 at ROMVARS.ideVars3+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
118%endif
119iend
120
121
122; Libraries and data
123%include "AssemblyLibrary.asm"
124%include "Strings.asm" ; For BIOS message strings
125
126; Initialization and drive detection
127%include "Initialize.asm" ; For BIOS initialization
128%include "Interrupts.asm" ; For Interrupt initialization
129%include "RamVars.asm" ; For RAMVARS initialization and access
130%include "CreateDPT.asm" ; For creating DPTs
131%include "FindDPT.asm" ; For finding DPTs
132%include "AccessDPT.asm" ; For accessing DPTs
133%include "BootInfo.asm" ; For creating BOOTNFO structs
134%include "AtaID.asm" ; For ATA Identify Device information
135%include "DetectDrives.asm" ; For detecting IDE drives
136%include "DetectPrint.asm" ; For printing drive detection strings
137
138; Boot menu
139%include "BootMenu.asm" ; For Boot Menu operations
140%include "BootMenuEvent.asm" ; For menu library event handling
141%include "FloppyDrive.asm" ; Floppy Drive related functions
142%include "BootSector.asm" ; For loading boot sector
143%include "BootPrint.asm" ; For printing boot information
144%include "BootMenuPrint.asm" ; For printing Boot Menu strings
145%include "BootMenuPrintCfg.asm" ; For printing hard disk configuration
146
147; Boot loader
148%ifndef USE_AT
149 %include "Int19hLate.asm" ; For late initialization
150%endif
151%include "Int19hMenu.asm" ; For Int 19h, Boot Loader for Boot Menu
152
153; For all device types
154%include "Device.asm"
155%include "Idepack.asm"
156%include "Timer.asm" ; For timeout and delay
157
158; IDE Device support
159%include "IdeCommand.asm"
160%include "IdeTransfer.asm" ; Must be included after IdeCommand.asm
161%include "IdeDPT.asm"
162%include "IdeIO.asm"
163%include "IdeIrq.asm"
164%include "IdeWait.asm"
165%include "IdeError.asm" ; Must be included after IdeWait.asm
166
167; Serial Port Device support
168%include "SerialCommand.asm"
169%include "SerialDPT.asm"
170
171; INT 13h Hard Disk BIOS functions
172%include "DriveXlate.asm" ; For swapping drive numbers
173%include "Address.asm" ; For sector address translations
174%include "CommandLookup.asm" ; For getting correct transfer command
175%include "Int13h.asm" ; For Int 13h, Disk functions
176%include "AH0h_HReset.asm" ; Required by Int13h_Jump.asm
177%include "AH1h_HStatus.asm" ; Required by Int13h_Jump.asm
178%include "AH2h_HRead.asm" ; Required by Int13h_Jump.asm
179%include "AH3h_HWrite.asm" ; Required by Int13h_Jump.asm
180%include "AH4h_HVerify.asm" ; Required by Int13h_Jump.asm
181%include "AH8h_HParams.asm" ; Required by Int13h_Jump.asm
182%include "AH9h_HInit.asm" ; Required by Int13h_Jump.asm
183%include "AHCh_HSeek.asm" ; Required by Int13h_Jump.asm
184%include "AHDh_HReset.asm" ; Required by Int13h_Jump.asm
185%include "AH10h_HReady.asm" ; Required by Int13h_Jump.asm
186%include "AH11h_HRecal.asm" ; Required by Int13h_Jump.asm
187%include "AH15h_HSize.asm" ; Required by Int13h_Jump.asm
188%include "AH23h_HFeatures.asm" ; Required by Int13h_Jump.asm
189%include "AH24h_HSetBlocks.asm" ; Required by Int13h_Jump.asm
190%include "AH25h_HDrvID.asm" ; Required by Int13h_Jump.asm
191%include "AH41h_CheckIfExtensionsPresent.asm"
192%include "AH42h_ExtendedReadSectors.asm"
193%include "AH43h_ExtendedWriteSectors.asm"
194%include "AH44h_ExtendedVerifySectors.asm"
195%include "AH47h_ExtendedSeek.asm"
196%include "AH48h_GetExtendedDriveParameters.asm"
197
198
199; Fill with zeroes until size is what we want
200;times (CNT_ROM_BLOCKS*512)-($-$$) db 0
Note: See TracBrowser for help on using the repository browser.