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

Last change on this file since 521 was 505, checked in by krille_n_@…, 11 years ago

Changes:

  • Reverted the changes to MenuEvents.inc done in r492 since they broke the F1 key function in XTIDECFG.
  • Added a tail-call optimized variant of the CALL_DISPLAY_LIBRARY macro (JMP_DISPLAY_LIBRARY).
  • Put a block size limit in AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL. I think it's needed but if not, it's easy to remove.
  • Other optimizations and fixes.
File size: 4.0 KB
Line 
1; Project name : XTIDE Univeral 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-2012 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 "IdeRegisters.inc" ; Needed for port and device autodetection
28%include "JRIDE_ISA.inc" ; For JR-IDE/ISA default segment
29%include "XTCF.inc" ; For XT-CF modes
30
31%include "Version.inc"
32%include "MenuCfg.inc"
33%include "MenuStructs.inc"
34%include "Variables.inc"
35
36
37; Section containing code
38SECTION .text
39
40
41; Program first instruction.
42ORG 100h ; Code starts at offset 100h (DOS .COM)
43Start:
44 jmp Main_Start
45
46; Include library sources
47%include "AssemblyLibrary.asm"
48
49; Include sources for this program
50%include "AutoConfigure.asm"
51%include "BiosFile.asm"
52%include "Buffers.asm"
53%include "Dialogs.asm"
54%include "EEPROM.asm"
55%include "Flash.asm"
56%include "IdeAutodetect.asm"
57%include "MenuEvents.asm"
58%include "Menuitem.asm"
59%include "MenuitemPrint.asm"
60%include "Menupage.asm"
61%include "Strings.asm"
62
63%include "BootMenuSettingsMenu.asm"
64%include "ConfigurationMenu.asm"
65%include "FlashMenu.asm"
66%include "IdeControllerMenu.asm"
67%include "MainMenu.asm"
68%include "MasterSlaveMenu.asm"
69
70
71
72;--------------------------------------------------------------------
73; Program start
74;--------------------------------------------------------------------
75ALIGN JUMP_ALIGN
76Main_Start:
77 mov ax, SCREEN_BACKGROUND_CHARACTER_AND_ATTRIBUTE
78 call InitializeScreenWithBackgroudCharAndAttrInAX
79
80 call Main_InitializeCfgVars
81 call MenuEvents_DisplayMenu
82 mov ax, DOS_BACKGROUND_CHARACTER_AND_ATTRIBUTE
83 call InitializeScreenWithBackgroudCharAndAttrInAX
84
85 ; Exit to DOS
86 mov ax, 4C00h ; Exit to DOS
87 int 21h
88
89
90;--------------------------------------------------------------------
91; InitializeScreenWithBackgroudCharAndAttrInAX
92; Parameters:
93; AL: Background character
94; AH: Background attribute
95; Returns:
96; Nothing
97; Corrupts registers:
98; AX, DX, DI
99;--------------------------------------------------------------------
100ALIGN JUMP_ALIGN
101InitializeScreenWithBackgroudCharAndAttrInAX:
102 xchg dx, ax
103 CALL_DISPLAY_LIBRARY InitializeDisplayContext ; Reset cursor etc
104 xchg ax, dx
105 JMP_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
106
107
108;--------------------------------------------------------------------
109; Main_InitializeCfgVars
110; Parameters:
111; DS: Segment to CFGVARS
112; Returns:
113; Nothing
114; Corrupts registers:
115; AX, BX, CX, DI
116;--------------------------------------------------------------------
117ALIGN JUMP_ALIGN
118Main_InitializeCfgVars:
119 push es
120
121 call Buffers_Clear
122 call EEPROM_FindXtideUniversalBiosROMtoESDI
123 jnc SHORT .InitializationCompleted
124 mov [CFGVARS.wEepromSegment], es
125.InitializationCompleted:
126 pop es
127 ret
128
129
130; Section containing initialized data
131SECTION .data
132
133ALIGN WORD_ALIGN
134g_cfgVars:
135istruc CFGVARS
136 at CFGVARS.pMenupage, dw g_MenupageForMainMenu
137 at CFGVARS.wFlags, dw DEFAULT_CFGVARS_FLAGS
138 at CFGVARS.wEepromSegment, dw 0
139 at CFGVARS.bEepromType, db DEFAULT_EEPROM_TYPE
140 at CFGVARS.bEepromPage, db DEFAULT_PAGE_SIZE
141 at CFGVARS.bSdpCommand, db DEFAULT_SDP_COMMAND
142iend
143
144
145; Section containing uninitialized data
146SECTION .bss
Note: See TracBrowser for help on using the repository browser.