Skip to content

Instantly share code, notes, and snippets.

@og2t
Created October 15, 2010 15:31
Show Gist options
  • Save og2t/628387 to your computer and use it in GitHub Desktop.
Save og2t/628387 to your computer and use it in GitHub Desktop.
Color Phase Delay Editor
// Edytor faz
// Gives: $0c00-$0fe8 screen
// Load: Adv. Art Atudio picture
// Finished on 1995.VI.18 (not all!)
// (w) 1995 by Digger/Square Team/pd
// Ported to Kick Ass on 11/10/2010
// Yes, that's 15 years.
.var vadd = $0c00
.var vedd = $0fc0
.var vend = $0fe8
.var spr1 = $0380
.var spr2 = $03c0
.var tabela = $4800
.var saddmap = $0900
.var eaddmap = $0a11
.var xpos = $d0
.var ypos = $d1//d2
.var vchr = $d3//d4
.var spx = $d5//d6
.var spy = $d7
.var mchar = $d8
.var do11 = $d9
.var cpnt = $da
.var autoflg = $db
.var help = $dc
.var c3f = $dd
.var vtab = $de//df
.var vcpy = $e0//e1
.var vopr = $e2//e3
.var speed = $01
.var stripeCol = $0c
.var bank = $37
:BasicUpstart2(run)
.pc = $0c00 "Color fade delays screen"
table: .import c64 "screen_1.dat"
.pc = $2000 "Bitmap"
.import c64 "bitmap.dat"
.pc = $4800 "Colors"
.import c64 "tabela.col"
/*.import source "/Users/tomek/C64/MyStuff/macros.asm"*/
.pc = $5b00 "Main"
run: lda #$0b
jsr $e536
sei
lda #<irq
ldy #>irq
sta $0314
sty $0315
lda #$7f
sta $dc0d
lda #$01
sta $d01a
lda $3fff
sta c3f
lda #$00
sta $d020
sta $d021
sta cpnt
sta autoflg
ldx #$00
clr: lda shape,x
sta spr1,x
lda #0
sta spr2,x
inx
cpx #$40
bne clr
lda #bank
sta $d018
lda #$1b
sta $d011
sta do11
lda #$f9
sta $d012
lda #$03
sta $d015
lda #$0f
sta $d027
sta $d028
lda #spr1/64
sta $0ff8
sta $07f8
lda #spr2/64
sta $0ff9
sta $07f9
lda #$20
sta $d002
lda #$ff
sta $d003
lda #$00
sta mchar
jsr cshow
lda #$08
jsr $ffd2 //blokada
lda #$00
sta spy
sta spx
sta spx+1
jsr supdt
lda #<vadd
ldy #>vadd
sta ypos
sty ypos+1
lda #<vadd
sta xpos
jsr actual
cli
read: jsr $ffe4
beq read
cmp #$11
beq sdown
cmp #$91
beq sup
cmp #$1d
beq sright
cmp #$9d
beq sleft
cmp #$0a
beq senter
cmp #$20
beq senter
cmp #$2b
beq splus
cmp #$2d
beq sminus
cmp #$8d
beq stake
cmp #$85
beq sf1
cmp #$86
beq sf3
cmp #$13
beq home
cmp #$03
beq sauto
cmp #$93
beq sfill
cmp #$88 //F7
beq stest
cmp #$69 //i
beq skier
ldx #$09
check1: cmp chars,x
beq scwpis
dex
bpl check1
ldx #$05
check2: cmp lits,x
beq slwpis
dex
bpl check2
jmp read
//-----------------------------------------------------------------------
sleft: jmp left
sright: jmp right
sdown: jmp down
senter: jmp enter
sup: jmp up
sf1: jmp f1
sf3: jmp f3
scwpis: jmp cwpis
slwpis: jmp lwpis
sauto: jmp auto
stest: jmp test
stake: jmp take
skier: jmp kier
sminus: jmp minus
sfill: jmp fill
splus: jmp plus
//--------------------------------------------------------------------------
home: lda #<vadd
ldy #>vadd
sta ypos
sty ypos+1
lda #<vadd
sta xpos
lda #$00
sta spy
sta spx
sta spx+1
jsr supdt
jsr actual
jmp read
plus: inc mchar
jsr cshow
jmp read
minus: dec mchar
jsr cshow
jmp read
take: ldy xpos
lda (ypos),y
sta mchar
jsr cshow
jmp read
fill: ldx #$00
lda mchar
sta vadd,x
sta vadd+$0100,x
sta vadd+$0200,x
sta vadd+$02e8,x
inx
bne fill+2
jsr actual
jmp read
auto: lda autoflg
eor #$01
sta autoflg
beq not8
lda #%00111110
sta spr2+[20*3]
jmp read
not8: lda #$00
sta spr2+[20*3]
jmp read
enter: ldy xpos
lda mchar
sta (ypos),y
lda autoflg
beq not7
inc mchar
not7: jsr cshow
jsr actual
jmp read
down: inc spy
lda spy
cmp #$19
bne not6
lda #$00
sta spy
lda #<vadd
ldy #>vadd
sta ypos
sty ypos+1
jmp right
not6: jsr supdt
lda ypos
clc
adc #$28
sta ypos
lda ypos+1
adc #$00
sta ypos+1
jsr actual
jmp read
up: dec spy
lda spy
cmp #$ff
bne not5
lda #$18
sta spy
lda #<vedd
ldy #>vedd
sta ypos
sty ypos+1
jmp left
not5: jsr supdt
lda ypos
sec
sbc #$28
sta ypos
lda ypos+1
sbc #$00
sta ypos+1
jsr actual
jmp read
right: inc spx
lda spx
cmp #$1d
bne not3
inc spx+1
not3: jsr supdt
inc xpos
lda xpos
cmp #$28
bne not1
lda #$00
sta xpos
sta spx
sta spx+1
jmp down
not1: jsr actual
jmp read
left: dec spx
lda spx
cmp #$1c
bne not4
dec spx+1
not4: jsr supdt
dec xpos
lda xpos
cmp #$ff
bne not2
lda #$27
sta xpos
sta spx
lda #$01
sta spx+1
jmp up
not2: jsr actual
jmp read
f1: jsr vblank
lda #$0b
sta $d011
sta do11
lda #bank
sta $d018
lda #$c8
sta $d016
ldx #$00
fill1: lda #$0b
sta $d800,x
sta $d900,x
sta $da00,x
sta $dae8,x
inx
bne fill1
jsr vblank
lda #$1b
sta $d011
sta do11
jmp read
f3: jsr vblank
lda #$0b
sta do11
sta $d011
lda #$18
sta $d018
sta $d016
ldx #$00
fill2: lda $3f40,x
sta $0400,x
lda $4040,x
sta $0500,x
lda $4140,x
sta $0600,x
lda $4228,x
sta $06e8,x
lda $4338,x
sta $d800,x
lda $4438,x
sta $d900,x
lda $4538,x
sta $da00,x
lda $4620,x
sta $dae8,x
inx
bne fill2
jsr vblank
lda #$3b
sta $d011
sta do11
jmp read
kier: lda #<vadd
sta vopr
lda #>vadd
sta vopr+1
ldy #$00
opr: lda (vopr),y
eor #$ff
sta (vopr),y
inc vopr
bne *+4
inc vopr+1
lda vopr+1
cmp #>vend
bne opr
lda vopr
cmp #<vend
bne opr
jmp read
//-----------------------------------------------------------------------
//--------------------------------------------------------------------------------
test: ldx #$00
lda #>tabela
sta saddmap,x
sta saddmap+$10,x
inx
bne test+2
lda #<tabela
sta vtab
lda #>tabela
sta vtab+1
lda #<saddmap
sta vcpy
lda #>saddmap
sta vcpy+1
start: lda $dc01
cmp #$df
bne part1-2
jmp read
ldx #$00
part1: ldy $0c00,x
lda saddmap+$10,y
sta vtab+1
ldy $3f40,x
lda (vtab),y
sta $0400,x
ldy $4338,x
lda (vtab),y
sta $d800,x
ldy $0d00,x
lda saddmap+$10,y
sta vtab+1
ldy $4040,x
lda (vtab),y
sta $0500,x
ldy $4438,x
lda (vtab),y
sta $d900,x
ldy $0e00,x
lda saddmap+$10,y
sta vtab+1
ldy $4140,x
lda (vtab),y
sta $0600,x
ldy $4538,x
lda (vtab),y
sta $da00,x
inx
bne part1
part2: ldy $0f00,x
lda saddmap+$10,y
sta vtab+1
ldy $4240,x
lda (vtab),y
sta $0700,x
ldy $4638,x
lda (vtab),y
sta $db00,x
inx
cpx #$e8
bne part2
ldy #$00
rewrt: lda pocztab,y
sta (vcpy),y
iny
cpy #$10
bne rewrt
inc vcpy
bne *+4
inc vcpy+1
lda vcpy+1
cmp #>eaddmap
bne gostr
lda vcpy
cmp #<eaddmap
beq fine
gostr: jmp start
fine: jmp read
//-----------------------------------------------------------------
supdt: lda spy
asl
asl
asl
clc
adc #$32
sta $d001
lda spx
asl
asl
asl
clc
adc #$18
sta $d000
lda spx+1
sta $d010
rts
//--------------------------------------------------------------------
actual: ldy xpos
lda (ypos),y
tax
lsr
lsr
lsr
lsr
sta vchr
txa
and #$0f
sta vchr+1
lda vchr
asl
asl
asl
tax
ldy #$00
copy1a: lda cyfry,x
lsr
lsr
sta spr2+[9*3],y
inx
iny
iny
iny
cpy #$08*3
bne copy1a
lda vchr+1
asl
asl
asl
tax
ldy #$00
copy2a: lda cyfry,x
sta spr2+[9*3]+1,y
inx
iny
iny
iny
cpy #$08*3
bne copy2a
lda #$00
sta help
ldy xpos
lda (ypos),y
asl
rol help
asl
rol help
asl
rol help
sta skad1+1
lda help
clc
adc #$d8
sta skad1+2
lda #$33
sta $01
ldx #$00
ldy #$00
skad1: lda $ffff,x
sta spr2+[9*3]+2,y
iny
iny
iny
inx
cpx #$08
bne skad1
lda #$37
sta $01
rts
//-----------------------------------------------------------------------
cshow: lda mchar
tax
lsr
lsr
lsr
lsr
sta vchr
txa
and #$0f
sta vchr+1
lda vchr
asl
asl
asl
tax
ldy #$00
copy1: lda cyfry,x
lsr
lsr
sta spr2,y
inx
iny
iny
iny
cpy #$08*3
bne copy1
lda vchr+1
asl
asl
asl
tax
ldy #$00
copy2: lda cyfry,x
sta spr2+1,y
inx
iny
iny
iny
cpy #$08*3
bne copy2
lda #$00
sta help
lda mchar
asl
rol help
asl
rol help
asl
rol help
sta skad+1
lda help
clc
adc #$d8
sta skad+2
lda #$33
sta $01
ldx #$00
ldy #$00
skad: lda $ffff,x
sta spr2+2,y
iny
iny
iny
inx
cpx #$08
bne skad
lda #$37
sta $01
rts
//-----------------------------------------------------------------------
cwpis: sec
sbc #$30
jmp ok1
lwpis: sec
sbc #$37
ok1: sta mchar
jsr cshow
asl mchar
asl mchar
asl mchar
asl mchar
read2: jsr $ffe4
beq read2
ldx #$09
chc1: cmp chars,x
beq csecond
dex
bpl chc1
ldx #$05
chc2: cmp lits,x
beq lsecond
dex
bpl chc2
jmp read2
csecond: sec
sbc #$30
jmp ok
lsecond: sec
sbc #$37
ok: ora mchar
sta mchar
jsr cshow
jmp read
vblank: lda $d011
bpl *-3
lda $d011
bmi *-3
rts
//--------------------------------------------------------------------------------------------
irq: inc $d019
lda #$00
sta $3fff
lda do11
and #$f0
ora #$03
sta $d011
ldx #$0b
dex
bne *-1
lda #stripeCol
sta $d021
ldx #$0b
dex
bne *-1
stx $d021
lda c3f
sta $3fff
ldx #$14
dex
bne *-1
lda do11
sta $d011
ldx cpnt
lda coltab,x
sta $d027
cpx #34
bne end
lda #$00
sta cpnt
end: inc cpnt
lda #<irqa
ldy #>irqa
sta $0314
sty $0315
lda #$31
sta $d012
inc $d019
jmp $ea31
//--------------------------------------------------------------------------------------
irqa: inc $d019
lda #$00
sta $3fff
ldx #$02
dex
bne *-1
lda #stripeCol
sta $d021
ldx #$0a
dex
bne *-1
stx $d021
lda c3f
sta $3fff
lda #<irq
ldy #>irq
sta $0314
sty $0315
lda #$f9
sta $d012
inc $d019
jmp $ea81
//--------------------------------------------------------
chars: .text "0123456789"
lits: .text "abcdef"
// luminances
coltab: .byte $00,$06,$09,$0b,$02,$04,$08,$0c,$0e,$0a,$05,$0f,$03,$07,$0d,$01,$0d,$07,$03,$0f,$05,$0a,$0e,$0c,$08,$04,$02,$0b,$09,$06,$00,$00,$00
cyfry: .byte $70,$d8,$d8,$d8,$d8,$d8
.byte $d8,$70,$30,$70,$30,$30
.byte $30,$30,$30,$30,$70,$d8
.byte $18,$30,$60,$c0,$c0,$f8
.byte $70,$d8,$18,$30,$18,$18
.byte $d8,$70,$d8,$d8,$d8,$78
.byte $18,$18,$18,$18,$f8,$c0
.byte $f0,$18,$18,$d8,$d8,$70
.byte $70,$d8,$c0,$f0,$d8,$d8
.byte $d8,$70,$f0,$18,$38,$18
.byte $18,$18,$18,$18,$70,$d8
.byte $d8,$70,$d8,$d8,$d8,$70
.byte $70,$d8,$d8,$d8,$78,$18
.byte $d8,$70,$70,$d8,$d8,$f8
.byte $d8,$d8,$d8,$d8,$f0,$d8
.byte $d8,$f0,$d8,$d8,$d8,$f0
.byte $70,$d8,$c0,$c0,$c0,$c0
.byte $d8,$70,$f0,$d8,$d8,$d8
.byte $d8,$d8,$d8,$f0,$f0,$c0
.byte $c0,$f0,$c0,$c0,$c0,$f8
.byte $f8,$c0,$c0,$f0,$c0,$c0
.byte $c0,$c0
shape: .byte %11111111,0,0
.byte %10000001,0,0
.byte %10000001,0,0
.byte %10000001,0,0
.byte %10000001,0,0
.byte %10000001,0,0
.byte %10000001,0,0
.byte %11111111,0,0
.byte 0,0,0,0,0,0
.byte 0,0,0,0,0,0
.byte 0,0,0,0,0,0
.byte 0,0,0,0,0,0
.byte 0,0,0,0,0,0
.byte 0,0,0,0,0,0
.byte 0,0,0
pocztab: .byte >tabela+$0f00
.byte >tabela+$0e00
.byte >tabela+$0d00
.byte >tabela+$0c00
.byte >tabela+$0b00
.byte >tabela+$0a00
.byte >tabela+$0900
.byte >tabela+$0800
.byte >tabela+$0700
.byte >tabela+$0600
.byte >tabela+$0500
.byte >tabela+$0400
.byte >tabela+$0300
.byte >tabela+$0200
.byte >tabela+$0100
.byte >tabela+$00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment