Changeset 48 in xtideuniversalbios for trunk/Assembly_Library/Src/Display/DisplayCharOut.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/Display/DisplayCharOut.asm
r47 r48 2 2 ; Project name : Assembly Library 3 3 ; Created date : 26.6.2010 4 ; Last update : 4.10.20104 ; Last update : 8.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for outputting characters to video memory. … … 11 11 ; Section containing code 12 12 SECTION .text 13 14 ;--------------------------------------------------------------------15 ; WAIT_RETRACE_IF_NECESSARY_THEN16 ; Parameters:17 ; AL: Character to output18 ; AH: Attribute to output (stosw only)19 ; DS: BDA segment (zero)20 ; ES:DI: Ptr to video memory where to output21 ; Returns:22 ; DI: Incremented for next character23 ; Corrupts registers:24 ; AX, DX25 ;--------------------------------------------------------------------26 %macro WAIT_RETRACE_IF_NECESSARY_THEN 127 %ifdef ELIMINATE_CGA_SNOW28 %ifidn %1, stosb29 call StosbWithoutCgaSnow30 %else31 call StoswWithoutCgaSnow32 %endif33 %else34 %1 ; STOSB or STOSW35 %endif36 %endmacro37 38 13 39 14 ;-------------------------------------------------------------------- … … 155 130 .BufferFull: 156 131 ret 157 158 159 ; STOSB and STOSW replacement functions to prevent CGA snow. These will slow160 ; drawing a lot so use them only if it is necessary to eliminate CGA snow.161 %ifdef ELIMINATE_CGA_SNOW162 163 OFFSET_TO_CGA_STATUS_REGISTER EQU 6 ; Base port 3D4h + 6 = 3DAh164 CGA_STATUS_REGISTER EQU 3DAh165 166 ;--------------------------------------------------------------------167 ; WAIT_UNTIL_SAFE_CGA_WRITE168 ; Parameters:169 ; DX: CGA Status Register Address (3DAh)170 ; Returns:171 ; Nothing172 ; Corrupts registers:173 ; AL174 ;--------------------------------------------------------------------175 %macro WAIT_UNTIL_SAFE_CGA_WRITE 0176 %%WaitUntilNotInRetrace:177 in al, dx178 shr al, 1 ; 1 = Bit 0: A 1 indicates that regen-buffer memory access can be179 ; made without interfering with the display. (H or V retrace)180 jc SHORT %%WaitUntilNotInRetrace181 %%WaitUntilNextRetraceStarts:182 in al, dx183 shr al, 1184 jnc SHORT %%WaitUntilNextRetraceStarts185 %endmacro186 187 ;--------------------------------------------------------------------188 ; StosbWithoutCgaSnow189 ; StoswWithoutCgaSnow190 ; Parameters:191 ; AL: Character to output192 ; AH: Attribute to output (StoswWithoutCgaSnow only)193 ; DS: BDA segment (zero)194 ; ES:DI: Ptr to video memory where to output195 ; Returns:196 ; DI: Incremented for next character197 ; Corrupts registers:198 ; AX, DX199 ;--------------------------------------------------------------------200 ALIGN JUMP_ALIGN201 StosbWithoutCgaSnow:202 call DisplayCharOut_LoadAndVerifyStatusRegisterFromBDA203 jne SHORT .StosbWithoutWaitSinceUnknownPort204 205 mov ah, al206 cli ; Interrupt request would mess up timing207 WAIT_UNTIL_SAFE_CGA_WRITE208 mov al, ah209 .StosbWithoutWaitSinceUnknownPort:210 stosb211 sti212 ret213 214 ALIGN JUMP_ALIGN215 StoswWithoutCgaSnow:216 push bx217 call DisplayCharOut_LoadAndVerifyStatusRegisterFromBDA218 jne SHORT .StoswWithoutWaitSinceUnknownPort219 220 xchg bx, ax221 cli ; Interrupt request would mess up timing222 WAIT_UNTIL_SAFE_CGA_WRITE223 xchg ax, bx224 .StoswWithoutWaitSinceUnknownPort:225 stosw226 pop bx227 sti228 ret229 230 231 ;--------------------------------------------------------------------232 ; DisplayCharOut_LoadAndVerifyStatusRegisterFromBDA233 ; Parameters:234 ; DS: BDA segment (zero)235 ; Returns:236 ; DX: CGA Status Register Address237 ; ZF: Set if CGA Base Port found in BDA238 ; Corrupts registers:239 ; Nothing240 ;--------------------------------------------------------------------241 ALIGN JUMP_ALIGN242 DisplayCharOut_LoadAndVerifyStatusRegisterFromBDA:243 mov dx, [BDA.wVidPort]244 add dl, OFFSET_TO_CGA_STATUS_REGISTER245 cmp dx, CGA_STATUS_REGISTER246 ret247 248 %endif ; ELIMINATE_CGA_SNOW
Note:
See TracChangeset
for help on using the changeset viewer.