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

Last change on this file since 178 was 176, checked in by gregli@…, 13 years ago

Made a module around the EBIOS code, so that it can be turned off to make room for serial code, still enabled by default in the Makefile

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