[57] | 1 | ; Project name : XTIDE Universal BIOS Configurator v2
|
---|
| 2 | ; Description : Functions for accessing MENUPAGE structs.
|
---|
| 3 |
|
---|
[376] | 4 | ;
|
---|
[525] | 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.
|
---|
[525] | 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
|
---|
[525] | 16 | ; GNU General Public License for more details.
|
---|
[376] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
[525] | 18 | ;
|
---|
[376] | 19 |
|
---|
[57] | 20 | ; Section containing code
|
---|
| 21 | SECTION .text
|
---|
| 22 |
|
---|
| 23 | ;--------------------------------------------------------------------
|
---|
| 24 | ; Menupage_ChangeToNewMenupageInDSSI
|
---|
| 25 | ; Parameters:
|
---|
| 26 | ; DS:SI: Ptr to new MENUPAGE
|
---|
| 27 | ; SS:BP: Menu handle
|
---|
| 28 | ; Returns:
|
---|
| 29 | ; Nothing
|
---|
| 30 | ; Corrupts registers:
|
---|
| 31 | ; AX, DI
|
---|
| 32 | ;--------------------------------------------------------------------
|
---|
| 33 | ALIGN JUMP_ALIGN
|
---|
| 34 | Menupage_ChangeToNewMenupageInDSSI:
|
---|
| 35 | mov di, si
|
---|
| 36 | call Menupage_SetActiveMenupageFromDSDI
|
---|
| 37 | call Menupage_GetVisibleMenuitemsToAXfromDSDI
|
---|
| 38 | CALL_MENU_LIBRARY SetTotalItemsFromAX
|
---|
| 39 | xor ax, ax
|
---|
| 40 | CALL_MENU_LIBRARY HighlightItemFromAX
|
---|
[525] | 41 | JMP_MENU_LIBRARY RefreshWindow
|
---|
[57] | 42 |
|
---|
| 43 |
|
---|
| 44 | ;--------------------------------------------------------------------
|
---|
[109] | 45 | ; SetActiveMenupageFromDSDI
|
---|
[57] | 46 | ; Parameters:
|
---|
| 47 | ; DS:DI: Ptr to MENUPAGE to set active
|
---|
| 48 | ; SS:BP: Menu handle
|
---|
| 49 | ; Returns:
|
---|
| 50 | ; Nothing
|
---|
| 51 | ; Corrupts registers:
|
---|
[109] | 52 | ; Nothing
|
---|
[57] | 53 | ;--------------------------------------------------------------------
|
---|
| 54 | ALIGN JUMP_ALIGN
|
---|
| 55 | Menupage_SetActiveMenupageFromDSDI:
|
---|
| 56 | mov [g_cfgVars+CFGVARS.pMenupage], di
|
---|
| 57 | ret
|
---|
| 58 |
|
---|
| 59 |
|
---|
| 60 | ;--------------------------------------------------------------------
|
---|
| 61 | ; Menupage_GetActiveMenupageToDSDI:
|
---|
| 62 | ; Parameters:
|
---|
| 63 | ; SS:BP: Menu handle
|
---|
| 64 | ; Returns:
|
---|
| 65 | ; DS:DI: Ptr to MENUPAGE
|
---|
| 66 | ; Corrupts registers:
|
---|
| 67 | ; Nothing
|
---|
| 68 | ;--------------------------------------------------------------------
|
---|
| 69 | ALIGN JUMP_ALIGN
|
---|
| 70 | Menupage_GetActiveMenupageToDSDI:
|
---|
| 71 | push cs
|
---|
| 72 | pop ds
|
---|
| 73 | mov di, [g_cfgVars+CFGVARS.pMenupage]
|
---|
| 74 | ret
|
---|
| 75 |
|
---|
| 76 |
|
---|
| 77 | ;--------------------------------------------------------------------
|
---|
| 78 | ; Menupage_GetVisibleMenuitemsToAXfromDSDI
|
---|
| 79 | ; Parameters:
|
---|
| 80 | ; DS:DI: Ptr to MENUPAGE
|
---|
| 81 | ; Returns:
|
---|
| 82 | ; AX: Number of visible MENUITEMs in MENUPAGE
|
---|
| 83 | ; Corrupts registers:
|
---|
| 84 | ; BX, CX
|
---|
| 85 | ;--------------------------------------------------------------------
|
---|
| 86 | ALIGN JUMP_ALIGN
|
---|
| 87 | Menupage_GetVisibleMenuitemsToAXfromDSDI:
|
---|
| 88 | xor ax, ax
|
---|
| 89 | mov cx, [di+MENUPAGE.wMenuitems]
|
---|
| 90 | lea bx, [di+MENUPAGE.rgMenuitem]
|
---|
| 91 |
|
---|
| 92 | ALIGN JUMP_ALIGN
|
---|
| 93 | .CheckVisibilityFromNextMenuitem:
|
---|
| 94 | test BYTE [bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
|
---|
| 95 | jz SHORT .PrepareToLoop
|
---|
| 96 | inc ax
|
---|
| 97 | .PrepareToLoop:
|
---|
| 98 | add bx, BYTE MENUITEM_size
|
---|
| 99 | loop .CheckVisibilityFromNextMenuitem
|
---|
| 100 | ret
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 | ;--------------------------------------------------------------------
|
---|
| 104 | ; Menupage_GetCXthVisibleMenuitemToDSSIfromDSDI
|
---|
| 105 | ; Parameters:
|
---|
| 106 | ; CX: nth visible MENUITEM to find
|
---|
| 107 | ; DS:DI: Ptr to MENUPAGE
|
---|
| 108 | ; Returns:
|
---|
| 109 | ; DS:SI: Ptr to CXth visible MENUITEM
|
---|
| 110 | ; CF: Set if MENUITEM found
|
---|
| 111 | ; Cleared if MENUITEM not found
|
---|
| 112 | ; Corrupts registers:
|
---|
| 113 | ; AX, CX
|
---|
| 114 | ;--------------------------------------------------------------------
|
---|
| 115 | ALIGN JUMP_ALIGN
|
---|
| 116 | Menupage_GetCXthVisibleMenuitemToDSSIfromDSDI:
|
---|
| 117 | mov ax, [di+MENUPAGE.wMenuitems]
|
---|
| 118 | cmp cx, ax
|
---|
| 119 | jae SHORT .MenuitemNotFound
|
---|
| 120 | xchg ax, cx
|
---|
| 121 | inc ax
|
---|
| 122 | lea si, [di+MENUPAGE.rgMenuitem]
|
---|
| 123 | ALIGN JUMP_ALIGN
|
---|
| 124 | .CheckNextMenuitem:
|
---|
| 125 | test BYTE [si+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
|
---|
| 126 | jz SHORT .PrepareToLoop
|
---|
| 127 | dec ax
|
---|
| 128 | jz SHORT .MenuitemFound
|
---|
| 129 | .PrepareToLoop:
|
---|
| 130 | add si, BYTE MENUITEM_size
|
---|
| 131 | loop .CheckNextMenuitem
|
---|
| 132 | .MenuitemNotFound:
|
---|
| 133 | clc
|
---|
| 134 | ret
|
---|
| 135 | ALIGN JUMP_ALIGN
|
---|
| 136 | .MenuitemFound:
|
---|
| 137 | stc
|
---|
| 138 | ret
|
---|