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 |
---|
9 | SECTION .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 | ;-------------------------------------------------------------------- |
---|
27 | ALIGN JUMP_ALIGN |
---|
28 | MenuCharOut_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 | |
---|
36 | ALIGN JUMP_ALIGN |
---|
37 | MenuCharOut_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 | ;-------------------------------------------------------------------- |
---|
57 | ALIGN JUMP_ALIGN |
---|
58 | MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine: |
---|
59 | mov al, LF |
---|
60 | call DisplayCharOut_BiosTeletypeOutput |
---|
61 | ; Fall to PrintCRandAdjustOffsetForStartOfLine |
---|
62 | |
---|
63 | ALIGN JUMP_ALIGN |
---|
64 | PrintCRandAdjustOffsetForStartOfLine: |
---|
65 | mov al, CR |
---|
66 | call DisplayCharOut_BiosTeletypeOutput |
---|
67 | eMOVZX ax, BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam] |
---|
68 | add di, ax |
---|
69 | ReturnSinceNoNeedToStartLineWithControlCharacter: |
---|
70 | ret |
---|