Changeset 181 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Main.asm


Ignore:
Timestamp:
Nov 13, 2011, 3:38:40 PM (12 years ago)
Author:
krille_n_@…
google:author:
krille_n_@hotmail.com
Message:

Changes to all parts of the project:

  • Size optimizations.
  • Added a define (EXCLUDE_FROM_XTIDECFG) to exclude unused library code from XTIDECFG.
  • Tried to minimize time spent with interrupts disabled.
  • Some minor attempts to improve speed (reordering instructions etc).
  • Tried to improve readability, did some cleanup and fixed some errors in comments.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r179 r181  
    33;               :   aitotat@gmail.com
    44;               :
     5;               :   Greg Lindhorst
     6;               :   gregli@hotmail.com
     7;               ;
    58;               :   Krister Nordvall
    69;               :   krille_n_@hotmail.com
     
    1316
    1417
    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
     18    ; Included .inc files
     19    %include "AssemblyLibrary.inc"  ; Assembly Library. Must be included first!
     20    %include "IntController.inc"    ; For Interrupt Controller equates
     21    %include "ATA_ID.inc"           ; For ATA Drive Information structs
     22    %include "IdeRegisters.inc"     ; For ATA Registers, flags and commands
     23    %include "Int13h.inc"           ; Equates for INT 13h functions
    2124%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
     25    %include "EBIOS.inc"            ; Equates for EBIOS functions
     26%endif
     27    %include "CustomDPT.inc"        ; For Disk Parameter Table
     28    %include "RomVars.inc"          ; For ROMVARS and IDEVARS structs
     29    %include "RamVars.inc"          ; For RAMVARS struct
     30    %include "BootVars.inc"         ; For BOOTVARS and BOOTNFO structs
     31    %include "BootMenu.inc"         ; For Boot Menu
     32    %include "IDE_8bit.inc"         ; For IDE 8-bit data port macros
     33    %include "DeviceIDE.inc"        ; For IDE device equates
    3134
    3235
     
    3942    at  ROMVARS.wRomSign,   dw  0AA55h          ; PC ROM signature
    4043    at  ROMVARS.bRomSize,   db  CNT_ROM_BLOCKS  ; ROM size in 512B blocks
    41     at  ROMVARS.rgbJump,    jmp Initialize_FromMainBiosRomSearch
     44    at  ROMVARS.rgbJump,    jmp Initialize_FromMainBiosRomSearch
    4245    at  ROMVARS.rgbSign,    db  "XTIDE120"      ; Signature for flash program
    4346    at  ROMVARS.szTitle
     
    5356
    5457;;; For OR'ing into wFlags below
    55 ;;; 
     58;;;
    5659%ifdef MODULE_SERIAL
    57 MAIN_FLG_MODULE_SERIAL  equ   FLG_ROMVARS_MODULE_SERIAL
    58 %else
    59 MAIN_FLG_MODULE_SERIAL  equ   0
     60    MAIN_FLG_MODULE_SERIAL  equ FLG_ROMVARS_MODULE_SERIAL
     61%else
     62    MAIN_FLG_MODULE_SERIAL  equ 0
    6063%endif
    6164
    6265%ifdef MODULE_EBIOS
    63 MAIN_FLG_MODULE_EBIOS   equ   FLG_ROMVARS_MODULE_EBIOS
    64 %else
    65 MAIN_FLG_MODULE_EBIOS   equ   0
     66    MAIN_FLG_MODULE_EBIOS   equ FLG_ROMVARS_MODULE_EBIOS
     67%else
     68    MAIN_FLG_MODULE_EBIOS   equ 0
    6669%endif
    6770
     
    109112    at  ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice,      db  DEVICE_SERIAL_PORT
    110113    at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db  FLG_DRVPARAMS_BLOCKMODE
    111     at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,  db  FLG_DRVPARAMS_BLOCKMODE     
    112 %endif         
     114    at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,  db  FLG_DRVPARAMS_BLOCKMODE
     115%endif
    113116%else
    114117;-----------------------------------;
     
    142145    at  ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice,      db  DEVICE_SERIAL_PORT
    143146    at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db  FLG_DRVPARAMS_BLOCKMODE
    144     at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,  db  FLG_DRVPARAMS_BLOCKMODE     
    145 %endif 
     147    at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,  db  FLG_DRVPARAMS_BLOCKMODE
     148%endif
    146149%endif
    147150iend
    148151
    149152
    150 ; Libraries and data
    151 %include "AssemblyLibrary.asm"
    152 %include "Strings.asm"          ; For BIOS message strings
    153 
    154 ; Initialization and drive detection
    155 %include "Initialize.asm"       ; For BIOS initialization
    156 %include "Interrupts.asm"       ; For Interrupt initialization
    157 %include "RamVars.asm"          ; For RAMVARS initialization and access
    158 %include "CreateDPT.asm"        ; For creating DPTs
    159 %include "FindDPT.asm"          ; For finding DPTs
    160 %include "AccessDPT.asm"        ; For accessing DPTs
    161 %include "BootInfo.asm"         ; For creating BOOTNFO structs
    162 %include "AtaID.asm"            ; For ATA Identify Device information
    163 %include "DetectDrives.asm"     ; For detecting IDE drives
    164 %include "DetectPrint.asm"      ; For printing drive detection strings
    165 
    166 ; Boot menu
    167 %include "BootMenu.asm"         ; For Boot Menu operations
    168 %include "BootMenuEvent.asm"    ; For menu library event handling
    169 %include "FloppyDrive.asm"      ; Floppy Drive related functions
    170 %include "BootSector.asm"       ; For loading boot sector
    171 %include "BootPrint.asm"        ; For printing boot information
    172 %include "BootMenuPrint.asm"    ; For printing Boot Menu strings
    173 %include "BootMenuPrintCfg.asm" ; For printing hard disk configuration
    174 
    175 ; Boot loader
     153    ; Libraries and data
     154    %include "AssemblyLibrary.asm"
     155    %include "Strings.asm"          ; For BIOS message strings
     156
     157    ; Initialization and drive detection
     158    %include "Initialize.asm"       ; For BIOS initialization
     159    %include "Interrupts.asm"       ; For Interrupt initialization
     160    %include "RamVars.asm"          ; For RAMVARS initialization and access
     161    %include "CreateDPT.asm"        ; For creating DPTs
     162    %include "FindDPT.asm"          ; For finding DPTs
     163    %include "AccessDPT.asm"        ; For accessing DPTs
     164    %include "BootInfo.asm"         ; For creating BOOTNFO structs
     165    %include "AtaID.asm"            ; For ATA Identify Device information
     166    %include "DetectDrives.asm"     ; For detecting IDE drives
     167    %include "DetectPrint.asm"      ; For printing drive detection strings
     168
     169    ; Boot menu
     170    %include "BootMenu.asm"         ; For Boot Menu operations
     171    %include "BootMenuEvent.asm"    ; For menu library event handling
     172    %include "FloppyDrive.asm"      ; Floppy Drive related functions
     173    %include "BootSector.asm"       ; For loading boot sector
     174    %include "BootPrint.asm"        ; For printing boot information
     175    %include "BootMenuPrint.asm"    ; For printing Boot Menu strings
     176    %include "BootMenuPrintCfg.asm" ; For printing hard disk configuration
     177
     178    ; Boot loader
    176179%ifndef USE_AT
    177     %include "Int19hLate.asm"   ; For late initialization
    178 %endif
    179 %include "Int19hMenu.asm"       ; For Int 19h, Boot Loader for Boot Menu
    180 
    181 ; For all device types
    182 %include "Device.asm"
    183 %include "Idepack.asm"
    184 %include "Timer.asm"            ; For timeout and delay
    185 
    186 ; IDE Device support
    187 %include "IdeCommand.asm"
    188 %include "IdeTransfer.asm"      ; Must be included after IdeCommand.asm
    189 %include "IdeDPT.asm"
    190 %include "IdeIO.asm"
    191 %include "IdeIrq.asm"
    192 %include "IdeWait.asm"
    193 %include "IdeError.asm"         ; Must be included after IdeWait.asm
    194 
    195 %ifdef MODULE_SERIAL       
    196 ; Serial Port Device support
    197 %include "SerialCommand.asm"
    198 %include "SerialDPT.asm"
    199 %endif
    200 
    201 ; INT 13h Hard Disk BIOS functions
    202 %include "DriveXlate.asm"       ; For swapping drive numbers
    203 %include "Address.asm"          ; For sector address translations
    204 %include "CommandLookup.asm"    ; For getting correct transfer command
    205 %include "Int13h.asm"           ; For Int 13h, Disk functions
    206 %include "AH0h_HReset.asm"      ; Required by Int13h_Jump.asm
    207 %include "AH1h_HStatus.asm"     ; Required by Int13h_Jump.asm
    208 %include "AH2h_HRead.asm"       ; Required by Int13h_Jump.asm
    209 %include "AH3h_HWrite.asm"      ; Required by Int13h_Jump.asm
    210 %include "AH4h_HVerify.asm"     ; Required by Int13h_Jump.asm
    211 %include "AH8h_HParams.asm"     ; Required by Int13h_Jump.asm
    212 %include "AH9h_HInit.asm"       ; Required by Int13h_Jump.asm
    213 %include "AHCh_HSeek.asm"       ; Required by Int13h_Jump.asm
    214 %include "AHDh_HReset.asm"      ; Required by Int13h_Jump.asm
    215 %include "AH10h_HReady.asm"     ; Required by Int13h_Jump.asm
    216 %include "AH11h_HRecal.asm"     ; Required by Int13h_Jump.asm
    217 %include "AH15h_HSize.asm"      ; Required by Int13h_Jump.asm
    218 %include "AH23h_HFeatures.asm"  ; Required by Int13h_Jump.asm
    219 %include "AH24h_HSetBlocks.asm" ; Required by Int13h_Jump.asm
    220 %include "AH25h_HDrvID.asm"     ; Required by Int13h_Jump.asm
     180    %include "Int19hLate.asm"       ; For late initialization
     181%endif
     182    %include "Int19hMenu.asm"       ; For Int 19h, Boot Loader for Boot Menu
     183
     184    ; For all device types
     185    %include "Device.asm"
     186    %include "Idepack.asm"
     187    %include "Timer.asm"            ; For timeout and delay
     188
     189    ; IDE Device support
     190    %include "IdeCommand.asm"
     191    %include "IdeTransfer.asm"      ; Must be included after IdeCommand.asm
     192    %include "IdeDPT.asm"
     193    %include "IdeIO.asm"
     194    %include "IdeIrq.asm"
     195    %include "IdeWait.asm"
     196    %include "IdeError.asm"         ; Must be included after IdeWait.asm
     197
     198%ifdef MODULE_SERIAL                ; Serial Port Device support
     199    %include "SerialCommand.asm"
     200    %include "SerialDPT.asm"
     201%endif
     202
     203    ; INT 13h Hard Disk BIOS functions
     204    %include "DriveXlate.asm"       ; For swapping drive numbers
     205    %include "Address.asm"          ; For sector address translations
     206    %include "CommandLookup.asm"    ; For getting correct transfer command
     207    %include "Int13h.asm"           ; For Int 13h, Disk functions
     208    %include "AH0h_HReset.asm"      ; Required by Int13h_Jump.asm
     209    %include "AH1h_HStatus.asm"     ; Required by Int13h_Jump.asm
     210    %include "AH2h_HRead.asm"       ; Required by Int13h_Jump.asm
     211    %include "AH3h_HWrite.asm"      ; Required by Int13h_Jump.asm
     212    %include "AH4h_HVerify.asm"     ; Required by Int13h_Jump.asm
     213    %include "AH8h_HParams.asm"     ; Required by Int13h_Jump.asm
     214    %include "AH9h_HInit.asm"       ; Required by Int13h_Jump.asm
     215    %include "AHCh_HSeek.asm"       ; Required by Int13h_Jump.asm
     216    %include "AHDh_HReset.asm"      ; Required by Int13h_Jump.asm
     217    %include "AH10h_HReady.asm"     ; Required by Int13h_Jump.asm
     218    %include "AH11h_HRecal.asm"     ; Required by Int13h_Jump.asm
     219    %include "AH15h_HSize.asm"      ; Required by Int13h_Jump.asm
     220    %include "AH23h_HFeatures.asm"  ; Required by Int13h_Jump.asm
     221    %include "AH24h_HSetBlocks.asm" ; Required by Int13h_Jump.asm
     222    %include "AH25h_HDrvID.asm"     ; Required by Int13h_Jump.asm
    221223%ifdef MODULE_EBIOS
    222 %include "AH41h_CheckIfExtensionsPresent.asm"
    223 %include "AH42h_ExtendedReadSectors.asm"
    224 %include "AH43h_ExtendedWriteSectors.asm"
    225 %include "AH44h_ExtendedVerifySectors.asm"
    226 %include "AH47h_ExtendedSeek.asm"
    227 %include "AH48h_GetExtendedDriveParameters.asm"
     224    %include "AH41h_CheckIfExtensionsPresent.asm"
     225    %include "AH42h_ExtendedReadSectors.asm"
     226    %include "AH43h_ExtendedWriteSectors.asm"
     227    %include "AH44h_ExtendedVerifySectors.asm"
     228    %include "AH47h_ExtendedSeek.asm"
     229    %include "AH48h_GetExtendedDriveParameters.asm"
    228230%endif
    229231
Note: See TracChangeset for help on using the changeset viewer.