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

Last change on this file since 88 was 88, checked in by aitotat, 13 years ago

Changes to XTIDE Universal BIOS:

  • Now uses new libraries (untested)
  • Non-working since code size is too large
File size: 8.3 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; Included .inc files
15%include "AssemblyLibrary.inc"  ; Assembly Library. Must be included first!
16%include "macros.inc"           ; General purpose macros
17%include "BiosData.inc"         ; For BIOS Data area equates
18%include "Interrupts.inc"       ; For interrupt equates
19%include "ATA_ID.inc"           ; For ATA Drive Information structs
20%include "IdeRegisters.inc"     ; For ATA Registers, flags and commands
21%include "Int13h.inc"           ; Equates for INT 13h functions
22%include "CustomDPT.inc"        ; For Disk Parameter Table
23%include "CompatibleDPT.inc"    ; For standard Disk Parameter Tables
24%include "RomVars.inc"          ; For ROMVARS and IDEVARS structs
25%include "RamVars.inc"          ; For RAMVARS struct
26%include "BootVars.inc"         ; For BOOTVARS and BOOTNFO structs
27%include "BootMenu.inc"         ; For Boot Menu
28%include "IDE_8bit.inc"         ; For IDE 8-bit data port macros
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.rgbDate,    db  "01/27/11"      ; Build data (mm/dd/yy)
41    at  ROMVARS.rgbSign,    db  "XTIDE120"      ; Signature for flash program
42    at  ROMVARS.szTitle
43        db  "-=XTIDE Universal BIOS"
44%ifdef USE_AT
45        db  " (AT)=-",NULL
46%elifdef USE_186
47        db  " (XT+)=-",NULL
48%else
49        db  " (XT)=-",NULL
50%endif
51    at  ROMVARS.szVersion,  db  "v1.2.0_wip (01/27/11)",NULL
52
53;---------------------------;
54; AT Build default settings ;
55;---------------------------;
56%ifdef USE_AT
57    at  ROMVARS.wFlags,         dw  FLG_ROMVARS_FULLMODE | FLG_ROMVARS_DRVXLAT | FLG_ROMVARS_DRVNFO | FLG_ROMVARS_MAXSIZE
58    at  ROMVARS.bIdeCnt,        db  3                       ; Number of supported controllers
59    at  ROMVARS.bBootDrv,       db  80h                     ; Boot Menu default drive
60    at  ROMVARS.bBootDelay,     db  30                      ; Boot Menu selection delay (secs)
61    at  ROMVARS.bBootLdrType,   db  BOOTLOADER_TYPE_MENU    ; Boot loader type
62    at  ROMVARS.bMinFddCnt,     db  0                       ; Do not force minimum number of floppy drives
63    at  ROMVARS.bStealSize,     db  1                       ; Steal 1kB from base memory
64
65    at  ROMVARS.ideVars0+IDEVARS.wPort,         dw  1F0h            ; Controller Command Block base port
66    at  ROMVARS.ideVars0+IDEVARS.wPortCtrl,     dw  3F0h            ; Controller Control Block base port
67    at  ROMVARS.ideVars0+IDEVARS.bBusType,      db  BUS_TYPE_16     ; Bus type
68    at  ROMVARS.ideVars0+IDEVARS.bIRQ,          db  14              ; IRQ
69    at  ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  FLG_DRVPARAMS_BLOCKMODE
70    at  ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  FLG_DRVPARAMS_BLOCKMODE
71
72    at  ROMVARS.ideVars1+IDEVARS.wPort,         dw  170h            ; Controller Command Block base port
73    at  ROMVARS.ideVars1+IDEVARS.wPortCtrl,     dw  370h            ; Controller Control Block base port
74    at  ROMVARS.ideVars1+IDEVARS.bBusType,      db  BUS_TYPE_16     ; Bus type
75    at  ROMVARS.ideVars1+IDEVARS.bIRQ,          db  15              ; IRQ
76    at  ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  FLG_DRVPARAMS_BLOCKMODE
77    at  ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  FLG_DRVPARAMS_BLOCKMODE
78
79    at  ROMVARS.ideVars2+IDEVARS.wPort,         dw  300h            ; Controller Command Block base port
80    at  ROMVARS.ideVars2+IDEVARS.wPortCtrl,     dw  308h            ; Controller Control Block base port
81    at  ROMVARS.ideVars2+IDEVARS.bBusType,      db  BUS_TYPE_8_DUAL ; Bus type
82    at  ROMVARS.ideVars2+IDEVARS.bIRQ,          db  0               ; IRQ
83    at  ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  FLG_DRVPARAMS_BLOCKMODE
84    at  ROMVARS.ideVars2+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  FLG_DRVPARAMS_BLOCKMODE
85%else
86;-----------------------------------;
87; XT and XT+ Build default settings ;
88;-----------------------------------;
89    at  ROMVARS.wFlags,         dw  FLG_ROMVARS_LATE | FLG_ROMVARS_DRVXLAT | FLG_ROMVARS_ROMBOOT | FLG_ROMVARS_DRVNFO | FLG_ROMVARS_MAXSIZE
90    at  ROMVARS.bIdeCnt,        db  1                       ; Number of supported controllers
91    at  ROMVARS.bBootDrv,       db  80h                     ; Boot Menu default drive
92    at  ROMVARS.bBootDelay,     db  30                      ; Boot Menu selection delay (secs)
93    at  ROMVARS.bBootLdrType,   db  BOOTLOADER_TYPE_MENU    ; Boot loader type
94    at  ROMVARS.bMinFddCnt,     db  1                       ; Assume at least 1 floppy drive present if autodetect fails
95    at  ROMVARS.bStealSize,     db  1                       ; Steal 1kB from base memory in full mode
96
97    at  ROMVARS.ideVars0+IDEVARS.wPort,         dw  300h            ; Controller Command Block base port
98    at  ROMVARS.ideVars0+IDEVARS.wPortCtrl,     dw  308h            ; Controller Control Block base port
99    at  ROMVARS.ideVars0+IDEVARS.bBusType,      db  BUS_TYPE_8_DUAL ; Bus type
100    at  ROMVARS.ideVars0+IDEVARS.bIRQ,          db  0               ; IRQ
101    at  ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  FLG_DRVPARAMS_BLOCKMODE
102    at  ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  FLG_DRVPARAMS_BLOCKMODE
103%endif
104iend
105
106
107; Include .asm files (static data and libraries)
108%include "AssemblyLibrary.asm"
109%include "Strings.asm"          ; For BIOS message strings
110
111; Include .asm files (Initialization and drive detection)
112%include "Initialize.asm"       ; For BIOS initialization
113%include "Interrupts.asm"       ; For Interrupt initialization
114%include "RamVars.asm"          ; For RAMVARS initialization and access
115%include "CreateDPT.asm"        ; For creating DPTs
116%include "FindDPT.asm"          ; For finding DPTs
117%include "AccessDPT.asm"        ; For accessing DPTs
118%include "CompatibleDPT.asm"    ; For creating compatible DPTs
119%include "BootInfo.asm"         ; For creating BOOTNFO structs
120%include "AtaID.asm"            ; For ATA Identify Device information
121%include "DetectDrives.asm"     ; For detecting IDE drives
122%include "DetectPrint.asm"      ; For printing drive detection strings
123
124; Include .asm files (boot menu)
125%include "BootVars.asm"         ; For accessing BOOTVARS struct
126%include "BootMenu.asm"         ; For Boot Menu operations
127%include "BootMenuEvent.asm"    ; For menu library event handling
128%include "FloppyDrive.asm"      ; Floppy Drive related functions
129%include "BootMenuPrint.asm"    ; For printing Boot Menu strings
130%include "BootMenuPrintCfg.asm" ; For printing hard disk configuration
131
132; Include .asm files (general drive accessing)
133%include "DriveXlate.asm"       ; For swapping drive numbers
134%include "HAddress.asm"         ; For sector address translations
135%include "HCapacity.asm"        ; For calculating drive capacity
136%include "HError.asm"           ; For error checking
137%include "HPIO.asm"             ; For PIO transfers
138%include "HIRQ.asm"             ; For IRQ handling
139%include "HStatus.asm"          ; For reading hard disk status
140%include "HDrvSel.asm"          ; For selecting drive to access
141%include "HCommand.asm"         ; For outputting command and parameters
142
143; Include .asm files (Interrupt handlers)
144%include "Int13h.asm"           ; For Int 13h, Disk functions
145%include "Int18h.asm"           ; For Int 18h, ROM Boot and Boot error
146%include "Int19h.asm"           ; For Int 19h, Boot Loader
147%include "Int19hMenu.asm"       ; For Int 19h, Boot Loader for Boot Menu
148%include "BootPrint.asm"        ; For printing boot information
149
150; Include .asm files (Hard Disk BIOS functions)
151%include "AH0h_HReset.asm"      ; Required by Int13h_Jump.asm
152%include "AH1h_HStatus.asm"     ; Required by Int13h_Jump.asm
153%include "AH2h_HRead.asm"       ; Required by Int13h_Jump.asm
154%include "AH3h_HWrite.asm"      ; Required by Int13h_Jump.asm
155%include "AH4h_HVerify.asm"     ; Required by Int13h_Jump.asm
156%include "AH5h_HFormat.asm"     ; Required by Int13h_Jump.asm
157%include "AH8h_HParams.asm"     ; Required by Int13h_Jump.asm
158%include "AH9h_HInit.asm"       ; Required by Int13h_Jump.asm
159%include "AHCh_HSeek.asm"       ; Required by Int13h_Jump.asm
160%include "AHDh_HReset.asm"      ; Required by Int13h_Jump.asm
161%include "AH10h_HReady.asm"     ; Required by Int13h_Jump.asm
162%include "AH11h_HRecal.asm"     ; Required by Int13h_Jump.asm
163%include "AH14h_HDiag.asm"      ; Required by Int13h_Jump.asm
164%include "AH15h_HSize.asm"      ; Required by Int13h_Jump.asm
165%include "AH23h_HFeatures.asm"  ; Required by Int13h_Jump.asm
166%include "AH24h_HSetBlocks.asm" ; Required by Int13h_Jump.asm
167%include "AH25h_HDrvID.asm"     ; Required by Int13h_Jump.asm
168
169
170
171; Fill with zeroes until size is what we want
172;times (CNT_ROM_BLOCKS*512)-($-$$) db 0
Note: See TracBrowser for help on using the repository browser.