[41] | 1 | ; Project name : Assembly Library
|
---|
| 2 | ; Description : Displays message 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 |
|
---|
[526] | 20 |
|
---|
[41] | 21 | ; Section containing code
|
---|
| 22 | SECTION .text
|
---|
| 23 |
|
---|
| 24 | ;--------------------------------------------------------------------
|
---|
| 25 | ; DialogMessage_DisplayMessageWithInputInDSSI
|
---|
| 26 | ; Parameters:
|
---|
| 27 | ; DS:SI: Ptr to DIALOG_INPUT
|
---|
| 28 | ; SS:BP: Ptr to parent MENU
|
---|
| 29 | ; Returns:
|
---|
| 30 | ; Nothing
|
---|
| 31 | ; Corrupts registers:
|
---|
[596] | 32 | ; AX, BX, CX, DX, DI
|
---|
[41] | 33 | ;--------------------------------------------------------------------
|
---|
| 34 | ALIGN JUMP_ALIGN
|
---|
| 35 | DialogMessage_DisplayMessageWithInputInDSSI:
|
---|
| 36 | mov bx, MessageEventHandler
|
---|
| 37 | jmp Dialog_DisplayWithDialogInputInDSSIandHandlerInBX
|
---|
| 38 |
|
---|
| 39 |
|
---|
| 40 | ;--------------------------------------------------------------------
|
---|
| 41 | ; MessageEventHandler
|
---|
| 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 | MessageEventHandler:
|
---|
| 53 | jmp [cs:bx+.rgfnEventHandlers]
|
---|
| 54 |
|
---|
| 55 |
|
---|
| 56 | ALIGN JUMP_ALIGN
|
---|
| 57 | .InitializeMenuinitFromDSSI:
|
---|
| 58 | or BYTE [bp+MENU.bFlags], FLG_MENU_USER_HANDLES_SCROLLING | FLG_MENU_NOHIGHLIGHT
|
---|
[52] | 59 | xor ax, ax ; Cannot be NO_ITEM_HIGHLIGHTED because of scrolling
|
---|
| 60 | jmp Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX
|
---|
[41] | 61 |
|
---|
| 62 |
|
---|
| 63 | ALIGN JUMP_ALIGN
|
---|
| 64 | .KeyStrokeInAX:
|
---|
| 65 | call ProcessMessageScrollingKeysFromAX
|
---|
| 66 | stc
|
---|
| 67 | ret
|
---|
| 68 |
|
---|
| 69 |
|
---|
| 70 | ALIGN WORD_ALIGN
|
---|
| 71 | .rgfnEventHandlers:
|
---|
| 72 | istruc MENUEVENT
|
---|
| 73 | at MENUEVENT.InitializeMenuinitFromDSSI, dw .InitializeMenuinitFromDSSI
|
---|
[58] | 74 | at MENUEVENT.ExitMenu, dw Dialog_EventExitMenu
|
---|
[41] | 75 | at MENUEVENT.IdleProcessing, dw Dialog_EventNotHandled
|
---|
| 76 | at MENUEVENT.ItemHighlightedFromCX, dw Dialog_EventNotHandled
|
---|
| 77 | at MENUEVENT.ItemSelectedFromCX, dw Dialog_EventAnyThatClosesDialog
|
---|
| 78 | at MENUEVENT.KeyStrokeInAX, dw .KeyStrokeInAX
|
---|
| 79 | at MENUEVENT.RefreshTitle, dw Dialog_EventRefreshTitle
|
---|
| 80 | at MENUEVENT.RefreshInformation, dw Dialog_EventRefreshInformation
|
---|
| 81 | at MENUEVENT.RefreshItemFromCX, dw Dialog_EventRefreshItemFromCX
|
---|
| 82 | iend
|
---|
| 83 |
|
---|
| 84 |
|
---|
| 85 | ;--------------------------------------------------------------------
|
---|
| 86 | ; ProcessMessageScrollingKeysFromAX
|
---|
| 87 | ; Parameters
|
---|
| 88 | ; AL: ASCII character
|
---|
| 89 | ; AH: BIOS scan code
|
---|
| 90 | ; SS:BP: Ptr to DIALOG
|
---|
| 91 | ; Returns:
|
---|
| 92 | ; Nothing
|
---|
| 93 | ; Corrupts registers:
|
---|
| 94 | ; BX, CX, DX, SI, DI
|
---|
| 95 | ;--------------------------------------------------------------------
|
---|
| 96 | ALIGN JUMP_ALIGN
|
---|
| 97 | ProcessMessageScrollingKeysFromAX:
|
---|
| 98 | cmp ah, MENU_KEY_UP
|
---|
| 99 | je SHORT .DecrementLines
|
---|
| 100 | cmp ah, MENU_KEY_DOWN
|
---|
| 101 | je SHORT .IncrementLines
|
---|
| 102 | jmp MenuLoop_ProcessScrollingKeysFromAX
|
---|
| 103 |
|
---|
| 104 | ALIGN JUMP_ALIGN
|
---|
| 105 | .DecrementLines:
|
---|
[52] | 106 | cmp WORD [bp+MENUINIT.wHighlightedItem], BYTE 0
|
---|
[41] | 107 | je SHORT .AlreadyAtTheTopOrBottom
|
---|
| 108 |
|
---|
| 109 | mov ax, [bp+MENU.wFirstVisibleItem]
|
---|
[52] | 110 | mov [bp+MENUINIT.wHighlightedItem], ax
|
---|
[41] | 111 | mov ah, MENU_KEY_UP
|
---|
| 112 | jmp MenuLoop_ProcessScrollingKeysFromAX
|
---|
| 113 |
|
---|
| 114 | ALIGN JUMP_ALIGN
|
---|
| 115 | .IncrementLines:
|
---|
| 116 | mov ax, [bp+MENUINIT.wItems]
|
---|
| 117 | dec ax ; Last possible item to highlight
|
---|
[52] | 118 | cmp [bp+MENUINIT.wHighlightedItem], ax
|
---|
[41] | 119 | jae SHORT .AlreadyAtTheTopOrBottom
|
---|
| 120 |
|
---|
| 121 | call MenuScrollbars_GetLastVisibleItemOnPageToAX
|
---|
[52] | 122 | mov [bp+MENUINIT.wHighlightedItem], ax
|
---|
[41] | 123 | mov ah, MENU_KEY_DOWN
|
---|
| 124 | jmp MenuLoop_ProcessScrollingKeysFromAX
|
---|
| 125 |
|
---|
| 126 | ALIGN JUMP_ALIGN
|
---|
| 127 | .AlreadyAtTheTopOrBottom:
|
---|
| 128 | ret
|
---|