[525] | 1 | ; Project name : XTIDE Universal BIOS Configurator v2 |
---|
[153] | 2 | ; Description : Program start and exit. |
---|
[57] | 3 | |
---|
[376] | 4 | ; |
---|
[505] | 5 | ; XTIDE Universal BIOS and Associated Tools |
---|
[526] | 6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team. |
---|
[376] | 7 | ; |
---|
| 8 | ; This program is free software; you can redistribute it and/or modify |
---|
| 9 | ; it under the terms of the GNU General Public License as published by |
---|
| 10 | ; the Free Software Foundation; either version 2 of the License, or |
---|
| 11 | ; (at your option) any later version. |
---|
[505] | 12 | ; |
---|
[376] | 13 | ; This program is distributed in the hope that it will be useful, |
---|
| 14 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
[505] | 16 | ; GNU General Public License for more details. |
---|
[376] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
[505] | 18 | ; |
---|
[376] | 19 | |
---|
[57] | 20 | ; Include .inc files |
---|
[505] | 21 | |
---|
[57] | 22 | %define INCLUDE_MENU_DIALOGS |
---|
[280] | 23 | %define INCLUDE_SERIAL_LIBRARY |
---|
[505] | 24 | |
---|
[57] | 25 | %include "AssemblyLibrary.inc" ; Assembly Library. Must be included first! |
---|
[554] | 26 | %include "RomVars.inc" ; XTIDE Universal BIOS variables |
---|
[614] | 27 | %include "ATA_ID.inc" ; Needed for Master/Slave Drive menu |
---|
[497] | 28 | %include "IdeRegisters.inc" ; Needed for port and device autodetection |
---|
[483] | 29 | %include "JRIDE_ISA.inc" ; For JR-IDE/ISA default segment |
---|
[536] | 30 | %include "ADP50L.inc" ; For ADP50L default segment |
---|
[481] | 31 | %include "XTCF.inc" ; For XT-CF modes |
---|
[57] | 32 | |
---|
[457] | 33 | %include "Version.inc" |
---|
[57] | 34 | %include "MenuCfg.inc" |
---|
| 35 | %include "MenuStructs.inc" |
---|
| 36 | %include "Variables.inc" |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | ; Section containing code |
---|
| 40 | SECTION .text |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | ; Program first instruction. |
---|
| 44 | ORG 100h ; Code starts at offset 100h (DOS .COM) |
---|
| 45 | Start: |
---|
| 46 | jmp Main_Start |
---|
| 47 | |
---|
| 48 | ; Include library sources |
---|
| 49 | %include "AssemblyLibrary.asm" |
---|
| 50 | |
---|
| 51 | ; Include sources for this program |
---|
[497] | 52 | %include "AutoConfigure.asm" |
---|
[57] | 53 | %include "BiosFile.asm" |
---|
| 54 | %include "Buffers.asm" |
---|
| 55 | %include "Dialogs.asm" |
---|
| 56 | %include "EEPROM.asm" |
---|
[65] | 57 | %include "Flash.asm" |
---|
[620] | 58 | %include "FlashSST.asm" |
---|
[497] | 59 | %include "IdeAutodetect.asm" |
---|
[57] | 60 | %include "MenuEvents.asm" |
---|
| 61 | %include "Menuitem.asm" |
---|
| 62 | %include "MenuitemPrint.asm" |
---|
| 63 | %include "Menupage.asm" |
---|
| 64 | %include "Strings.asm" |
---|
| 65 | |
---|
[59] | 66 | %include "BootMenuSettingsMenu.asm" |
---|
[57] | 67 | %include "ConfigurationMenu.asm" |
---|
[59] | 68 | %include "FlashMenu.asm" |
---|
[57] | 69 | %include "IdeControllerMenu.asm" |
---|
| 70 | %include "MainMenu.asm" |
---|
| 71 | %include "MasterSlaveMenu.asm" |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | ;-------------------------------------------------------------------- |
---|
| 76 | ; Program start |
---|
| 77 | ;-------------------------------------------------------------------- |
---|
| 78 | ALIGN JUMP_ALIGN |
---|
| 79 | Main_Start: |
---|
[589] | 80 | mov ah, GET_DOS_VERSION |
---|
| 81 | int DOS_INTERRUPT_21h |
---|
| 82 | cmp al, 2 |
---|
| 83 | jae SHORT .DosVersionIsOK |
---|
| 84 | mov dx, g_s$NotMinimumDosVersion |
---|
| 85 | mov ah, WRITE_STRING_TO_STANDARD_OUTPUT |
---|
| 86 | int DOS_INTERRUPT_21h |
---|
| 87 | ret |
---|
| 88 | .DosVersionIsOK: |
---|
[593] | 89 | mov [bDosVersionMajor], al ; bDosVersionMajor must be initialized by the application (library code depends on it) |
---|
| 90 | cmp al, 5 |
---|
| 91 | jb SHORT .DoNotInstallInt2FhHandler |
---|
| 92 | ; Since we are installing our Int2Fh handler we must also hook interrupt 23h to ensure a clean exit on ctrl-c/ctrl-break |
---|
| 93 | call HookInterrupt23h |
---|
| 94 | call HookInterrupt2Fh |
---|
| 95 | .DoNotInstallInt2FhHandler: |
---|
[589] | 96 | |
---|
[68] | 97 | mov ax, SCREEN_BACKGROUND_CHARACTER_AND_ATTRIBUTE |
---|
[589] | 98 | call InitializeScreenWithBackgroundCharAndAttrInAX |
---|
[57] | 99 | |
---|
| 100 | call Main_InitializeCfgVars |
---|
| 101 | call MenuEvents_DisplayMenu |
---|
[68] | 102 | mov ax, DOS_BACKGROUND_CHARACTER_AND_ATTRIBUTE |
---|
[589] | 103 | call InitializeScreenWithBackgroundCharAndAttrInAX |
---|
[57] | 104 | |
---|
[593] | 105 | call UnhookInterrupt2Fh |
---|
| 106 | |
---|
[57] | 107 | ; Exit to DOS |
---|
[589] | 108 | mov ax, TERMINATE_WITH_RETURN_CODE<<8 ; Errorlevel 0 in AL |
---|
| 109 | int DOS_INTERRUPT_21h |
---|
[57] | 110 | |
---|
| 111 | |
---|
| 112 | ;-------------------------------------------------------------------- |
---|
[589] | 113 | ; InitializeScreenWithBackgroundCharAndAttrInAX |
---|
[68] | 114 | ; Parameters: |
---|
| 115 | ; AL: Background character |
---|
| 116 | ; AH: Background attribute |
---|
| 117 | ; Returns: |
---|
| 118 | ; Nothing |
---|
| 119 | ; Corrupts registers: |
---|
| 120 | ; AX, DX, DI |
---|
| 121 | ;-------------------------------------------------------------------- |
---|
| 122 | ALIGN JUMP_ALIGN |
---|
[589] | 123 | InitializeScreenWithBackgroundCharAndAttrInAX: |
---|
[68] | 124 | xchg dx, ax |
---|
| 125 | CALL_DISPLAY_LIBRARY InitializeDisplayContext ; Reset cursor etc |
---|
| 126 | xchg ax, dx |
---|
[505] | 127 | JMP_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH |
---|
[68] | 128 | |
---|
| 129 | |
---|
| 130 | ;-------------------------------------------------------------------- |
---|
[57] | 131 | ; Main_InitializeCfgVars |
---|
| 132 | ; Parameters: |
---|
| 133 | ; DS: Segment to CFGVARS |
---|
| 134 | ; Returns: |
---|
| 135 | ; Nothing |
---|
| 136 | ; Corrupts registers: |
---|
| 137 | ; AX, BX, CX, DI |
---|
| 138 | ;-------------------------------------------------------------------- |
---|
| 139 | ALIGN JUMP_ALIGN |
---|
| 140 | Main_InitializeCfgVars: |
---|
| 141 | push es |
---|
| 142 | |
---|
| 143 | call Buffers_Clear |
---|
| 144 | call EEPROM_FindXtideUniversalBiosROMtoESDI |
---|
[592] | 145 | jc SHORT .InitializationCompleted |
---|
[57] | 146 | mov [CFGVARS.wEepromSegment], es |
---|
| 147 | .InitializationCompleted: |
---|
| 148 | pop es |
---|
| 149 | ret |
---|
| 150 | |
---|
| 151 | |
---|
| 152 | ; Section containing initialized data |
---|
| 153 | SECTION .data |
---|
| 154 | |
---|
| 155 | ALIGN WORD_ALIGN |
---|
| 156 | g_cfgVars: |
---|
| 157 | istruc CFGVARS |
---|
[59] | 158 | at CFGVARS.pMenupage, dw g_MenupageForMainMenu |
---|
| 159 | at CFGVARS.wFlags, dw DEFAULT_CFGVARS_FLAGS |
---|
[371] | 160 | at CFGVARS.wEepromSegment, dw 0 |
---|
[63] | 161 | at CFGVARS.bEepromType, db DEFAULT_EEPROM_TYPE |
---|
[65] | 162 | at CFGVARS.bEepromPage, db DEFAULT_PAGE_SIZE |
---|
[59] | 163 | at CFGVARS.bSdpCommand, db DEFAULT_SDP_COMMAND |
---|
[57] | 164 | iend |
---|
| 165 | |
---|
| 166 | |
---|
| 167 | ; Section containing uninitialized data |
---|
| 168 | SECTION .bss |
---|
[593] | 169 | |
---|
| 170 | bDosVersionMajor: resb 1 |
---|
| 171 | |
---|