source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Dialogs.asm@ 254

Last change on this file since 254 was 181, checked in by krille_n_@…, 13 years ago

Changes to all parts of the project:

  • Size optimizations.
  • Added a define (EXCLUDE_FROM_XTIDECFG) to exclude unused library code from XTIDECFG.
  • Tried to minimize time spent with interrupts disabled.
  • Some minor attempts to improve speed (reordering instructions etc).
  • Tried to improve readability, did some cleanup and fixed some errors in comments.
File size: 5.7 KB
Line 
1; Project name : XTIDE Univeral BIOS Configurator v2
2; Description : Functions for displaying dialogs.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; Dialogs_DisplayHelpFromCSDXwithTitleInCSDI
9; Parameters:
10; CS:DX: Ptr to help string to display
11; CS:DI: Ptr to title string for help dialog
12; SS:BP: Menu handle
13; Returns:
14; Nothing
15; Corrupts registers:
16; AX
17;--------------------------------------------------------------------
18ALIGN JUMP_ALIGN
19Dialogs_DisplayHelpFromCSDXwithTitleInCSDI:
20 push ds
21 push si
22 push di
23 push cx
24
25 mov cx, DIALOG_INPUT_size
26 call Memory_ReserveCXbytesFromStackToDSSI
27 call InitializeDialogInputFromDSSI
28 mov [si+DIALOG_INPUT.fszTitle], di
29 jmp SHORT DisplayMessageDialogWithMessageInCSDXandDialogInputInDSSI
30
31;--------------------------------------------------------------------
32; Dialogs_DisplayNotificationFromCSDX
33; Dialogs_DisplayErrorFromCSDX
34; Parameters:
35; CS:DX: Ptr to notification string to display
36; SS:BP: Menu handle
37; Returns:
38; Nothing
39; Corrupts registers:
40; AX
41;--------------------------------------------------------------------
42ALIGN JUMP_ALIGN
43Dialogs_DisplayNotificationFromCSDX:
44 push ds
45 push si
46 push di
47 push cx
48
49 mov cx, DIALOG_INPUT_size
50 call Memory_ReserveCXbytesFromStackToDSSI
51 call InitializeDialogInputFromDSSI
52 mov WORD [si+DIALOG_INPUT.fszTitle], g_szNotificationDialog
53 jmp SHORT DisplayMessageDialogWithMessageInCSDXandDialogInputInDSSI
54
55ALIGN JUMP_ALIGN
56Dialogs_DisplayErrorFromCSDX:
57 push ds
58 push si
59 push di
60 push cx
61
62 mov cx, DIALOG_INPUT_size
63 call Memory_ReserveCXbytesFromStackToDSSI
64 mov WORD [si+DIALOG_INPUT.fszTitle], g_szErrorDialog
65ALIGN JUMP_ALIGN
66DisplayMessageDialogWithMessageInCSDXandDialogInputInDSSI:
67 call InitializeDialogInputFromDSSI
68 mov [si+DIALOG_INPUT.fszItems], dx
69 CALL_MENU_LIBRARY DisplayMessageWithInputInDSSI
70
71 add sp, BYTE DIALOG_INPUT_size
72 pop cx
73 pop di
74 pop si
75 pop ds
76 ret
77
78
79;--------------------------------------------------------------------
80; Dialogs_DisplayFileDialogWithDialogIoInDSSI
81; Parameters:
82; DS:SI: Ptr to FILE_DIALOG_IO
83; SS:BP: Menu handle
84; Returns:
85; Nothing
86; Corrupts registers:
87; AX, DI
88;--------------------------------------------------------------------
89ALIGN JUMP_ALIGN
90Dialogs_DisplayFileDialogWithDialogIoInDSSI:
91 push es
92
93 call Buffers_GetFileDialogItemBufferToESDI
94 mov WORD [si+FILE_DIALOG_IO.fszTitle], g_szDlgFileTitle
95 mov [si+FILE_DIALOG_IO.fszTitle+2], cs
96 mov [si+FILE_DIALOG_IO.fszItemBuffer], di
97 mov [si+FILE_DIALOG_IO.fszItemBuffer+2], es
98 mov BYTE [si+FILE_DIALOG_IO.bDialogFlags], FLG_FILEDIALOG_DRIVES
99 mov BYTE [si+FILE_DIALOG_IO.bFileAttributes], FLG_FILEATTR_DIRECTORY | FLG_FILEATTR_ARCHIVE
100 mov WORD [si+FILE_DIALOG_IO.fpFileFilterString], g_szDlgFileFilter
101 mov [si+FILE_DIALOG_IO.fpFileFilterString+2], cs
102 CALL_MENU_LIBRARY GetFileNameWithIoInDSSI
103
104 pop es
105 ret
106
107
108;--------------------------------------------------------------------
109; Dialogs_DisplayQuitDialog
110; Dialogs_DisplaySaveChangesDialog
111; Parameters:
112; SS:BP: Menu handle
113; Returns:
114; ZF: Set if user wants to do the action
115; Cleared if user wants to cancel
116; Corrupts registers:
117; AX, CX
118;--------------------------------------------------------------------
119ALIGN JUMP_ALIGN
120Dialogs_DisplayQuitDialog:
121 push ds
122
123 mov cx, DIALOG_INPUT_size
124 call Memory_ReserveCXbytesFromStackToDSSI
125 call InitializeDialogInputFromDSSI
126 mov WORD [si+DIALOG_INPUT.fszTitle], g_szDlgExitToDos
127 jmp Dialogs_DisplayQuitAndSaveChangesDialogsSharedEnding
128
129
130ALIGN JUMP_ALIGN
131Dialogs_DisplaySaveChangesDialog:
132 push ds
133
134 mov cx, DIALOG_INPUT_size
135 call Memory_ReserveCXbytesFromStackToDSSI
136 call InitializeDialogInputFromDSSI
137 mov WORD [si+DIALOG_INPUT.fszTitle], g_szDlgSaveChanges
138Dialogs_DisplayQuitAndSaveChangesDialogsSharedEnding:
139 mov WORD [si+DIALOG_INPUT.fszItems], g_szMultichoiceBooleanFlag
140 CALL_MENU_LIBRARY GetSelectionToAXwithInputInDSSI
141 add sp, BYTE DIALOG_INPUT_size
142 cmp ax, BYTE 1 ; 1 = YES
143
144 pop ds
145 ret
146
147
148;--------------------------------------------------------------------
149; Dialogs_DisplayProgressDialogForFlashingWithDialogIoInDSSIandFlashvarsInDSBX
150; Parameters:
151; DS:BX: Ptr to FLASHVARS
152; DS:SI: Ptr to PROGRESS_DIALOG_IO
153; SS:BP: Menu handle
154; Returns:
155; Nothing
156; Corrupts registers:
157; AX, DX, DI
158;--------------------------------------------------------------------
159ALIGN JUMP_ALIGN
160Dialogs_DisplayProgressDialogForFlashingWithDialogIoInDSSIandFlashvarsInDSBX:
161 ; Initialize progress dialog I/O in DS:SI with flashvars in DS:BX
162 call InitializeDialogInputFromDSSI
163 mov WORD [si+DIALOG_INPUT.fszTitle], g_szFlashTitle
164
165 xor ax, ax
166 mov [si+PROGRESS_DIALOG_IO.wCurrentProgressValue], ax
167 mov dx, [bx+FLASHVARS.wPagesToFlash]
168 mov [si+PROGRESS_DIALOG_IO.wMaxProgressValue], dx
169 mov [si+PROGRESS_DIALOG_IO.wMinProgressValue], ax
170 mov WORD [si+PROGRESS_DIALOG_IO.fnTaskWithParamInDSSI], Flash_EepromWithFlashvarsInDSSI
171 mov [si+PROGRESS_DIALOG_IO.fnTaskWithParamInDSSI+2], cs
172 ; Init done
173
174 mov dx, ds
175 mov ax, bx
176 CALL_MENU_LIBRARY StartProgressTaskWithIoInDSSIandParamInDXAX
177 ret
178
179
180;--------------------------------------------------------------------
181; InitializeDialogInputFromDSSI
182; Parameters:
183; DS:SI: Ptr to DIALOG_INPUT
184; Returns:
185; Nothing
186; Corrupts registers:
187; Nothing
188;--------------------------------------------------------------------
189ALIGN JUMP_ALIGN
190InitializeDialogInputFromDSSI:
191 mov [si+DIALOG_INPUT.fszTitle+2], cs
192 mov [si+DIALOG_INPUT.fszItems+2], cs
193 mov WORD [si+DIALOG_INPUT.fszInfo], g_szGenericDialogInfo
194 mov [si+DIALOG_INPUT.fszInfo+2], cs
195 ret
Note: See TracBrowser for help on using the repository browser.