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

Last change on this file since 376 was 376, checked in by gregli@…, 12 years ago

WIDE checkin... Added copyright and license information to sorce files, as per the GPL instructions for usage.

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