Skip to content

Instantly share code, notes, and snippets.

@og2t
Created October 23, 2010 09:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save og2t/642013 to your computer and use it in GitHub Desktop.
Save og2t/642013 to your computer and use it in GitHub Desktop.
1x1 SCROLL SIDE-FLOODER
// -------------------------------------
// 1x1 SCROLL SIDE-FLOODER
// Idea by someone from STARION
//
// Done (quite easy) by Digger
// of PETLICZEK DEZIGNS on 1996.09.18
// -------------------------------------
.var vtxt = $c0//c1
.var cadd = $c2//c3
.var charline = 24 //pos (0-24)
.var raster = <$32 + charline * 8
.var scrline = $0400 + [raster - $32] / 8 * 40
// -------------------------------------
:BasicUpstart2(run)
.pc = $0a00 //sys 2560
run: lda #$0c
jsr $e536
sei
lda #<irq
ldy #>irq
sta $0314
sty $0315
lda #<scrtxt
ldy #>scrtxt
sta vtxt
sty vtxt+1
lda #$7f
sta $dc0d
lda #$01
sta $d01a
lda #$00
sta $d021
sta $d012
lda #$1b
sta $d011
lda #$18
sta $d018
cli
jmp *
// -------------------------------------
irq: inc $d019
ldy #0 //right border
sty cadd+1
lda scrline
jsr afont
lp2r: lda (cadd),y
ldx roll
beq passr
lp1r: ror
dex
bpl lp1r
passr: and #1
tax
lda rctab,x
sta rtab,y
iny
cpy #$08
bne lp2r
ldy #0 //left border
sty cadd+1
lda scrline+$26
jsr afont
lp2l: lda (cadd),y
ldx roll
beq passl
lp1l: ror
dex
bpl lp1l
passl: and #1
tax
lda lctab,x
sta ltab,y
iny
cpy #$08
bne lp2l
lda #raster //position
cmp $d012
bne *-3
ldx #$0d
dex
bne *-1
lda roll
sta $d016
// -------------------------------------
ldy #0 //flooder
lp: lda rtab+1,y //split
sta $d020 //display
ldx #$03
dex
bne *-1
bit $00
lda ltab+1,y
sta $d020
ldx #$04
dex
bne *-1
iny
cpy #$07
bne lp
lda #0
sta $d020
lda #$08
sta $d016
lda flg
beq scroll
lda speed
eor #$01
sta speed
// -------------------------------------
// Ordinary scroll...
// (he, he - beat me it is probably the shortest variable speed 1x1 scroll routine in the world)
scroll: lda roll
sec
sbc speed
bpl nzero
and #$07
sta roll
ldy #0
rewrite: lda scrline+1,y
sta scrline,y
iny
cpy #$27
bne rewrite
ldy #0
lda (vtxt),y
bne enter
lda #<scrtxt
ldy #>scrtxt
sta vtxt
sty vtxt+1
lda roll
nzero: sta roll
jmp end
enter: sta scrline+$27
inc vtxt
bne *+4
inc vtxt+1
jmp end
// -------------------------------------
flg: brk
rtab: .byte 0,0,0,0,0,0,0,0
ltab: .byte 0,0,0,0,0,0,0,0
lctab: .byte 0,$0c //color
rctab: .byte 0,$0c
roll: .byte $07
speed: .byte 2 // speed (0-8)
// -------------------------------------
afont: asl //find char address
rol cadd+1
asl
rol cadd+1
asl
rol cadd+1
sta cadd
lda cadd+1
clc
adc #>charset
sta cadd+1
rts
end: lda $dc01
cmp #$7f
beq slow
cmp #$df
beq fast
jmp quit
slow: lda #1
sta flg
sta speed
jmp quit
fast: lda #0
sta flg
lda #2
sta speed
jmp quit
quit: inc $d019
jmp $ea81
.pc = $0d00 "Scroll Text"
scrtxt: .import c64 "scr_text.dat"
.pc = $2000 "Font"
charset: .import c64 "1x1chars.fnt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment