source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Main.asm@ 616

Last change on this file since 616 was 614, checked in by Krister Nordvall, 3 years ago

Changes:

  • BIOSDRVS should now build again (broke in r613).
  • Removed the NO_ATAID_CORRECTION define from the Tiny build.
  • Added a new configuration option to skip detection of slave drives.
  • Made FLASH_SIGNATURE 2 bytes shorter to free up ROM space.
  • "Auto Configure" in XTIDECFG should now detect if running on an Olivetti M24, AT&T PC6300, Xerox 6060 or Logabax Persona 1600 and automatically select the fastest compatible transfer mode/device type for any IDE controllers found in the system.
  • Cleaned out some duplicate/unused definitions.
File size: 4.8 KB
Line 
1; Project name : XTIDE Universal BIOS Configurator v2
2; Description : Program start and exit.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
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.
12;
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
16; GNU General Public License for more details.
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
20; Include .inc files
21
22%define INCLUDE_MENU_DIALOGS
23%define INCLUDE_SERIAL_LIBRARY
24
25%include "AssemblyLibrary.inc" ; Assembly Library. Must be included first!
26%include "RomVars.inc" ; XTIDE Universal BIOS variables
27%include "ATA_ID.inc" ; Needed for Master/Slave Drive menu
28%include "IdeRegisters.inc" ; Needed for port and device autodetection
29%include "JRIDE_ISA.inc" ; For JR-IDE/ISA default segment
30%include "ADP50L.inc" ; For ADP50L default segment
31%include "XTCF.inc" ; For XT-CF modes
32
33%include "Version.inc"
34%include "MenuCfg.inc"
35%include "MenuStructs.inc"
36%include "Variables.inc"
37
38
39; Section containing code
40SECTION .text
41
42
43; Program first instruction.
44ORG 100h ; Code starts at offset 100h (DOS .COM)
45Start:
46 jmp Main_Start
47
48; Include library sources
49%include "AssemblyLibrary.asm"
50
51; Include sources for this program
52%include "AutoConfigure.asm"
53%include "BiosFile.asm"
54%include "Buffers.asm"
55%include "Dialogs.asm"
56%include "EEPROM.asm"
57%include "Flash.asm"
58%include "IdeAutodetect.asm"
59%include "MenuEvents.asm"
60%include "Menuitem.asm"
61%include "MenuitemPrint.asm"
62%include "Menupage.asm"
63%include "Strings.asm"
64
65%include "BootMenuSettingsMenu.asm"
66%include "ConfigurationMenu.asm"
67%include "FlashMenu.asm"
68%include "IdeControllerMenu.asm"
69%include "MainMenu.asm"
70%include "MasterSlaveMenu.asm"
71
72
73
74;--------------------------------------------------------------------
75; Program start
76;--------------------------------------------------------------------
77ALIGN JUMP_ALIGN
78Main_Start:
79 mov ah, GET_DOS_VERSION
80 int DOS_INTERRUPT_21h
81 cmp al, 2
82 jae SHORT .DosVersionIsOK
83 mov dx, g_s$NotMinimumDosVersion
84 mov ah, WRITE_STRING_TO_STANDARD_OUTPUT
85 int DOS_INTERRUPT_21h
86 ret
87.DosVersionIsOK:
88 mov [bDosVersionMajor], al ; bDosVersionMajor must be initialized by the application (library code depends on it)
89 cmp al, 5
90 jb SHORT .DoNotInstallInt2FhHandler
91 ; Since we are installing our Int2Fh handler we must also hook interrupt 23h to ensure a clean exit on ctrl-c/ctrl-break
92 call HookInterrupt23h
93 call HookInterrupt2Fh
94.DoNotInstallInt2FhHandler:
95
96 mov ax, SCREEN_BACKGROUND_CHARACTER_AND_ATTRIBUTE
97 call InitializeScreenWithBackgroundCharAndAttrInAX
98
99 call Main_InitializeCfgVars
100 call MenuEvents_DisplayMenu
101 mov ax, DOS_BACKGROUND_CHARACTER_AND_ATTRIBUTE
102 call InitializeScreenWithBackgroundCharAndAttrInAX
103
104 call UnhookInterrupt2Fh
105
106 ; Exit to DOS
107 mov ax, TERMINATE_WITH_RETURN_CODE<<8 ; Errorlevel 0 in AL
108 int DOS_INTERRUPT_21h
109
110
111;--------------------------------------------------------------------
112; InitializeScreenWithBackgroundCharAndAttrInAX
113; Parameters:
114; AL: Background character
115; AH: Background attribute
116; Returns:
117; Nothing
118; Corrupts registers:
119; AX, DX, DI
120;--------------------------------------------------------------------
121ALIGN JUMP_ALIGN
122InitializeScreenWithBackgroundCharAndAttrInAX:
123 xchg dx, ax
124 CALL_DISPLAY_LIBRARY InitializeDisplayContext ; Reset cursor etc
125 xchg ax, dx
126 JMP_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
127
128
129;--------------------------------------------------------------------
130; Main_InitializeCfgVars
131; Parameters:
132; DS: Segment to CFGVARS
133; Returns:
134; Nothing
135; Corrupts registers:
136; AX, BX, CX, DI
137;--------------------------------------------------------------------
138ALIGN JUMP_ALIGN
139Main_InitializeCfgVars:
140 push es
141
142 call Buffers_Clear
143 call EEPROM_FindXtideUniversalBiosROMtoESDI
144 jc SHORT .InitializationCompleted
145 mov [CFGVARS.wEepromSegment], es
146.InitializationCompleted:
147 pop es
148 ret
149
150
151; Section containing initialized data
152SECTION .data
153
154ALIGN WORD_ALIGN
155g_cfgVars:
156istruc CFGVARS
157 at CFGVARS.pMenupage, dw g_MenupageForMainMenu
158 at CFGVARS.wFlags, dw DEFAULT_CFGVARS_FLAGS
159 at CFGVARS.wEepromSegment, dw 0
160 at CFGVARS.bEepromType, db DEFAULT_EEPROM_TYPE
161 at CFGVARS.bEepromPage, db DEFAULT_PAGE_SIZE
162 at CFGVARS.bSdpCommand, db DEFAULT_SDP_COMMAND
163iend
164
165
166; Section containing uninitialized data
167SECTION .bss
168
169bDosVersionMajor: resb 1
170
Note: See TracBrowser for help on using the repository browser.