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

Last change on this file since 52 was 52, checked in by aitotat, 14 years ago

Changes to Assembly Library:
Completely rewritten line splitting (slower but no need to modify string).
Some changes to string processing functions.
Saved few bytes from CGA detection.

File size: 2.4 KB
Line 
1; File name     :   MenuCharOut.asm
2; Project name  :   Assembly Library
3; Created date  :   15.7.2010
4; Last update   :   12.10.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_MenuTeletypeOutputWithAutomaticLineChange
13; MenuCharOut_MenuTeletypeOutput
14;   Parameters:
15;       AL:     Character to output
16;       AH:     Attribute to output
17;       DS:     BDA segment (zero)
18;       ES:DI:  Ptr to video memory where to output
19;       [DISPLAY_CONTEXT.wCharOutParam]:
20;               Low byte  = First column offset (after CR)
21;               High byte = Last column offset (when using automatic line change)
22;   Returns:
23;       DI:     Incremented for next character
24;   Corrupts registers:
25;       AX, DX
26;--------------------------------------------------------------------
27ALIGN JUMP_ALIGN
28MenuCharOut_MenuTeletypeOutputWithAutomaticLineChange:
29    call    CharOutLineSplitter_IsCursorAtTheEndOfTextLine
30    jnc     SHORT MenuCharOut_MenuTeletypeOutput
31    cmp     al, ' '
32    jb      SHORT ReturnSinceNoNeedToStartLineWithControlCharacter
33    call    CharOutLineSplitter_MovePartialWordToNewTextLine
34    ; Fall to MenuCharOut_MenuTextTeletypeOutputWithAttribute
35
36ALIGN JUMP_ALIGN
37MenuCharOut_MenuTeletypeOutput:
38    cmp     al, CR
39    je      SHORT PrintCRandAdjustOffsetForStartOfLine
40    jmp     DisplayCharOut_TeletypeOutputWithAttribute
41
42
43;--------------------------------------------------------------------
44; MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine
45; PrintCRandAdjustOffsetForStartOfLine
46;   Parameters:
47;       DS:     BDA segment (zero)
48;       ES:DI:  Ptr to cursor location
49;       [DISPLAY_CONTEXT.wCharOutParam]:
50;               Low byte  = First column offset (after CR)
51;               High byte = Last column offset (when using automatic line change)
52;   Returns:
53;       ES:DI:  Ptr to beginning of new line
54;   Corrupts registers:
55;       AX, DX
56;--------------------------------------------------------------------
57ALIGN JUMP_ALIGN
58MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine:
59    mov     al, LF
60    call    DisplayCharOut_BiosTeletypeOutput
61    ; Fall to PrintCRandAdjustOffsetForStartOfLine
62
63ALIGN JUMP_ALIGN
64PrintCRandAdjustOffsetForStartOfLine:
65    mov     al, CR
66    call    DisplayCharOut_BiosTeletypeOutput
67    eMOVZX  ax, BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam]
68    add     di, ax
69ReturnSinceNoNeedToStartLineWithControlCharacter:
70    ret
Note: See TracBrowser for help on using the repository browser.