!to "p4vscroll.prg",cbm
; Basicstart
*= $1001
!byte $0c,$10,$0a,$00,$9e,$34,$31,$30,$39,$00,$00,$00
; main
*=$100d
;--------------------------------------------------
; Commodore 16 Y-Scroll
;--------------------------------------------------
sei
ldx #$00
txs
lda #$93
jsr $ffd2
ldx #$27
- lda text,x
sta $0fc0,x
dex
bpl -
lda #$00
sta $0f
sta $0e
sta $10
lda #$c0
sta $0a
sta $0c
lda #$0f
sta $0b
sta $0d
lda #$00
tax
tay
lda #<vscroll
sta $0314
lda #>vscroll
sta $0315
cli
jmp*
vscroll:
lda $10 ; direction 0: up ; 1:down
bne ++
lda $0f
cmp #$14 ; upper line
beq +
jmp up
+ inc $10
jmp ex_
++ lda $0f
cmp #$04 ; lower line
beq +
jmp down
+ dec $10
skip: jmp ex_
up:
- lda $ff1d ; Current position of vertical scanning.
cmp #$ff ; wait for rasterline , lower: faster
bne -
++ lda $0e
and #$07
ora #%00010000 ; screen on, 24 lines
sta $ff06 ; write bit 0-2: Vertical smooth-scrolling
and #$07
beq +
dec $0e ; softscroll again
jmp ex_
+ inc $0f ;
sec
lda $0c ; sbc #40 for next line
sbc #$28
sta $0c
bcs +
dec $0d
sec
+ ldy #$27 ; hardscroll
- lda ($0a),y ; get old line
sta ($0c),y ; move up
dey
bcs +
dec $0b
+ bpl -
lda #$20 ; delete old line
ldy #$27
- sta ($0a),y
dey
bpl -
sec ; calculate next line
lda $0a
sbc #$28
sta $0a
bcs ++
dec $0b
++ jmp ex_
down:
lda $ff1d
cmp #$ff ; wait for rasterline , lower: faster
bne down
lda $0e ; softscroll-bits
and #$07
sta $0e
ora #%00010000 ; screen on, 24 lines
sta $ff06 ; write bit 0-2: Vertical smooth-scrolling
and #$07
cmp #$07 ; 8 bits ?
beq + ; do hardscroll
inc $0e ; softscroll again
jmp skip
+ dec $0f
clc
lda $0c ; adc #40 for next line
adc #$28
sta $0c
bcc +
inc $0d
+ sec
ldy #$27 ; hardscroll
- lda ($0a),y ; get old line
sta ($0c),y ; move up
dey
bcs +
dec $0b
+ bpl -
lda #$20 ; delete old line
ldy #$27
- sta ($0a),y
dey
bpl -
clc ; calculate next line
lda $0a
adc #$28
sta $0a
bcc ex_
inc $0b
ex_: pla
tay
pla
tax
pla
rti
text:
!scr "!!!! the crazy jumping plus/4 text !!!!!"Letzte Änderung: 2020-12-28 20:52:17