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