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

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

Changes:

  • A huge thank you to Jayeson Lee-Steere for adding SST39SF0x0 flash ROM programming support to the configurator (XTIDECFG.COM). This means that there is no longer a need to use a separate program for flashing the Lo-Tech boards and other devices using these flash ROMs.
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 "FlashSST.asm"
59%include "IdeAutodetect.asm"
60%include "MenuEvents.asm"
61%include "Menuitem.asm"
62%include "MenuitemPrint.asm"
63%include "Menupage.asm"
64%include "Strings.asm"
65
66%include "BootMenuSettingsMenu.asm"
67%include "ConfigurationMenu.asm"
68%include "FlashMenu.asm"
69%include "IdeControllerMenu.asm"
70%include "MainMenu.asm"
71%include "MasterSlaveMenu.asm"
72
73
74
75;--------------------------------------------------------------------
76; Program start
77;--------------------------------------------------------------------
78ALIGN JUMP_ALIGN
79Main_Start:
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:
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:
96
97 mov ax, SCREEN_BACKGROUND_CHARACTER_AND_ATTRIBUTE
98 call InitializeScreenWithBackgroundCharAndAttrInAX
99
100 call Main_InitializeCfgVars
101 call MenuEvents_DisplayMenu
102 mov ax, DOS_BACKGROUND_CHARACTER_AND_ATTRIBUTE
103 call InitializeScreenWithBackgroundCharAndAttrInAX
104
105 call UnhookInterrupt2Fh
106
107 ; Exit to DOS
108 mov ax, TERMINATE_WITH_RETURN_CODE<<8 ; Errorlevel 0 in AL
109 int DOS_INTERRUPT_21h
110
111
112;--------------------------------------------------------------------
113; InitializeScreenWithBackgroundCharAndAttrInAX
114; Parameters:
115; AL: Background character
116; AH: Background attribute
117; Returns:
118; Nothing
119; Corrupts registers:
120; AX, DX, DI
121;--------------------------------------------------------------------
122ALIGN JUMP_ALIGN
123InitializeScreenWithBackgroundCharAndAttrInAX:
124 xchg dx, ax
125 CALL_DISPLAY_LIBRARY InitializeDisplayContext ; Reset cursor etc
126 xchg ax, dx
127 JMP_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
128
129
130;--------------------------------------------------------------------
131; Main_InitializeCfgVars
132; Parameters:
133; DS: Segment to CFGVARS
134; Returns:
135; Nothing
136; Corrupts registers:
137; AX, BX, CX, DI
138;--------------------------------------------------------------------
139ALIGN JUMP_ALIGN
140Main_InitializeCfgVars:
141 push es
142
143 call Buffers_Clear
144 call EEPROM_FindXtideUniversalBiosROMtoESDI
145 jc SHORT .InitializationCompleted
146 mov [CFGVARS.wEepromSegment], es
147.InitializationCompleted:
148 pop es
149 ret
150
151
152; Section containing initialized data
153SECTION .data
154
155ALIGN WORD_ALIGN
156g_cfgVars:
157istruc CFGVARS
158 at CFGVARS.pMenupage, dw g_MenupageForMainMenu
159 at CFGVARS.wFlags, dw DEFAULT_CFGVARS_FLAGS
160 at CFGVARS.wEepromSegment, dw 0
161 at CFGVARS.bEepromType, db DEFAULT_EEPROM_TYPE
162 at CFGVARS.bEepromPage, db DEFAULT_PAGE_SIZE
163 at CFGVARS.bSdpCommand, db DEFAULT_SDP_COMMAND
164iend
165
166
167; Section containing uninitialized data
168SECTION .bss
169
170bDosVersionMajor: resb 1
171
Note: See TracBrowser for help on using the repository browser.