Post by remark on Apr 18, 2017 12:53:58 GMT
This program shows how to scroll from right to left, according to the method described on page 323 in the C128 PRG. It is an adaptation from the vertical scroll program by tokra in the thread
VDC Smooth scroll register "Flicker" bug (in Demoscene). The program scrolls one character to far, but i leave that to others to correct. There is no flickering.
Usage: bload the program and do a sys4864.
hscroll.prg (188 B)
EDIT: I put the attribute memory at $0800, this should have been $1000 (not corrected in source or program)
VDC Smooth scroll register "Flicker" bug (in Demoscene). The program scrolls one character to far, but i leave that to others to correct. There is no flickering.
Usage: bload the program and do a sys4864.
;
;usage:
; bload"hscroll.prg"
; sys4864
;
*=$1300
lda #80 ;numbers of columns to scroll
sta cols
lda #7 ;start value of softscroll
sta soft
lda #0
sta scn_hi ;screenbase pointer ($0000)
lda #8
sta atr_hi ;attributebase pointer ($0800)
lda #0
sta scn_lo
sta atr_lo
sei
lda #80 ;set virtual screen to 160 columns (+80)
ldx #27
stx $d600
wait1 bit $d600
bpl wait1
sta $d601
main lda #$20 ;wait until really in vblank
wait2 bit $d600
bne wait2
wait3 lda #$20
bit $d600
beq wait3
lda soft ;update hor. softscroll register
ora #$40 ;enable attributes
ldx #25
stx $d600
wait4 bit $d600
bpl wait4
sta $d601
dec soft
bne flag3
lda #$07
sta soft
lda scn_lo ;increase base pointers
clc
adc #1
sta scn_lo
sta atr_lo
bcc flag1
inc scn_hi
inc atr_hi
flag1 lda scn_hi ;update screenbase pointer
ldx #12
stx $d600
wait5 bit $d600
bpl wait5
sta $d601
lda scn_lo
ldx #13
stx $d600
wait6 bit $d600
bpl wait6
sta $d601
lda atr_hi ;update attributebase pointer
ldx #20
stx $d600
wait7 bit $d600
bpl wait7
sta $d601
lda atr_lo
ldx #21
stx $d600
wait8 bit $d600
bpl wait8
sta $d601
flag2 dec cols
beq end
flag3 jmp main
end cli
rts
cols byte 0
soft byte 0
scn_hi byte 0
scn_lo byte 0
atr_hi byte 0
atr_lo byte 0
hscroll.prg (188 B)
EDIT: I put the attribute memory at $0800, this should have been $1000 (not corrected in source or program)