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

Last change on this file since 146 was 143, checked in by Tomi Tilli, 14 years ago

Changes to XTIDE Universal BIOS:

  • Removed "Boot sector found!" string.
  • Added option to specify display mode for boot menu.
File size: 8.7 KB
RevLine 
[3]1; Project name : XTIDE Universal BIOS
[86]2; Authors : Tomi Tilli
3; : aitotat@gmail.com
4; :
5; : Krister Nordvall
6; : krille_n_@hotmail.com
7; :
[3]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
[97]14
[3]15; Included .inc files
[88]16%include "AssemblyLibrary.inc" ; Assembly Library. Must be included first!
[3]17%include "Interrupts.inc" ; For interrupt 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 "CustomDPT.inc" ; For Disk Parameter Table
22%include "RomVars.inc" ; For ROMVARS and IDEVARS structs
23%include "RamVars.inc" ; For RAMVARS struct
24%include "BootVars.inc" ; For BOOTVARS and BOOTNFO structs
25%include "BootMenu.inc" ; For Boot Menu
26%include "IDE_8bit.inc" ; For IDE 8-bit data port macros
27
28
29; Section containing code
30SECTION .text
31
32; ROM variables (must start at offset 0)
33CNT_ROM_BLOCKS EQU 16 ; 16 * 512B = 8kB BIOS
34istruc ROMVARS
35 at ROMVARS.wRomSign, dw 0AA55h ; PC ROM signature
36 at ROMVARS.bRomSize, db CNT_ROM_BLOCKS ; ROM size in 512B blocks
37 at ROMVARS.rgbJump, jmp Initialize_FromMainBiosRomSearch
[88]38 at ROMVARS.rgbSign, db "XTIDE120" ; Signature for flash program
[3]39 at ROMVARS.szTitle
40 db "-=XTIDE Universal BIOS"
41%ifdef USE_AT
[88]42 db " (AT)=-",NULL
[3]43%elifdef USE_186
[88]44 db " (XT+)=-",NULL
[3]45%else
[88]46 db " (XT)=-",NULL
[3]47%endif
[97]48 at ROMVARS.szVersion, db "v1.2.0_wip (",__DATE__,")",NULL
[3]49
50;---------------------------;
51; AT Build default settings ;
52;---------------------------;
53%ifdef USE_AT
[93]54 at ROMVARS.wFlags, dw FLG_ROMVARS_FULLMODE | FLG_ROMVARS_DRVXLAT
[143]55 at ROMVARS.wDisplayMode, dw DEFAULT_TEXT_MODE
[137]56 at ROMVARS.wBootTimeout, dw 30 * TICKS_PER_SECOND ; Boot Menu selection timeout
[3]57 at ROMVARS.bIdeCnt, db 3 ; Number of supported controllers
58 at ROMVARS.bBootDrv, db 80h ; Boot Menu default drive
59 at ROMVARS.bMinFddCnt, db 0 ; Do not force minimum number of floppy drives
60 at ROMVARS.bStealSize, db 1 ; Steal 1kB from base memory
61
62 at ROMVARS.ideVars0+IDEVARS.wPort, dw 1F0h ; Controller Command Block base port
63 at ROMVARS.ideVars0+IDEVARS.wPortCtrl, dw 3F0h ; Controller Control Block base port
64 at ROMVARS.ideVars0+IDEVARS.bBusType, db BUS_TYPE_16 ; Bus type
65 at ROMVARS.ideVars0+IDEVARS.bIRQ, db 14 ; IRQ
66 at ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
67 at ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
68
69 at ROMVARS.ideVars1+IDEVARS.wPort, dw 170h ; Controller Command Block base port
70 at ROMVARS.ideVars1+IDEVARS.wPortCtrl, dw 370h ; Controller Control Block base port
71 at ROMVARS.ideVars1+IDEVARS.bBusType, db BUS_TYPE_16 ; Bus type
72 at ROMVARS.ideVars1+IDEVARS.bIRQ, db 15 ; IRQ
73 at ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
74 at ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
75
76 at ROMVARS.ideVars2+IDEVARS.wPort, dw 300h ; Controller Command Block base port
77 at ROMVARS.ideVars2+IDEVARS.wPortCtrl, dw 308h ; Controller Control Block base port
78 at ROMVARS.ideVars2+IDEVARS.bBusType, db BUS_TYPE_8_DUAL ; Bus type
79 at ROMVARS.ideVars2+IDEVARS.bIRQ, db 0 ; IRQ
80 at ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
81 at ROMVARS.ideVars2+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
[143]82
83 at ROMVARS.ideVars3+IDEVARS.wPort, dw 168h ; Controller Command Block base port
84 at ROMVARS.ideVars3+IDEVARS.wPortCtrl, dw 368h ; Controller Control Block base port
85 at ROMVARS.ideVars3+IDEVARS.bBusType, db BUS_TYPE_16 ; Bus type
86 at ROMVARS.ideVars3+IDEVARS.bIRQ, db 0 ; IRQ
87 at ROMVARS.ideVars3+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
88 at ROMVARS.ideVars3+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
[3]89%else
90;-----------------------------------;
91; XT and XT+ Build default settings ;
92;-----------------------------------;
[93]93 at ROMVARS.wFlags, dw FLG_ROMVARS_DRVXLAT
[143]94 at ROMVARS.wDisplayMode, dw DEFAULT_TEXT_MODE
[137]95 at ROMVARS.wBootTimeout, dw 30 * TICKS_PER_SECOND ; Boot Menu selection timeout
[3]96 at ROMVARS.bIdeCnt, db 1 ; Number of supported controllers
97 at ROMVARS.bBootDrv, db 80h ; Boot Menu default drive
98 at ROMVARS.bMinFddCnt, db 1 ; Assume at least 1 floppy drive present if autodetect fails
99 at ROMVARS.bStealSize, db 1 ; Steal 1kB from base memory in full mode
100
101 at ROMVARS.ideVars0+IDEVARS.wPort, dw 300h ; Controller Command Block base port
102 at ROMVARS.ideVars0+IDEVARS.wPortCtrl, dw 308h ; Controller Control Block base port
103 at ROMVARS.ideVars0+IDEVARS.bBusType, db BUS_TYPE_8_DUAL ; Bus type
104 at ROMVARS.ideVars0+IDEVARS.bIRQ, db 0 ; IRQ
105 at ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
106 at ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
[143]107
108 at ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
109 at ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
110
111 at ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
112 at ROMVARS.ideVars2+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
113
114 at ROMVARS.ideVars3+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
115 at ROMVARS.ideVars3+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE
[3]116%endif
117iend
118
119
120; Include .asm files (static data and libraries)
[88]121%include "AssemblyLibrary.asm"
[3]122%include "Strings.asm" ; For BIOS message strings
123
124; Include .asm files (Initialization and drive detection)
125%include "Initialize.asm" ; For BIOS initialization
[33]126%include "Interrupts.asm" ; For Interrupt initialization
[3]127%include "RamVars.asm" ; For RAMVARS initialization and access
128%include "CreateDPT.asm" ; For creating DPTs
129%include "FindDPT.asm" ; For finding DPTs
130%include "AccessDPT.asm" ; For accessing DPTs
131%include "BootInfo.asm" ; For creating BOOTNFO structs
132%include "AtaID.asm" ; For ATA Identify Device information
133%include "DetectDrives.asm" ; For detecting IDE drives
134%include "DetectPrint.asm" ; For printing drive detection strings
135
136; Include .asm files (boot menu)
137%include "BootMenu.asm" ; For Boot Menu operations
138%include "BootMenuEvent.asm" ; For menu library event handling
139%include "FloppyDrive.asm" ; Floppy Drive related functions
[96]140%include "BootSector.asm" ; For loading boot sector
141%include "BootPrint.asm" ; For printing boot information
[3]142%include "BootMenuPrint.asm" ; For printing Boot Menu strings
143%include "BootMenuPrintCfg.asm" ; For printing hard disk configuration
144
145; Include .asm files (general drive accessing)
146%include "DriveXlate.asm" ; For swapping drive numbers
147%include "HAddress.asm" ; For sector address translations
148%include "HCapacity.asm" ; For calculating drive capacity
149%include "HError.asm" ; For error checking
150%include "HPIO.asm" ; For PIO transfers
151%include "HIRQ.asm" ; For IRQ handling
152%include "HStatus.asm" ; For reading hard disk status
153%include "HDrvSel.asm" ; For selecting drive to access
154%include "HCommand.asm" ; For outputting command and parameters
[140]155%include "HTimer.asm" ; For timeout and delay
[3]156
157; Include .asm files (Interrupt handlers)
158%include "Int13h.asm" ; For Int 13h, Disk functions
[90]159%ifndef USE_AT
160 %include "Int19hLate.asm" ; For late initialization
161%endif
[3]162%include "Int19hMenu.asm" ; For Int 19h, Boot Loader for Boot Menu
163
164; Include .asm files (Hard Disk BIOS functions)
165%include "AH0h_HReset.asm" ; Required by Int13h_Jump.asm
166%include "AH1h_HStatus.asm" ; Required by Int13h_Jump.asm
167%include "AH2h_HRead.asm" ; Required by Int13h_Jump.asm
168%include "AH3h_HWrite.asm" ; Required by Int13h_Jump.asm
169%include "AH4h_HVerify.asm" ; Required by Int13h_Jump.asm
170%include "AH8h_HParams.asm" ; Required by Int13h_Jump.asm
171%include "AH9h_HInit.asm" ; Required by Int13h_Jump.asm
172%include "AHCh_HSeek.asm" ; Required by Int13h_Jump.asm
173%include "AHDh_HReset.asm" ; Required by Int13h_Jump.asm
174%include "AH10h_HReady.asm" ; Required by Int13h_Jump.asm
175%include "AH11h_HRecal.asm" ; Required by Int13h_Jump.asm
176%include "AH15h_HSize.asm" ; Required by Int13h_Jump.asm
177%include "AH23h_HFeatures.asm" ; Required by Int13h_Jump.asm
178%include "AH24h_HSetBlocks.asm" ; Required by Int13h_Jump.asm
179%include "AH25h_HDrvID.asm" ; Required by Int13h_Jump.asm
180
181
182
183; Fill with zeroes until size is what we want
[88]184;times (CNT_ROM_BLOCKS*512)-($-$$) db 0
Note: See TracBrowser for help on using the repository browser.