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

Last change on this file since 619 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
RevLine 
[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
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
[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"
[497]58%include "IdeAutodetect.asm"
[57]59%include "MenuEvents.asm"
60%include "Menuitem.asm"
61%include "MenuitemPrint.asm"
62%include "Menupage.asm"
63%include "Strings.asm"
64
[59]65%include "BootMenuSettingsMenu.asm"
[57]66%include "ConfigurationMenu.asm"
[59]67%include "FlashMenu.asm"
[57]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:
[589]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:
[593]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:
[589]95
[68]96 mov ax, SCREEN_BACKGROUND_CHARACTER_AND_ATTRIBUTE
[589]97 call InitializeScreenWithBackgroundCharAndAttrInAX
[57]98
99 call Main_InitializeCfgVars
100 call MenuEvents_DisplayMenu
[68]101 mov ax, DOS_BACKGROUND_CHARACTER_AND_ATTRIBUTE
[589]102 call InitializeScreenWithBackgroundCharAndAttrInAX
[57]103
[593]104 call UnhookInterrupt2Fh
105
[57]106 ; Exit to DOS
[589]107 mov ax, TERMINATE_WITH_RETURN_CODE<<8 ; Errorlevel 0 in AL
108 int DOS_INTERRUPT_21h
[57]109
110
111;--------------------------------------------------------------------
[589]112; InitializeScreenWithBackgroundCharAndAttrInAX
[68]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
[589]122InitializeScreenWithBackgroundCharAndAttrInAX:
[68]123 xchg dx, ax
124 CALL_DISPLAY_LIBRARY InitializeDisplayContext ; Reset cursor etc
125 xchg ax, dx
[505]126 JMP_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
[68]127
128
129;--------------------------------------------------------------------
[57]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
[592]144 jc SHORT .InitializationCompleted
[57]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
[59]157 at CFGVARS.pMenupage, dw g_MenupageForMainMenu
158 at CFGVARS.wFlags, dw DEFAULT_CFGVARS_FLAGS
[371]159 at CFGVARS.wEepromSegment, dw 0
[63]160 at CFGVARS.bEepromType, db DEFAULT_EEPROM_TYPE
[65]161 at CFGVARS.bEepromPage, db DEFAULT_PAGE_SIZE
[59]162 at CFGVARS.bSdpCommand, db DEFAULT_SDP_COMMAND
[57]163iend
164
165
166; Section containing uninitialized data
167SECTION .bss
[593]168
169bDosVersionMajor: resb 1
170
Note: See TracBrowser for help on using the repository browser.