[41] | 1 | ; Project name : Assembly Library
|
---|
| 2 | ; Description : Functions for calculation menu window dimensions.
|
---|
| 3 |
|
---|
| 4 | ; Section containing code
|
---|
| 5 | SECTION .text
|
---|
| 6 |
|
---|
| 7 | ;--------------------------------------------------------------------
|
---|
| 8 | ; MenuLocation_GetTextCoordinatesToAXforItemInAX
|
---|
| 9 | ; Parameters
|
---|
| 10 | ; AX: Item index
|
---|
| 11 | ; SS:BP: Ptr to MENU
|
---|
| 12 | ; Returns:
|
---|
| 13 | ; AL: Column (X)
|
---|
| 14 | ; AH: Row (Y)
|
---|
| 15 | ; Corrupts registers:
|
---|
| 16 | ; Nothing
|
---|
| 17 | ;--------------------------------------------------------------------
|
---|
[369] | 18 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 19 | MenuLocation_GetTextCoordinatesToAXforItemInAX:
|
---|
| 20 | sub ax, [bp+MENU.wFirstVisibleItem] ; Item to line
|
---|
| 21 | xchg al, ah ; Line to AH, clear AL
|
---|
| 22 | add ax, (MENU_TEXT_ROW_OFFSET<<8) | MENU_TEXT_COLUMN_OFFSET
|
---|
[181] | 23 | SKIP2B f ; cmp ax, <next instruction>
|
---|
| 24 | ; Fall to MenuLocation_GetItemBordersTopLeftCoordinatesToAX
|
---|
[41] | 25 |
|
---|
| 26 | ;--------------------------------------------------------------------
|
---|
[181] | 27 | ; MenuLocation_GetItemBordersTopLeftCoordinatesToAX
|
---|
| 28 | ; MenuLocation_GetTitleTextTopLeftCoordinatesToAX
|
---|
[41] | 29 | ; MenuLocation_GetTitleBordersTopLeftCoordinatesToAX
|
---|
[181] | 30 | ; MenuLocation_GetInformationTextTopLeftCoordinatesToAX
|
---|
[41] | 31 | ; MenuLocation_GetBottomBordersTopLeftCoordinatesToAX
|
---|
| 32 | ; Parameters
|
---|
| 33 | ; SS:BP: Ptr to MENU
|
---|
| 34 | ; Returns:
|
---|
| 35 | ; AL: Column (X)
|
---|
| 36 | ; AH: Row (Y)
|
---|
| 37 | ; Corrupts registers:
|
---|
| 38 | ; Nothing
|
---|
| 39 | ;--------------------------------------------------------------------
|
---|
[181] | 40 | MenuLocation_GetItemBordersTopLeftCoordinatesToAX:
|
---|
| 41 | xor ax, ax
|
---|
| 42 | jmp SHORT AddItemBordersTopLeftCoordinatesToAX
|
---|
| 43 |
|
---|
[369] | 44 | ALIGN MENU_JUMP_ALIGN
|
---|
[181] | 45 | MenuLocation_GetTitleTextTopLeftCoordinatesToAX:
|
---|
| 46 | mov ax, (MENU_TEXT_ROW_OFFSET<<8) | MENU_TEXT_COLUMN_OFFSET
|
---|
| 47 | SKIP2B f ; cmp ax, <next instruction>
|
---|
[41] | 48 | MenuLocation_GetTitleBordersTopLeftCoordinatesToAX:
|
---|
| 49 | xor ax, ax
|
---|
| 50 | jmp SHORT MenuLocation_AddTitleBordersTopLeftCoordinatesToAX
|
---|
| 51 |
|
---|
[369] | 52 | ALIGN MENU_JUMP_ALIGN
|
---|
[181] | 53 | MenuLocation_GetInformationTextTopLeftCoordinatesToAX:
|
---|
| 54 | mov ax, (MENU_TEXT_ROW_OFFSET<<8) | MENU_TEXT_COLUMN_OFFSET
|
---|
| 55 | jmp SHORT AddInformationBordersTopLeftCoordinatesToAX
|
---|
[41] | 56 |
|
---|
[369] | 57 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 58 | MenuLocation_GetBottomBordersTopLeftCoordinatesToAX:
|
---|
| 59 | xor ax, ax
|
---|
[104] | 60 | ; Fall to .AddBottomBordersTopLeftCoordinatesToAX
|
---|
[41] | 61 |
|
---|
| 62 | ;--------------------------------------------------------------------
|
---|
[104] | 63 | ; .AddBottomBordersTopLeftCoordinatesToAX
|
---|
[41] | 64 | ; AddInformationBordersTopLeftCoordinatesToAX
|
---|
| 65 | ; AddItemBordersTopLeftCoordinatesToAX
|
---|
| 66 | ; MenuLocation_AddTitleBordersTopLeftCoordinatesToAX
|
---|
| 67 | ; Parameters
|
---|
| 68 | ; AX: Zero of offset
|
---|
| 69 | ; SS:BP: Ptr to MENU
|
---|
| 70 | ; Returns:
|
---|
| 71 | ; AL: Column (X)
|
---|
| 72 | ; AH: Row (Y)
|
---|
| 73 | ; Corrupts registers:
|
---|
| 74 | ; Nothing
|
---|
| 75 | ;--------------------------------------------------------------------
|
---|
[104] | 76 | .AddBottomBordersTopLeftCoordinatesToAX:
|
---|
[41] | 77 | stc ; Compensate for Information top border
|
---|
| 78 | adc ah, [bp+MENUINIT.bInfoLines]
|
---|
[369] | 79 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 80 | AddInformationBordersTopLeftCoordinatesToAX:
|
---|
| 81 | push cx
|
---|
| 82 | call MenuScrollbars_GetMaxVisibleItemsOnPageToCX
|
---|
| 83 | inc cx ; Compensate for Items top border
|
---|
| 84 | add ah, cl
|
---|
| 85 | pop cx
|
---|
[369] | 86 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 87 | AddItemBordersTopLeftCoordinatesToAX:
|
---|
| 88 | stc ; Compensate for Title top border
|
---|
| 89 | adc ah, [bp+MENUINIT.bTitleLines]
|
---|
[369] | 90 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 91 | MenuLocation_AddTitleBordersTopLeftCoordinatesToAX:
|
---|
| 92 | push di
|
---|
| 93 | push ax
|
---|
| 94 | CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
|
---|
| 95 | sub al, [bp+MENUINIT.bWidth]
|
---|
| 96 | sub ah, [bp+MENUINIT.bHeight]
|
---|
| 97 | shr al, 1
|
---|
| 98 | shr ah, 1
|
---|
| 99 | pop di ; Old AX to DI
|
---|
| 100 | add ax, di ; Add old AX to menu top left coordinates
|
---|
| 101 | pop di
|
---|
| 102 | ret
|
---|
| 103 |
|
---|
| 104 |
|
---|
| 105 | ;--------------------------------------------------------------------
|
---|
| 106 | ; MenuLocation_GetMaxTextLineLengthToAX
|
---|
| 107 | ; Parameters
|
---|
| 108 | ; SS:BP: Ptr to MENU
|
---|
| 109 | ; Returns:
|
---|
| 110 | ; AX: Maximum text line length in characters
|
---|
| 111 | ; Corrupts registers:
|
---|
| 112 | ; Nothing
|
---|
| 113 | ;--------------------------------------------------------------------
|
---|
[369] | 114 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 115 | MenuLocation_GetMaxTextLineLengthToAX:
|
---|
[293] | 116 | eMOVZX ax, [bp+MENUINIT.bWidth]
|
---|
[41] | 117 | sub ax, BYTE MENU_HORIZONTAL_BORDER_LINES + MENU_TEXT_COLUMN_OFFSET
|
---|
| 118 | ret
|
---|