[41] | 1 | ; Project name : Assembly Library |
---|
| 2 | ; Description : Character out function for printing withing menu window. |
---|
| 3 | |
---|
[376] | 4 | ; |
---|
| 5 | ; XTIDE Universal BIOS and Associated Tools |
---|
| 6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team. |
---|
| 7 | ; |
---|
| 8 | ; This program is free software; you can redistribute it and/or modify |
---|
| 9 | ; it under the terms of the GNU General Public License as published by |
---|
| 10 | ; the Free Software Foundation; either version 2 of the License, or |
---|
| 11 | ; (at your option) any later version. |
---|
| 12 | ; |
---|
| 13 | ; This program is distributed in the hope that it will be useful, |
---|
| 14 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | ; GNU General Public License for more details. |
---|
| 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
| 18 | ; |
---|
| 19 | |
---|
| 20 | |
---|
[41] | 21 | ; Section containing code |
---|
| 22 | SECTION .text |
---|
| 23 | |
---|
| 24 | ;-------------------------------------------------------------------- |
---|
[52] | 25 | ; MenuCharOut_MenuTeletypeOutputWithAutomaticLineChange |
---|
| 26 | ; MenuCharOut_MenuTeletypeOutput |
---|
[41] | 27 | ; Parameters: |
---|
| 28 | ; AL: Character to output |
---|
| 29 | ; AH: Attribute to output |
---|
| 30 | ; DS: BDA segment (zero) |
---|
| 31 | ; ES:DI: Ptr to video memory where to output |
---|
[52] | 32 | ; [DISPLAY_CONTEXT.wCharOutParam]: |
---|
| 33 | ; Low byte = First column offset (after CR) |
---|
| 34 | ; High byte = Last column offset (when using automatic line change) |
---|
[41] | 35 | ; Returns: |
---|
| 36 | ; DI: Incremented for next character |
---|
| 37 | ; Corrupts registers: |
---|
| 38 | ; AX, DX |
---|
| 39 | ;-------------------------------------------------------------------- |
---|
[369] | 40 | ALIGN MENU_JUMP_ALIGN |
---|
[52] | 41 | MenuCharOut_MenuTeletypeOutputWithAutomaticLineChange: |
---|
| 42 | call CharOutLineSplitter_IsCursorAtTheEndOfTextLine |
---|
| 43 | jnc SHORT MenuCharOut_MenuTeletypeOutput |
---|
| 44 | cmp al, ' ' |
---|
| 45 | jb SHORT ReturnSinceNoNeedToStartLineWithControlCharacter |
---|
| 46 | call CharOutLineSplitter_MovePartialWordToNewTextLine |
---|
[48] | 47 | ; Fall to MenuCharOut_MenuTextTeletypeOutputWithAttribute |
---|
| 48 | |
---|
[369] | 49 | ALIGN MENU_JUMP_ALIGN |
---|
[52] | 50 | MenuCharOut_MenuTeletypeOutput: |
---|
| 51 | cmp al, CR |
---|
| 52 | je SHORT PrintCRandAdjustOffsetForStartOfLine |
---|
[41] | 53 | jmp DisplayCharOut_TeletypeOutputWithAttribute |
---|
| 54 | |
---|
[48] | 55 | |
---|
| 56 | ;-------------------------------------------------------------------- |
---|
[52] | 57 | ; MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine |
---|
| 58 | ; PrintCRandAdjustOffsetForStartOfLine |
---|
[48] | 59 | ; Parameters: |
---|
| 60 | ; DS: BDA segment (zero) |
---|
| 61 | ; ES:DI: Ptr to cursor location |
---|
[52] | 62 | ; [DISPLAY_CONTEXT.wCharOutParam]: |
---|
| 63 | ; Low byte = First column offset (after CR) |
---|
| 64 | ; High byte = Last column offset (when using automatic line change) |
---|
[48] | 65 | ; Returns: |
---|
| 66 | ; ES:DI: Ptr to beginning of new line |
---|
| 67 | ; Corrupts registers: |
---|
| 68 | ; AX, DX |
---|
| 69 | ;-------------------------------------------------------------------- |
---|
[369] | 70 | ALIGN MENU_JUMP_ALIGN |
---|
[52] | 71 | MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine: |
---|
[48] | 72 | mov al, LF |
---|
| 73 | call DisplayCharOut_BiosTeletypeOutput |
---|
[52] | 74 | ; Fall to PrintCRandAdjustOffsetForStartOfLine |
---|
[48] | 75 | |
---|
[369] | 76 | ALIGN MENU_JUMP_ALIGN |
---|
[52] | 77 | PrintCRandAdjustOffsetForStartOfLine: |
---|
| 78 | mov al, CR |
---|
[48] | 79 | call DisplayCharOut_BiosTeletypeOutput |
---|
[293] | 80 | eMOVZX ax, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam] |
---|
[52] | 81 | add di, ax |
---|
| 82 | ReturnSinceNoNeedToStartLineWithControlCharacter: |
---|
[41] | 83 | ret |
---|