source: xtideuniversalbios/trunk/Assembly_Library/Inc/CgaSnow.inc@ 625

Last change on this file since 625 was 624, checked in by Krister Nordvall, 2 years ago

Changes:

  • The BIOS version string has been changed to show the repository revision number instead of the useless "v2.0.0 beta 3+" string. In other words, the seemingly never ending beta is finally over! The version string is now updated by TortoiseSVN client side hook scripts (residing in \Tools) to be used when committing changes to the repository. It should also be possible to use these scripts with other subversion clients under Windows since they are essentially just regular batch (cmd) files!
  • The eSEG_STR macro has been changed to always disable interrupts. The workaround used for the buggy, early revisions of the 8088/8086 CPUs apparently does not work. Many thanks to Jim Leonard (Trixter) for reporting this problem!
  • Minor optimizations to the eBSF and eBSR macros.
File size: 2.3 KB
Line 
1; Project name : Assembly Library
2; Description : Macros for preventing CGA snow.
3%ifndef CGASNOW_INC
4%define CGASNOW_INC
5
6;--------------------------------------------------------------------
7; CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN
8; JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN
9; Parameters:
10; %1: Instruction that accesses CGA memory
11; AL: Character to output
12; AH: Attribute to output (stosw only)
13; DS: BDA segment (zero)
14; ES:SI: Ptr to video memory where to read from (if %1 reads)
15; ES:DI: Ptr to video memory where to output (if %1 writes)
16; Returns:
17; SI, DI: Updated according to instruction
18; Corrupts registers:
19; AX, DX
20;--------------------------------------------------------------------
21%macro CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN 1
22%ifdef ELIMINATE_CGA_SNOW
23 %ifidn %1, stosb
24 call CgaSnow_Stosb
25 %elifidn %1, stosw
26 call CgaSnow_Stosw
27 %elifidn %1, rep movsb
28 call CgaSnow_RepMovsb
29 %else
30 %error "Invalid instruction passed to CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN"
31 %endif
32%else ; No CGA snow prevention
33 %ifidn %1, rep movsb
34 eSEG_STR rep, es, movsb
35 %else
36 %1 ; Single instruction
37 %endif
38%endif
39%endmacro
40
41%macro JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN 1
42%ifdef ELIMINATE_CGA_SNOW
43 %ifidn %1, stosb
44 jmp CgaSnow_Stosb
45 %elifidn %1, stosw
46 jmp CgaSnow_Stosw
47 %elifidn %1, rep movsb
48 jmp CgaSnow_RepMovsb
49 %else
50 %error "Invalid instruction passed to JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN"
51 %endif
52%else ; No CGA snow prevention
53 %ifidn %1, rep movsb
54 eSEG_STR rep, es, movsb
55 ret
56 %else
57 %1 ; Single instruction
58 ret
59 %endif
60%endif
61%endmacro
62
63
64;--------------------------------------------------------------------
65; WAIT_UNTIL_SAFE_CGA_WRITE
66; Parameters:
67; DX: CGA Status Register Address (3DAh)
68; Returns:
69; Nothing
70; Corrupts registers:
71; AL
72;--------------------------------------------------------------------
73%macro WAIT_UNTIL_SAFE_CGA_WRITE 0
74%%WaitUntilNotInRetrace:
75 in al, dx
76 shr al, 1 ; 1 = Bit 0: A 1 indicates that regen-buffer memory access can be
77 ; made without interfering with the display. (H or V retrace)
78 jc SHORT %%WaitUntilNotInRetrace
79%%WaitUntilNextRetraceStarts:
80 in al, dx
81 shr al, 1
82 jnc SHORT %%WaitUntilNextRetraceStarts
83%endmacro
84
85
86%endif ; CGASNOW_INC
Note: See TracBrowser for help on using the repository browser.