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

Last change on this file since 48 was 48, checked in by aitotat, 14 years ago

Changes to Assembly Library:
Added functions to clear Menu Title and Information areas.
Implemented automatic line change when writing Menu Title and Information areas.
CGA snow related functions have been moved to CgaSnow.asm.
Keyboard input functions no longer produce beep for backspace.

File size: 2.0 KB
Line 
1; File name     :   CgaSnow.inc
2; Project name  :   AssemblyLibrary
3; Created date  :   8.10.2010
4; Last update   :   8.10.2010
5; Author        :   Tomi Tilli
6; Description   :   Macros for preventing CGA snow.
7%ifndef CGASNOW_INC
8%define CGASNOW_INC
9
10;--------------------------------------------------------------------
11; WAIT_RETRACE_IF_NECESSARY_THEN
12;   Parameters:
13;       %1:     Instruction that accessed CGA memory
14;       AL:     Character to output
15;       AH:     Attribute to output (stosw only)
16;       DS:     BDA segment (zero)
17;       ES:SI:  Ptr to video memory where to read from (if %1 reads)
18;       ES:DI:  Ptr to video memory where to output (if %1 writes)
19;   Returns:
20;       SI, DI: Updated according to instruction
21;   Corrupts registers:
22;       AX, DX
23;--------------------------------------------------------------------
24%macro WAIT_RETRACE_IF_NECESSARY_THEN 1
25%ifdef ELIMINATE_CGA_SNOW
26    %ifidn %1, stosb
27        call    CgaSnow_StosbWithoutCgaSnow
28    %elifidn %1, stosw
29        call    CgaSnow_StoswWithoutCgaSnow
30    %elifidn %1, scasb
31        call    CgaSnow_ScasbWithoutCgaSnow
32    %elifidn %1, rep movsb
33        call    CgaSnow_RepMovsbWithoutCgaSnow
34    %else
35        %error  "Invalid instruction passed to WAIT_RETRACE_IF_NECESSARY_THEN"
36    %endif
37%else   ; No CGA snow prevention
38    %ifidn %1, rep movsb
39        eSEG_STR rep, es, movsb
40    %else
41        %1  ; Single instruction
42    %endif
43%endif
44%endmacro
45
46
47;--------------------------------------------------------------------
48; WAIT_UNTIL_SAFE_CGA_WRITE
49;   Parameters:
50;       DX:     CGA Status Register Address (3DAh)
51;   Returns:
52;       Nothing
53;   Corrupts registers:
54;       AL
55;--------------------------------------------------------------------
56%macro WAIT_UNTIL_SAFE_CGA_WRITE 0
57%%WaitUntilNotInRetrace:
58    in      al, dx
59    shr     al, 1   ; 1 = Bit 0: A 1 indicates that regen-buffer memory access can be
60                    ; made without interfering with the display. (H or V retrace)
61    jc      SHORT %%WaitUntilNotInRetrace
62%%WaitUntilNextRetraceStarts:
63    in      al, dx
64    shr     al, 1
65    jnc     SHORT %%WaitUntilNextRetraceStarts
66%endmacro
67
68
69%endif ; CGASNOW_INC
Note: See TracBrowser for help on using the repository browser.