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

Last change on this file since 54 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
RevLine 
[41]1; File name     :   MenuCharOut.asm
2; Project name  :   Assembly Library
3; Created date  :   15.7.2010
[52]4; Last update   :   12.10.2010
[41]5; Author        :   Tomi Tilli
6; Description   :   Character out function for printing withing menu window.
7
8; Section containing code
9SECTION .text
10
11;--------------------------------------------------------------------
[52]12; MenuCharOut_MenuTeletypeOutputWithAutomaticLineChange
13; MenuCharOut_MenuTeletypeOutput
[41]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
[52]19;       [DISPLAY_CONTEXT.wCharOutParam]:
20;               Low byte  = First column offset (after CR)
21;               High byte = Last column offset (when using automatic line change)
[41]22;   Returns:
23;       DI:     Incremented for next character
24;   Corrupts registers:
25;       AX, DX
26;--------------------------------------------------------------------
27ALIGN JUMP_ALIGN
[52]28MenuCharOut_MenuTeletypeOutputWithAutomaticLineChange:
29    call    CharOutLineSplitter_IsCursorAtTheEndOfTextLine
30    jnc     SHORT MenuCharOut_MenuTeletypeOutput
31    cmp     al, ' '
32    jb      SHORT ReturnSinceNoNeedToStartLineWithControlCharacter
33    call    CharOutLineSplitter_MovePartialWordToNewTextLine
[48]34    ; Fall to MenuCharOut_MenuTextTeletypeOutputWithAttribute
35
36ALIGN JUMP_ALIGN
[52]37MenuCharOut_MenuTeletypeOutput:
38    cmp     al, CR
39    je      SHORT PrintCRandAdjustOffsetForStartOfLine
[41]40    jmp     DisplayCharOut_TeletypeOutputWithAttribute
41
[48]42
43;--------------------------------------------------------------------
[52]44; MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine
45; PrintCRandAdjustOffsetForStartOfLine
[48]46;   Parameters:
47;       DS:     BDA segment (zero)
48;       ES:DI:  Ptr to cursor location
[52]49;       [DISPLAY_CONTEXT.wCharOutParam]:
50;               Low byte  = First column offset (after CR)
51;               High byte = Last column offset (when using automatic line change)
[48]52;   Returns:
53;       ES:DI:  Ptr to beginning of new line
54;   Corrupts registers:
55;       AX, DX
56;--------------------------------------------------------------------
57ALIGN JUMP_ALIGN
[52]58MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine:
[48]59    mov     al, LF
60    call    DisplayCharOut_BiosTeletypeOutput
[52]61    ; Fall to PrintCRandAdjustOffsetForStartOfLine
[48]62
63ALIGN JUMP_ALIGN
[52]64PrintCRandAdjustOffsetForStartOfLine:
65    mov     al, CR
[48]66    call    DisplayCharOut_BiosTeletypeOutput
[52]67    eMOVZX  ax, BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam]
68    add     di, ax
69ReturnSinceNoNeedToStartLineWithControlCharacter:
[41]70    ret
Note: See TracBrowser for help on using the repository browser.