source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/Dialog/DialogString.asm@ 618

Last change on this file since 618 was 596, checked in by Krister Nordvall, 6 years ago

Changes:

  • Made changes to HotkeyBar.asm to give the Boot Menu and Hotkey Bar a more consistent look. It will probably seem a bit strange at first to people used to the classic theme.
  • Added the missing parts of USE_NEC_V that should have been committed with the rest in r593.
  • Removed DEFINES_ALL_FEATURES from the BIOS makefile. It didn't work anymore and never really made sense anyway. Added all the official builds to 'make unused' instead which actually uncovered some unused code in the Tiny build.
  • XTIDECFG will no longer load color themes from unrecognized versions of the BIOS.
  • Other fixes in comments and some minor optimizations.
File size: 3.6 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-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; DialogString_GetStringWithIoInDSSI
25; Parameters:
26; DS:SI: Ptr to STRING_DIALOG_IO
27; SS:BP: Ptr to parent MENU
28; Returns:
29; Nothing
30; Corrupts registers:
31; AX, BX, CX, DX, DI
32;--------------------------------------------------------------------
33ALIGN JUMP_ALIGN
34DialogString_GetStringWithIoInDSSI:
35 mov bx, StringEventHandler
36 mov BYTE [si+STRING_DIALOG_IO.bUserCancellation], TRUE
37 jmp Dialog_DisplayWithDialogInputInDSSIandHandlerInBX
38
39
40;--------------------------------------------------------------------
41; StringEventHandler
42; Common parameters for all events:
43; BX: Menu event (anything from MENUEVENT struct)
44; SS:BP: Ptr to DIALOG
45; Common return values for all events:
46; CF: Set if event processed
47; Cleared if event not processed
48; Corrupts registers:
49; All
50;--------------------------------------------------------------------
51ALIGN JUMP_ALIGN
52StringEventHandler:
53 jmp [cs:bx+.rgfnEventHandlers]
54
55
56ALIGN JUMP_ALIGN
57.InitializeMenuinitFromDSSI:
58 xor ax, ax
59 jmp Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX
60
61
62ALIGN JUMP_ALIGN
63.IdleProcessing:
64 xor cx, cx ; Item 0 is used as input line
65 call MenuText_AdjustDisplayContextForDrawingItemFromCX
66 call GetStringFromUser
67 call MenuInit_CloseMenuWindow
68 stc
69 ret
70
71
72ALIGN WORD_ALIGN
73.rgfnEventHandlers:
74istruc MENUEVENT
75 at MENUEVENT.InitializeMenuinitFromDSSI, dw .InitializeMenuinitFromDSSI
76 at MENUEVENT.ExitMenu, dw Dialog_EventExitMenu
77 at MENUEVENT.IdleProcessing, dw .IdleProcessing
78 at MENUEVENT.ItemHighlightedFromCX, dw Dialog_EventNotHandled
79 at MENUEVENT.ItemSelectedFromCX, dw Dialog_EventNotHandled
80 at MENUEVENT.KeyStrokeInAX, dw Dialog_EventNotHandled
81 at MENUEVENT.RefreshTitle, dw Dialog_EventRefreshTitle
82 at MENUEVENT.RefreshInformation, dw Dialog_EventRefreshInformation
83 at MENUEVENT.RefreshItemFromCX, dw Dialog_EventNotHandled
84iend
85
86
87;--------------------------------------------------------------------
88; GetStringFromUser
89; Parameters
90; SS:BP: Ptr to DIALOG
91; Returns:
92; Nothing (User input stored to STRING_DIALOG_IO)
93; Corrupts registers:
94; AX, CX, DX, SI, DI
95;--------------------------------------------------------------------
96ALIGN JUMP_ALIGN
97GetStringFromUser:
98 lds si, [bp+DIALOG.fpDialogIO]
99 mov cx, [si+STRING_DIALOG_IO.wBufferSize]
100 les di, [si+STRING_DIALOG_IO.fpReturnBuffer]
101 mov dx, [si+STRING_DIALOG_IO.fnCharFilter]
102 test dx, dx
103 jnz SHORT .CharacterFilterFunctionInDX
104 mov dx, Char_CharIsValid
105
106.CharacterFilterFunctionInDX:
107 call Keyboard_ReadUserInputtedStringToESDIWhilePrinting
108 jz SHORT .UserCancellation
109
110 mov BYTE [si+STRING_DIALOG_IO.bUserCancellation], FALSE
111 mov [si+STRING_DIALOG_IO.wReturnLength], cx
112.UserCancellation:
113 ret
Note: See TracBrowser for help on using the repository browser.