[41] | 1 | ; Project name : Assembly Library |
---|
| 2 | ; Description : Displays word input dialog. |
---|
| 3 | |
---|
[376] | 4 | ; |
---|
[505] | 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. |
---|
[505] | 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 |
---|
[505] | 16 | ; GNU General Public License for more details. |
---|
[376] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
| 18 | ; |
---|
| 19 | |
---|
[505] | 20 | |
---|
[41] | 21 | ; Section containing code |
---|
| 22 | SECTION .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, SI, DI |
---|
| 33 | ;-------------------------------------------------------------------- |
---|
| 34 | ALIGN JUMP_ALIGN |
---|
| 35 | DialogWord_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 | ;-------------------------------------------------------------------- |
---|
| 52 | ALIGN JUMP_ALIGN |
---|
| 53 | WordEventHandler: |
---|
| 54 | jmp [cs:bx+.rgfnEventHandlers] |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | ALIGN JUMP_ALIGN |
---|
[52] | 58 | .InitializeMenuinitFromDSSI: |
---|
| 59 | xor ax, ax |
---|
| 60 | jmp Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | ALIGN JUMP_ALIGN |
---|
[41] | 64 | .IdleProcessing: |
---|
[52] | 65 | xor cx, cx ; Item 0 is used as input line |
---|
| 66 | call MenuText_AdjustDisplayContextForDrawingItemFromCX |
---|
[41] | 67 | call GetWordFromUser |
---|
| 68 | call MenuInit_CloseMenuWindow |
---|
| 69 | stc |
---|
| 70 | ret |
---|
| 71 | |
---|
| 72 | |
---|
| 73 | ALIGN WORD_ALIGN |
---|
| 74 | .rgfnEventHandlers: |
---|
| 75 | istruc MENUEVENT |
---|
[52] | 76 | at MENUEVENT.InitializeMenuinitFromDSSI, dw .InitializeMenuinitFromDSSI |
---|
[58] | 77 | at MENUEVENT.ExitMenu, dw Dialog_EventExitMenu |
---|
[41] | 78 | at MENUEVENT.IdleProcessing, dw .IdleProcessing |
---|
| 79 | at MENUEVENT.ItemHighlightedFromCX, dw Dialog_EventNotHandled |
---|
| 80 | at MENUEVENT.ItemSelectedFromCX, dw Dialog_EventNotHandled |
---|
| 81 | at MENUEVENT.KeyStrokeInAX, dw Dialog_EventNotHandled |
---|
| 82 | at MENUEVENT.RefreshTitle, dw Dialog_EventRefreshTitle |
---|
| 83 | at MENUEVENT.RefreshInformation, dw Dialog_EventRefreshInformation |
---|
| 84 | at MENUEVENT.RefreshItemFromCX, dw Dialog_EventNotHandled |
---|
| 85 | iend |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | ;-------------------------------------------------------------------- |
---|
| 89 | ; GetWordFromUser |
---|
| 90 | ; Parameters |
---|
| 91 | ; SS:BP: Ptr to DIALOG |
---|
| 92 | ; Returns: |
---|
| 93 | ; Nothing (User input stored to WORD_DIALOG_IO) |
---|
| 94 | ; Corrupts registers: |
---|
| 95 | ; AX, BX, DX, SI, DI |
---|
| 96 | ;-------------------------------------------------------------------- |
---|
| 97 | ALIGN JUMP_ALIGN |
---|
| 98 | GetWordFromUser: |
---|
| 99 | lds si, [bp+DIALOG.fpDialogIO] |
---|
[293] | 100 | eMOVZX bx, [si+WORD_DIALOG_IO.bNumericBase] |
---|
[41] | 101 | ALIGN JUMP_ALIGN |
---|
| 102 | .GetUserInputIntilValidOrCancelled: |
---|
| 103 | call Keyboard_ReadUserInputtedWordWhilePrinting |
---|
| 104 | jz SHORT .UserCancellation |
---|
| 105 | |
---|
| 106 | cmp ax, [si+WORD_DIALOG_IO.wMin] |
---|
| 107 | jb SHORT .InputtedWordNotInRange |
---|
| 108 | cmp ax, [si+WORD_DIALOG_IO.wMax] |
---|
| 109 | ja SHORT .InputtedWordNotInRange |
---|
| 110 | |
---|
| 111 | mov [si+WORD_DIALOG_IO.bUserCancellation], bh ; Zero = FALSE |
---|
| 112 | mov [si+WORD_DIALOG_IO.wReturnWord], ax |
---|
| 113 | .UserCancellation: |
---|
| 114 | ret |
---|
| 115 | |
---|
| 116 | .InputtedWordNotInRange: |
---|
| 117 | call Keyboard_PlayBellForUnwantedKeystroke |
---|
| 118 | call .ClearInputtedWordFromDialog |
---|
| 119 | jmp SHORT .GetUserInputIntilValidOrCancelled |
---|
| 120 | |
---|
| 121 | ;-------------------------------------------------------------------- |
---|
| 122 | ; .ClearInputtedWordFromDialog |
---|
| 123 | ; Parameters |
---|
| 124 | ; SS:BP: Ptr to DIALOG |
---|
| 125 | ; Returns: |
---|
| 126 | ; Nothing |
---|
| 127 | ; Corrupts registers: |
---|
| 128 | ; AX, CX, DX, DI |
---|
| 129 | ;-------------------------------------------------------------------- |
---|
| 130 | ALIGN JUMP_ALIGN |
---|
| 131 | .ClearInputtedWordFromDialog: |
---|
| 132 | CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX |
---|
| 133 | xchg dx, ax |
---|
| 134 | |
---|
| 135 | mov al, ' ' |
---|
| 136 | mov cx, 5 |
---|
| 137 | CALL_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX |
---|
| 138 | |
---|
| 139 | xchg ax, dx |
---|
[505] | 140 | JMP_DISPLAY_LIBRARY SetCursorCoordinatesFromAX |
---|
| 141 | |
---|