Mail Archives: djgpp/1995/06/21/17:25:35
In article <3s7m1a$85d AT newsbf02 DOT news DOT aol DOT com>,
Count0Int <count0int AT aol DOT com> wrote:
> Could someone help me out. As far as I see, when switching pages in
>various graphic modes (Mode X in this case), it requires the passing of a
>segment and an offset. Could someone explain to me what I would call to
>switch pages in this case, as I've tried to obvious ...
You need to output the low address 8-bits followed by the high 8-bits to
the CRTC Register (0x3d4). This should be done during vertical retrace
to avoid flicker. The words written are formatted like:
Low WORD = 0xYY0d
High WORD = 0xZZ0c
where the address of the page offset is 0xZZYY. This is the offset
from the start of the 64k graphics page (0xa0000).
The function attached is a gas conversion of the show_page function
from the XSHARP graphics package.
Hope this helps,
Paul
/********************************************************************/
/* x_show_page(WORD PageOffset); - sets visible page, waits for VR */
/* %ebp+8 */
/********************************************************************/
_x_show_page:
pushl %ebp
movl %esp, %ebp
/* Pre-load for fastest flip after Display Enable */
movb $0x0d, %bl /* 0x0d - start address low */
movb 8(%ebp), %bh
movb $0x0c, %cl /* 0x0c - start address high */
movb 9(%ebp), %ch
movw $0x3da, %dx /* Input Status 1 */
WaitDE:
inb %dx, %al
test $1, %al
jnz WaitDE
/* DE is now active low - set start offset in display memory */
movw $0x3d4, %dx /* CRTC Index */
movw %bx, %ax
outw %ax, %dx
movw %cx, %ax
outw %ax, %dx
movw $0x3da, %dx /* Input Status 1 */
/* Wait for VSync so other page will be invisible when we draw */
WaitVS:
inb %dx, %al
test $8, %al
jz WaitVS
pop %ebp
ret
- Raw text -