| | Frantic
Registered: Mar 2003 Posts: 1648 |
codebase.c64.org
Hello!
Just wanted to tell you all that the C64 codebase wiki now got a proper URL and can be accessed through:
http://codebase.c64.org/
Enjoy! Greetings to Slaygon for supplying the URL. Now you don't have to remember that old weird URL. ;)
Keep on adding your stuff!
//FTC
|
|
... 30 posts hidden. Click here to view all posts.... |
| | Oswald
Registered: Apr 2002 Posts: 5094 |
fungi, the last line of that sprite was already displayed in the prvs frame so no problems.
hmm or is this a way for 9th sprite eliminate? |
| | Fungus
Registered: Sep 2002 Posts: 686 |
well , since I can't fix the typo in my previous post ,here is another one.
;---------------------------------------
;Multiplexer 1999
;---------------------------------------
*= $2400 ;origin
ysin = $3800 ;y sinus
sort = $05 ;sort buffer
xpos = $0900 ;plot buffer
xbuf = $05+($20) ;raster buffer
ypos = $0920
ybuf = $05+($20*2)
sprc = $0940
cbuf = $05+($20*3)
sprp = $0960
pbuf = $05+($20*4)
sptr = $02
mnt = $03
cnt = $04
xofs = $04
yofs = $04
maxspr = $1f
;---------------------------------------
;game setup routines
sei
cld
ldx #$02
;jsr $1000
lda #<nmi
ldx #>nmi
sta $fffa
sta $fffc
stx $fffb
stx $fffd
lda #<ir0
ldx #>ir0
sta $fffe
stx $ffff
lda #$35
sta $01
lda #$00
sta $d020
sta $d021
sta $d012
lda #$1b
sta $d011
lda #$01
sta $d01a
lda #$1f
sta $dc0d
sta $dd0d
lda $dc0d
lda $dd0d
lda #$08
sta $d025 ;dark
lda #$0c
sta $d026 ;light
ldx #maxspr
lda #$02
ser sta sprc,x
dex
bpl ser
lda #$ff
sta $d01c
jsr mvspr
ldx #$00
fuck txa
sta sort,x
clc
adc #$90
sta sprp,x
inx
cpx #maxspr+1
bne fuck
rset ldx #$00
pols ldy sort+1,x
plis lda ypos,y
ldy sort,x
cmp ypos,y
bcc paws
inx
cpx #maxspr
bne pols
bpl edn
paws lda sort+1,x
sta sort,x
sty sort+1,x
dex
bpl pols
inx
beq plis
edn
inc $d019
lda $dc0d
lda $dd0d
cli
main lda $b0
shit cmp $b0
beq shit
; inc $d020
jsr mvspr
; jsr $1003
; dec $d020
jmp main
;---------------------------------------
;experimental
;game irq routine
ir0
pha
txa
pha
tya
pha
inc $d019
ldx #$03
b1 dex
bpl b1
lda #$00
sta $d015
inc $d020
rest ldx #$00 ;super sort
slop ldy sort+1,x
slep lda ypos,y
ldy sort,x
cmp ypos,y
bcc swap
inx
cpx #maxspr
bne slop
beq end
swap
lda sort+1,x
sta sort,x
sty sort+1,x
tay
dex
bpl slep
inx
beq slep
end
dec $d020
ldy sort ;re-order buffers
lda ypos,y
sta ybuf
lda xpos,y
sta xbuf
lda sprc,y
sta cbuf
lda sprp,y
sta pbuf
ldy sort+1
lda ypos,y
sta ybuf+1
lda xpos,y
sta xbuf+1
lda sprc,y
sta cbuf+1
lda sprp,y
sta pbuf+1
ldy sort+2
lda ypos,y
sta ybuf+2
lda xpos,y
sta xbuf+2
lda sprc,y
sta cbuf+2
lda sprp,y
sta pbuf+2
ldy sort+3
lda ypos,y
sta ybuf+3
lda xpos,y
sta xbuf+3
lda sprc,y
sta cbuf+3
lda sprp,y
sta pbuf+3
ldy sort+4
lda ypos,y
sta ybuf+4
lda xpos,y
sta xbuf+4
lda sprc,y
sta cbuf+4
lda sprp,y
sta pbuf+4
ldy sort+5
lda ypos,y
sta ybuf+5
lda xpos,y
sta xbuf+5
lda sprc,y
sta cbuf+5
lda sprp,y
sta pbuf+5
ldy sort+6
lda ypos,y
sta ybuf+6
lda xpos,y
sta xbuf+6
lda sprc,y
sta cbuf+6
lda sprp,y
sta pbuf+6
ldy sort+7
lda ypos,y
sta ybuf+7
lda xpos,y
sta xbuf+7
lda sprc,y
sta cbuf+7
lda sprp,y
sta pbuf+7
ldy sort+8
lda ypos,y
sta ybuf+8
lda xpos,y
sta xbuf+8
lda sprc,y
sta cbuf+8
lda sprp,y
sta pbuf+8
ldy sort+9
lda ypos,y
sta ybuf+9
lda xpos,y
sta xbuf+9
lda sprc,y
sta cbuf+9
lda sprp,y
sta pbuf+9
ldy sort+10
lda ypos,y
sta ybuf+10
lda xpos,y
sta xbuf+10
lda sprc,y
sta cbuf+10
lda sprp,y
sta pbuf+10
ldy sort+11
lda ypos,y
sta ybuf+11
lda xpos,y
sta xbuf+11
lda sprc,y
sta cbuf+11
lda sprp,y
sta pbuf+11
ldy sort+12
lda ypos,y
sta ybuf+12
lda xpos,y
sta xbuf+12
lda sprc,y
sta cbuf+12
lda sprp,y
sta pbuf+12
ldy sort+13
lda ypos,y
sta ybuf+13
lda xpos,y
sta xbuf+13
lda sprc,y
sta cbuf+13
lda sprp,y
sta pbuf+13
ldy sort+14
lda ypos,y
sta ybuf+14
lda xpos,y
sta xbuf+14
lda sprc,y
sta cbuf+14
lda sprp,y
sta pbuf+14
ldy sort+15
lda ypos,y
sta ybuf+15
lda xpos,y
sta xbuf+15
lda sprc,y
sta cbuf+15
lda sprp,y
sta pbuf+15
ldy sort+16
lda ypos,y
sta ybuf+16
lda xpos,y
sta xbuf+16
lda sprc,y
sta cbuf+16
lda sprp,y
sta pbuf+16
ldy sort+17
lda ypos,y
sta ybuf+17
lda xpos,y
sta xbuf+17
lda sprc,y
sta cbuf+17
lda sprp,y
sta pbuf+17
ldy sort+18
lda ypos,y
sta ybuf+18
lda xpos,y
sta xbuf+18
lda sprc,y
sta cbuf+18
lda sprp,y
sta pbuf+18
ldy sort+19
lda ypos,y
sta ybuf+19
lda xpos,y
sta xbuf+19
lda sprc,y
sta cbuf+19
lda sprp,y
sta pbuf+19
ldy sort+20
lda ypos,y
sta ybuf+20
lda xpos,y
sta xbuf+20
lda sprc,y
sta cbuf+20
lda sprp,y
sta pbuf+20
ldy sort+21
lda ypos,y
sta ybuf+21
lda xpos,y
sta xbuf+21
lda sprc,y
sta cbuf+21
lda sprp,y
sta pbuf+21
ldy sort+22
lda ypos,y
sta ybuf+22
lda xpos,y
sta xbuf+22
lda sprc,y
sta cbuf+22
lda sprp,y
sta pbuf+22
ldy sort+23
lda ypos,y
sta ybuf+23
lda xpos,y
sta xbuf+23
lda sprc,y
sta cbuf+23
lda sprp,y
sta pbuf+23
ldy sort+24
lda ypos,y
sta ybuf+24
lda xpos,y
sta xbuf+24
lda sprc,y
sta cbuf+24
lda sprp,y
sta pbuf+24
ldy sort+25
lda ypos,y
sta ybuf+25
lda xpos,y
sta xbuf+25
lda sprc,y
sta cbuf+25
lda sprp,y
sta pbuf+25
ldy sort+26
lda ypos,y
sta ybuf+26
lda xpos,y
sta xbuf+26
lda sprc,y
sta cbuf+26
lda sprp,y
sta pbuf+26
ldy sort+27
lda ypos,y
sta ybuf+27
lda xpos,y
sta xbuf+27
lda sprc,y
sta cbuf+27
lda sprp,y
sta pbuf+27
ldy sort+28
lda ypos,y
sta ybuf+28
lda xpos,y
sta xbuf+28
lda sprc,y
sta cbuf+28
lda sprp,y
sta pbuf+28
ldy sort+29
lda ypos,y
sta ybuf+29
lda xpos,y
sta xbuf+29
lda sprc,y
sta cbuf+29
lda sprp,y
sta pbuf+29
ldy sort+30
lda ypos,y
sta ybuf+30
lda xpos,y
sta xbuf+30
lda sprc,y
sta cbuf+30
lda sprp,y
sta pbuf+30
ldy sort+31
lda ypos,y
sta ybuf+31
lda xpos,y
sta xbuf+31
lda sprc,y
sta cbuf+31
lda sprp,y
sta pbuf+31
ldx #$00 ;find how many
stx sptr ;sprites
maxc lda ybuf,x
cmp #$ff
beq maxs
inx
cpx #maxspr+1
bne maxc
maxs stx cnt
cpx #$07
bcc maxm
ldx #$07
maxm stx mnt
lda #$ff
sta $d001
sta $d003
sta $d005
sta $d007
sta $d009
sta $d00b
sta $d00d
sta $d00f
inc $b0
lda #$02
sta $dd00
lda #$80
sta $d018
lda #$18
sta $d016
lda #$00
sta $d021
lda #$3b
sta $d011
lda #<ir1
sta $fffe
lda #>ir1
sta $ffff
lda #$28
sta $d012
jmp eirq
ir1
pha
txa
pha
tya
pha
inc $d019
lda #$ff
sta $d015
ldx sptr
hlop1 lda ybuf,x
sta $d001
lda xbuf,x
asl a ;rm w/mbuf
sta $d000
; lda mbuf,x
bcc no1 ;beg w/mbuf
lda $d010
ora #%00000001
bne yes1
no1 lda $d010
and #%11111110
yes1 sta $d010
lda pbuf,x
sta $63f8
lda cbuf,x
sta $d027
inx
cpx mnt
bcc hlop2
cpx cnt
bne ok1
jmp done
ok1 stx sptr
lda $d003
clc
adc #$15
cmp $d012
bcc hlop2
adc #$02
sta $d012
lda #<ir2
sta $fffe
lda #>ir2
sta $ffff
jmp eirq
ir2 pha
txa
pha
tya
pha
inc $d019
ldx sptr
hlop2 lda ybuf,x
sta $d003
lda xbuf,x
asl a
sta $d002
;lda mbuf,x
bcc no2
lda $d010
ora #%00000010
bne yes2
no2 lda $d010
and #%11111101
yes2 sta $d010
lda pbuf,x
sta $63f9
lda cbuf,x
sta $d028
inx
cpx mnt
bcc hlop3
cpx cnt
bne ok2
jmp done
ok2 stx sptr
lda $d005
clc
adc #$15
cmp $d012
bcc hlop3
adc #$02
sta $d012
lda #<ir3
sta $fffe
lda #>ir3
sta $ffff
jmp eirq
ir3 pha
txa
pha
tya
pha
inc $d019
ldx sptr
hlop3 lda ybuf,x
sta $d005
lda xbuf,x
asl a
sta $d004
;lda mbuf,x
bcc no3
lda $d010
ora #%00000100
bne yes3
no3 lda $d010
and #%11111011
yes3 sta $d010
lda pbuf,x
sta $63fa
lda cbuf,x
sta $d029
inx
cpx mnt
bcc hlop4
cpx cnt
bne ok3
jmp done
ok3 stx sptr
lda $d007
clc
adc #$15
cmp $d012
bcc hlop4
adc #$02
sta $d012
lda #<ir4
sta $fffe
lda #>ir4
sta $ffff
jmp eirq
ir4 pha
txa
pha
tya
pha
inc $d019
ldx sptr
hlop4 lda ybuf,x
sta $d007
lda xbuf,x
asl a
sta $d006
;lda mbuf,x
bcc no4
lda $d010
ora #%00001000
bne yes4
no4 lda $d010
and #%11110111
yes4 sta $d010
lda pbuf,x
sta $63fb
lda cbuf,x
sta $d02a
inx
cpx mnt
bcc hlop5
cpx cnt
bne ok4
jmp done
ok4 stx sptr
lda $d009
clc
adc #$15
cmp $d012
bcc hlop5
adc #$02
sta $d012
lda #<ir5
sta $fffe
lda #>ir5
sta $ffff
jmp eirq
ir5 pha
txa
pha
tya
pha
inc $d019
ldx sptr
hlop5 lda ybuf,x
sta $d009
lda xbuf,x
asl a
sta $d008
;lda mbuf,x
bcc no5
lda $d010
ora #%00010000
bne yes5
no5 lda $d010
and #%11101111
yes5 sta $d010
lda pbuf,x
sta $63fc
lda cbuf,x
sta $d02b
inx
cpx mnt
bcc hlop6
cpx cnt
bne ok5
jmp done
ok5 stx sptr
lda $d00b
clc
adc #$15
cmp $d012
bcc hlop6
adc #$02
sta $d012
lda #<ir6
sta $fffe
lda #>ir6
sta $ffff
jmp eirq
ir6 pha
txa
pha
tya
pha
inc $d019
ldx sptr
hlop6 lda ybuf,x
sta $d00b
lda xbuf,x
asl a
sta $d00a
; lda mbuf,x
bcc no6
lda $d010
ora #%00100000
bne yes6
no6 lda $d010
and #%11011111
yes6 sta $d010
lda pbuf,x
sta $63fd
lda cbuf,x
sta $d02c
inx
cpx mnt
bcc hlop7
cpx cnt
bne ok6
jmp done
ok6 stx sptr
lda $d00d
clc
adc #$15
cmp $d012
bcc hlop7
adc #$02
sta $d012
lda #<ir7
sta $fffe
lda #>ir7
sta $ffff
jmp eirq
ir7 pha
txa
pha
tya
pha
inc $d019
ldx sptr
hlop7 lda ybuf,x
sta $d00d
lda xbuf,x
asl a
sta $d00c
; lda mbuf,x
bcc no7
lda $d010
ora #%01000000
bne yes7
no7 lda $d010
and #%10111111
yes7 sta $d010
lda pbuf,x
sta $63fe
lda cbuf,x
sta $d02d
inx
cpx mnt
bcc hlop8
cpx cnt
bne ok7
jmp done
ok7 stx sptr
lda $d00f
clc
adc #$15
cmp $d012
bcc hlop8
adc #$02
sta $d012
lda #<ir8
sta $fffe
lda #>ir8
sta $ffff
jmp eirq
ir8 pha
txa
pha
tya
pha
inc $d019
ldx sptr
hlop8 lda ybuf,x
sta $d00f
lda xbuf,x
asl a
sta $d00e
;lda mbuf,x
bcc no8
lda $d010
ora #%10000000
bne yes8
no8 lda $d010
and #%01111111
yes8 sta $d010
lda pbuf,x
sta $63ff
lda cbuf,x
sta $d02e
inx
cpx mnt
bcc hlop9
cpx cnt
bne ok8
jmp done
ok8 stx sptr
lda $d001
clc
adc #$15
cmp $d012
bcc hlop9
adc #$02
sta $d012
lda #<ir1
sta $fffe
lda #>ir1
sta $ffff
jmp eirq
hlop9 jmp hlop1
done lda #<ir0
sta $fffe
lda #>ir0
sta $ffff
lda #$fb
sta $d012
eirq
pla
tay
pla
tax
pla
rti
;---------------------------------------
;sprite movement
mvspr
;plot y
y1 lda ysin
sta ypos
y2 lda ysin+yofs
sta ypos+1
y3 lda ysin+(yofs*2)
sta ypos+2
y4 lda ysin+(yofs*3)
sta ypos+3
y5 lda ysin+(yofs*4)
sta ypos+4
y6 lda ysin+(yofs*5)
sta ypos+5
y7 lda ysin+(yofs*6)
sta ypos+6
y8 lda ysin+(yofs*7)
sta ypos+7
y9 lda ysin+(yofs*8)
sta ypos+8
y10 lda ysin+(yofs*9)
sta ypos+9
y11 lda ysin+(yofs*10)
sta ypos+10
y12 lda ysin+(yofs*11)
sta ypos+11
y13 lda ysin+(yofs*12)
sta ypos+12
y14 lda ysin+(yofs*13)
sta ypos+13
y15 lda ysin+(yofs*14)
sta ypos+14
y16 lda ysin+(yofs*15)
sta ypos+15
y17 lda ysin+(yofs*16)
sta ypos+16
y18 lda ysin+(yofs*17)
sta ypos+17
y19 lda ysin+(yofs*18)
sta ypos+18
y20 lda ysin+(yofs*19)
sta ypos+19
y21 lda ysin+(yofs*20)
sta ypos+20
y22 lda ysin+(yofs*21)
sta ypos+21
y23 lda ysin+(yofs*22)
sta ypos+22
y24 lda ysin+(yofs*23)
sta ypos+23
y25 lda ysin+(yofs*24)
sta ypos+24
y26 lda ysin+(yofs*25)
sta ypos+25
y27 lda ysin+(yofs*26)
sta ypos+26
y28 lda ysin+(yofs*27)
sta ypos+27
y29 lda ysin+(yofs*28)
sta ypos+28
y30 lda ysin+(yofs*29)
sta ypos+29
y31 lda ysin+(yofs*30)
sta ypos+30
y32 lda ysin+(yofs*31)
sta ypos+31
;plot x
x1 lda #$00
sta xpos
x2 lda #$00+xofs
sta xpos+1
x3 lda #$00+(xofs*2)
sta xpos+2
x4 lda #$00+(xofs*3)
sta xpos+3
x5 lda #$00+(xofs*4)
sta xpos+4
x6 lda #$00+(xofs*5)
sta xpos+5
x7 lda #$00+(xofs*6)
sta xpos+6
x8 lda #$00+(xofs*7)
sta xpos+7
x9 lda #$00+(xofs*8)
sta xpos+8
x10 lda #$00+(xofs*9)
sta xpos+9
x11 lda #$00+(xofs*10)
sta xpos+10
x12 lda #$00+(xofs*11)
sta xpos+11
x13 lda #$00+(xofs*12)
sta xpos+12
x14 lda #$00+(xofs*13)
sta xpos+13
x15 lda #$00+(xofs*14)
sta xpos+14
x16 lda #$00+(xofs*15)
sta xpos+15
x17 lda #$00+(xofs*16)
sta xpos+16
x18 lda #$00+(xofs*17)
sta xpos+17
x19 lda #$00+(xofs*18)
sta xpos+18
x20 lda #$00+(xofs*19)
sta xpos+19
x21 lda #$00+(xofs*20)
sta xpos+20
x22 lda #$00+(xofs*21)
sta xpos+21
x23 lda #$00+(xofs*22)
sta xpos+22
x24 lda #$00+(xofs*23)
sta xpos+23
x25 lda #$00+(xofs*24)
sta xpos+24
x26 lda #$00+(xofs*25)
sta xpos+25
x27 lda #$00+(xofs*26)
sta xpos+26
x28 lda #$00+(xofs*27)
sta xpos+27
x29 lda #$00+(xofs*28)
sta xpos+28
x30 lda #$00+(xofs*29)
sta xpos+29
x31 lda #$00+(xofs*30)
sta xpos+30
x32 lda #$00+(xofs*31)
sta xpos+31
;jmp cx
;move y
inc y1+1
inc y2+1
inc y3+1
inc y4+1
inc y5+1
inc y6+1
inc y7+1
inc y8+1
inc y9+1
inc y10+1
inc y11+1
inc y12+1
inc y13+1
inc y14+1
inc y15+1
inc y16+1
inc y17+1
inc y18+1
inc y19+1
inc y20+1
inc y21+1
inc y22+1
inc y23+1
inc y24+1
inc y25+1
inc y26+1
inc y27+1
inc y28+1
inc y29+1
inc y30+1
inc y31+1
inc y32+1
;move x
cx
dec x1+1
dec x2+1
dec x3+1
dec x4+1
dec x5+1
dec x6+1
dec x7+1
dec x8+1
dec x9+1
dec x10+1
dec x11+1
dec x12+1
dec x13+1
dec x14+1
dec x15+1
dec x16+1
dec x17+1
dec x18+1
dec x19+1
dec x20+1
dec x21+1
dec x22+1
dec x23+1
dec x24+1
dec x25+1
dec x26+1
dec x27+1
dec x28+1
dec x29+1
dec x30+1
dec x31+1
dec x32+1
;scroll wrap
ldx #$b0
lda x1+1
cmp #$ff
bne p1
stx x1+1
p1 lda x2+1
cmp #$ff
bne p2
stx x2+1
p2 lda x3+1
cmp #$ff
bne p3
stx x3+1
p3 lda x4+1
cmp #$ff
bne p4
stx x4+1
p4 lda x5+1
cmp #$ff
bne p5
stx x5+1
p5 lda x6+1
cmp #$ff
bne p6
stx x6+1
p6 lda x7+1
cmp #$ff
bne p7
stx x7+1
p7 lda x8+1
cmp #$ff
bne p8
stx x8+1
p8 lda x9+1
cmp #$ff
bne p9
stx x9+1
p9 lda x10+1
cmp #$ff
bne p10
stx x10+1
p10 lda x11+1
cmp #$ff
bne p11
stx x11+1
p11 lda x12+1
cmp #$ff
bne p12
stx x12+1
p12 lda x13+1
cmp #$ff
bne p13
stx x13+1
p13 lda x14+1
cmp #$ff
bne p14
stx x14+1
p14 lda x15+1
cmp #$ff
bne p15
stx x15+1
p15 lda x16+1
cmp #$ff
bne p16
stx x16+1
p16 lda x17+1
cmp #$ff
bne p17
stx x17+1
p17 lda x18+1
cmp #$ff
bne p18
stx x18+1
p18 lda x19+1
cmp #$ff
bne p19
stx x19+1
p19 lda x20+1
cmp #$ff
bne p20
stx x20+1
p20 lda x21+1
cmp #$ff
bne p21
stx x21+1
p21 lda x22+1
cmp #$ff
bne p22
stx x22+1
p22 lda x23+1
cmp #$ff
bne p23
stx x23+1
p23 lda x24+1
cmp #$ff
bne p24
stx x24+1
p24 lda x25+1
cmp #$ff
bne p25
stx x25+1
p25 lda x26+1
cmp #$ff
bne p26
stx x26+1
p26 lda x27+1
cmp #$ff
bne p27
stx x27+1
p27 lda x28+1
cmp #$ff
bne p28
stx x28+1
p28 lda x29+1
cmp #$ff
bne p29
stx x29+1
p29 lda x30+1
cmp #$ff
bne p30
stx x30+1
p30 lda x31+1
cmp #$ff
bne p31
stx x31+1
p31 lda x32+1
cmp #$ff
bne p32
stx x32+1
p32 rts
;---------------------------------------
;sprite animation
;---------------------------------------
;end
nmi
lda #$37
sta $01
lda $dd0d
jmp $9000
|
| | Fungus
Registered: Sep 2002 Posts: 686 |
Here is a third unfinished one, with some minor bugs to be fixed.
;---------------------------------------
;New Multiplexer Engine
;24 sprite version
;
;Written by Fungus in 2005
;---------------------------------------
*= $2000
xofs = $06 ;x position
;offset
yofs = $06 ;x position
;offset
ysin = $3800
sort = $02 ;index
ybuf = $1a ;y position
xbuf = $32 ;x position
mbuf = $0800 ;msb of x
pbuf = $4a ;image pointer
cbuf = $52 ;-$69 ;color value
maxspr = $18 ;24 sprites
setup
sei
cld
lda #<irq0
ldx #>irq0
sta $fffe
stx $ffff
lda #<crap
ldx #>crap
sta $fffa
sta $fffc
stx $fffb
stx $fffd
lda #$01
ldx #$fb
sta $d01a
stx $d012
lda #$1b
sta $d011
lda #$7f
sta $dc0d
ldx #$17 ;init index tab
isort txa
sta sort,x
dex
bpl isort
jsr move ;init first frame
jsr super
lda #$35
sta $01
bit $dc0d
inc $d019
cli
;this routine in realtime
main
sw2 lda #$00
bne nomove
jsr move ;move sprites
jsr super
nomove
jmp main
super ldx #$00 ;super swap
a0 ldy sort+1,x ;remember sort
a1 lda ybuf,y
ldy sort,x
cmp ybuf,y
bcc swap
inx
cpx #maxspr-1
bne a0
beq send
swap lda sort+1,x
sta sort,x
sty sort+1,x
dex
bpl a1
inx
beq a1
send inc sw1+1 ;ok to swap!
rts
;this routine inside irq
irq0
pha
txa
pha
tya
pha
sw1 lda #$00 ;ok to swap?
bne doit
jmp skipit
doit dec sw1+1
inc sw2+1 ;tell main to
;wait
ldx idx ;reset end of
;irq chain
lda entab,x
sta ren+1
lda entab+1,x
sta ren+2
lda #$00
ren sta $1111
nrt ldy #$00 ;mod irqs
sty msb ;sprite values
;according to
;index table
ldx sort+0
lda ybuf,x
sta y1+1
pha
clc
adc #$15
sta r8+1
lda xbuf,x
sta x1+1
lda mbuf,x
bne no1
lda msb
ora ortab,y
bne ye1
no1 lda msb
and antab,y
ye1 sta m1+1
lda pbuf,x
sta p1+1
lda cbuf,x
sta c1+1
iny
ldx sort+1
lda ybuf,x
sta y2+1
pha
clc
adc #$15
sta r9+1
lda xbuf,x
sta x2+1
lda mbuf,x
bne no2
lda msb
ora ortab,y
bne ye2
no2 lda msb
and antab,y
ye2 sta m2+1
lda pbuf,x
sta p2+1
lda cbuf,x
sta c2+1
iny
ldx sort+2
lda ybuf,x
sta y3+1
pha
clc
adc #$15
sta r10+1
lda xbuf,x
sta x3+1
lda mbuf,x
bne no3
lda msb
ora ortab,y
bne ye3
no3 lda msb
and antab,y
ye3 sta m3+1
lda pbuf,x
sta p3+1
lda cbuf,x
sta c3+1
iny
ldx sort+3
lda ybuf,x
sta y4+1
pha
clc
adc #$15
sta r11+1
lda xbuf,x
sta x4+1
lda mbuf,x
bne no4
lda msb
ora ortab,y
bne ye4
no4 lda msb
and antab,y
ye4 sta m4+1
lda pbuf,x
sta p4+1
lda cbuf,x
sta c4+1
iny
ldx sort+4
lda ybuf,x
sta y5+1
pha
clc
adc #$15
sta r12+1
lda xbuf,x
sta x5+1
lda mbuf,x
bne no5
lda msb
ora ortab,y
bne ye5
no5 lda msb
and antab,y
ye5 sta m5+1
lda pbuf,x
sta p5+1
lda cbuf,x
sta c5+1
iny
ldx sort+5
lda ybuf,x
sta y6+1
pha
clc
adc #$15
sta r13+1
lda xbuf,x
sta x6+1
lda mbuf,x
bne no6
lda msb
ora ortab,y
bne ye6
no6 lda msb
and antab,y
ye6 sta m6+1
lda pbuf,x
sta p6+1
lda cbuf,x
sta c6+1
iny
ldx sort+6
lda ybuf,x
sta y7+1
pha
clc
adc #$15
sta r14+1
lda xbuf,x
sta x7+1
lda mbuf,x
bne no7
lda msb
ora ortab,y
bne ye7
no7 lda msb
and antab,y
ye7 sta m7+1
lda pbuf,x
sta p7+1
lda cbuf,x
sta c7+1
iny
ldx sort+7
lda ybuf,x
sta y8+1
pha
clc
adc #$15
sta r15+1
lda xbuf,x
sta x8+1
lda mbuf,x
bne no8
lda msb
ora ortab,y
bne ye8
no8 lda msb
and antab,y
ye8 sta m8+1
lda pbuf,x
sta p8+1
lda cbuf,x
sta c8+1
ldy #$00
ldx sort+8
lda ybuf,x
sta y9+1
pha
clc
adc #$15
sta r16+1
lda xbuf,x
sta x9+1
lda mbuf,x
bne no9
lda msb
ora ortab,y
bne ye9
no9 lda msb
and antab,y
ye9 sta m9+1
lda pbuf,x
sta p9+1
lda cbuf,x
sta c9+1
iny
ldx sort+10
lda ybuf,x
sta y10+1
pha
clc
adc #$15
sta r17+1
lda xbuf,x
sta x10+1
lda mbuf,x
bne no10
lda msb
ora ortab,y
bne ye10
no10 lda msb
and antab,y
ye10 sta m10+1
lda pbuf,x
sta p10+1
lda cbuf,x
sta c10+1
iny
ldx sort+10
lda ybuf,x
sta y11+1
pha
clc
adc #$15
sta r18+1
lda xbuf,x
sta x11+1
lda mbuf,x
bne no11
lda msb
ora ortab,y
bne ye11
no11 lda msb
and antab,y
ye11 sta m11+1
lda pbuf,x
sta p11+1
lda cbuf,x
sta c11+1
iny
ldx sort+11
lda ybuf,x
sta y12+1
pha
clc
adc #$15
sta r19+1
lda xbuf,x
sta x12+1
lda mbuf,x
bne no12
lda msb
ora ortab,y
bne ye12
no12 lda msb
and antab,y
ye12 sta m12+1
lda pbuf,x
sta p12+1
lda cbuf,x
sta c12+1
iny
ldx sort+12
lda ybuf,x
sta y13+1
pha
clc
adc #$15
sta r20+1
lda xbuf,x
sta x13+1
lda mbuf,x
bne no13
lda msb
ora ortab,y
bne ye13
no13 lda msb
and antab,y
ye13 sta m13+1
lda pbuf,x
sta p13+1
lda cbuf,x
sta c13+1
iny
ldx sort+13
lda ybuf,x
sta y14+1
pha
clc
adc #$15
sta r21+1
lda xbuf,x
sta x14+1
lda mbuf,x
bne no14
lda msb
ora ortab,y
bne ye14
no14 lda msb
and antab,y
ye14 sta m14+1
lda pbuf,x
sta p14+1
lda cbuf,x
sta c14+1
iny
ldx sort+14
lda ybuf,x
sta y15+1
pha
clc
adc #$15
sta r22+1
lda xbuf,x
sta x15+1
lda mbuf,x
bne no15
lda msb
ora ortab,y
bne ye15
no15 lda msb
and antab,y
ye15 sta m15+1
lda pbuf,x
sta p15+1
lda cbuf,x
sta c15+1
iny
ldx sort+15
lda ybuf,x
sta y16+1
pha
clc
adc #$15
sta r23+1
lda xbuf,x
sta x16+1
lda mbuf,x
bne no16
lda msb
ora ortab,y
bne ye16
no16 lda msb
and antab,y
ye16 sta m16+1
lda pbuf,x
sta p16+1
lda cbuf,x
sta c16+1
ldy #$00
ldx sort+16
lda ybuf,x
sta y17+1
pha
lda xbuf,x
sta x17+1
lda mbuf,x
bne no17
lda msb
ora ortab,y
bne ye17
no17 lda msb
and antab,y
ye17 sta m17+1
lda pbuf,x
sta p17+1
lda cbuf,x
sta c17+1
iny
ldx sort+17
lda ybuf,x
sta y18+1
pha
lda xbuf,x
sta x18+1
lda mbuf,x
bne no18
lda msb
ora ortab,y
bne ye18
no18 lda msb
and antab,y
ye18 sta m18+1
lda pbuf,x
sta p18+1
lda cbuf,x
sta c18+1
iny
ldx sort+18
lda ybuf,x
sta y19+1
pha
lda xbuf,x
sta x19+1
lda mbuf,x
bne no19
lda msb
ora ortab,y
bne ye19
no19 lda msb
and antab,y
ye19 sta m19+1
lda pbuf,x
sta p19+1
lda cbuf,x
sta c19+1
iny
ldx sort+19
lda ybuf,x
sta y20+1
pha
lda xbuf,x
sta x20+1
lda mbuf,x
bne no20
lda msb
ora ortab,y
bne ye20
no20 lda msb
and antab,y
ye20 sta m20+1
lda pbuf,x
sta p20+1
lda cbuf,x
sta c20+1
iny
ldx sort+20
lda ybuf,x
sta y21+1
pha
lda xbuf,x
sta x21+1
lda mbuf,x
bne no21
lda msb
ora ortab,y
bne ye21
no21 lda msb
and antab,y
ye21 sta m21+1
lda pbuf,x
sta p21+1
lda cbuf,x
sta c21+1
iny
ldx sort+21
lda ybuf,x
sta y22+1
pha
lda xbuf,x
sta x22+1
lda mbuf,x
bne no22
lda msb
ora ortab,y
bne ye22
no22 lda msb
and antab,y
ye22 sta m22+1
lda pbuf,x
sta p22+1
lda cbuf,x
sta c22+1
iny
ldx sort+22
lda ybuf,x
sta y23+1
pha
lda xbuf,x
sta x23+1
lda mbuf,x
bne no23
lda msb
ora ortab,y
bne ye23
no23 lda msb
and antab,y
ye23 sta m23+1
lda pbuf,x
sta p23+1
lda cbuf,x
sta c23+1
iny
ldx sort+23
lda ybuf,x
sta y24+1
pha
lda xbuf,x
sta x24+1
lda mbuf,x
bne no24
lda msb
ora ortab,y
bne ye24
no24 lda msb
and antab,y
ye24 sta m24+1
lda pbuf,x
sta p24+1
lda cbuf,x
sta c24+1
ldx #$18 ;find count
cnt1 dex
bmi none
pla
beq cnt1
txa
sta $fb ;sprite count
rest pla
dex
bpl rest
none
lda $fb ;set end of chain
asl a ;*2
tax
stx idx ;save for next
lda entab,x ;frame
sta sen+1
lda entab+1,x
sta sen+2
lda #$01
sen sta $1111 ;self modded
dec sw2+1 ;ok to move
;again
skipit
lda #$2d
sta $d012
lda #<irq1
sta $fffe
lda #>irq1
sta $ffff
inc $d019
pla
tay
pla
tax
pla
rti
irq1
pha
inc $d019
lda #$ff
sta $d015
y1 lda #$00
sta $d001
x1 lda #$00
sta $d000
m1 lda #$00
sta $d010
p1 lda #$00
sta $63f8
sta $67f8
c1 lda #$00
sta $d027
e1 lda #$00
beq s1
jmp end
s1
y2 lda #$00
sta $d003
x2 lda #$00
sta $d002
m2 lda #$00
sta $d010
p2 lda #$00
sta $63f9
sta $67f9
c2 lda #$00
sta $d028
e2 lda #$00
beq s2
jmp end
s2
y3 lda #$00
sta $d005
x3 lda #$00
sta $d004
m3 lda #$00
sta $d010
p3 lda #$00
sta $63fa
sta $67fa
c3 lda #$00
sta $d029
e3 lda #$00
beq s3
jmp end
s3
y4 lda #$00
sta $d007
x4 lda #$00
sta $d006
m4 lda #$00
sta $d010
p4 lda #$00
sta $63fb
sta $67fb
c4 lda #$00
sta $d02a
e4 lda #$00
beq s4
jmp end
s4
y5 lda #$00
sta $d009
x5 lda #$00
sta $d008
m5 lda #$00
sta $d010
p5 lda #$00
sta $63fc
sta $67fc
c5 lda #$00
sta $d02b
e5 lda #$00
beq s5
jmp end
s5
y6 lda #$00
sta $d00b
x6 lda #$00
sta $d00a
m6 lda #$00
sta $d010
p6 lda #$00
sta $63fd
sta $67fd
c6 lda #$00
sta $d02c
e6 lda #$00
beq s6
jmp end
s6
y7 lda #$00
sta $d00d
x7 lda #$00
sta $d00c
m7 lda #$00
sta $d010
p7 lda #$00
sta $63fe
sta $67fe
c7 lda #$00
sta $d02d
e7 lda #$00
beq s7
jmp end
s7
y8 lda #$00
sta $d00f
x8 lda #$00
sta $d00e
m8 lda #$00
sta $d010
p8 lda #$00
sta $63ff
sta $67ff
c8 lda #$00
sta $d02e
e8 lda #$00
beq s8
jmp end
s8
lda #$00
bne y9
r8 lda #$00
sta $d012
lda #<irq2
sta $fffe
lda #>irq2
sta $ffff
pla
rti
irq2
pha
inc $d019
y9 lda #$00
sta $d001
x9 lda #$00
sta $d000
m9 lda #$00
sta $d010
p9 lda #$00
sta $63f8
sta $67f8
c9 lda #$00
sta $d027
e9 lda #$00
beq s9
jmp end
s9
lda #$00
bne y10
r9 lda #$00
sta $d012
lda #<irq3
sta $fffe
lda #>irq3
sta $ffff
pla
rti
irq3
pha
inc $d019
y10 lda #$00
sta $d003
x10 lda #$00
sta $d002
m10 lda #$00
sta $d010
p10 lda #$00
sta $63f9
sta $67f9
c10 lda #$00
sta $d028
e10 lda #$00
beq s10
jmp end
s10
lda #$00
bne y11
r10 lda #$00
sta $d012
lda #<irq4
sta $fffe
lda #>irq4
sta $ffff
pla
rti
irq4
pha
inc $d019
y11 lda #$00
sta $d005
x11 lda #$00
sta $d004
m11 lda #$00
sta $d010
p11 lda #$00
sta $63fa
sta $67fa
c11 lda #$00
sta $d029
e11 lda #$00
beq s11
jmp end
s11
lda #$00
bne y12
r11 lda #$00
sta $d012
lda #<irq5
sta $fffe
lda #>irq5
sta $ffff
pla
rti
irq5
pha
inc $d019
y12 lda #$00
sta $d007
x12 lda #$00
sta $d006
m12 lda #$00
sta $d010
p12 lda #$00
sta $63fb
sta $67fb
c12 lda #$00
sta $d02a
e12 lda #$00
beq s12
jmp end
s12
lda #$00
bne y14
r12 lda #$00
sta $d012
lda #<irq6
sta $fffe
lda #>irq6
sta $ffff
pla
rti
irq6
pha
inc $d019
y13 lda #$00
sta $d009
x13 lda #$00
sta $d008
m13 lda #$00
sta $d010
p13 lda #$00
sta $63fc
sta $67fc
c13 lda #$00
sta $d02b
e13 lda #$00
beq s13
jmp end
s13
lda #$00
bne y15
r13 lda #$00
sta $d012
lda #<irq7
sta $fffe
lda #>irq7
sta $ffff
pla
rti
irq7
pha
inc $d019
y14 lda #$00
sta $d00b
x14 lda #$00
sta $d00a
m14 lda #$00
sta $d010
p14 lda #$00
sta $63fd
sta $67fd
c14 lda #$00
sta $d02c
e14 lda #$00
beq s14
jmp end
s14
lda #$00
bne y16
r14 lda #$00
sta $d012
lda #<irq8
sta $fffe
lda #>irq8
sta $ffff
pla
rti
irq8
pha
inc $d019
y15 lda #$00
sta $d00d
x15 lda #$00
sta $d00c
m15 lda #$00
sta $d010
p15 lda #$00
sta $63fe
sta $67fe
c15 lda #$00
sta $d02d
e15 lda #$00
beq s15
jmp end
s15
lda #$00
bne y17
r15 lda #$00
sta $d012
lda #<irq9
sta $fffe
lda #>irq9
sta $ffff
pla
rti
irq9
pha
inc $d019
y16 lda #$00
sta $d00f
x16 lda #$00
sta $d00e
m16 lda #$00
sta $d010
p16 lda #$00
sta $63ff
sta $67ff
c16 lda #$00
sta $d02e
e16 lda #$00
beq s16
jmp end
s16
lda #$00
bne y17
r16 lda #$00
sta $d012
lda #<irqa
sta $fffe
lda #>irqa
sta $ffff
pla
rti
irqa
pha
inc $d019
y17 lda #$00
sta $d001
x17 lda #$00
sta $d000
m17 lda #$00
sta $d010
p17 lda #$00
sta $63f8
sta $67f8
c17 lda #$00
sta $d027
e17 lda #$00
beq s17
jmp end
s17
lda #$00
bne y18
r17 lda #$00
sta $d012
lda #<irqb
sta $fffe
lda #>irqb
sta $ffff
pla
rti
irqb
pha
inc $d019
y18 lda #$00
sta $d003
x18 lda #$00
sta $d002
m18 lda #$00
sta $d010
p18 lda #$00
sta $63f9
sta $67f9
c18 lda #$00
sta $d028
e18 lda #$00
beq s18
jmp end
s18
lda #$00
bne y19
r18 lda #$00
sta $d012
lda #<irqc
sta $fffe
lda #>irqc
sta $ffff
pla
rti
irqc
pha
inc $d019
y19 lda #$00
sta $d005
x19 lda #$00
sta $d004
m19 lda #$00
sta $d010
p19 lda #$00
sta $63fa
sta $67fa
c19 lda #$00
sta $d029
e19 lda #$00
beq s19
jmp end
s19
lda #$00
bne y20
r19 lda #$00
sta $d012
lda #<irqd
sta $fffe
lda #>irqd
sta $ffff
pla
rti
irqd
pha
inc $d019
y20 lda #$00
sta $d007
x20 lda #$00
sta $d006
m20 lda #$00
sta $d010
p20 lda #$00
sta $63fb
sta $67fb
c20 lda #$00
sta $d02a
e20 lda #$00
beq s20
jmp end
s20
lda #$00
bne y21
r20 lda #$00
sta $d012
lda #<irqe
sta $fffe
lda #>irqe
sta $ffff
pla
rti
irqe
pha
inc $d019
y21 lda #$00
sta $d009
x21 lda #$00
sta $d008
m21 lda #$00
sta $d010
p21 lda #$00
sta $63fc
sta $67fc
c21 lda #$00
sta $d02b
e21 lda #$00
beq s21
jmp end
s21
lda #$00
bne y22
r21 lda #$00
sta $d012
lda #<irqf
sta $fffe
lda #>irqf
sta $ffff
pla
rti
irqf
pha
inc $d019
y22 lda #$00
sta $d00b
x22 lda #$00
sta $d00a
m22 lda #$00
sta $d010
p22 lda #$00
sta $63fd
sta $67fd
c22 lda #$00
sta $d02c
e22 lda #$00
beq s22
jmp end
s22
lda #$00
bne y23
r22 lda #$00
sta $d012
lda #<irqg
sta $fffe
lda #>irqg
sta $ffff
pla
rti
irqg
pha
inc $d019
y23 lda #$00
sta $d00d
x23 lda #$00
sta $d00c
m23 lda #$00
sta $d010
p23 lda #$00
sta $63fe
sta $67fe
c23 lda #$00
sta $d02d
e23 lda #$00
beq s23
jmp end
s23
lda #$00
bne y24
r23 lda #$00
sta $d012
lda #<irqh
sta $fffe
lda #>irqh
sta $ffff
pla
rti
irqh
pha
inc $d019
y24 lda #$00
sta $d00f
x24 lda #$00
sta $d00e
m24 lda #$00
sta $d010
p24 lda #$00
sta $63ff
sta $67ff
c24 lda #$00
sta $d02e
;end here
e24 lda #$00
end lda #$00
sta $d012
lda #<irq0
sta $fffe
lda #>irq0
sta $ffff
pla
crap rti
idx .byte $ff
msb .byte $ff
ortab
.byte %10000000
.byte %01000000
.byte %00100000
.byte %00010000
.byte %00001000
.byte %00000100
.byte %00000010
.byte %00000001
antab
.byte %01111111
.byte %10111111
.byte %11011111
.byte %11101111
.byte %11110111
.byte %11111011
.byte %11111101
.byte %11111110
en01 = e1+1
en02 = e2+1
en03 = e3+1
en04 = e4+1
en05 = e5+1
en06 = e6+1
en07 = e7+1
en08 = e8+1
en09 = e9+1
en10 = e10+1
en11 = e11+1
en12 = e12+1
en13 = e13+1
en14 = e14+1
en15 = e15+1
en16 = e16+1
en17 = e17+1
en18 = e18+1
en19 = e19+1
en20 = e20+1
en21 = e21+1
en22 = e22+1
en23 = e23+1
en24 = e24+1
entab
.byte <en01,>en01
.byte <en02,>en02
.byte <en03,>en03
.byte <en04,>en04
.byte <en05,>en05
.byte <en06,>en06
.byte <en07,>en07
.byte <en08,>en08
.byte <en09,>en09
.byte <en10,>en10
.byte <en11,>en11
.byte <en12,>en12
.byte <en13,>en13
.byte <en14,>en14
.byte <en15,>en15
.byte <en16,>en16
.byte <en17,>en17
.byte <en18,>en18
.byte <en19,>en19
.byte <en20,>en20
.byte <en21,>en21
.byte <en22,>en22
.byte <en23,>en23
.byte <en24,>en24
;---------------------------------------
;sprite movement
move
;plot y
j1 lda ysin
sta ybuf
j2 lda ysin+yofs
sta ybuf+1
j3 lda ysin+(yofs*2)
sta ybuf+2
j4 lda ysin+(yofs*3)
sta ybuf+3
j5 lda ysin+(yofs*4)
sta ybuf+4
j6 lda ysin+(yofs*5)
sta ybuf+5
j7 lda ysin+(yofs*6)
sta ybuf+6
j8 lda ysin+(yofs*7)
sta ybuf+7
j9 lda ysin+(yofs*8)
sta ybuf+8
j10 lda ysin+(yofs*9)
sta ybuf+9
j11 lda ysin+(yofs*10)
sta ybuf+10
j12 lda ysin+(yofs*11)
sta ybuf+11
j13 lda ysin+(yofs*12)
sta ybuf+12
j14 lda ysin+(yofs*13)
sta ybuf+13
j15 lda ysin+(yofs*14)
sta ybuf+14
j16 lda ysin+(yofs*15)
sta ybuf+15
j17 lda ysin+(yofs*16)
sta ybuf+16
j18 lda ysin+(yofs*17)
sta ybuf+17
j19 lda ysin+(yofs*18)
sta ybuf+18
j20 lda ysin+(yofs*19)
sta ybuf+19
j21 lda ysin+(yofs*20)
sta ybuf+20
j22 lda ysin+(yofs*21)
sta ybuf+21
j23 lda ysin+(yofs*22)
sta ybuf+22
j24 lda ysin+(yofs*23)
sta ybuf+23
;plot x
k1 lda #$00
sta xbuf
k2 lda #$00+xofs
sta xbuf+1
k3 lda #$00+(xofs*2)
sta xbuf+2
k4 lda #$00+(xofs*3)
sta xbuf+3
k5 lda #$00+(xofs*4)
sta xbuf+4
k6 lda #$00+(xofs*5)
sta xbuf+5
k7 lda #$00+(xofs*6)
sta xbuf+6
k8 lda #$00+(xofs*7)
sta xbuf+7
k9 lda #$00+(xofs*8)
sta xbuf+8
k10 lda #$00+(xofs*9)
sta xbuf+9
k11 lda #$00+(xofs*10)
sta xbuf+10
k12 lda #$00+(xofs*11)
sta xbuf+11
k13 lda #$00+(xofs*12)
sta xbuf+12
k14 lda #$00+(xofs*13)
sta xbuf+13
k15 lda #$00+(xofs*14)
sta xbuf+14
k16 lda #$00+(xofs*15)
sta xbuf+15
k17 lda #$00+(xofs*16)
sta xbuf+16
k18 lda #$00+(xofs*17)
sta xbuf+17
k19 lda #$00+(xofs*18)
sta xbuf+18
k20 lda #$00+(xofs*19)
sta xbuf+19
k21 lda #$00+(xofs*20)
sta xbuf+20
k22 lda #$00+(xofs*21)
sta xbuf+21
k23 lda #$00+(xofs*22)
sta xbuf+22
k24 lda #$00+(xofs*23)
sta xbuf+23
;jmp cx
;move y
inc j1+1
inc j2+1
inc j3+1
inc j4+1
inc j5+1
inc j6+1
inc j7+1
inc j8+1
inc j9+1
inc j10+1
inc j11+1
inc j12+1
inc j13+1
inc j14+1
inc j15+1
inc j16+1
inc j17+1
inc j18+1
inc j19+1
inc j20+1
inc j21+1
inc j22+1
inc j23+1
inc j24+1
;move x
cx
dec k1+1
dec k2+1
dec k3+1
dec k4+1
dec k5+1
dec k6+1
dec k7+1
dec k8+1
dec k9+1
dec k10+1
dec k11+1
dec k12+1
dec k13+1
dec k14+1
dec k15+1
dec k16+1
dec k17+1
dec k18+1
dec k19+1
dec k20+1
dec k21+1
dec k22+1
dec k23+1
dec k24+1
;scroll wrap
ldx #$b0
lda k1+1
cmp #$ff
bne n1
stx k1+1
n1 lda k2+1
cmp #$ff
bne n2
stx k2+1
n2 lda k3+1
cmp #$ff
bne n3
stx k3+1
n3 lda k4+1
cmp #$ff
bne n4
stx k4+1
n4 lda k5+1
cmp #$ff
bne n5
stx k5+1
n5 lda k6+1
cmp #$ff
bne n6
stx k6+1
n6 lda k7+1
cmp #$ff
bne n7
stx k7+1
n7 lda k8+1
cmp #$ff
bne n8
stx k8+1
n8 lda k9+1
cmp #$ff
bne n9
stx k9+1
n9 lda k10+1
cmp #$ff
bne n10
stx k10+1
n10 lda k11+1
cmp #$ff
bne n11
stx k11+1
n11 lda k12+1
cmp #$ff
bne n12
stx k12+1
n12 lda k13+1
cmp #$ff
bne n13
stx k13+1
n13 lda k14+1
cmp #$ff
bne n14
stx k14+1
n14 lda k15+1
cmp #$ff
bne n15
stx k15+1
n15 lda k16+1
cmp #$ff
bne n16
stx k16+1
n16 lda k17+1
cmp #$ff
bne n17
stx k17+1
n17 lda k18+1
cmp #$ff
bne n18
stx k18+1
n18 lda k19+1
cmp #$ff
bne n19
stx k19+1
n19 lda k20+1
cmp #$ff
bne n20
stx k20+1
n20 lda k21+1
cmp #$ff
bne n21
stx k21+1
n21 lda k22+1
cmp #$ff
bne n22
stx k22+1
n22 lda k23+1
cmp #$ff
bne n23
stx k23+1
n23 lda k24+1
cmp #$ff
bne n24
stx k24+1
n24 lda k25+1
cmp #$ff
bne n25
stx k25+1
n25
rts
|
| | Fungus
Registered: Sep 2002 Posts: 686 |
and now a (simple) VSP routine to bounce a koala pic.
;---------------------------------------
;Variable Screen Positioning (VSP)
;
;Coded by Fungus
;---------------------------------------
*= $1000
sei
lda #$35
sta $01
r1 bit $d011 ;wait
bpl r1
r2 bit $d011
bmi r2
lda #$00
sta $d020 ;border
lda #$00
sta $d021 ;background
lda #$7f ;remove timer
sta $dc0d ;irqs
sta $dd0d
lda $dc0d
lda $dd0d
lda #$58
sta $d011
lda #$03
ldx #$18
ldy #$28
sta $dd00
stx $d016
sty $d018
ldx #$00 ;clear colors
c0 lda #$00
sta $d800,x
sta $d900,x
sta $da00,x
sta $db00,x
sta $0800,x
sta $0900,x
sta $0a00,x
sta $0b00,x
lda #$20 ;blank normal
sta $0400,x ;screen
sta $0500,x
sta $0600,x
sta $0700,x
inx
bne c0
bit $d011 ;wait
bpl *-3
bit $d011
bmi *-3
lda #$39
sta $d011
lda #<rt ;setup irq
ldx #>rt
sta $fffa
stx $fffb
lda #$2d
sta $d012
lda #<irq1
ldx #>irq1
ldy #$01
sta $fffe
stx $ffff
sty $d01a
lda $d019
sta $d019
cli
m1 jmp m1
rt
lda #$37
sta $01
jmp $9000
*= $1100
irq1 ;double irq
inc $d019 ;stable raster
sta s1+1
stx s2+1
sty s3+1
lda #$2e
ldx #<irq2
ldy #>irq2
sta $d012
stx $fffe
sty $ffff
tsx
cmp $00
cli
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
irq2 txs
ldx #$09
l1 dex
bne l1
nop
lda #$2e ;65 cycles w/irq
cmp $d012 ;make it stable
beq k1
k1
ldx #$0b ;waste a line
dex
bne *-1
nop ;65 cyles
nop
nop
lda #$00 ;delayer
k4 beq k5 ;for 16 pixel
;hard scroll
k5 cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
cmp #$c9
bit $ea
lda #$38 ;start dma here!
sta $d011
lda #$39 ;turn back off now
sta $d011 ;to prevent bugs
inc $d019
lda #$fb ;next irq
ldx #<irq3
ldy #>irq3
exit sta $d012
stx $fffe
sty $ffff
s1 lda #$00
s2 ldx #$00
s3 ldy #$00
rti
irq3
n0 lda $1600
sta $d016
n1 lda $1700
sta k4+1
sec
p8 sbc #$01
p9 cmp #$80
bcc p2
jmp p1
p2 jmp p3
p3 tax
lda $1800,x
sta $0800,x
lda $1c00,x
sta $d800,x
lda $1800+$28,x
sta $0800+$28,x
lda $1c00+$28,x
sta $d800+$28,x
lda $1800+$50,x
sta $0800+$50,x
lda $1c00+$50,x
sta $d800+$50,x
lda $1800+$78,x
sta $0800+$78,x
lda $1c00+$78,x
sta $d800+$78,x
lda $1800+$a0,x
sta $0800+$a0,x
lda $1c00+$a0,x
sta $d800+$a0,x
lda $1800+$c8,x
sta $0800+$c8,x
lda $1c00+$c8,x
sta $d800+$c8,x
lda $1800+$f0,x
sta $0800+$f0,x
lda $1c00+$f0,x
sta $d800+$f0,x
lda $1800+$0118,x
sta $0800+$0118,x
lda $1c00+$0118,x
sta $d800+$0118,x
lda $1800+$0140,x
sta $0800+$0140,x
lda $1c00+$0140,x
sta $d800+$0140,x
lda $1800+$0168,x
sta $0800+$0168,x
lda $1c00+$0168,x
sta $d800+$0168,x
lda $1800+$0190,x
sta $0800+$0190,x
lda $1c00+$0190,x
sta $d800+$0190,x
lda $1800+$01b8,x
sta $0800+$01b8,x
lda $1c00+$01b8,x
sta $d800+$01b8,x
lda $1800+$01e0,x
sta $0800+$01e0,x
lda $1c00+$01e0,x
sta $d800+$01e0,x
lda $1800+$0208,x
sta $0800+$0208,x
lda $1c00+$0208,x
sta $d800+$0208,x
lda $1800+$0230,x
sta $0800+$0230,x
lda $1c00+$0230,x
sta $d800+$0230,x
lda $1800+$0258,x
sta $0800+$0258,x
lda $1c00+$0258,x
sta $d800+$0258,x
lda $1800+$0280,x
sta $0800+$0280,x
lda $1c00+$0280,x
sta $d800+$0280,x
lda $1800+$02a8,x
sta $0800+$02a8,x
lda $1c00+$02a8,x
sta $d800+$02a8,x
lda $1800+$02d0,x
sta $0800+$02d0,x
lda $1c00+$02d0,x
sta $d800+$02d0,x
lda $1800+$02f8,x
sta $0800+$02f8,x
lda $1c00+$02f8,x
sta $d800+$02f8,x
lda $1800+$0320,x
sta $0800+$0320,x
lda $1c00+$0320,x
sta $d800+$0320,x
lda $1800+$0348,x
sta $0800+$0348,x
lda $1c00+$0348,x
sta $d800+$0348,x
lda $1800+$0370,x
sta $0800+$0370,x
lda $1c00+$0370,x
sta $d800+$0370,x
lda $1800+$0398,x
sta $0800+$0398,x
lda $1c00+$0398,x
sta $d800+$0398,x
lda $1800+$03c0,x
sta $0800+$03c0,x
lda $1c00+$03c0,x
sta $d800+$03c0,x
txa
clc
adc #$e8
sta v1+1
sta v2+1
sta v3+1
sta v4+1
bcc u1
lda #$08
.byte $2c
u1 lda #$0b
sta v2+2
ora #$10
sta v1+2
cmp #$1b
bcc u2
lda #$1f
.byte $2c
u2 lda #$1c
sta v3+2
cmp #$1f
bcc u3
lda #$db
.byte $2c
u3 lda #$d8
sta v4+2
v1 lda $1800
v2 sta $0800
v3 lda $1c00
v4 sta $d800
jmp p1
p5
tax
lda #$00
sta $0800,x
sta $d800,x
sta $0800+$28,x
sta $d800+$28,x
sta $0800+$50,x
sta $d800+$50,x
sta $0800+$78,x
sta $d800+$78,x
sta $0800+$a0,x
sta $d800+$a0,x
sta $0800+$c8,x
sta $d800+$c8,x
sta $0800+$f0,x
sta $d800+$f0,x
sta $0800+$0118,x
sta $d800+$0118,x
sta $0800+$0140,x
sta $d800+$0140,x
sta $0800+$0168,x
sta $d800+$0168,x
sta $0800+$0190,x
sta $d800+$0190,x
sta $0800+$01b8,x
sta $d800+$01b8,x
sta $0800+$01e0,x
sta $d800+$01e0,x
sta $0800+$0208,x
sta $d800+$0208,x
sta $0800+$0230,x
sta $d800+$0230,x
sta $0800+$0258,x
sta $d800+$0258,x
sta $0800+$0280,x
sta $d800+$0280,x
sta $0800+$02a8,x
sta $d800+$02a8,x
sta $0800+$02d0,x
sta $d800+$02d0,x
sta $0800+$02f8,x
sta $d800+$02f8,x
sta $0800+$0320,x
sta $d800+$0320,x
sta $0800+$0348,x
sta $d800+$0348,x
sta $0800+$0370,x
sta $d800+$0370,x
sta $0800+$0398,x
sta $d800+$0398,x
sta $0800+$03c0,x
sta $d800+$03c0,x
p1
inc n0+1
inc n1+1
lda n0+1
p7 cmp #$80
bne p4
cmp #$80
bne p6
lda #<p5
ldx #>p5
sta p2+1
stx p2+2
lda #$00
sta p7+1
sta p8+1
lda #$28
sta p9+1
jmp p4
p6 lda #<p3
ldx #>p3
sta p2+1
stx p2+2
lda #$80
sta p7+1
sta p9+1
lda #$01
sta p8+1
p4 inc $d019
lda #$2d
ldx #<irq1
ldy #>irq1
jmp exit
|
Previous - 1 | 2 | 3 | 4 - Next | |