(Horizontal Panning Register - HPR) (13) - 4


*

*.Sample scroll.c

**/

void VerScroll(unsigned offset) {

unsigned start_addr_reg, preset_row_reg;

div_t res;

BIOS_VAR _far *bios_var_ptr;

bios_var_ptr = (BIOS_VAR _far *) FP_MAKE(0x0000, 0x0410);

res = div(offset,bios_var_ptr -> wCharHigh);

start_addr_reg = res.quot * (bios_var_ptr -> wColumns);

preset_row_reg = res.rem;

_asm {

push ds

; 1 (3BAh/3DAh)

xor ax,ax

mov es,ax

mov dx,es:[463h]

add dx,6

;

in al,dx

nop

nop

test al,08h

jz wait_on

wait_off:

in al,dx

nop

nop

test al,08h

jnz wait_off

wait_on:

in al,dx

nop

nop

test al,08h

jz wait_on

;

sub dx,6

;

mov al,0Dh

out dx,al

inc dx

mov ax,start_addr_reg

out dx,al

dec dx

;

mov al,0Ch

out dx,al

inc dx

mov al,ah

out dx,al

; 1

add dx,5

;

wait_next:

in al,dx

nop

nop

test al,08h

jz wait_next