Changeset 48 in xtideuniversalbios for trunk/Assembly_Library/Src/Menu/MenuCharOut.asm
- Timestamp:
- Oct 8, 2010, 3:44:05 PM (15 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Src/Menu/MenuCharOut.asm
r41 r48 2 2 ; Project name : Assembly Library 3 3 ; Created date : 15.7.2010 4 ; Last update : 4.8.20104 ; Last update : 8.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Character out function for printing withing menu window. … … 29 29 ALIGN JUMP_ALIGN 30 30 .PrintCRandAdjustColumnToMenuBorders: 31 call DisplayCharOut_ TeletypeOutputWithAttribute31 call DisplayCharOut_BiosTeletypeOutput 32 32 xor ax, ax ; No offset, cursor to start of border 33 33 jmp SHORT SetCursorToNextMenuLine … … 35 35 36 36 ;-------------------------------------------------------------------- 37 ; MenuCharOut_MenuTextTeletypeOutputWithAttributeAndAutomaticLineChange 37 38 ; MenuCharOut_MenuTextTeletypeOutputWithAttribute 38 39 ; Parameters: … … 47 48 ;-------------------------------------------------------------------- 48 49 ALIGN JUMP_ALIGN 50 MenuCharOut_MenuTextTeletypeOutputWithAttributeAndAutomaticLineChange: 51 push di 52 push ax 53 mov al, DOUBLE_VERTICAL 54 add di, BYTE MENU_TEXT_COLUMN_OFFSET ; Border char comes after space 55 WAIT_RETRACE_IF_NECESSARY_THEN scasb 56 pop ax 57 pop di 58 je SHORT MovePartialWordToNewTextLineAndPrintCharacterFromAX 59 ; Fall to MenuCharOut_MenuTextTeletypeOutputWithAttribute 60 61 ALIGN JUMP_ALIGN 49 62 MenuCharOut_MenuTextTeletypeOutputWithAttribute: 50 63 cmp al, CR ; Carriage return? 51 je SHORT .PrintCRandAdjustColumnToMenuText64 je SHORT PrintCRfromALandAdjustColumnToMenuText 52 65 jmp DisplayCharOut_TeletypeOutputWithAttribute 53 66 54 ALIGN JUMP_ALIGN 55 .PrintCRandAdjustColumnToMenuText: 56 call DisplayCharOut_TeletypeOutputWithAttribute 67 68 ;-------------------------------------------------------------------- 69 ; MovePartialWordToNewTextLineAndPrintCharacterFromAX 70 ; Parameters: 71 ; AL: Character to output 72 ; AH: Attribute to output 73 ; DS: BDA segment (zero) 74 ; ES:DI: Ptr to end of text line in video memory 75 ; Returns: 76 ; DI: Incremented for next character 77 ; Corrupts registers: 78 ; AX, DX 79 ;-------------------------------------------------------------------- 80 ALIGN JUMP_ALIGN 81 MovePartialWordToNewTextLineAndPrintCharacterFromAX: 82 cmp al, ' ' 83 je SHORT .MoveCursorInDItoBeginningOfNextLine 84 push si 85 push cx 86 push ax 87 88 call .GetOffsetToPartialWordToSIandSizeToCX 89 call .MoveCursorInDItoBeginningOfNextLine 90 jcxz .NothingToMove 91 call .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX 92 .NothingToMove: 93 pop ax 94 pop cx 95 pop si 96 jmp DisplayCharOut_TeletypeOutputWithAttribute 97 98 ;-------------------------------------------------------------------- 99 ; .GetOffsetToPartialWordToSIandSizeToCX 100 ; Parameters: 101 ; ES:DI: Ptr to space before border character 102 ; Returns: 103 ; CX: Number of bytes that needs to be moved 104 ; ES:SI: Ptr to beginning of partial word that needs to be moved to new line 105 ; Corrupts registers: 106 ; Nothing 107 ;-------------------------------------------------------------------- 108 ALIGN JUMP_ALIGN 109 .GetOffsetToPartialWordToSIandSizeToCX: 110 xor cx, cx 111 mov si, di 112 ALIGN JUMP_ALIGN 113 .ScanNextCharacter: ; Space will always be found since one comes after border 114 dec si 115 dec si 116 cmp BYTE [es:si], ' ' 117 je SHORT .PartialWordFound 118 inc cx 119 jmp SHORT .ScanNextCharacter 120 ALIGN JUMP_ALIGN 121 .PartialWordFound: 122 inc si 123 inc si ; SI now points one past space 124 shl cx, 1 ; Characters to bytes 125 ret 126 127 ;-------------------------------------------------------------------- 128 ; .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX 129 ; Parameters: 130 ; CX: Number of bytes in partial word 131 ; DS: BDA segment (zero) 132 ; ES:SI: Ptr to partial word on previous line 133 ; ES:DI: Ptr to new empty line 134 ; Returns: 135 ; ES:DI: Ptr where to store next character 136 ; Corrupts registers: 137 ; AX, CX, DX, SI 138 ;-------------------------------------------------------------------- 139 ALIGN JUMP_ALIGN 140 .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX: 141 push si 142 push cx 143 WAIT_RETRACE_IF_NECESSARY_THEN rep movsb 144 pop cx 145 pop si 146 xchg di, si 147 shr cx, 1 ; Bytes to characters 148 mov al, ' ' 149 call DisplayPrint_RepeatCharacterFromALwithCountInCX 150 mov di, si 151 ret 152 153 ;-------------------------------------------------------------------- 154 ; .MoveCursorInDItoBeginningOfNextLine 155 ; Parameters: 156 ; DS: BDA segment (zero) 157 ; ES:DI: Ptr to cursor location 158 ; Returns: 159 ; ES:DI: Ptr to beginning of new line 160 ; Corrupts registers: 161 ; AX, DX 162 ;-------------------------------------------------------------------- 163 ALIGN JUMP_ALIGN 164 .MoveCursorInDItoBeginningOfNextLine: 165 mov al, LF 166 call DisplayCharOut_BiosTeletypeOutput 167 mov al, CR 168 ; Fall to PrintCRfromALandAdjustColumnToMenuText 169 170 171 ;-------------------------------------------------------------------- 172 ; PrintCRfromALandAdjustColumnToMenuText 173 ; Parameters: 174 ; AL: Character to output (CR) 175 ; DS: BDA segment (zero) 176 ; ES:DI: Ptr to video memory where to output 177 ; Returns: 178 ; DI: Incremented for next text line 179 ; Corrupts registers: 180 ; AX, DX 181 ;-------------------------------------------------------------------- 182 ALIGN JUMP_ALIGN 183 PrintCRfromALandAdjustColumnToMenuText: 184 call DisplayCharOut_BiosTeletypeOutput 57 185 mov al, MENU_TEXT_COLUMN_OFFSET ; Offset to start of text 58 186 ; Fall to SetCursorToNextMenuLine
Note:
See TracChangeset
for help on using the changeset viewer.