[41] | 1 | ; Project name : Assembly Library
|
---|
| 2 | ; Description : Functions for calculation menu window dimensions.
|
---|
| 3 |
|
---|
[376] | 4 | ;
|
---|
| 5 | ; XTIDE Universal BIOS and Associated Tools
|
---|
| 6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
|
---|
| 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.
|
---|
| 12 | ;
|
---|
| 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
|
---|
| 16 | ; GNU General Public License for more details.
|
---|
| 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
| 18 | ;
|
---|
| 19 |
|
---|
| 20 |
|
---|
[41] | 21 | ; Section containing code
|
---|
| 22 | SECTION .text
|
---|
| 23 |
|
---|
| 24 | ;--------------------------------------------------------------------
|
---|
| 25 | ; MenuLocation_GetTextCoordinatesToAXforItemInAX
|
---|
| 26 | ; Parameters
|
---|
| 27 | ; AX: Item index
|
---|
| 28 | ; SS:BP: Ptr to MENU
|
---|
| 29 | ; Returns:
|
---|
| 30 | ; AL: Column (X)
|
---|
| 31 | ; AH: Row (Y)
|
---|
| 32 | ; Corrupts registers:
|
---|
| 33 | ; Nothing
|
---|
| 34 | ;--------------------------------------------------------------------
|
---|
[369] | 35 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 36 | MenuLocation_GetTextCoordinatesToAXforItemInAX:
|
---|
| 37 | sub ax, [bp+MENU.wFirstVisibleItem] ; Item to line
|
---|
| 38 | xchg al, ah ; Line to AH, clear AL
|
---|
| 39 | add ax, (MENU_TEXT_ROW_OFFSET<<8) | MENU_TEXT_COLUMN_OFFSET
|
---|
[181] | 40 | SKIP2B f ; cmp ax, <next instruction>
|
---|
| 41 | ; Fall to MenuLocation_GetItemBordersTopLeftCoordinatesToAX
|
---|
[41] | 42 |
|
---|
| 43 | ;--------------------------------------------------------------------
|
---|
[181] | 44 | ; MenuLocation_GetItemBordersTopLeftCoordinatesToAX
|
---|
| 45 | ; MenuLocation_GetTitleTextTopLeftCoordinatesToAX
|
---|
[41] | 46 | ; MenuLocation_GetTitleBordersTopLeftCoordinatesToAX
|
---|
[181] | 47 | ; MenuLocation_GetInformationTextTopLeftCoordinatesToAX
|
---|
[41] | 48 | ; MenuLocation_GetBottomBordersTopLeftCoordinatesToAX
|
---|
| 49 | ; Parameters
|
---|
| 50 | ; SS:BP: Ptr to MENU
|
---|
| 51 | ; Returns:
|
---|
| 52 | ; AL: Column (X)
|
---|
| 53 | ; AH: Row (Y)
|
---|
| 54 | ; Corrupts registers:
|
---|
| 55 | ; Nothing
|
---|
| 56 | ;--------------------------------------------------------------------
|
---|
[489] | 57 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
|
---|
[181] | 58 | MenuLocation_GetItemBordersTopLeftCoordinatesToAX:
|
---|
[489] | 59 | %endif
|
---|
[181] | 60 | xor ax, ax
|
---|
| 61 | jmp SHORT AddItemBordersTopLeftCoordinatesToAX
|
---|
| 62 |
|
---|
[369] | 63 | ALIGN MENU_JUMP_ALIGN
|
---|
[181] | 64 | MenuLocation_GetTitleTextTopLeftCoordinatesToAX:
|
---|
| 65 | mov ax, (MENU_TEXT_ROW_OFFSET<<8) | MENU_TEXT_COLUMN_OFFSET
|
---|
| 66 | SKIP2B f ; cmp ax, <next instruction>
|
---|
[41] | 67 | MenuLocation_GetTitleBordersTopLeftCoordinatesToAX:
|
---|
| 68 | xor ax, ax
|
---|
| 69 | jmp SHORT MenuLocation_AddTitleBordersTopLeftCoordinatesToAX
|
---|
| 70 |
|
---|
[369] | 71 | ALIGN MENU_JUMP_ALIGN
|
---|
[181] | 72 | MenuLocation_GetInformationTextTopLeftCoordinatesToAX:
|
---|
| 73 | mov ax, (MENU_TEXT_ROW_OFFSET<<8) | MENU_TEXT_COLUMN_OFFSET
|
---|
| 74 | jmp SHORT AddInformationBordersTopLeftCoordinatesToAX
|
---|
[41] | 75 |
|
---|
[369] | 76 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 77 | MenuLocation_GetBottomBordersTopLeftCoordinatesToAX:
|
---|
| 78 | xor ax, ax
|
---|
[104] | 79 | ; Fall to .AddBottomBordersTopLeftCoordinatesToAX
|
---|
[41] | 80 |
|
---|
| 81 | ;--------------------------------------------------------------------
|
---|
[104] | 82 | ; .AddBottomBordersTopLeftCoordinatesToAX
|
---|
[41] | 83 | ; AddInformationBordersTopLeftCoordinatesToAX
|
---|
| 84 | ; AddItemBordersTopLeftCoordinatesToAX
|
---|
| 85 | ; MenuLocation_AddTitleBordersTopLeftCoordinatesToAX
|
---|
| 86 | ; Parameters
|
---|
| 87 | ; AX: Zero of offset
|
---|
| 88 | ; SS:BP: Ptr to MENU
|
---|
| 89 | ; Returns:
|
---|
| 90 | ; AL: Column (X)
|
---|
| 91 | ; AH: Row (Y)
|
---|
| 92 | ; Corrupts registers:
|
---|
| 93 | ; Nothing
|
---|
| 94 | ;--------------------------------------------------------------------
|
---|
[104] | 95 | .AddBottomBordersTopLeftCoordinatesToAX:
|
---|
[41] | 96 | stc ; Compensate for Information top border
|
---|
| 97 | adc ah, [bp+MENUINIT.bInfoLines]
|
---|
[369] | 98 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 99 | AddInformationBordersTopLeftCoordinatesToAX:
|
---|
| 100 | push cx
|
---|
| 101 | call MenuScrollbars_GetMaxVisibleItemsOnPageToCX
|
---|
| 102 | inc cx ; Compensate for Items top border
|
---|
| 103 | add ah, cl
|
---|
| 104 | pop cx
|
---|
[369] | 105 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 106 | AddItemBordersTopLeftCoordinatesToAX:
|
---|
| 107 | stc ; Compensate for Title top border
|
---|
| 108 | adc ah, [bp+MENUINIT.bTitleLines]
|
---|
[369] | 109 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 110 | MenuLocation_AddTitleBordersTopLeftCoordinatesToAX:
|
---|
| 111 | push di
|
---|
| 112 | push ax
|
---|
| 113 | CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
|
---|
| 114 | sub al, [bp+MENUINIT.bWidth]
|
---|
| 115 | sub ah, [bp+MENUINIT.bHeight]
|
---|
| 116 | shr al, 1
|
---|
| 117 | shr ah, 1
|
---|
| 118 | pop di ; Old AX to DI
|
---|
| 119 | add ax, di ; Add old AX to menu top left coordinates
|
---|
| 120 | pop di
|
---|
| 121 | ret
|
---|
| 122 |
|
---|
| 123 |
|
---|
| 124 | ;--------------------------------------------------------------------
|
---|
| 125 | ; MenuLocation_GetMaxTextLineLengthToAX
|
---|
| 126 | ; Parameters
|
---|
| 127 | ; SS:BP: Ptr to MENU
|
---|
| 128 | ; Returns:
|
---|
| 129 | ; AX: Maximum text line length in characters
|
---|
| 130 | ; Corrupts registers:
|
---|
| 131 | ; Nothing
|
---|
| 132 | ;--------------------------------------------------------------------
|
---|
[369] | 133 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 134 | MenuLocation_GetMaxTextLineLengthToAX:
|
---|
[293] | 135 | eMOVZX ax, [bp+MENUINIT.bWidth]
|
---|
[41] | 136 | sub ax, BYTE MENU_HORIZONTAL_BORDER_LINES + MENU_TEXT_COLUMN_OFFSET
|
---|
| 137 | ret
|
---|