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

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

Changes to XTIDE Universal BIOS:

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