source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/Dialog/DialogWord.asm @ 625

Last change on this file since 625 was 625, checked in by krille_n_, 14 months ago

Changes:

  • Added a configuration option to let the BIOS store RamVars to an UMB when Full operating mode is enabled. This is primarily for XT class machines with RAM in the UMA (which apparently is a common thing these days).
  • Added two new builds specifically for IBM PS/2 machines. This is for support of the new McIDE adapter from the guys at zzxio.com. Note that the additional hardware specific code (under the USE_PS2 define) is for the PS/2 machines themselves and not for the McIDE adapters, so any controller in an IBM PS/2 machine can be used with the USE_PS2 define.
  • Moved pColorTheme out of the range of ROMVARS being copied over when doing "Load old settings from EEPROM" in XTIDECFG. This fixed a serious bug from r592 where loading a BIOS from file and then loading the old settings from ROM would corrupt 7 bytes of code somewhere in the loaded BIOS.
  • Optimizations (speed and size) to the library. Browsing the menus in XTIDECFG should now feel a little less sluggish.
  • Hopefully fixed a problem with the PostCommitHook script where it sometimes wouldn't find the CommitInProgress file. I say hopefully because testing this is a nightmare.
File size: 3.9 KB
Line 
1; Project name  :   Assembly Library
2; Description   :   Displays word input dialog.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2023 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
21; Section containing code
22SECTION .text
23
24;--------------------------------------------------------------------
25; DialogWord_GetWordWithIoInDSSI
26;   Parameters:
27;       DS:SI:  Ptr to WORD_DIALOG_IO
28;       SS:BP:  Ptr to parent MENU
29;   Returns:
30;       Nothing
31;   Corrupts registers:
32;       AX, BX, CX, DX, DI
33;--------------------------------------------------------------------
34ALIGN JUMP_ALIGN
35DialogWord_GetWordWithIoInDSSI:
36    mov     bx, WordEventHandler
37    mov     BYTE [si+WORD_DIALOG_IO.bUserCancellation], TRUE
38    jmp     Dialog_DisplayWithDialogInputInDSSIandHandlerInBX
39
40
41;--------------------------------------------------------------------
42; WordEventHandler
43;   Common parameters for all events:
44;       BX:         Menu event (anything from MENUEVENT struct)
45;       SS:BP:      Ptr to DIALOG
46;   Common return values for all events:
47;       CF:         Set if event processed
48;                   Cleared if event not processed
49;   Corrupts registers:
50;       All
51;--------------------------------------------------------------------
52ALIGN JUMP_ALIGN
53WordEventHandler:
54    jmp     [cs:bx+.rgfnEventHandlers]
55
56
57ALIGN JUMP_ALIGN
58.IdleProcessing:
59    xor     cx, cx                      ; Item 0 is used as input line
60    call    MenuText_AdjustDisplayContextForDrawingItemFromCX
61    call    GetWordFromUser
62    call    MenuInit_CloseMenuWindow
63    stc
64    ret
65
66
67ALIGN WORD_ALIGN
68.rgfnEventHandlers:
69istruc MENUEVENT
70    at  MENUEVENT.InitializeMenuinitFromDSSI,   dw  Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithItemZero
71    at  MENUEVENT.ExitMenu,                     dw  Dialog_EventExitMenu
72    at  MENUEVENT.IdleProcessing,               dw  .IdleProcessing
73    at  MENUEVENT.ItemHighlightedFromCX,        dw  Dialog_EventNotHandled
74    at  MENUEVENT.ItemSelectedFromCX,           dw  Dialog_EventNotHandled
75    at  MENUEVENT.KeyStrokeInAX,                dw  Dialog_EventNotHandled
76    at  MENUEVENT.RefreshTitle,                 dw  Dialog_EventRefreshTitle
77    at  MENUEVENT.RefreshInformation,           dw  Dialog_EventRefreshInformation
78    at  MENUEVENT.RefreshItemFromCX,            dw  Dialog_EventNotHandled
79iend
80
81
82;--------------------------------------------------------------------
83; GetWordFromUser
84;   Parameters
85;       SS:BP:  Ptr to DIALOG
86;   Returns:
87;       Nothing (User input stored to WORD_DIALOG_IO)
88;   Corrupts registers:
89;       AX, BX, CX, DX, SI, DI, DS
90;--------------------------------------------------------------------
91ALIGN JUMP_ALIGN
92GetWordFromUser:
93    lds     si, [bp+DIALOG.fpDialogIO]
94    eMOVZX  bx, [si+WORD_DIALOG_IO.bNumericBase]
95ALIGN JUMP_ALIGN
96.GetUserInputUntilValidOrCancelled:
97    call    Keyboard_ReadUserInputtedWordWhilePrinting
98    jz      SHORT .UserCancellation
99
100    cmp     ax, [si+WORD_DIALOG_IO.wMin]
101    jb      SHORT .InputtedWordNotInRange
102    cmp     ax, [si+WORD_DIALOG_IO.wMax]
103    ja      SHORT .InputtedWordNotInRange
104
105    mov     [si+WORD_DIALOG_IO.bUserCancellation], bh   ; Zero = FALSE
106    mov     [si+WORD_DIALOG_IO.wReturnWord], ax
107.UserCancellation:
108    ret
109
110.InputtedWordNotInRange:
111    call    Keyboard_PlayBellForUnwantedKeystroke
112    ; Clear inputted word from dialog
113    CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
114    xchg    dx, ax
115
116    mov     al, ' '
117    mov     cx, 5
118    CALL_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
119
120    xchg    ax, dx
121    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
122    jmp     SHORT .GetUserInputUntilValidOrCancelled
Note: See TracBrowser for help on using the repository browser.