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

Last change on this file since 374 was 369, checked in by gregli@…, 13 years ago

Removed align directives for initalization code and added define for align in boot-time calls to the assembly library (defaulting to 1), resulting in a significant savings for the AT and 386 builds. Fixed a bug with switch command line handling in the serial server. Put in CR characters in licesnse.txt, so that it properly displays on Windows. In the configurator, added default values for user supplied CHS and LBA values, defaulting to values within range when those features are enabled. Updated the copyright message in the configurator as the literal word Copyright is important.

File size: 3.8 KB
Line 
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 MENU_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
23 SKIP2B f ; cmp ax, <next instruction>
24 ; Fall to MenuLocation_GetItemBordersTopLeftCoordinatesToAX
25
26;--------------------------------------------------------------------
27; MenuLocation_GetItemBordersTopLeftCoordinatesToAX
28; MenuLocation_GetTitleTextTopLeftCoordinatesToAX
29; MenuLocation_GetTitleBordersTopLeftCoordinatesToAX
30; MenuLocation_GetInformationTextTopLeftCoordinatesToAX
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;--------------------------------------------------------------------
40MenuLocation_GetItemBordersTopLeftCoordinatesToAX:
41 xor ax, ax
42 jmp SHORT AddItemBordersTopLeftCoordinatesToAX
43
44ALIGN MENU_JUMP_ALIGN
45MenuLocation_GetTitleTextTopLeftCoordinatesToAX:
46 mov ax, (MENU_TEXT_ROW_OFFSET<<8) | MENU_TEXT_COLUMN_OFFSET
47 SKIP2B f ; cmp ax, <next instruction>
48MenuLocation_GetTitleBordersTopLeftCoordinatesToAX:
49 xor ax, ax
50 jmp SHORT MenuLocation_AddTitleBordersTopLeftCoordinatesToAX
51
52ALIGN MENU_JUMP_ALIGN
53MenuLocation_GetInformationTextTopLeftCoordinatesToAX:
54 mov ax, (MENU_TEXT_ROW_OFFSET<<8) | MENU_TEXT_COLUMN_OFFSET
55 jmp SHORT AddInformationBordersTopLeftCoordinatesToAX
56
57ALIGN MENU_JUMP_ALIGN
58MenuLocation_GetBottomBordersTopLeftCoordinatesToAX:
59 xor ax, ax
60 ; Fall to .AddBottomBordersTopLeftCoordinatesToAX
61
62;--------------------------------------------------------------------
63; .AddBottomBordersTopLeftCoordinatesToAX
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;--------------------------------------------------------------------
76.AddBottomBordersTopLeftCoordinatesToAX:
77 stc ; Compensate for Information top border
78 adc ah, [bp+MENUINIT.bInfoLines]
79ALIGN MENU_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 MENU_JUMP_ALIGN
87AddItemBordersTopLeftCoordinatesToAX:
88 stc ; Compensate for Title top border
89 adc ah, [bp+MENUINIT.bTitleLines]
90ALIGN MENU_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 MENU_JUMP_ALIGN
115MenuLocation_GetMaxTextLineLengthToAX:
116 eMOVZX ax, [bp+MENUINIT.bWidth]
117 sub ax, BYTE MENU_HORIZONTAL_BORDER_LINES + MENU_TEXT_COLUMN_OFFSET
118 ret
Note: See TracBrowser for help on using the repository browser.