[41] | 1 | ; Project name : Assembly Library
|
---|
| 2 | ; Description : Displays word input dialog.
|
---|
| 3 |
|
---|
[376] | 4 | ;
|
---|
[526] | 5 | ; XTIDE Universal BIOS and Associated Tools
|
---|
| 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.
|
---|
[526] | 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
|
---|
[526] | 16 | ; GNU General Public License for more details.
|
---|
[376] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
| 18 | ;
|
---|
| 19 |
|
---|
[41] | 20 | ; Section containing code
|
---|
| 21 | SECTION .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, SI, DI
|
---|
| 32 | ;--------------------------------------------------------------------
|
---|
| 33 | ALIGN JUMP_ALIGN
|
---|
| 34 | DialogString_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 | ;--------------------------------------------------------------------
|
---|
| 51 | ALIGN JUMP_ALIGN
|
---|
| 52 | StringEventHandler:
|
---|
| 53 | jmp [cs:bx+.rgfnEventHandlers]
|
---|
| 54 |
|
---|
| 55 |
|
---|
| 56 | ALIGN JUMP_ALIGN
|
---|
[52] | 57 | .InitializeMenuinitFromDSSI:
|
---|
| 58 | xor ax, ax
|
---|
| 59 | jmp Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 | ALIGN JUMP_ALIGN
|
---|
[41] | 63 | .IdleProcessing:
|
---|
[52] | 64 | xor cx, cx ; Item 0 is used as input line
|
---|
| 65 | call MenuText_AdjustDisplayContextForDrawingItemFromCX
|
---|
[41] | 66 | call GetStringFromUser
|
---|
| 67 | call MenuInit_CloseMenuWindow
|
---|
| 68 | stc
|
---|
| 69 | ret
|
---|
| 70 |
|
---|
| 71 |
|
---|
| 72 | ALIGN WORD_ALIGN
|
---|
| 73 | .rgfnEventHandlers:
|
---|
| 74 | istruc MENUEVENT
|
---|
[52] | 75 | at MENUEVENT.InitializeMenuinitFromDSSI, dw .InitializeMenuinitFromDSSI
|
---|
[58] | 76 | at MENUEVENT.ExitMenu, dw Dialog_EventExitMenu
|
---|
[41] | 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
|
---|
| 84 | iend
|
---|
| 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 | ;--------------------------------------------------------------------
|
---|
| 96 | ALIGN JUMP_ALIGN
|
---|
| 97 | GetStringFromUser:
|
---|
| 98 | lds si, [bp+DIALOG.fpDialogIO]
|
---|
| 99 | mov cx, [si+STRING_DIALOG_IO.wBufferSize]
|
---|
| 100 | les di, [si+STRING_DIALOG_IO.fpReturnBuffer]
|
---|
[568] | 101 | mov dx, [si+STRING_DIALOG_IO.fnCharFilter]
|
---|
| 102 | test dx, dx
|
---|
| 103 | jnz SHORT .CharacterFilterFunctionInDX
|
---|
| 104 | mov dx, Char_CharIsValid
|
---|
[41] | 105 |
|
---|
[568] | 106 | .CharacterFilterFunctionInDX:
|
---|
[41] | 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
|
---|