source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/MenuLocation.asm@ 319

Last change on this file since 319 was 293, checked in by krille_n_@…, 13 years ago

Commit 1/2 (Library, Configurators and Serial Server):

  • Changed Emulate.inc so that making 286 and 386 versions now works. Additionally, only one processor type define is needed in the makefile.
  • Minor optimizations.
  • Fixed spelling and did some cleaning.
File size: 3.8 KB
RevLine 
[41]1; Project name : Assembly Library
2; Description : Functions for calculation menu window dimensions.
3
4; Section containing code
5SECTION .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;--------------------------------------------------------------------
18ALIGN JUMP_ALIGN
19MenuLocation_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]40MenuLocation_GetItemBordersTopLeftCoordinatesToAX:
41 xor ax, ax
42 jmp SHORT AddItemBordersTopLeftCoordinatesToAX
43
[41]44ALIGN JUMP_ALIGN
[181]45MenuLocation_GetTitleTextTopLeftCoordinatesToAX:
46 mov ax, (MENU_TEXT_ROW_OFFSET<<8) | MENU_TEXT_COLUMN_OFFSET
47 SKIP2B f ; cmp ax, <next instruction>
[41]48MenuLocation_GetTitleBordersTopLeftCoordinatesToAX:
49 xor ax, ax
50 jmp SHORT MenuLocation_AddTitleBordersTopLeftCoordinatesToAX
51
52ALIGN JUMP_ALIGN
[181]53MenuLocation_GetInformationTextTopLeftCoordinatesToAX:
54 mov ax, (MENU_TEXT_ROW_OFFSET<<8) | MENU_TEXT_COLUMN_OFFSET
55 jmp SHORT AddInformationBordersTopLeftCoordinatesToAX
[41]56
57ALIGN JUMP_ALIGN
58MenuLocation_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]
79ALIGN JUMP_ALIGN
80AddInformationBordersTopLeftCoordinatesToAX:
81 push cx
82 call MenuScrollbars_GetMaxVisibleItemsOnPageToCX
83 inc cx ; Compensate for Items top border
84 add ah, cl
85 pop cx
86ALIGN JUMP_ALIGN
87AddItemBordersTopLeftCoordinatesToAX:
88 stc ; Compensate for Title top border
89 adc ah, [bp+MENUINIT.bTitleLines]
90ALIGN JUMP_ALIGN
91MenuLocation_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;--------------------------------------------------------------------
114ALIGN JUMP_ALIGN
115MenuLocation_GetMaxTextLineLengthToAX:
[293]116 eMOVZX ax, [bp+MENUINIT.bWidth]
[41]117 sub ax, BYTE MENU_HORIZONTAL_BORDER_LINES + MENU_TEXT_COLUMN_OFFSET
118 ret
Note: See TracBrowser for help on using the repository browser.