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

Last change on this file since 602 was 602, checked in by krille_n_, 5 years ago

Changes:

  • SerDrive: Fixed a bug that prevented use of 3.5" 720 KB floppy disk images.
  • Also added support for Microsoft DMF (Distribution Media Format) floppy disk images.
  • XTIDECFG / Library: Minor size optimizations. Added a new macro (SKIP1B) as part of that.
  • BIOS: A small size optimization (2 bytes) to MODULE_8BIT_IDE_ADVANCED that is enabled only when USE_NEC_V is defined.
File size: 5.7 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-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; Section containing code
21SECTION .text
22
23
24;--------------------------------------------------------------------
25; Dialogs_DisplayNotificationFromCSDX
26; Dialogs_DisplayErrorFromCSDX
27;   Parameters:
28;       CS:DX:  Ptr to notification/error string to display
29;       SS:BP:  Menu handle
30;   Returns:
31;       Nothing
32;   Corrupts registers:
33;       AX
34;--------------------------------------------------------------------
35ALIGN JUMP_ALIGN
36Dialogs_DisplayNotificationFromCSDX:
37    push    di
38    mov     di, g_szNotificationDialog
39    jmp     SHORT DisplayMessageDialogWithMessageInCSDXandDialogInputInDSSI
40
41ALIGN JUMP_ALIGN
42Dialogs_DisplayErrorFromCSDX:
43    push    di
44    mov     di, g_szErrorDialog
45    SKIP1B  al
46    ; Fall to DisplayMessageDialogWithMessageInCSDXandDialogInputInDSSI
47
48;--------------------------------------------------------------------
49; Dialogs_DisplayHelpFromCSDXwithTitleInCSDI
50;   Parameters:
51;       CS:DX:  Ptr to help string to display
52;       CS:DI:  Ptr to title string for help dialog
53;       SS:BP:  Menu handle
54;   Returns:
55;       Nothing
56;   Corrupts registers:
57;       AX
58;--------------------------------------------------------------------
59Dialogs_DisplayHelpFromCSDXwithTitleInCSDI:
60    push    di
61
62DisplayMessageDialogWithMessageInCSDXandDialogInputInDSSI:
63    push    ds
64    push    si
65    push    cx
66
67    mov     cl, DIALOG_INPUT_size
68    call    Memory_ReserveCLbytesFromStackToDSSI
69    call    InitializeDialogInputFromDSSI
70    mov     [si+DIALOG_INPUT.fszTitle], di
71    mov     [si+DIALOG_INPUT.fszItems], dx
72    CALL_MENU_LIBRARY DisplayMessageWithInputInDSSI
73
74    add     sp, BYTE DIALOG_INPUT_size
75    pop     cx
76    pop     si
77    pop     ds
78
79    pop     di
80    ret
81
82
83;--------------------------------------------------------------------
84; Dialogs_DisplayFileDialogWithDialogIoInDSSI
85;   Parameters:
86;       DS:SI:  Ptr to FILE_DIALOG_IO
87;       SS:BP:  Menu handle
88;   Returns:
89;       Nothing
90;   Corrupts registers:
91;       AX, DI
92;--------------------------------------------------------------------
93ALIGN JUMP_ALIGN
94Dialogs_DisplayFileDialogWithDialogIoInDSSI:
95    push    es
96
97    call    Buffers_GetFileDialogItemBufferToESDI
98    mov     WORD [si+FILE_DIALOG_IO.fszTitle], g_szDlgFileTitle
99    mov     [si+FILE_DIALOG_IO.fszTitle+2], cs
100    mov     [si+FILE_DIALOG_IO.fszItemBuffer], di
101    mov     [si+FILE_DIALOG_IO.fszItemBuffer+2], es
102    mov     BYTE [si+FILE_DIALOG_IO.bDialogFlags], FLG_FILEDIALOG_DRIVES
103    mov     BYTE [si+FILE_DIALOG_IO.bFileAttributes], FLG_FILEATTR_DIRECTORY | FLG_FILEATTR_ARCHIVE
104    mov     WORD [si+FILE_DIALOG_IO.fpFileFilterString], g_szDlgFileFilter
105    mov     [si+FILE_DIALOG_IO.fpFileFilterString+2], cs
106    CALL_MENU_LIBRARY GetFileNameWithIoInDSSI
107
108    pop     es
109    ret
110
111
112;--------------------------------------------------------------------
113; Dialogs_DisplayYesNoResponseDialogWithTitleStringInBX
114;   Parameters:
115;       BX:     Offset to dialog title string
116;       SS:BP:  Menu handle
117;   Returns:
118;       ZF:     Set if user wants to do the action
119;               Cleared if user wants to cancel
120;   Corrupts registers:
121;       AX, CX
122;--------------------------------------------------------------------
123ALIGN JUMP_ALIGN
124Dialogs_DisplayYesNoResponseDialogWithTitleStringInBX:
125    push    ds
126
127    mov     cl, DIALOG_INPUT_size
128    call    Memory_ReserveCLbytesFromStackToDSSI
129    call    InitializeDialogInputFromDSSI
130    mov     [si+DIALOG_INPUT.fszTitle], bx
131    mov     WORD [si+DIALOG_INPUT.fszItems], g_szMultichoiceBooleanFlag
132    CALL_MENU_LIBRARY GetSelectionToAXwithInputInDSSI
133    add     sp, BYTE DIALOG_INPUT_size
134    dec     ax              ; -1 = NO, 0 = YES
135
136    pop     ds
137    ret
138
139
140;--------------------------------------------------------------------
141; Dialogs_DisplayProgressDialogForFlashingWithDialogIoInDSSIandFlashvarsInDSBX
142;   Parameters:
143;       DS:BX:  Ptr to FLASHVARS
144;       DS:SI:  Ptr to PROGRESS_DIALOG_IO
145;       SS:BP:  Menu handle
146;   Returns:
147;       Nothing
148;   Corrupts registers:
149;       AX, DX, DI
150;--------------------------------------------------------------------
151ALIGN JUMP_ALIGN
152Dialogs_DisplayProgressDialogForFlashingWithDialogIoInDSSIandFlashvarsInDSBX:
153    ; Initialize progress dialog I/O in DS:SI with flashvars in DS:BX
154    call    InitializeDialogInputFromDSSI
155    mov     WORD [si+DIALOG_INPUT.fszTitle], g_szFlashTitle
156
157    xor     ax, ax
158    mov     [si+PROGRESS_DIALOG_IO.wCurrentProgressValue], ax
159    mov     dx, [bx+FLASHVARS.wPagesToFlash]
160    mov     [si+PROGRESS_DIALOG_IO.wMaxProgressValue], dx
161    mov     [si+PROGRESS_DIALOG_IO.wMinProgressValue], ax
162    mov     WORD [si+PROGRESS_DIALOG_IO.fnTaskWithParamInDSSI], Flash_EepromWithFlashvarsInDSSI
163    mov     [si+PROGRESS_DIALOG_IO.fnTaskWithParamInDSSI+2], cs
164    ; Init done
165
166    mov     dx, ds
167    mov     ax, bx
168    JMP_MENU_LIBRARY StartProgressTaskWithIoInDSSIandParamInDXAX
169
170
171;--------------------------------------------------------------------
172; InitializeDialogInputFromDSSI
173;   Parameters:
174;       DS:SI:  Ptr to DIALOG_INPUT
175;   Returns:
176;       Nothing
177;   Corrupts registers:
178;       Nothing
179;--------------------------------------------------------------------
180ALIGN JUMP_ALIGN
181InitializeDialogInputFromDSSI:
182    mov     [si+DIALOG_INPUT.fszTitle+2], cs
183    mov     [si+DIALOG_INPUT.fszItems+2], cs
184    mov     WORD [si+DIALOG_INPUT.fszInfo], g_szGenericDialogInfo
185    mov     [si+DIALOG_INPUT.fszInfo+2], cs
186    ret
Note: See TracBrowser for help on using the repository browser.