source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/MenuCharOut.asm@ 43

Last change on this file since 43 was 41, checked in by Tomi Tilli, 14 years ago

Initial commit for Assembly Library.

File size: 3.1 KB
RevLine 
[41]1; File name : MenuCharOut.asm
2; Project name : Assembly Library
3; Created date : 15.7.2010
4; Last update : 4.8.2010
5; Author : Tomi Tilli
6; Description : Character out function for printing withing menu window.
7
8; Section containing code
9SECTION .text
10
11;--------------------------------------------------------------------
12; MenuCharOut_MenuBorderTeletypeOutputWithAttribute
13; Parameters:
14; AL: Character to output
15; AH: Attribute to output
16; DS: BDA segment (zero)
17; ES:DI: Ptr to video memory where to output
18; Returns:
19; DI: Incremented for next character
20; Corrupts registers:
21; AX, DX
22;--------------------------------------------------------------------
23ALIGN JUMP_ALIGN
24MenuCharOut_MenuBorderTeletypeOutputWithAttribute:
25 cmp al, CR ; Carriage return?
26 je SHORT .PrintCRandAdjustColumnToMenuBorders
27 jmp DisplayCharOut_TeletypeOutputWithAttribute
28
29ALIGN JUMP_ALIGN
30.PrintCRandAdjustColumnToMenuBorders:
31 call DisplayCharOut_TeletypeOutputWithAttribute
32 xor ax, ax ; No offset, cursor to start of border
33 jmp SHORT SetCursorToNextMenuLine
34
35
36;--------------------------------------------------------------------
37; MenuCharOut_MenuTextTeletypeOutputWithAttribute
38; Parameters:
39; AL: Character to output
40; AH: Attribute to output
41; DS: BDA segment (zero)
42; ES:DI: Ptr to video memory where to output
43; Returns:
44; DI: Incremented for next character
45; Corrupts registers:
46; AX, DX
47;--------------------------------------------------------------------
48ALIGN JUMP_ALIGN
49MenuCharOut_MenuTextTeletypeOutputWithAttribute:
50 cmp al, CR ; Carriage return?
51 je SHORT .PrintCRandAdjustColumnToMenuText
52 jmp DisplayCharOut_TeletypeOutputWithAttribute
53
54ALIGN JUMP_ALIGN
55.PrintCRandAdjustColumnToMenuText:
56 call DisplayCharOut_TeletypeOutputWithAttribute
57 mov al, MENU_TEXT_COLUMN_OFFSET ; Offset to start of text
58 ; Fall to SetCursorToNextMenuLine
59
60;--------------------------------------------------------------------
61; SetCursorToNextMenuLine
62; Parameters:
63; AL: Column offset from start of borders
64; DS: BDA segment (zero)
65; ES:DI: Ptr to video memory where to output
66; Returns:
67; DI: Adjusted for next line
68; Corrupts registers:
69; AX, DX
70;--------------------------------------------------------------------
71ALIGN JUMP_ALIGN
72SetCursorToNextMenuLine:
73 push bp
74
75 mov bp, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam]
76 call .AddCoordinatesForNewBorderLineToAX
77 call DisplayCursor_SetCoordinatesFromAX ; Updates DI
78
79 pop bp
80 ret
81
82;--------------------------------------------------------------------
83; .AddCoordinatesForNewBorderLineToAX
84; Parameters:
85; AL: Column offset from start of borders
86; DS: BDA segment (zero)
87; SS:BP: Ptr to MENU
88; Returns:
89; AX: Coordinates for new line
90; Corrupts registers:
91; DX
92;--------------------------------------------------------------------
93ALIGN JUMP_ALIGN
94.AddCoordinatesForNewBorderLineToAX:
95 call MenuLocation_AddTitleBordersTopLeftCoordinatesToAX
96 push ax
97 call DisplayCursor_GetSoftwareCoordinatesToAX
98 pop dx
99 mov al, dl ; Adjust column to borders
100 ret
Note: See TracBrowser for help on using the repository browser.