[41] | 1 | ; File name : DialogMessage.asm |
---|
| 2 | ; Project name : Assembly Library |
---|
| 3 | ; Created date : 6.8.2010 |
---|
[58] | 4 | ; Last update : 18.11.2010 |
---|
[41] | 5 | ; Author : Tomi Tilli |
---|
| 6 | ; Description : Displays message dialog. |
---|
| 7 | |
---|
[376] | 8 | ; |
---|
| 9 | ; XTIDE Universal BIOS and Associated Tools |
---|
| 10 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team. |
---|
| 11 | ; |
---|
| 12 | ; This program is free software; you can redistribute it and/or modify |
---|
| 13 | ; it under the terms of the GNU General Public License as published by |
---|
| 14 | ; the Free Software Foundation; either version 2 of the License, or |
---|
| 15 | ; (at your option) any later version. |
---|
| 16 | ; |
---|
| 17 | ; This program is distributed in the hope that it will be useful, |
---|
| 18 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 19 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 20 | ; GNU General Public License for more details. |
---|
| 21 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
| 22 | ; |
---|
| 23 | |
---|
| 24 | |
---|
[41] | 25 | ; Section containing code |
---|
| 26 | SECTION .text |
---|
| 27 | |
---|
| 28 | ;-------------------------------------------------------------------- |
---|
| 29 | ; DialogMessage_DisplayMessageWithInputInDSSI |
---|
| 30 | ; Parameters: |
---|
| 31 | ; DS:SI: Ptr to DIALOG_INPUT |
---|
| 32 | ; SS:BP: Ptr to parent MENU |
---|
| 33 | ; Returns: |
---|
| 34 | ; Nothing |
---|
| 35 | ; Corrupts registers: |
---|
| 36 | ; AX, BX, CX, DX, SI, DI |
---|
| 37 | ;-------------------------------------------------------------------- |
---|
| 38 | ALIGN JUMP_ALIGN |
---|
| 39 | DialogMessage_DisplayMessageWithInputInDSSI: |
---|
| 40 | mov bx, MessageEventHandler |
---|
| 41 | jmp Dialog_DisplayWithDialogInputInDSSIandHandlerInBX |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | ;-------------------------------------------------------------------- |
---|
| 45 | ; MessageEventHandler |
---|
| 46 | ; Common parameters for all events: |
---|
| 47 | ; BX: Menu event (anything from MENUEVENT struct) |
---|
| 48 | ; SS:BP: Ptr to DIALOG |
---|
| 49 | ; Common return values for all events: |
---|
| 50 | ; CF: Set if event processed |
---|
| 51 | ; Cleared if event not processed |
---|
| 52 | ; Corrupts registers: |
---|
| 53 | ; All |
---|
| 54 | ;-------------------------------------------------------------------- |
---|
| 55 | ALIGN JUMP_ALIGN |
---|
| 56 | MessageEventHandler: |
---|
| 57 | jmp [cs:bx+.rgfnEventHandlers] |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | ALIGN JUMP_ALIGN |
---|
| 61 | .InitializeMenuinitFromDSSI: |
---|
| 62 | or BYTE [bp+MENU.bFlags], FLG_MENU_USER_HANDLES_SCROLLING | FLG_MENU_NOHIGHLIGHT |
---|
[52] | 63 | xor ax, ax ; Cannot be NO_ITEM_HIGHLIGHTED because of scrolling |
---|
| 64 | jmp Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX |
---|
[41] | 65 | |
---|
| 66 | |
---|
| 67 | ALIGN JUMP_ALIGN |
---|
| 68 | .KeyStrokeInAX: |
---|
| 69 | call ProcessMessageScrollingKeysFromAX |
---|
| 70 | stc |
---|
| 71 | ret |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | ALIGN WORD_ALIGN |
---|
| 75 | .rgfnEventHandlers: |
---|
| 76 | istruc MENUEVENT |
---|
| 77 | at MENUEVENT.InitializeMenuinitFromDSSI, dw .InitializeMenuinitFromDSSI |
---|
[58] | 78 | at MENUEVENT.ExitMenu, dw Dialog_EventExitMenu |
---|
[41] | 79 | at MENUEVENT.IdleProcessing, dw Dialog_EventNotHandled |
---|
| 80 | at MENUEVENT.ItemHighlightedFromCX, dw Dialog_EventNotHandled |
---|
| 81 | at MENUEVENT.ItemSelectedFromCX, dw Dialog_EventAnyThatClosesDialog |
---|
| 82 | at MENUEVENT.KeyStrokeInAX, dw .KeyStrokeInAX |
---|
| 83 | at MENUEVENT.RefreshTitle, dw Dialog_EventRefreshTitle |
---|
| 84 | at MENUEVENT.RefreshInformation, dw Dialog_EventRefreshInformation |
---|
| 85 | at MENUEVENT.RefreshItemFromCX, dw Dialog_EventRefreshItemFromCX |
---|
| 86 | iend |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | ;-------------------------------------------------------------------- |
---|
| 90 | ; ProcessMessageScrollingKeysFromAX |
---|
| 91 | ; Parameters |
---|
| 92 | ; AL: ASCII character |
---|
| 93 | ; AH: BIOS scan code |
---|
| 94 | ; SS:BP: Ptr to DIALOG |
---|
| 95 | ; Returns: |
---|
| 96 | ; Nothing |
---|
| 97 | ; Corrupts registers: |
---|
| 98 | ; BX, CX, DX, SI, DI |
---|
| 99 | ;-------------------------------------------------------------------- |
---|
| 100 | ALIGN JUMP_ALIGN |
---|
| 101 | ProcessMessageScrollingKeysFromAX: |
---|
| 102 | cmp ah, MENU_KEY_UP |
---|
| 103 | je SHORT .DecrementLines |
---|
| 104 | cmp ah, MENU_KEY_DOWN |
---|
| 105 | je SHORT .IncrementLines |
---|
| 106 | jmp MenuLoop_ProcessScrollingKeysFromAX |
---|
| 107 | |
---|
| 108 | ALIGN JUMP_ALIGN |
---|
| 109 | .DecrementLines: |
---|
[52] | 110 | cmp WORD [bp+MENUINIT.wHighlightedItem], BYTE 0 |
---|
[41] | 111 | je SHORT .AlreadyAtTheTopOrBottom |
---|
| 112 | |
---|
| 113 | mov ax, [bp+MENU.wFirstVisibleItem] |
---|
[52] | 114 | mov [bp+MENUINIT.wHighlightedItem], ax |
---|
[41] | 115 | mov ah, MENU_KEY_UP |
---|
| 116 | jmp MenuLoop_ProcessScrollingKeysFromAX |
---|
| 117 | |
---|
| 118 | ALIGN JUMP_ALIGN |
---|
| 119 | .IncrementLines: |
---|
| 120 | mov ax, [bp+MENUINIT.wItems] |
---|
| 121 | dec ax ; Last possible item to highlight |
---|
[52] | 122 | cmp [bp+MENUINIT.wHighlightedItem], ax |
---|
[41] | 123 | jae SHORT .AlreadyAtTheTopOrBottom |
---|
| 124 | |
---|
| 125 | call MenuScrollbars_GetLastVisibleItemOnPageToAX |
---|
[52] | 126 | mov [bp+MENUINIT.wHighlightedItem], ax |
---|
[41] | 127 | mov ah, MENU_KEY_DOWN |
---|
| 128 | jmp MenuLoop_ProcessScrollingKeysFromAX |
---|
| 129 | |
---|
| 130 | ALIGN JUMP_ALIGN |
---|
| 131 | .AlreadyAtTheTopOrBottom: |
---|
| 132 | ret |
---|