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
RevLine 
[57]1; Project name  :   XTIDE Univeral BIOS Configurator v2
2; Description   :   Functions for displaying dialogs.
3
[376]4;
[525]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.
[525]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
[525]16; GNU General Public License for more details.
[376]17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
[525]18;
[376]19
[57]20; Section containing code
21SECTION .text
22
[602]23
[57]24;--------------------------------------------------------------------
[602]25; Dialogs_DisplayNotificationFromCSDX
26; Dialogs_DisplayErrorFromCSDX
[57]27;   Parameters:
[602]28;       CS:DX:  Ptr to notification/error string to display
[57]29;       SS:BP:  Menu handle
30;   Returns:
31;       Nothing
32;   Corrupts registers:
33;       AX
34;--------------------------------------------------------------------
35ALIGN JUMP_ALIGN
[602]36Dialogs_DisplayNotificationFromCSDX:
[57]37    push    di
[602]38    mov     di, g_szNotificationDialog
[57]39    jmp     SHORT DisplayMessageDialogWithMessageInCSDXandDialogInputInDSSI
40
[602]41ALIGN JUMP_ALIGN
42Dialogs_DisplayErrorFromCSDX:
43    push    di
44    mov     di, g_szErrorDialog
45    SKIP1B  al
46    ; Fall to DisplayMessageDialogWithMessageInCSDXandDialogInputInDSSI
47
[57]48;--------------------------------------------------------------------
[602]49; Dialogs_DisplayHelpFromCSDXwithTitleInCSDI
[57]50;   Parameters:
[602]51;       CS:DX:  Ptr to help string to display
52;       CS:DI:  Ptr to title string for help dialog
[57]53;       SS:BP:  Menu handle
54;   Returns:
55;       Nothing
56;   Corrupts registers:
57;       AX
58;--------------------------------------------------------------------
[602]59Dialogs_DisplayHelpFromCSDXwithTitleInCSDI:
[57]60    push    di
61
[602]62DisplayMessageDialogWithMessageInCSDXandDialogInputInDSSI:
[57]63    push    ds
64    push    si
65    push    cx
66
[602]67    mov     cl, DIALOG_INPUT_size
68    call    Memory_ReserveCLbytesFromStackToDSSI
[57]69    call    InitializeDialogInputFromDSSI
[602]70    mov     [si+DIALOG_INPUT.fszTitle], di
[57]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
[602]78
79    pop     di
[57]80    ret
81
82
83;--------------------------------------------------------------------
84; Dialogs_DisplayFileDialogWithDialogIoInDSSI
85;   Parameters:
86;       DS:SI:  Ptr to FILE_DIALOG_IO
[65]87;       SS:BP:  Menu handle
[57]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
[59]110
111
112;--------------------------------------------------------------------
[592]113; Dialogs_DisplayYesNoResponseDialogWithTitleStringInBX
[59]114;   Parameters:
[592]115;       BX:     Offset to dialog title string
[65]116;       SS:BP:  Menu handle
[59]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
[592]124Dialogs_DisplayYesNoResponseDialogWithTitleStringInBX:
[59]125    push    ds
126
[602]127    mov     cl, DIALOG_INPUT_size
128    call    Memory_ReserveCLbytesFromStackToDSSI
[59]129    call    InitializeDialogInputFromDSSI
[592]130    mov     [si+DIALOG_INPUT.fszTitle], bx
[108]131    mov     WORD [si+DIALOG_INPUT.fszItems], g_szMultichoiceBooleanFlag
[59]132    CALL_MENU_LIBRARY GetSelectionToAXwithInputInDSSI
133    add     sp, BYTE DIALOG_INPUT_size
[592]134    dec     ax              ; -1 = NO, 0 = YES
[59]135
136    pop     ds
137    ret
138
139
140;--------------------------------------------------------------------
[65]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:
[181]153    ; Initialize progress dialog I/O in DS:SI with flashvars in DS:BX
[65]154    call    InitializeDialogInputFromDSSI
[109]155    mov     WORD [si+DIALOG_INPUT.fszTitle], g_szFlashTitle
[65]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
[181]164    ; Init done
165
166    mov     dx, ds
167    mov     ax, bx
[525]168    JMP_MENU_LIBRARY StartProgressTaskWithIoInDSSIandParamInDXAX
[65]169
170
171;--------------------------------------------------------------------
[59]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.