1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-26 12:49:21 +00:00

Removed support for programs without segments. Closes #465

This commit is contained in:
jespergravgaard 2020-12-21 08:57:41 +01:00
parent 089125ff5e
commit da789e007f
1672 changed files with 41555 additions and 5225 deletions

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 149935006b 1499351e94
//KICKC FRAGMENT CACHE 15355792e7 153557b11b
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 149935006b 1499351e94
//KICKC FRAGMENT CACHE 15355792e7 153557b11b
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}

File diff suppressed because it is too large Load Diff

View File

@ -1128,3 +1128,893 @@ bcc {la1}
//FRAGMENT vbuyy_lt_vbuc1_then_la1
cpy #{c1}
bcc {la1}
//FRAGMENT vbuz1=vbuz2_band_vbuc1
lda #{c1}
and {z2}
sta {z1}
//FRAGMENT _deref_pbuc1=_dec__deref_pbuc1
dec {c1}
//FRAGMENT pbuz1=pbuc1
lda #<{c1}
sta {z1}
lda #>{c1}
sta {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vbuz2
lda {z2}
clc
adc #<{c1}
sta {z1}
lda #>{c1}
adc #0
sta {z1}+1
//FRAGMENT pvoz1=pvoz2
lda {z2}
sta {z1}
lda {z2}+1
sta {z1}+1
//FRAGMENT vbuz1=vbuz1_plus_2
lda {z1}
clc
adc #2
sta {z1}
//FRAGMENT vbuz1=vbuz2_rol_1
lda {z2}
asl
sta {z1}
//FRAGMENT vbuz1=vbuz2_bor_vbuz3
lda {z2}
ora {z3}
sta {z1}
//FRAGMENT vwuz1_lt_vwuc1_then_la1
lda {z1}+1
cmp #>{c1}
bcc {la1}
bne !+
lda {z1}
cmp #<{c1}
bcc {la1}
!:
//FRAGMENT vbuz1=pbuz2_derefidx_vbuc1
ldy #{c1}
lda ({z2}),y
sta {z1}
//FRAGMENT pbuz1=pbuz2_plus_vbuc1
lda #{c1}
clc
adc {z2}
sta {z1}
lda #0
adc {z2}+1
sta {z1}+1
//FRAGMENT pbuz1_neq_pbuc1_then_la1
lda {z1}+1
cmp #>{c1}
bne {la1}
lda {z1}
cmp #<{c1}
bne {la1}
//FRAGMENT _deref_pbuz1=_deref_pbuz2
ldy #0
lda ({z2}),y
ldy #0
sta ({z1}),y
//FRAGMENT vbuaa=vbuz1
lda {z1}
//FRAGMENT vbuz1=vbuaa_band_vbuc1
and #{c1}
sta {z1}
//FRAGMENT vbuz1=vbuxx_band_vbuc1
lda #{c1}
sax {z1}
//FRAGMENT vbuz1=vbuyy_band_vbuc1
tya
and #{c1}
sta {z1}
//FRAGMENT vbuaa=vbuz1_band_vbuc1
lda #{c1}
and {z1}
//FRAGMENT vbuaa=vbuaa_band_vbuc1
and #{c1}
//FRAGMENT vbuaa=vbuxx_band_vbuc1
txa
and #{c1}
//FRAGMENT vbuaa=vbuyy_band_vbuc1
tya
and #{c1}
//FRAGMENT vbuxx=vbuz1_band_vbuc1
lda #{c1}
and {z1}
tax
//FRAGMENT vbuxx=vbuaa_band_vbuc1
ldx #{c1}
axs #0
//FRAGMENT vbuyy=vbuz1_band_vbuc1
lda #{c1}
and {z1}
tay
//FRAGMENT pbuz1=pbuc1_plus_vbuaa
clc
adc #<{c1}
sta {z1}
lda #>{c1}
adc #0
sta {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vbuxx
txa
clc
adc #<{c1}
sta {z1}
lda #>{c1}
adc #0
sta {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vbuyy
tya
clc
adc #<{c1}
sta {z1}
lda #>{c1}
adc #0
sta {z1}+1
//FRAGMENT vbuxx=vbuxx_plus_2
inx
inx
//FRAGMENT vbuz1=vbuaa_rol_1
asl
sta {z1}
//FRAGMENT vbuz1=vbuxx_rol_1
txa
asl
sta {z1}
//FRAGMENT vbuz1=vbuyy_rol_1
tya
asl
sta {z1}
//FRAGMENT vbuaa=vbuz1_rol_1
lda {z1}
asl
//FRAGMENT vbuaa=vbuaa_rol_1
asl
//FRAGMENT vbuaa=vbuxx_rol_1
txa
asl
//FRAGMENT vbuaa=vbuyy_rol_1
tya
asl
//FRAGMENT vbuxx=vbuz1_rol_1
lda {z1}
asl
tax
//FRAGMENT vbuxx=vbuaa_rol_1
asl
tax
//FRAGMENT vbuxx=vbuxx_rol_1
txa
asl
tax
//FRAGMENT vbuxx=vbuyy_rol_1
tya
asl
tax
//FRAGMENT vbuyy=vbuz1_rol_1
lda {z1}
asl
tay
//FRAGMENT vbuyy=vbuaa_rol_1
asl
tay
//FRAGMENT vbuyy=vbuxx_rol_1
txa
asl
tay
//FRAGMENT vbuyy=vbuyy_rol_1
tya
asl
tay
//FRAGMENT vbuz1=vbuxx_bor_vbuz2
txa
ora {z2}
sta {z1}
//FRAGMENT vbuz1=vbuyy_bor_vbuz2
tya
ora {z2}
sta {z1}
//FRAGMENT vbuz1=vbuz2_bor_vbuaa
ora {z2}
sta {z1}
//FRAGMENT vbuz1=vbuxx_bor_vbuaa
stx $ff
ora $ff
sta {z1}
//FRAGMENT vbuz1=vbuyy_bor_vbuaa
sty $ff
ora $ff
sta {z1}
//FRAGMENT vbuz1=vbuz2_bor_vbuxx
txa
ora {z2}
sta {z1}
//FRAGMENT vbuz1=vbuxx_bor_vbuxx
stx {z1}
//FRAGMENT vbuaa=pbuz1_derefidx_vbuc1
ldy #{c1}
lda ({z1}),y
//FRAGMENT vbuxx=pbuz1_derefidx_vbuc1
ldy #{c1}
lda ({z1}),y
tax
//FRAGMENT vbuyy=pbuz1_derefidx_vbuc1
ldy #{c1}
lda ({z1}),y
tay
//FRAGMENT vbuz1=vbuz2_bor_vbuyy
tya
ora {z2}
sta {z1}
//FRAGMENT vbuaa=vbuc1
lda #{c1}
//FRAGMENT vbuaa=vbuz1_bor_vbuz2
lda {z1}
ora {z2}
//FRAGMENT vbuaa=vbuz1_bor_vbuaa
ora {z1}
//FRAGMENT vbuaa=vbuz1_bor_vbuxx
txa
ora {z1}
//FRAGMENT vbuaa=vbuz1_bor_vbuyy
tya
ora {z1}
//FRAGMENT vbuxx=vbuz1_bor_vbuz2
lda {z1}
ora {z2}
tax
//FRAGMENT vbuxx=vbuz1_bor_vbuaa
ora {z1}
tax
//FRAGMENT vbuxx=vbuz1_bor_vbuxx
txa
ora {z1}
tax
//FRAGMENT vbuxx=vbuz1_bor_vbuyy
tya
ora {z1}
tax
//FRAGMENT vbuyy=vbuz1_bor_vbuz2
lda {z1}
ora {z2}
tay
//FRAGMENT vbuyy=vbuz1_bor_vbuaa
ora {z1}
tay
//FRAGMENT vbuyy=vbuz1_bor_vbuxx
txa
ora {z1}
tay
//FRAGMENT vbuyy=vbuz1_bor_vbuyy
tya
ora {z1}
tay
//FRAGMENT vbuz1=vbuxx_bor_vbuyy
txa
sty $ff
ora $ff
sta {z1}
//FRAGMENT vbuaa=vbuxx_bor_vbuz1
txa
ora {z1}
//FRAGMENT vbuaa=vbuxx_bor_vbuaa
stx $ff
ora $ff
//FRAGMENT vbuaa=vbuxx_bor_vbuyy
txa
sty $ff
ora $ff
//FRAGMENT vbuxx=vbuxx_bor_vbuz1
txa
ora {z1}
tax
//FRAGMENT vbuxx=vbuxx_bor_vbuaa
stx $ff
ora $ff
tax
//FRAGMENT vbuxx=vbuxx_bor_vbuyy
txa
sty $ff
ora $ff
tax
//FRAGMENT vbuyy=vbuxx_bor_vbuz1
txa
ora {z1}
tay
//FRAGMENT vbuyy=vbuxx_bor_vbuaa
stx $ff
ora $ff
tay
//FRAGMENT vbuyy=vbuxx_bor_vbuyy
txa
sty $ff
ora $ff
tay
//FRAGMENT vbuaa=vbuyy_bor_vbuaa
sty $ff
ora $ff
//FRAGMENT vbuxx=vbuaa
tax
//FRAGMENT vbuyy=vbuaa
tay
//FRAGMENT pbuz1=pbuz1_plus_vbuc1
lda #{c1}
clc
adc {z1}
sta {z1}
bcc !+
inc {z1}+1
!:
//FRAGMENT vbuz1=_dec_vbuz1
dec {z1}
//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuz2
ldy {z2}
lda {c1},y
ldy #0
sta ({z1}),y
//FRAGMENT pbuz1=_inc_pbuz2
clc
lda {z2}
adc #1
sta {z1}
lda {z2}+1
adc #0
sta {z1}+1
//FRAGMENT _deref_pbuz1=vbuc1
lda #{c1}
ldy #0
sta ({z1}),y
//FRAGMENT vbuz1=pbuc1_derefidx_vbuz2
ldy {z2}
lda {c1},y
sta {z1}
//FRAGMENT vbuz1_ge_vbuz2_then_la1
lda {z1}
cmp {z2}
bcs {la1}
//FRAGMENT vbuz1=vbuz1_minus_vbuz2
lda {z1}
sec
sbc {z2}
sta {z1}
//FRAGMENT vwuz1=vwuz2_rol_5
lda {z2}
asl
sta {z1}
lda {z2}+1
rol
sta {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vwuz2
clc
lda {z2}
adc #<{c1}
sta {z1}
lda {z2}+1
adc #>{c1}
sta {z1}+1
//FRAGMENT vbuz1_eq_vbuc1_then_la1
lda #{c1}
cmp {z1}
beq {la1}
//FRAGMENT pbuz1=pbuz2_plus_vbuz3
lda {z3}
clc
adc {z2}
sta {z1}
lda #0
adc {z2}+1
sta {z1}+1
//FRAGMENT pbuz1=pbuz1_minus_vbuc1
sec
lda {z1}
sbc #{c1}
sta {z1}
lda {z1}+1
sbc #0
sta {z1}+1
//FRAGMENT vbuz1=_deref_pbuc1
lda {c1}
sta {z1}
//FRAGMENT _deref_pbuz1=vbuz2
lda {z2}
ldy #0
sta ({z1}),y
//FRAGMENT vbuxx=vbuxx_band_vbuc1
lda #{c1}
axs #0
//FRAGMENT vbuyy=vbuxx_band_vbuc1
txa
and #{c1}
tay
//FRAGMENT vbuxx=vbuyy_band_vbuc1
ldx #{c1}
tya
axs #0
//FRAGMENT vbuyy=vbuyy_band_vbuc1
tya
and #{c1}
tay
//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuaa
tay
lda {c1},y
ldy #0
sta ({z1}),y
//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuxx
lda {c1},x
ldy #0
sta ({z1}),y
//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuyy
lda {c1},y
ldy #0
sta ({z1}),y
//FRAGMENT vbuaa=pbuc1_derefidx_vbuz1
ldy {z1}
lda {c1},y
//FRAGMENT vbuxx=pbuc1_derefidx_vbuz1
ldy {z1}
ldx {c1},y
//FRAGMENT vbuyy=pbuc1_derefidx_vbuz1
ldx {z1}
ldy {c1},x
//FRAGMENT vbuz1=pbuc1_derefidx_vbuaa
tay
lda {c1},y
sta {z1}
//FRAGMENT vbuaa=pbuc1_derefidx_vbuaa
tay
lda {c1},y
//FRAGMENT vbuxx=pbuc1_derefidx_vbuaa
tay
ldx {c1},y
//FRAGMENT vbuyy=pbuc1_derefidx_vbuaa
tax
ldy {c1},x
//FRAGMENT vbuz1=pbuc1_derefidx_vbuxx
lda {c1},x
sta {z1}
//FRAGMENT 0_neq_vbuaa_then_la1
cmp #0
bne {la1}
//FRAGMENT vbuaa_ge_vbuz1_then_la1
cmp {z1}
bcs {la1}
//FRAGMENT vbuxx=vbuxx_minus_vbuz1
txa
sec
sbc {z1}
tax
//FRAGMENT vbuz1=vbuz1_minus_vbuaa
eor #$ff
sec
adc {z1}
sta {z1}
//FRAGMENT vbuxx=vbuxx_minus_vbuaa
sta $ff
txa
sec
sbc $ff
tax
//FRAGMENT vbuz1=vbuz1_minus_vbuxx
txa
eor #$ff
sec
adc {z1}
sta {z1}
//FRAGMENT vbuxx=vbuxx_minus_vbuxx
lda #0
tax
//FRAGMENT vbuz1=vbuz1_minus_vbuyy
tya
eor #$ff
sec
adc {z1}
sta {z1}
//FRAGMENT vbuxx=vbuxx_minus_vbuyy
txa
sty $ff
sec
sbc $ff
tax
//FRAGMENT vbuaa_eq_vbuc1_then_la1
cmp #{c1}
beq {la1}
//FRAGMENT vbuaa=_deref_pbuc1
lda {c1}
//FRAGMENT vbuxx=_deref_pbuc1
ldx {c1}
//FRAGMENT _deref_pbuz1=vbuaa
ldy #0
sta ({z1}),y
//FRAGMENT _deref_pbuz1=vbuxx
txa
ldy #0
sta ({z1}),y
//FRAGMENT _deref_pbuz1=vbuyy
tya
ldy #0
sta ({z1}),y
//FRAGMENT vbuxx_ge_vbuz1_then_la1
cpx {z1}
bcs {la1}
//FRAGMENT vbuxx_eq_vbuc1_then_la1
cpx #{c1}
beq {la1}
//FRAGMENT vbuyy=_deref_pbuc1
ldy {c1}
//FRAGMENT vbuz1_ge_vbuxx_then_la1
lda {z1}
stx $ff
cmp $ff
bcs {la1}
//FRAGMENT vbuyy=vbuz1
ldy {z1}
//FRAGMENT vbuz1_ge_vbuyy_then_la1
lda {z1}
sty $ff
cmp $ff
bcs {la1}
//FRAGMENT vbuxx_ge_vbuyy_then_la1
sty $ff
cpx $ff
bcs {la1}
//FRAGMENT vbuaa=vbuxx
txa
//FRAGMENT vbuyy=vbuxx
txa
tay
//FRAGMENT vbuyy_eq_vbuc1_then_la1
cpy #{c1}
beq {la1}
//FRAGMENT vbuaa=vbuyy
tya
//FRAGMENT vbuxx=vbuyy
tya
tax
//FRAGMENT vbuyy_ge_vbuz1_then_la1
cpy {z1}
bcs {la1}
//FRAGMENT vwuz1=vwuz1_rol_5
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vwuz1
clc
lda {z1}
adc #<{c1}
sta {z1}
lda {z1}+1
adc #>{c1}
sta {z1}+1
//FRAGMENT vbuz1=vbuz2_plus_1
ldy {z2}
iny
sty {z1}
//FRAGMENT pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2
ldy {z2}
lda {c2},y
ldy {z1}
sta {c1},y
//FRAGMENT vbuz1=vbuz1_minus_vbuc1
lax {z1}
axs #{c1}
stx {z1}
//FRAGMENT vbuz1=pbuc1_derefidx_vbuz2_plus_pbuc2_derefidx_vbuz3
ldy {z2}
lda {c1},y
ldy {z3}
clc
adc {c2},y
sta {z1}
//FRAGMENT pbuc1_derefidx_vbuz1=vbuz2
lda {z2}
ldy {z1}
sta {c1},y
//FRAGMENT vbuz1=vbuz1_plus_vbuc1
lax {z1}
axs #-[{c1}]
stx {z1}
//FRAGMENT vbuaa=vbuz1_plus_1
lda {z1}
clc
adc #1
//FRAGMENT vbuz1=vbuaa_rol_2
asl
asl
sta {z1}
//FRAGMENT vbuaa=vbuaa_rol_2
asl
asl
//FRAGMENT vbuxx=vbuaa_rol_2
asl
asl
tax
//FRAGMENT vbuyy=vbuaa_rol_2
asl
asl
tay
//FRAGMENT pbuc1_derefidx_vbuaa=pbuc2_derefidx_vbuz1
ldx {z1}
tay
lda {c2},x
sta {c1},y
//FRAGMENT pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuz1
ldy {z1}
lda {c2},y
sta {c1},x
//FRAGMENT pbuc1_derefidx_vbuyy=pbuc2_derefidx_vbuz1
ldx {z1}
lda {c2},x
sta {c1},y
//FRAGMENT pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuxx
lda {c2},x
ldy {z1}
sta {c1},y
//FRAGMENT pbuc1_derefidx_vbuaa=pbuc2_derefidx_vbuxx
tay
lda {c2},x
sta {c1},y
//FRAGMENT pbuc1_derefidx_vbuyy=pbuc2_derefidx_vbuxx
lda {c2},x
sta {c1},y
//FRAGMENT pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuyy
lda {c2},y
ldy {z1}
sta {c1},y
//FRAGMENT pbuc1_derefidx_vbuaa=pbuc2_derefidx_vbuyy
tax
lda {c2},y
sta {c1},x
//FRAGMENT pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuyy
lda {c2},y
sta {c1},x
//FRAGMENT vbuxx=vbuxx_minus_vbuc1
txa
axs #{c1}
//FRAGMENT vbuyy=vbuyy_minus_vbuc1
tya
sec
sbc #{c1}
tay
//FRAGMENT vbuaa=pbuc1_derefidx_vbuz1_plus_pbuc2_derefidx_vbuz2
ldy {z1}
lda {c1},y
ldy {z2}
clc
adc {c2},y
//FRAGMENT vbuxx=pbuc1_derefidx_vbuz1_plus_pbuc2_derefidx_vbuz2
ldx {z1}
lda {c1},x
ldx {z2}
clc
adc {c2},x
tax
//FRAGMENT vbuyy=pbuc1_derefidx_vbuz1_plus_pbuc2_derefidx_vbuz2
ldy {z1}
lda {c1},y
ldy {z2}
clc
adc {c2},y
tay
//FRAGMENT vbuz1=pbuc1_derefidx_vbuz2_plus_pbuc2_derefidx_vbuxx
lda {c2},x
ldy {z2}
clc
adc {c1},y
sta {z1}
//FRAGMENT vbuaa=pbuc1_derefidx_vbuz1_plus_pbuc2_derefidx_vbuxx
lda {c2},x
ldy {z1}
clc
adc {c1},y
//FRAGMENT vbuxx=pbuc1_derefidx_vbuz1_plus_pbuc2_derefidx_vbuxx
lda {c2},x
ldx {z1}
clc
adc {c1},x
tax
//FRAGMENT vbuyy=pbuc1_derefidx_vbuz1_plus_pbuc2_derefidx_vbuxx
lda {c2},x
ldy {z1}
clc
adc {c1},y
tay
//FRAGMENT vbuz1=pbuc1_derefidx_vbuz2_plus_pbuc2_derefidx_vbuyy
lda {c2},y
ldy {z2}
clc
adc {c1},y
sta {z1}
//FRAGMENT vbuaa=pbuc1_derefidx_vbuz1_plus_pbuc2_derefidx_vbuyy
lda {c2},y
ldy {z1}
clc
adc {c1},y
//FRAGMENT vbuxx=pbuc1_derefidx_vbuz1_plus_pbuc2_derefidx_vbuyy
lda {c2},y
ldx {z1}
clc
adc {c1},x
tax
//FRAGMENT vbuyy=pbuc1_derefidx_vbuz1_plus_pbuc2_derefidx_vbuyy
lda {c2},y
ldy {z1}
clc
adc {c1},y
tay
//FRAGMENT vbuz1=pbuc1_derefidx_vbuxx_plus_pbuc2_derefidx_vbuz2
lda {c1},x
ldy {z2}
clc
adc {c2},y
sta {z1}
//FRAGMENT vbuaa=pbuc1_derefidx_vbuxx_plus_pbuc2_derefidx_vbuz1
lda {c1},x
ldy {z1}
clc
adc {c2},y
//FRAGMENT vbuxx=pbuc1_derefidx_vbuxx_plus_pbuc2_derefidx_vbuz1
lda {c1},x
ldx {z1}
clc
adc {c2},x
tax
//FRAGMENT vbuyy=pbuc1_derefidx_vbuxx_plus_pbuc2_derefidx_vbuz1
lda {c1},x
ldy {z1}
clc
adc {c2},y
tay
//FRAGMENT vbuz1=pbuc1_derefidx_vbuxx_plus_pbuc2_derefidx_vbuxx
lda {c1},x
clc
adc {c2},x
sta {z1}
//FRAGMENT vbuaa=pbuc1_derefidx_vbuxx_plus_pbuc2_derefidx_vbuxx
lda {c1},x
clc
adc {c2},x
//FRAGMENT vbuxx=pbuc1_derefidx_vbuxx_plus_pbuc2_derefidx_vbuxx
lda {c1},x
clc
adc {c2},x
tax
//FRAGMENT vbuyy=pbuc1_derefidx_vbuxx_plus_pbuc2_derefidx_vbuxx
lda {c1},x
clc
adc {c2},x
tay
//FRAGMENT vbuz1=pbuc1_derefidx_vbuxx_plus_pbuc2_derefidx_vbuyy
lda {c1},x
clc
adc {c2},y
sta {z1}
//FRAGMENT vbuaa=pbuc1_derefidx_vbuxx_plus_pbuc2_derefidx_vbuyy
lda {c1},x
clc
adc {c2},y
//FRAGMENT vbuxx=pbuc1_derefidx_vbuxx_plus_pbuc2_derefidx_vbuyy
lda {c1},x
clc
adc {c2},y
tax
//FRAGMENT vbuyy=pbuc1_derefidx_vbuxx_plus_pbuc2_derefidx_vbuyy
lda {c1},x
clc
adc {c2},y
tay
//FRAGMENT vbuz1=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuz2
lda {c1},y
ldy {z2}
clc
adc {c2},y
sta {z1}
//FRAGMENT vbuaa=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuz1
lda {c1},y
ldy {z1}
clc
adc {c2},y
//FRAGMENT vbuxx=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuz1
lda {c1},y
ldx {z1}
clc
adc {c2},x
tax
//FRAGMENT vbuyy=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuz1
lda {c1},y
ldy {z1}
clc
adc {c2},y
tay
//FRAGMENT vbuz1=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuxx
lda {c1},y
clc
adc {c2},x
sta {z1}
//FRAGMENT vbuaa=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuxx
lda {c1},y
clc
adc {c2},x
//FRAGMENT vbuxx=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuxx
lda {c1},y
clc
adc {c2},x
tax
//FRAGMENT vbuyy=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuxx
lda {c1},y
clc
adc {c2},x
tay
//FRAGMENT vbuz1=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuyy
lda {c1},y
clc
adc {c2},y
sta {z1}
//FRAGMENT vbuaa=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuyy
lda {c1},y
clc
adc {c2},y
//FRAGMENT vbuxx=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuyy
lda {c1},y
clc
adc {c2},y
tax
//FRAGMENT vbuyy=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuyy
lda {c1},y
clc
adc {c2},y
tay
//FRAGMENT pbuc1_derefidx_vbuz1=vbuaa
ldy {z1}
sta {c1},y
//FRAGMENT pbuc1_derefidx_vbuz1=vbuxx
ldy {z1}
txa
sta {c1},y
//FRAGMENT pbuc1_derefidx_vbuz1=vbuyy
tya
ldy {z1}
sta {c1},y
//FRAGMENT pbuc1_derefidx_vbuxx=vbuz1
lda {z1}
sta {c1},x
//FRAGMENT vbuyy_ge_vbuc1_then_la1
cpy #{c1}
bcs {la1}
//FRAGMENT pbuc1_derefidx_vbuxx=vbuaa
sta {c1},x
//FRAGMENT pbuc1_derefidx_vbuyy=vbuaa
sta {c1},y
//FRAGMENT vbuxx=vbuz1_plus_1
ldx {z1}
inx
//FRAGMENT vbuyy=vbuz1_plus_1
ldy {z1}
iny
//FRAGMENT _deref_pbuc1=_deref_pbuc1_bor_vbuc2
lda #{c2}
ora {c1}
sta {c1}
//FRAGMENT _deref_qprc1=pprc2
lda #<{c2}
sta {c1}
lda #>{c2}
sta {c1}+1

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 149935006b 1499351e94
//KICKC FRAGMENT CACHE 15355792e7 153557b11b
//FRAGMENT vwuz1=vwuc1
lda #<{c1}
sta {z1}
@ -268,63 +268,6 @@ sta {z1}
lda {z1}+1
adc #>{c1}
sta {z1}+1
//FRAGMENT vbuz1=_deref_pbuc1
lda {c1}
sta {z1}
//FRAGMENT vbuz1=vbuz2_plus_1
lda {z2}
inc
sta {z1}
//FRAGMENT vbuaa=_deref_pbuc1
lda {c1}
//FRAGMENT vbuxx=_deref_pbuc1
ldx {c1}
//FRAGMENT vbuz1=vbuaa_plus_1
inc
sta {z1}
//FRAGMENT vbuz1=vbuxx_plus_1
inx
stx {z1}
//FRAGMENT vbuyy=_deref_pbuc1
ldy {c1}
//FRAGMENT vbuz1=vbuyy_plus_1
iny
sty {z1}
//FRAGMENT vbuaa=vbuz1_plus_1
lda {z1}
inc
//FRAGMENT vbuaa=vbuaa_plus_1
inc
//FRAGMENT vbuaa=vbuxx_plus_1
txa
inc
//FRAGMENT vbuaa=vbuyy_plus_1
tya
inc
//FRAGMENT vbuxx=vbuz1_plus_1
ldx {z1}
inx
//FRAGMENT vbuxx=vbuaa_plus_1
tax
inx
//FRAGMENT vbuxx=vbuxx_plus_1
inx
//FRAGMENT vbuxx=vbuyy_plus_1
tya
inc
tax
//FRAGMENT vbuyy=vbuz1_plus_1
ldy {z1}
iny
//FRAGMENT vbuyy=vbuaa_plus_1
tay
iny
//FRAGMENT vbuyy=vbuxx_plus_1
txa
inc
tay
//FRAGMENT vbuyy=vbuyy_plus_1
iny
//FRAGMENT 0_neq_pbuc1_derefidx_vbuz1_then_la1
ldy {z1}
lda {c1},y
@ -531,3 +474,60 @@ inc
//FRAGMENT vbuyy_neq_vbuc1_then_la1
cpy #{c1}
bne {la1}
//FRAGMENT vbuz1=_deref_pbuc1
lda {c1}
sta {z1}
//FRAGMENT vbuz1=vbuz2_plus_1
lda {z2}
inc
sta {z1}
//FRAGMENT vbuaa=_deref_pbuc1
lda {c1}
//FRAGMENT vbuxx=_deref_pbuc1
ldx {c1}
//FRAGMENT vbuz1=vbuaa_plus_1
inc
sta {z1}
//FRAGMENT vbuz1=vbuxx_plus_1
inx
stx {z1}
//FRAGMENT vbuyy=_deref_pbuc1
ldy {c1}
//FRAGMENT vbuz1=vbuyy_plus_1
iny
sty {z1}
//FRAGMENT vbuaa=vbuz1_plus_1
lda {z1}
inc
//FRAGMENT vbuaa=vbuaa_plus_1
inc
//FRAGMENT vbuaa=vbuxx_plus_1
txa
inc
//FRAGMENT vbuaa=vbuyy_plus_1
tya
inc
//FRAGMENT vbuxx=vbuz1_plus_1
ldx {z1}
inx
//FRAGMENT vbuxx=vbuaa_plus_1
tax
inx
//FRAGMENT vbuxx=vbuxx_plus_1
inx
//FRAGMENT vbuxx=vbuyy_plus_1
tya
inc
tax
//FRAGMENT vbuyy=vbuz1_plus_1
ldy {z1}
iny
//FRAGMENT vbuyy=vbuaa_plus_1
tay
iny
//FRAGMENT vbuyy=vbuxx_plus_1
txa
inc
tay
//FRAGMENT vbuyy=vbuyy_plus_1
iny

View File

@ -18,7 +18,7 @@ import java.util.Map;
public class TargetPlatform {
/** The name of the default target platform. */
public static String DEFAULT_NAME = "c64basic";
public static String DEFAULT_NAME = "c64";
/** The platform name. */
private String name;

View File

@ -101,9 +101,6 @@ public class Pass4CodeGeneration {
linkScriptBody = linkScriptBody.replace("%P", AsmFormat.getAsmNumber(startAddress));
asm.addLine(new AsmInlineKickAsm(linkScriptBody, 0L, 0L));
// If the link script contains ".segment" then generate segments!
useSegments = linkScriptBody.contains(".segment");
// Generate global ZP labels
asm.startChunk(currentScope, null, "Global Constants & labels");
addConstantsAndLabels(asm, currentScope);
@ -176,8 +173,6 @@ public class Pass4CodeGeneration {
program.setAsm(asm);
}
// Should the generated program use segments?
private boolean useSegments = false;
// Name of the current data segment
private String currentCodeSegmentName = Scope.SEGMENT_CODE_DEFAULT;
// Name of the current code segment
@ -192,7 +187,7 @@ public class Pass4CodeGeneration {
* @param asm The ASM program (where a .segment line is added if needed)
*/
private void setCurrentSegment(String segmentName, AsmProgram asm) {
if(useSegments && !currentSegmentName.equals(segmentName)) {
if(!currentSegmentName.equals(segmentName)) {
asm.addLine(new AsmSegment(segmentName));
currentSegmentName = segmentName;
}

View File

@ -1 +1,5 @@
.pc = %P "Program"
// Generic ASM 6502
.file [name="%O", type="prg", segments="Program"]
.segmentdef Program [segments="Code, Data"]
.segmentdef Code [start=%P]
.segmentdef Data [startAfter="Code"]

View File

@ -6,5 +6,4 @@
.segment Vectors
.word %E // NMI
.word %E // RESET
.word %E // IRQ
.segment Code
.word %E // IRQ

View File

@ -5,6 +5,4 @@
.segmentdef Code [start=%P]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(%E)
.segment Code
:BasicUpstart(%E)

View File

@ -1,3 +0,0 @@
.pc = $801 "Basic"
:BasicUpstart(%E)
.pc = %P "Program"

View File

@ -1,11 +0,0 @@
{
"extension": "prg",
"link": "c64basic.ld",
"start_address": "0x080d",
"cpu": "MOS6502X",
"interrupt": "rom_min_c64",
"emulator": "x64sc",
"defines": {
"__C64__": 1
}
}

View File

@ -5,6 +5,4 @@
.segmentdef Code [start=%P]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(%E)
.segment Code
:BasicUpstart(%E)

View File

@ -5,6 +5,4 @@
.segmentdef Code [start=%P]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(%E)
.segment Code
:BasicUpstart(%E)

View File

@ -24,5 +24,4 @@
.byte $01 // 1x 16KB ROM (PRG)
.byte $01 // 1x 8KB VROM (CHR)
.byte %00000001 // Mapper nibble 0000 == No mapping (a simple 16KB PRG + 8KB CHR game)
// Mirroring nibble 0001 == Vertical mirroring only
.segment Code
// Mirroring nibble 0001 == Vertical mirroring only

View File

@ -5,6 +5,4 @@
.segmentdef Code [start=%P]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(%E)
.segment Code
:BasicUpstart(%E)

View File

@ -1,3 +0,0 @@
.pc = $1001 "Basic"
:BasicUpstart(%E)
.pc = %P "Program"

View File

@ -1,11 +0,0 @@
{
"extension": "prg",
"link": "plus4basic.ld",
"start_address": "0x100d",
"cpu": "MOS6502X",
"interrupt": "rom_min_plus4",
"emulator": "xplus4",
"defines": {
"__PLUS4__": 1
}
}

View File

@ -5,6 +5,4 @@
.segmentdef Code [start=%P]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(%E)
.segment Code
:BasicUpstart(%E)

View File

@ -1,3 +0,0 @@
.pc = $1001 "Basic"
:BasicUpstart(%E)
.pc = %P "Program"

View File

@ -1,11 +0,0 @@
{
"extension": "prg",
"link": "vic20basic.ld",
"start_address": "0x100d",
"cpu": "MOS6502X",
"interrupt": "rom_min_vic20",
"emulator": "xvic",
"defines": {
"__VIC20__": 1
}
}

View File

@ -1,5 +1,5 @@
// Test the #define for the plus4 target platform
#pragma target(plus4basic)
#pragma target(plus4)
char * const SCREEN = 0x0c00;

View File

@ -1,5 +1,5 @@
// Test implementation of kbhit() for Plus/4
#pragma target(plus4basic)
#pragma target(plus4)
#include <plus4.h>
void main() {

View File

@ -1,5 +1,5 @@
// Test reading keyboard port on the TED of the Plus/4
#pragma target(plus4basic)
#pragma target(plus4)
#include <string.h>

View File

@ -1,5 +1,5 @@
// VIC 20 Raster bars
#pragma target(vic20basic)
#pragma target(vic20)
#include <vic20.h>
void main() {

View File

@ -1,8 +1,13 @@
// Tests different rotate left commands
// Functions for performing input and output.
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="32bit-rols.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
.const LIGHT_BLUE = $e
.const OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS = 1
.const SIZEOF_BYTE = 1
@ -20,6 +25,7 @@
.label conio_line_text = $15
// The current color cursor line start
.label conio_line_color = $17
.segment Code
__start: {
// conio_cursor_x = 0
lda #0
@ -150,8 +156,10 @@ main: {
lda #1
sax.z i
jmp __b2
.segment Data
vals: .dword $deadbeef, $facefeed
}
.segment Code
// Set the cursor to the specified position
// gotoxy(byte register(X) y)
gotoxy: {
@ -1059,9 +1067,11 @@ rol_fixed: {
jsr cputs
// }
rts
.segment Data
s: .text @"rol fixed\n"
.byte 0
}
.segment Code
// Return true if there's a key waiting, return false if not
kbhit: {
// CIA#1 Port A: keyboard matrix columns and joystick #2
@ -1838,9 +1848,11 @@ ror_fixed: {
jsr cputs
// }
rts
.segment Data
s: .text @"ror fixed\n"
.byte 0
}
.segment Code
// rol_var(dword zp($1a) val)
rol_var: {
.label val = $1a
@ -1902,9 +1914,11 @@ rol_var: {
// for(char i=0;i<sizeof(rols);i++)
inc.z i
jmp __b1
.segment Data
s: .text @"rol var\n"
.byte 0
}
.segment Code
// ror_var(dword zp($1a) val)
ror_var: {
.label val = $1a
@ -1966,9 +1980,11 @@ ror_var: {
// for(char i=0;i<sizeof(rols);i++)
inc.z i
jmp __b1
.segment Data
s: .text @"ror var\n"
.byte 0
}
.segment Code
// Output a NUL-terminated string at the current cursor position
// cputs(byte* zp($c) s)
cputs: {
@ -2778,6 +2794,7 @@ memset: {
!:
jmp __b2
}
.segment Data
// The digits used for numbers
DIGITS: .text "0123456789abcdef"
// Values of decimal digits

View File

@ -12613,9 +12613,14 @@ ASSEMBLER BEFORE OPTIMIZATION
// Tests different rotate left commands
// Functions for performing input and output.
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="32bit-rols.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.const LIGHT_BLUE = $e
.const OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS = 1
@ -12634,6 +12639,7 @@ ASSEMBLER BEFORE OPTIMIZATION
.label conio_line_text = $15
// The current color cursor line start
.label conio_line_color = $17
.segment Code
// __start
__start: {
jmp __init1
@ -12905,8 +12911,10 @@ main: {
__b1_from___b10:
// [17] phi main::i#12 = main::i#1 [phi:main::@10->main::@1#0] -- register_copy
jmp __b1
.segment Data
vals: .dword $deadbeef, $facefeed
}
.segment Code
// gotoxy
// Set the cursor to the specified position
// gotoxy(byte register(X) y)
@ -14527,9 +14535,11 @@ rol_fixed: {
__breturn:
// [257] return
rts
.segment Data
s: .text @"rol fixed\n"
.byte 0
}
.segment Code
// kbhit
// Return true if there's a key waiting, return false if not
kbhit: {
@ -15969,9 +15979,11 @@ ror_fixed: {
__breturn:
// [431] return
rts
.segment Data
s: .text @"ror fixed\n"
.byte 0
}
.segment Code
// rol_var
// rol_var(dword zp($1a) val)
rol_var: {
@ -16081,9 +16093,11 @@ rol_var: {
__b1_from___b6:
// [434] phi rol_var::i#2 = rol_var::i#1 [phi:rol_var::@6->rol_var::@1#0] -- register_copy
jmp __b1
.segment Data
s: .text @"rol var\n"
.byte 0
}
.segment Code
// ror_var
// ror_var(dword zp($1a) val)
ror_var: {
@ -16193,9 +16207,11 @@ ror_var: {
__b1_from___b6:
// [449] phi ror_var::i#2 = ror_var::i#1 [phi:ror_var::@6->ror_var::@1#0] -- register_copy
jmp __b1
.segment Data
s: .text @"ror var\n"
.byte 0
}
.segment Code
// cputs
// Output a NUL-terminated string at the current cursor position
// cputs(byte* zp($c) s)
@ -17498,6 +17514,7 @@ memset: {
jmp __b2_from___b3
}
// File Data
.segment Data
// The digits used for numbers
DIGITS: .text "0123456789abcdef"
// Values of decimal digits
@ -18978,9 +18995,14 @@ Score: 2528599
// Tests different rotate left commands
// Functions for performing input and output.
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="32bit-rols.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.const LIGHT_BLUE = $e
.const OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS = 1
@ -18999,6 +19021,7 @@ Score: 2528599
.label conio_line_text = $15
// The current color cursor line start
.label conio_line_color = $17
.segment Code
// __start
__start: {
// __start::__init1
@ -19226,8 +19249,10 @@ main: {
// [17] phi from main::@10 to main::@1 [phi:main::@10->main::@1]
// [17] phi main::i#12 = main::i#1 [phi:main::@10->main::@1#0] -- register_copy
jmp __b2
.segment Data
vals: .dword $deadbeef, $facefeed
}
.segment Code
// gotoxy
// Set the cursor to the specified position
// gotoxy(byte register(X) y)
@ -20615,9 +20640,11 @@ rol_fixed: {
// }
// [257] return
rts
.segment Data
s: .text @"rol fixed\n"
.byte 0
}
.segment Code
// kbhit
// Return true if there's a key waiting, return false if not
kbhit: {
@ -21825,9 +21852,11 @@ ror_fixed: {
// }
// [431] return
rts
.segment Data
s: .text @"ror fixed\n"
.byte 0
}
.segment Code
// rol_var
// rol_var(dword zp($1a) val)
rol_var: {
@ -21924,9 +21953,11 @@ rol_var: {
// [434] phi from rol_var::@6 to rol_var::@1 [phi:rol_var::@6->rol_var::@1]
// [434] phi rol_var::i#2 = rol_var::i#1 [phi:rol_var::@6->rol_var::@1#0] -- register_copy
jmp __b1
.segment Data
s: .text @"rol var\n"
.byte 0
}
.segment Code
// ror_var
// ror_var(dword zp($1a) val)
ror_var: {
@ -22023,9 +22054,11 @@ ror_var: {
// [449] phi from ror_var::@6 to ror_var::@1 [phi:ror_var::@6->ror_var::@1]
// [449] phi ror_var::i#2 = ror_var::i#1 [phi:ror_var::@6->ror_var::@1#0] -- register_copy
jmp __b1
.segment Data
s: .text @"ror var\n"
.byte 0
}
.segment Code
// cputs
// Output a NUL-terminated string at the current cursor position
// cputs(byte* zp($c) s)
@ -23257,6 +23290,7 @@ memset: {
jmp __b2
}
// File Data
.segment Data
// The digits used for numbers
DIGITS: .text "0123456789abcdef"
// Values of decimal digits

View File

@ -1,10 +1,16 @@
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded zero-page address - global variable
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-0.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
.label SCREEN = $400
.label i = 2
.segment Code
__start: {
// i = 3
lda #3

View File

@ -126,12 +126,18 @@ ASSEMBLER BEFORE OPTIMIZATION
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded zero-page address - global variable
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-0.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.label i = 2
.segment Code
// __start
__start: {
jmp __init1
@ -213,12 +219,18 @@ Score: 278
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded zero-page address - global variable
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-0.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.label i = 2
.segment Code
// __start
__start: {
// __start::__init1

View File

@ -1,9 +1,15 @@
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded zero-page address - local variable
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.label SCREEN = $400
.segment Code
main: {
.label i = 2
// i = 3

View File

@ -99,11 +99,17 @@ ASSEMBLER BEFORE OPTIMIZATION
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded zero-page address - local variable
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.segment Code
// main
main: {
.label i = 2
@ -156,11 +162,17 @@ Score: 266
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded zero-page address - local variable
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.segment Code
// main
main: {
.label i = 2

View File

@ -1,10 +1,16 @@
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded mainmem-page address - global variable
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
.label SCREEN = $400
.label i = $2000
.segment Code
__start: {
// i = 3
lda #3

View File

@ -126,12 +126,18 @@ ASSEMBLER BEFORE OPTIMIZATION
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded mainmem-page address - global variable
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.label i = $2000
.segment Code
// __start
__start: {
jmp __init1
@ -213,12 +219,18 @@ Score: 309
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded mainmem-page address - global variable
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.label i = $2000
.segment Code
// __start
__start: {
// __start::__init1

View File

@ -1,9 +1,15 @@
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded mainmem address - local variable
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-3.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.label SCREEN = $400
.segment Code
main: {
.label i = $2000
// i = 3

View File

@ -99,11 +99,17 @@ ASSEMBLER BEFORE OPTIMIZATION
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded mainmem address - local variable
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-3.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.segment Code
// main
main: {
.label i = $2000
@ -156,11 +162,17 @@ Score: 297
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded mainmem address - local variable
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-3.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.segment Code
// main
main: {
.label i = $2000

View File

@ -1,9 +1,15 @@
// Test declaring a variable as at a hard-coded address
// Incrementing a load/store variable will result in cause two *SIZEOF's
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-4.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.label SCREEN = $400
.segment Code
main: {
.const ch = $102
.label i = 2

View File

@ -136,11 +136,17 @@ ASSEMBLER BEFORE OPTIMIZATION
// Test declaring a variable as at a hard-coded address
// Incrementing a load/store variable will result in cause two *SIZEOF's
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-4.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.segment Code
// main
main: {
.const ch = $102
@ -215,11 +221,17 @@ Score: 636
// Test declaring a variable as at a hard-coded address
// Incrementing a load/store variable will result in cause two *SIZEOF's
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-4.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.segment Code
// main
main: {
.const ch = $102

View File

@ -1,10 +1,16 @@
// Test declaring a variable as at a hard-coded address
// zero-page hard-coded address parameter
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-5.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
.label SCREEN = $400
.label idx = 3
.segment Code
__start: {
// idx
lda #0

View File

@ -155,12 +155,18 @@ ASSEMBLER BEFORE OPTIMIZATION
// Test declaring a variable as at a hard-coded address
// zero-page hard-coded address parameter
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-5.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.label idx = 3
.segment Code
// __start
__start: {
jmp __init1
@ -267,12 +273,18 @@ Score: 81
// Test declaring a variable as at a hard-coded address
// zero-page hard-coded address parameter
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-5.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.label idx = 3
.segment Code
// __start
__start: {
// __start::__init1

View File

@ -1,10 +1,16 @@
// Test declaring a variable as at a hard-coded address
// mainmem-page hard-coded address parameter
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-6.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
.label SCREEN = $400
.label idx = $3000
.segment Code
__start: {
// idx
lda #0

View File

@ -155,12 +155,18 @@ ASSEMBLER BEFORE OPTIMIZATION
// Test declaring a variable as at a hard-coded address
// mainmem-page hard-coded address parameter
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-6.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.label idx = $3000
.segment Code
// __start
__start: {
jmp __init1
@ -267,12 +273,18 @@ Score: 85
// Test declaring a variable as at a hard-coded address
// mainmem-page hard-coded address parameter
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-6.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.label idx = $3000
.segment Code
// __start
__start: {
// __start::__init1

View File

@ -1,9 +1,15 @@
// Test declaring an array variable as at a hard-coded address
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-8.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// The screen
.label SCREEN = $400
.segment Code
main: {
// SCREEN[0] = DATA[0]
lda DATA
@ -11,6 +17,7 @@ main: {
// }
rts
}
.segment Data
.pc = $1000 "DATA"
// Data to be put on the screen
DATA: .fill $3e8, 0

View File

@ -82,12 +82,18 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test declaring an array variable as at a hard-coded address
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-8.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
// The screen
.label SCREEN = $400
.segment Code
// main
main: {
// [0] *SCREEN = *DATA -- _deref_pbuc1=_deref_pbuc2
@ -100,6 +106,7 @@ main: {
rts
}
// File Data
.segment Data
.pc = $1000 "DATA"
// Data to be put on the screen
DATA: .fill $3e8, 0
@ -123,12 +130,18 @@ Score: 14
// File Comments
// Test declaring an array variable as at a hard-coded address
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-8.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
// The screen
.label SCREEN = $400
.segment Code
// main
main: {
// SCREEN[0] = DATA[0]
@ -141,6 +154,7 @@ main: {
rts
}
// File Data
.segment Data
.pc = $1000 "DATA"
// Data to be put on the screen
DATA: .fill $3e8, 0

View File

@ -1,9 +1,15 @@
// Test declaring an integer array variable as at a hard-coded address
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-9.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// The screen
.label SCREEN = $400
.segment Code
main: {
// SCREEN[0] = DATA[0]
lda DATA
@ -13,6 +19,7 @@ main: {
// }
rts
}
.segment Data
.pc = $1000 "DATA"
// Data to be put on the screen
DATA: .fill 2*$3e8, 0

View File

@ -93,12 +93,18 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test declaring an integer array variable as at a hard-coded address
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-9.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
// The screen
.label SCREEN = $400
.segment Code
// main
main: {
// [0] *SCREEN = *DATA -- _deref_pwsc1=_deref_pwsc2
@ -113,6 +119,7 @@ main: {
rts
}
// File Data
.segment Data
.pc = $1000 "DATA"
// Data to be put on the screen
DATA: .fill 2*$3e8, 0
@ -136,12 +143,18 @@ Score: 22
// File Comments
// Test declaring an integer array variable as at a hard-coded address
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-9.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
// The screen
.label SCREEN = $400
.segment Code
// main
main: {
// SCREEN[0] = DATA[0]
@ -156,6 +169,7 @@ main: {
rts
}
// File Data
.segment Data
.pc = $1000 "DATA"
// Data to be put on the screen
DATA: .fill 2*$3e8, 0

View File

@ -1,7 +1,13 @@
// Test address-of - use the pointer to get the value
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-of-0.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.segment Code
main: {
.label SCREEN = $400
.label bp = b

View File

@ -121,10 +121,16 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test address-of - use the pointer to get the value
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-of-0.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.segment Code
// main
main: {
.label SCREEN = $400
@ -182,10 +188,16 @@ Score: 286
// File Comments
// Test address-of - use the pointer to get the value
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-of-0.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.segment Code
// main
main: {
.label SCREEN = $400

View File

@ -1,7 +1,13 @@
// Test address-of - pass the pointer as parameter
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-of-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.segment Code
main: {
.label SCREEN = $400
.label b1 = 4

View File

@ -226,10 +226,16 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test address-of - pass the pointer as parameter
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-of-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.segment Code
// main
main: {
.label SCREEN = $400
@ -370,10 +376,16 @@ Score: 108
// File Comments
// Test address-of - pass the pointer as parameter
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-of-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.segment Code
// main
main: {
.label SCREEN = $400

View File

@ -1,8 +1,14 @@
// Test address-of by assigning the affected variable in multiple ways
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-of-2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
.label val = 2
.segment Code
__start: {
// val = 0
lda #0

View File

@ -343,11 +343,17 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test address-of by assigning the affected variable in multiple ways
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-of-2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.label val = 2
.segment Code
// __start
__start: {
jmp __init1
@ -517,11 +523,17 @@ Score: 148
// File Comments
// Test address-of by assigning the affected variable in multiple ways
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-of-2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.label val = 2
.segment Code
// __start
__start: {
// __start::__init1

View File

@ -1,10 +1,16 @@
// Test address-of an array element
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-of-3.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.const SIZEOF_SIGNED_WORD = 2
.label SCREEN = $400
.label idx = 3
.segment Code
main: {
.label i = 2
// print(VALS)
@ -61,4 +67,5 @@ print: {
// }
rts
}
.segment Data
VALS: .word 1, 2, 3, 4

View File

@ -305,13 +305,19 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test address-of an array element
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-of-3.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_SIGNED_WORD = 2
.label SCREEN = $400
.label idx = 3
.segment Code
// main
main: {
.label i = 2
@ -409,6 +415,7 @@ print: {
rts
}
// File Data
.segment Data
VALS: .word 1, 2, 3, 4
ASSEMBLER OPTIMIZATIONS
@ -465,13 +472,19 @@ Score: 457
// File Comments
// Test address-of an array element
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-of-3.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_SIGNED_WORD = 2
.label SCREEN = $400
.label idx = 3
.segment Code
// main
main: {
.label i = 2
@ -562,5 +575,6 @@ print: {
rts
}
// File Data
.segment Data
VALS: .word 1, 2, 3, 4

View File

@ -1,11 +1,17 @@
// Test declaring an address as expression
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-with-expression-value.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.const var1 = $800
.const var2 = $900
// The screen
.label SCREEN = $400
.segment Code
main: {
// SCREEN[0] = DATA[0]
lda DATA
@ -13,6 +19,7 @@ main: {
// }
rts
}
.segment Data
.pc = var1+var2 "DATA"
// Data to be put on the screen
DATA: .fill $3e8, 0

View File

@ -83,14 +83,20 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test declaring an address as expression
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-with-expression-value.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const var1 = $800
.const var2 = $900
// The screen
.label SCREEN = $400
.segment Code
// main
main: {
// [0] *SCREEN = *DATA -- _deref_pbuc1=_deref_pbuc2
@ -103,6 +109,7 @@ main: {
rts
}
// File Data
.segment Data
.pc = var1+var2 "DATA"
// Data to be put on the screen
DATA: .fill $3e8, 0
@ -128,14 +135,20 @@ Score: 14
// File Comments
// Test declaring an address as expression
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="address-with-expression-value.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const var1 = $800
.const var2 = $900
// The screen
.label SCREEN = $400
.segment Code
// main
main: {
// SCREEN[0] = DATA[0]
@ -148,6 +161,7 @@ main: {
rts
}
// File Data
.segment Data
.pc = var1+var2 "DATA"
// Data to be put on the screen
DATA: .fill $3e8, 0

View File

@ -1,7 +1,12 @@
// https://adventofcode.com/2020/day/2
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="2020-02.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
.const LIGHT_BLUE = $e
.const OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS = 1
.const SIZEOF_STRUCT_PRINTF_BUFFER_NUMBER = $c
@ -18,6 +23,7 @@
.label conio_line_text = $15
// The current color cursor line start
.label conio_line_color = $17
.segment Code
__start: {
// conio_cursor_x = 0
lda #0
@ -319,6 +325,7 @@ main: {
inc.z pwd+1
!:
jmp __b6
.segment Data
s: .text "rule a valid: "
.byte 0
s1: .text " invalid:"
@ -330,6 +337,7 @@ main: {
s4: .text "rule b valid: "
.byte 0
}
.segment Code
// Set the cursor to the specified position
// gotoxy(byte register(X) y)
gotoxy: {
@ -907,6 +915,7 @@ memset: {
!:
jmp __b2
}
.segment Data
// The digits used for numbers
DIGITS: .text "0123456789abcdef"
// Values of decimal digits

View File

@ -5070,9 +5070,14 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// https://adventofcode.com/2020/day/2
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="2020-02.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.const LIGHT_BLUE = $e
.const OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS = 1
@ -5090,6 +5095,7 @@ ASSEMBLER BEFORE OPTIMIZATION
.label conio_line_text = $15
// The current color cursor line start
.label conio_line_color = $17
.segment Code
// __start
__start: {
jmp __init1
@ -5649,6 +5655,7 @@ main: {
__b6_from___b9:
// [70] phi main::count_a#2 = main::count_a#6 [phi:main::@9->main::@6#0] -- register_copy
jmp __b6
.segment Data
s: .text "rule a valid: "
.byte 0
s1: .text " invalid:"
@ -5660,6 +5667,7 @@ main: {
s4: .text "rule b valid: "
.byte 0
}
.segment Code
// gotoxy
// Set the cursor to the specified position
// gotoxy(byte register(X) y)
@ -6534,6 +6542,7 @@ memset: {
jmp __b2_from___b3
}
// File Data
.segment Data
// The digits used for numbers
DIGITS: .text "0123456789abcdef"
// Values of decimal digits
@ -6817,7 +6826,7 @@ Succesful ASM optimization Pass5NextJumpElimination
Replacing instruction lda #0 with TYA
Removing instruction lda.z digit_value+1
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Fixing long branch [81] bne __b2 to beq
Fixing long branch [87] bne __b2 to beq
FINAL SYMBOL TABLE
const nomodify byte* COLORRAM = (byte*) 55296
@ -7099,9 +7108,14 @@ Score: 35049
// File Comments
// https://adventofcode.com/2020/day/2
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="2020-02.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.const LIGHT_BLUE = $e
.const OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS = 1
@ -7119,6 +7133,7 @@ Score: 35049
.label conio_line_text = $15
// The current color cursor line start
.label conio_line_color = $17
.segment Code
// __start
__start: {
// __start::__init1
@ -7610,6 +7625,7 @@ main: {
// [70] phi from main::@9 to main::@6 [phi:main::@9->main::@6]
// [70] phi main::count_a#2 = main::count_a#6 [phi:main::@9->main::@6#0] -- register_copy
jmp __b6
.segment Data
s: .text "rule a valid: "
.byte 0
s1: .text " invalid:"
@ -7621,6 +7637,7 @@ main: {
s4: .text "rule b valid: "
.byte 0
}
.segment Code
// gotoxy
// Set the cursor to the specified position
// gotoxy(byte register(X) y)
@ -8465,6 +8482,7 @@ memset: {
jmp __b2
}
// File Data
.segment Data
// The digits used for numbers
DIGITS: .text "0123456789abcdef"
// Values of decimal digits

View File

@ -1,9 +1,15 @@
// Demonstrates wrong padding for non-byte arrays.
// https://gitlab.com/camelot/kickc/-/issues/497
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="array-16bit-init.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.const SIZEOF_POINTER = 2
.segment Code
main: {
ldx #0
__b1:
@ -25,5 +31,6 @@ main: {
inx
jmp __b1
}
.segment Data
levelRowOff: .word 1, 2, 3
.fill 2*$1c, 0

View File

@ -153,11 +153,17 @@ ASSEMBLER BEFORE OPTIMIZATION
// Demonstrates wrong padding for non-byte arrays.
// https://gitlab.com/camelot/kickc/-/issues/497
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="array-16bit-init.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_POINTER = 2
.segment Code
// main
main: {
// [1] phi from main to main::@1 [phi:main->main::@1]
@ -194,6 +200,7 @@ main: {
jmp __b1
}
// File Data
.segment Data
levelRowOff: .word 1, 2, 3
.fill 2*$1c, 0
@ -226,11 +233,17 @@ Score: 321
// Demonstrates wrong padding for non-byte arrays.
// https://gitlab.com/camelot/kickc/-/issues/497
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="array-16bit-init.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_POINTER = 2
.segment Code
// main
main: {
// [1] phi from main to main::@1 [phi:main->main::@1]
@ -266,6 +279,7 @@ main: {
jmp __b1
}
// File Data
.segment Data
levelRowOff: .word 1, 2, 3
.fill 2*$1c, 0

View File

@ -1,8 +1,14 @@
// Test KickC performance for 16-bit array lookup function from article "Optimizing C array lookups for the 6502"
// http://8bitworkshop.com/blog/compilers/2019/03/17/cc65-optimization.html
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="array-16bit-lookup.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.segment Code
main: {
.label SCREEN = $400
.label __0 = 4
@ -50,4 +56,5 @@ getValue: {
// }
rts
}
.segment Data
arr16: .fill 2*$80, 0

View File

@ -283,10 +283,16 @@ ASSEMBLER BEFORE OPTIMIZATION
// Test KickC performance for 16-bit array lookup function from article "Optimizing C array lookups for the 6502"
// http://8bitworkshop.com/blog/compilers/2019/03/17/cc65-optimization.html
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="array-16bit-lookup.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.segment Code
// main
main: {
.label SCREEN = $400
@ -361,6 +367,7 @@ getValue: {
rts
}
// File Data
.segment Data
arr16: .fill 2*$80, 0
ASSEMBLER OPTIMIZATIONS
@ -417,10 +424,16 @@ Score: 502
// Test KickC performance for 16-bit array lookup function from article "Optimizing C array lookups for the 6502"
// http://8bitworkshop.com/blog/compilers/2019/03/17/cc65-optimization.html
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="array-16bit-lookup.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.segment Code
// main
main: {
.label SCREEN = $400
@ -494,5 +507,6 @@ getValue: {
rts
}
// File Data
.segment Data
arr16: .fill 2*$80, 0

View File

@ -1,8 +1,14 @@
// Illustrates symbolic array lengths
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="array-length-symbolic-min.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.const SZ = $f
.segment Code
// Fills the array item by item with $is, where i is the item# and s is the sub#
main: {
ldx #0
@ -17,4 +23,5 @@ main: {
// }
rts
}
.segment Data
items: .fill SZ, 0

View File

@ -113,11 +113,17 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Illustrates symbolic array lengths
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="array-length-symbolic-min.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const SZ = $f
.segment Code
// main
// Fills the array item by item with $is, where i is the item# and s is the sub#
main: {
@ -147,6 +153,7 @@ main: {
rts
}
// File Data
.segment Data
items: .fill SZ, 0
ASSEMBLER OPTIMIZATIONS
@ -179,11 +186,17 @@ Score: 161
// File Comments
// Illustrates symbolic array lengths
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="array-length-symbolic-min.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const SZ = $f
.segment Code
// main
// Fills the array item by item with $is, where i is the item# and s is the sub#
main: {
@ -210,5 +223,6 @@ main: {
rts
}
// File Data
.segment Data
items: .fill SZ, 0

View File

@ -1,9 +1,15 @@
// Illustrates symbolic array lengths
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="array-length-symbolic.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.const ITEM_COUNT = 3
.const ITEM_SIZE = 5
.segment Code
// Fills the array item by item with $is, where i is the item# and s is the sub#
main: {
.label cur_item = 2
@ -45,4 +51,5 @@ main: {
// }
rts
}
.segment Data
items: .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

View File

@ -230,12 +230,18 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Illustrates symbolic array lengths
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="array-length-symbolic.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const ITEM_COUNT = 3
.const ITEM_SIZE = 5
.segment Code
// main
// Fills the array item by item with $is, where i is the item# and s is the sub#
main: {
@ -307,6 +313,7 @@ main: {
rts
}
// File Data
.segment Data
items: .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
ASSEMBLER OPTIMIZATIONS
@ -359,12 +366,18 @@ Score: 3416
// File Comments
// Illustrates symbolic array lengths
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="array-length-symbolic.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const ITEM_COUNT = 3
.const ITEM_SIZE = 5
.segment Code
// main
// Fills the array item by item with $is, where i is the item# and s is the sub#
main: {
@ -431,5 +444,6 @@ main: {
rts
}
// File Data
.segment Data
items: .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

View File

@ -1,8 +1,14 @@
// Test initializing array using KickAssembler
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="arrays-init-kasm-0.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.label SCREEN = $400
.segment Code
main: {
// SCREEN[0] = SINTAB[0]
lda SINTAB
@ -10,6 +16,7 @@ main: {
// }
rts
}
.segment Data
// Sine table
SINTAB:
.fill 256, 128 + 128*sin(i*2*PI/256)

View File

@ -88,11 +88,17 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test initializing array using KickAssembler
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="arrays-init-kasm-0.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.segment Code
// main
main: {
// [0] *SCREEN = *SINTAB -- _deref_pbuc1=_deref_pbuc2
@ -105,6 +111,7 @@ main: {
rts
}
// File Data
.segment Data
// Sine table
SINTAB:
.fill 256, 128 + 128*sin(i*2*PI/256)
@ -130,11 +137,17 @@ Score: 14
// File Comments
// Test initializing array using KickAssembler
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="arrays-init-kasm-0.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.segment Code
// main
main: {
// SCREEN[0] = SINTAB[0]
@ -147,6 +160,7 @@ main: {
rts
}
// File Data
.segment Data
// Sine table
SINTAB:
.fill 256, 128 + 128*sin(i*2*PI/256)

View File

@ -1,9 +1,15 @@
// Test initializing array using KickAssembler
// Place array at hardcoded address
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="arrays-init-kasm-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.label SCREEN = $400
.segment Code
main: {
// SCREEN[0] = SINTAB[0]
lda SINTAB
@ -11,6 +17,7 @@ main: {
// }
rts
}
.segment Data
.pc = $1000 "SINTAB"
// Sine table at an absolute address in memory
SINTAB:

View File

@ -90,11 +90,17 @@ ASSEMBLER BEFORE OPTIMIZATION
// Test initializing array using KickAssembler
// Place array at hardcoded address
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="arrays-init-kasm-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.segment Code
// main
main: {
// [0] *SCREEN = *SINTAB -- _deref_pbuc1=_deref_pbuc2
@ -107,6 +113,7 @@ main: {
rts
}
// File Data
.segment Data
.pc = $1000 "SINTAB"
// Sine table at an absolute address in memory
SINTAB:
@ -134,11 +141,17 @@ Score: 14
// Test initializing array using KickAssembler
// Place array at hardcoded address
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="arrays-init-kasm-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.segment Code
// main
main: {
// SCREEN[0] = SINTAB[0]
@ -151,6 +164,7 @@ main: {
rts
}
// File Data
.segment Data
.pc = $1000 "SINTAB"
// Sine table at an absolute address in memory
SINTAB:

View File

@ -1,8 +1,14 @@
// Test a short array initializer - the rest should be zero-filled
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="arrays-init-short.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.label SCREEN = $400
.segment Code
main: {
ldx #0
__b1:
@ -33,6 +39,7 @@ main: {
inx
jmp __b1
}
.segment Data
msg1: .text "camelot"
.byte 0
.fill 8, 0

View File

@ -178,11 +178,17 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test a short array initializer - the rest should be zero-filled
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="arrays-init-short.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.segment Code
// main
main: {
// [1] phi from main to main::@1 [phi:main->main::@1]
@ -236,6 +242,7 @@ main: {
jmp __b1
}
// File Data
.segment Data
msg1: .text "camelot"
.byte 0
.fill 8, 0
@ -276,11 +283,17 @@ Score: 516
// File Comments
// Test a short array initializer - the rest should be zero-filled
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="arrays-init-short.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.segment Code
// main
main: {
// [1] phi from main to main::@1 [phi:main->main::@1]
@ -333,6 +346,7 @@ main: {
jmp __b1
}
// File Data
.segment Data
msg1: .text "camelot"
.byte 0
.fill 8, 0

View File

@ -1,7 +1,13 @@
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="arrays-init.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.label SCREEN = $400
.segment Code
main: {
// b[0] = 'c'
lda #'c'
@ -17,6 +23,7 @@ main: {
// }
rts
}
.segment Data
b: .fill 3, 0
c: .byte 'c', 'm', 'l'
d: .text "cml"

View File

@ -126,11 +126,17 @@ Uplifting [] best 39 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="arrays-init.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.segment Code
// main
main: {
// [0] *b = 'c' -- _deref_pbuc1=vbuc2
@ -152,6 +158,7 @@ main: {
rts
}
// File Data
.segment Data
b: .fill 3, 0
c: .byte 'c', 'm', 'l'
d: .text "cml"
@ -178,11 +185,17 @@ Score: 32
// File Comments
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="arrays-init.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
.segment Code
// main
main: {
// b[0] = 'c'
@ -206,6 +219,7 @@ main: {
rts
}
// File Data
.segment Data
b: .fill 3, 0
c: .byte 'c', 'm', 'l'
d: .text "cml"

View File

@ -1,8 +1,14 @@
// Example of inline ASM where a JMP is erronously culled during compilation
// https://gitlab.com/camelot/kickc/issues/302
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="asm-culling-jmp.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.segment Code
main: {
// asm
jmp qwe

View File

@ -69,10 +69,16 @@ ASSEMBLER BEFORE OPTIMIZATION
// Example of inline ASM where a JMP is erronously culled during compilation
// https://gitlab.com/camelot/kickc/issues/302
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="asm-culling-jmp.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.segment Code
// main
main: {
// asm { jmpqwe .byte0,25,51,76,102,128,153,179,204,230 qwe: lda#50 }
@ -109,10 +115,16 @@ Score: 17
// Example of inline ASM where a JMP is erronously culled during compilation
// https://gitlab.com/camelot/kickc/issues/302
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="asm-culling-jmp.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.segment Code
// main
main: {
// asm

View File

@ -1,9 +1,15 @@
// Test using an ASM mnemonic as a C symbol names
// Works if the C-lexer and the ASM-lexer are separated properly
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="asm-mnemonic-names.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.label lda = $400
.segment Code
main: {
.label jmp = 1
// *lda = jmp

View File

@ -118,11 +118,17 @@ ASSEMBLER BEFORE OPTIMIZATION
// Test using an ASM mnemonic as a C symbol names
// Works if the C-lexer and the ASM-lexer are separated properly
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="asm-mnemonic-names.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label lda = $400
.segment Code
// main
main: {
.label jmp = 1
@ -189,11 +195,17 @@ Score: 40
// Test using an ASM mnemonic as a C symbol names
// Works if the C-lexer and the ASM-lexer are separated properly
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="asm-mnemonic-names.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label lda = $400
.segment Code
// main
main: {
.label jmp = 1

View File

@ -1,8 +1,14 @@
// Tests that inline asm uses clause makes the compiler not cull a procedure referenced
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="asm-uses-0.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.label BG_COLOR = $d020
.segment Code
// Function only used inside the inline asm
init: {
// *BG_COLOR = 0

View File

@ -95,11 +95,17 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Tests that inline asm uses clause makes the compiler not cull a procedure referenced
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="asm-uses-0.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label BG_COLOR = $d020
.segment Code
// init
// Function only used inside the inline asm
init: {
@ -145,11 +151,17 @@ Score: 24
// File Comments
// Tests that inline asm uses clause makes the compiler not cull a procedure referenced
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="asm-uses-0.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label BG_COLOR = $d020
.segment Code
// init
// Function only used inside the inline asm
init: {

View File

@ -1,7 +1,13 @@
// Tests that chained assignments work as intended
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="assignment-chained.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.segment Code
main: {
.label screen = $400
// screen[0] = a = 'c'

View File

@ -148,10 +148,16 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Tests that chained assignments work as intended
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="assignment-chained.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.segment Code
// main
main: {
.label screen = $400
@ -207,10 +213,16 @@ Score: 38
// File Comments
// Tests that chained assignments work as intended
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="assignment-chained.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.segment Code
// main
main: {
.label screen = $400

View File

@ -1,12 +1,18 @@
// Test compound assignment operators
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="assignment-compound.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.const GREEN = 5
.const RED = 2
.label screen1 = $400
.label cols = $d800
.label screen2 = screen1+$28
.segment Code
main: {
// test(i++, a)
//3
@ -101,4 +107,5 @@ test: {
sta cols,x
rts
}
.segment Data
ref: .byte 3, 4, 3, $12, 9, 1, 4, 2, 4, 5, 1, 0

View File

@ -703,15 +703,21 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test compound assignment operators
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="assignment-compound.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const GREEN = 5
.const RED = 2
.label screen1 = $400
.label cols = $d800
.label screen2 = screen1+$28
.segment Code
// main
main: {
// [1] call test
@ -913,6 +919,7 @@ test: {
jmp __breturn
}
// File Data
.segment Data
ref: .byte 3, 4, 3, $12, 9, 1, 4, 2, 4, 5, 1, 0
ASSEMBLER OPTIMIZATIONS
@ -997,15 +1004,21 @@ Score: 202
// File Comments
// Test compound assignment operators
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="assignment-compound.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const GREEN = 5
.const RED = 2
.label screen1 = $400
.label cols = $d800
.label screen2 = screen1+$28
.segment Code
// main
main: {
// test(i++, a)
@ -1178,5 +1191,6 @@ test: {
rts
}
// File Data
.segment Data
ref: .byte 3, 4, 3, $12, 9, 1, 4, 2, 4, 5, 1, 0

View File

@ -1,9 +1,15 @@
// 8 bit converted md5 calculator
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="atarixl-md5b.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
.label line = 9
.label idx = $b
.segment Code
__start: {
// line = 0x0400
lda #<$400
@ -231,5 +237,6 @@ print: {
// }
rts
}
.segment Data
HEX: .text "0123456789abcdef"
.byte 0

View File

@ -871,12 +871,18 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// 8 bit converted md5 calculator
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="atarixl-md5b.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.label line = 9
.label idx = $b
.segment Code
// __start
__start: {
jmp __init1
@ -1220,6 +1226,7 @@ print: {
rts
}
// File Data
.segment Data
HEX: .text "0123456789abcdef"
.byte 0
@ -1364,12 +1371,18 @@ Score: 1690
// File Comments
// 8 bit converted md5 calculator
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="atarixl-md5b.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.label line = 9
.label idx = $b
.segment Code
// __start
__start: {
// __start::__init1
@ -1714,6 +1727,7 @@ print: {
rts
}
// File Data
.segment Data
HEX: .text "0123456789abcdef"
.byte 0

View File

@ -1,7 +1,12 @@
// Test atoi()
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="atoi-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
.const LIGHT_BLUE = $e
.const OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS = 1
.const SIZEOF_STRUCT_PRINTF_BUFFER_NUMBER = $c
@ -18,6 +23,7 @@
.label conio_line_text = $b
// The current color cursor line start
.label conio_line_color = $d
.segment Code
__start: {
// conio_cursor_x = 0
lda #0
@ -90,6 +96,7 @@ main: {
jsr cputs
// }
rts
.segment Data
str: .text "1234"
.byte 0
s: .text @"\n"
@ -97,6 +104,7 @@ main: {
str1: .text "-5678"
.byte 0
}
.segment Code
// Set the cursor to the specified position
// gotoxy(byte register(X) y)
gotoxy: {
@ -723,6 +731,7 @@ memset: {
!:
jmp __b2
}
.segment Data
// The digits used for numbers
DIGITS: .text "0123456789abcdef"
// Values of decimal digits

View File

@ -4028,9 +4028,14 @@ ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test atoi()
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="atoi-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.const LIGHT_BLUE = $e
.const OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS = 1
@ -4048,6 +4053,7 @@ ASSEMBLER BEFORE OPTIMIZATION
.label conio_line_text = $b
// The current color cursor line start
.label conio_line_color = $d
.segment Code
// __start
__start: {
jmp __init1
@ -4208,6 +4214,7 @@ main: {
__breturn:
// [32] return
rts
.segment Data
str: .text "1234"
.byte 0
s: .text @"\n"
@ -4215,6 +4222,7 @@ main: {
str1: .text "-5678"
.byte 0
}
.segment Code
// gotoxy
// Set the cursor to the specified position
// gotoxy(byte register(X) y)
@ -5155,6 +5163,7 @@ memset: {
jmp __b2_from___b3
}
// File Data
.segment Data
// The digits used for numbers
DIGITS: .text "0123456789abcdef"
// Values of decimal digits
@ -5590,9 +5599,14 @@ Score: 21586
// File Comments
// Test atoi()
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="atoi-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
.const LIGHT_BLUE = $e
.const OFFSET_STRUCT_PRINTF_BUFFER_NUMBER_DIGITS = 1
@ -5610,6 +5624,7 @@ Score: 21586
.label conio_line_text = $b
// The current color cursor line start
.label conio_line_color = $d
.segment Code
// __start
__start: {
// __start::__init1
@ -5746,6 +5761,7 @@ main: {
// }
// [32] return
rts
.segment Data
str: .text "1234"
.byte 0
s: .text @"\n"
@ -5753,6 +5769,7 @@ main: {
str1: .text "-5678"
.byte 0
}
.segment Code
// gotoxy
// Set the cursor to the specified position
// gotoxy(byte register(X) y)
@ -6659,6 +6676,7 @@ memset: {
jmp __b2
}
// File Data
.segment Data
// The digits used for numbers
DIGITS: .text "0123456789abcdef"
// Values of decimal digits

View File

@ -1,8 +1,14 @@
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bgblack.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.const BLACK = 0
.label BG_COLOR = $d021
.segment Code
main: {
// *BG_COLOR = BLACK
lda #BLACK

View File

@ -66,12 +66,18 @@ Uplifting [] best 15 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bgblack.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const BLACK = 0
.label BG_COLOR = $d021
.segment Code
// main
main: {
// [0] *BG_COLOR = BLACK -- _deref_pbuc1=vbuc2
@ -103,12 +109,18 @@ Score: 12
// File Comments
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bgblack.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const BLACK = 0
.label BG_COLOR = $d021
.segment Code
// main
main: {
// *BG_COLOR = BLACK

View File

@ -1,9 +1,14 @@
// Commodore 64 Registers and Constants
// The MOS 6526 Complex Interface Adapter (CIA)
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bitmap-circle-2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.const VIC_BMM = $20
.const VIC_DEN = $10
.const VIC_RSEL = 8
@ -13,6 +18,7 @@
.label VIC_MEMORY = $d018
.label SCREEN = $400
.label BITMAP = $2000
.segment Code
main: {
.label i = 2
// fill(BITMAP,40*25*8,0)
@ -493,4 +499,5 @@ plot: {
// }
rts
}
.segment Data
bitmask: .byte $80, $40, $20, $10, 8, 4, 2, 1

View File

@ -1274,9 +1274,14 @@ ASSEMBLER BEFORE OPTIMIZATION
// The MOS 6526 Complex Interface Adapter (CIA)
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bitmap-circle-2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const VIC_BMM = $20
.const VIC_DEN = $10
@ -1287,6 +1292,7 @@ ASSEMBLER BEFORE OPTIMIZATION
.label VIC_MEMORY = $d018
.label SCREEN = $400
.label BITMAP = $2000
.segment Code
// main
main: {
.label i = 2
@ -1928,6 +1934,7 @@ plot: {
rts
}
// File Data
.segment Data
bitmask: .byte $80, $40, $20, $10, 8, 4, 2, 1
ASSEMBLER OPTIMIZATIONS
@ -2003,11 +2010,11 @@ Removing instruction __b3:
Removing instruction __b2:
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination
Fixing long branch [146] bmi __b3 to bpl
Fixing long branch [343] bmi __breturn to bpl
Fixing long branch [353] bmi __breturn to bpl
Fixing long branch [357] bmi __breturn to bpl
Fixing long branch [367] bpl __breturn to bmi
Fixing long branch [152] bmi __b3 to bpl
Fixing long branch [349] bmi __breturn to bpl
Fixing long branch [359] bmi __breturn to bpl
Fixing long branch [363] bmi __breturn to bpl
Fixing long branch [373] bpl __breturn to bmi
FINAL SYMBOL TABLE
const nomodify byte* BITMAP = (byte*) 8192
@ -2120,9 +2127,14 @@ Score: 51752
// The MOS 6526 Complex Interface Adapter (CIA)
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bitmap-circle-2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const VIC_BMM = $20
.const VIC_DEN = $10
@ -2133,6 +2145,7 @@ Score: 51752
.label VIC_MEMORY = $d018
.label SCREEN = $400
.label BITMAP = $2000
.segment Code
// main
main: {
.label i = 2
@ -2767,5 +2780,6 @@ plot: {
rts
}
// File Data
.segment Data
bitmask: .byte $80, $40, $20, $10, 8, 4, 2, 1

View File

@ -1,9 +1,14 @@
// Plots a circle on a bitmap using Bresenham's Circle algorithm
// Coded by Richard-William Loerakker
// Original Source https://bcaorganizer.blogspot.com/p/c-program-for_21.html?fbclid=IwAR0iL8pYcCqhCPa6LmtQ9qej-YonYVepY2cBegYRIWO0l8RPeOnTVniMAac
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bitmap-circle.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.const VIC_BMM = $20
.const VIC_DEN = $10
.const VIC_RSEL = 8
@ -13,6 +18,7 @@
.label VIC_MEMORY = $d018
.label SCREEN = $400
.label BITMAP = $2000
.segment Code
main: {
// fill(BITMAP,40*25*8,0)
ldx #0
@ -425,4 +431,5 @@ plot: {
// }
rts
}
.segment Data
bitmask: .byte $80, $40, $20, $10, 8, 4, 2, 1

View File

@ -1150,9 +1150,14 @@ ASSEMBLER BEFORE OPTIMIZATION
// Coded by Richard-William Loerakker
// Original Source https://bcaorganizer.blogspot.com/p/c-program-for_21.html?fbclid=IwAR0iL8pYcCqhCPa6LmtQ9qej-YonYVepY2cBegYRIWO0l8RPeOnTVniMAac
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bitmap-circle.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const VIC_BMM = $20
.const VIC_DEN = $10
@ -1163,6 +1168,7 @@ ASSEMBLER BEFORE OPTIMIZATION
.label VIC_MEMORY = $d018
.label SCREEN = $400
.label BITMAP = $2000
.segment Code
// main
main: {
// [1] call fill
@ -1719,6 +1725,7 @@ plot: {
rts
}
// File Data
.segment Data
bitmask: .byte $80, $40, $20, $10, 8, 4, 2, 1
ASSEMBLER OPTIMIZATIONS
@ -1783,7 +1790,7 @@ Removing instruction __b13:
Removing instruction __b1_from___b13:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Fixing long branch [112] bmi __b3 to bpl
Fixing long branch [118] bmi __b3 to bpl
FINAL SYMBOL TABLE
const nomodify byte* BITMAP = (byte*) 8192
@ -1890,9 +1897,14 @@ Score: 6073
// Coded by Richard-William Loerakker
// Original Source https://bcaorganizer.blogspot.com/p/c-program-for_21.html?fbclid=IwAR0iL8pYcCqhCPa6LmtQ9qej-YonYVepY2cBegYRIWO0l8RPeOnTVniMAac
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bitmap-circle.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const VIC_BMM = $20
.const VIC_DEN = $10
@ -1903,6 +1915,7 @@ Score: 6073
.label VIC_MEMORY = $d018
.label SCREEN = $400
.label BITMAP = $2000
.segment Code
// main
main: {
// fill(BITMAP,40*25*8,0)
@ -2450,5 +2463,6 @@ plot: {
rts
}
// File Data
.segment Data
bitmask: .byte $80, $40, $20, $10, 8, 4, 2, 1

View File

@ -1,8 +1,13 @@
// Illustrates problem with bitmap-draw.kc line()
// Reported by Janne Johansson
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bitmap-line-anim-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.const VIC_BMM = $20
.const VIC_DEN = $10
.const VIC_RSEL = 8
@ -13,6 +18,7 @@
.label SCREEN = $400
.label BITMAP = $2000
.label next = 5
.segment Code
main: {
// *BORDER_COLOR = 0
lda #0
@ -426,6 +432,7 @@ bitmap_plot: {
// }
rts
}
.segment Data
// Tables for the plotter - initialized by calling bitmap_draw_init();
bitmap_plot_xlo: .fill $100, 0
bitmap_plot_xhi: .fill $100, 0

View File

@ -2641,9 +2641,14 @@ ASSEMBLER BEFORE OPTIMIZATION
// Illustrates problem with bitmap-draw.kc line()
// Reported by Janne Johansson
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bitmap-line-anim-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const VIC_BMM = $20
.const VIC_DEN = $10
@ -2655,6 +2660,7 @@ ASSEMBLER BEFORE OPTIMIZATION
.label SCREEN = $400
.label BITMAP = $2000
.label next = 5
.segment Code
// main
main: {
// [0] *BORDER_COLOR = 0 -- _deref_pbuc1=vbuc2
@ -3375,6 +3381,7 @@ bitmap_plot: {
rts
}
// File Data
.segment Data
// Tables for the plotter - initialized by calling bitmap_draw_init();
bitmap_plot_xlo: .fill $100, 0
bitmap_plot_xhi: .fill $100, 0
@ -3734,9 +3741,14 @@ Score: 30221
// Illustrates problem with bitmap-draw.kc line()
// Reported by Janne Johansson
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bitmap-line-anim-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const VIC_BMM = $20
.const VIC_DEN = $10
@ -3748,6 +3760,7 @@ Score: 30221
.label SCREEN = $400
.label BITMAP = $2000
.label next = 5
.segment Code
// main
main: {
// *BORDER_COLOR = 0
@ -4428,6 +4441,7 @@ bitmap_plot: {
rts
}
// File Data
.segment Data
// Tables for the plotter - initialized by calling bitmap_draw_init();
bitmap_plot_xlo: .fill $100, 0
bitmap_plot_xhi: .fill $100, 0

View File

@ -1,8 +1,13 @@
// Shows that bitmap2.kc line() does not have the same problem as bitmap-draw.kc
// See bitmap-line-anim-1.kc
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bitmap-line-anim-2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
.const VIC_BMM = $20
.const VIC_DEN = $10
.const VIC_RSEL = 8
@ -15,6 +20,7 @@
.label SCREEN = $400
.label BITMAP = $2000
.label next = 2
.segment Code
main: {
// *BORDER_COLOR = 0
lda #0
@ -502,6 +508,7 @@ bitmap_plot: {
// }
rts
}
.segment Data
// Tables for the plotter - initialized by calling bitmap_init();
bitmap_plot_ylo: .fill $100, 0
bitmap_plot_yhi: .fill $100, 0

View File

@ -2272,9 +2272,14 @@ ASSEMBLER BEFORE OPTIMIZATION
// Shows that bitmap2.kc line() does not have the same problem as bitmap-draw.kc
// See bitmap-line-anim-1.kc
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bitmap-line-anim-2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const VIC_BMM = $20
.const VIC_DEN = $10
@ -2288,6 +2293,7 @@ ASSEMBLER BEFORE OPTIMIZATION
.label SCREEN = $400
.label BITMAP = $2000
.label next = 2
.segment Code
// main
main: {
// [0] *BORDER_COLOR = 0 -- _deref_pbuc1=vbuc2
@ -3054,6 +3060,7 @@ bitmap_plot: {
rts
}
// File Data
.segment Data
// Tables for the plotter - initialized by calling bitmap_init();
bitmap_plot_ylo: .fill $100, 0
bitmap_plot_yhi: .fill $100, 0
@ -3217,7 +3224,7 @@ Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing unreachable instruction jmp __b1
Succesful ASM optimization Pass5UnreachableCodeElimination
Fixing long branch [153] beq __b4 to bne
Fixing long branch [159] beq __b4 to bne
FINAL SYMBOL TABLE
const nomodify byte* BG_COLOR = (byte*) 53281
@ -3396,9 +3403,14 @@ Score: 30180
// Shows that bitmap2.kc line() does not have the same problem as bitmap-draw.kc
// See bitmap-line-anim-1.kc
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bitmap-line-anim-2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const VIC_BMM = $20
.const VIC_DEN = $10
@ -3412,6 +3424,7 @@ Score: 30180
.label SCREEN = $400
.label BITMAP = $2000
.label next = 2
.segment Code
// main
main: {
// *BORDER_COLOR = 0
@ -4138,6 +4151,7 @@ bitmap_plot: {
rts
}
// File Data
.segment Data
// Tables for the plotter - initialized by calling bitmap_init();
bitmap_plot_ylo: .fill $100, 0
bitmap_plot_yhi: .fill $100, 0

View File

@ -3,9 +3,14 @@
// Commodore 64 Registers and Constants
// The MOS 6526 Complex Interface Adapter (CIA)
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bitmap-plot-0.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
.const CIA_INTERRUPT_CLEAR = $7f
.const VIC_BMM = $20
@ -42,6 +47,7 @@
.label SCREEN = $400
// Counts frames - updated by the IRQ
.label frame_cnt = 8
.segment Code
__start: {
// frame_cnt = 1
lda #1
@ -364,6 +370,7 @@ memset: {
!:
jmp __b2
}
.segment Data
// Tables for the plotter - initialized by calling bitmap_init();
bitmap_plot_ylo: .fill $100, 0
bitmap_plot_yhi: .fill $100, 0

View File

@ -1648,9 +1648,14 @@ ASSEMBLER BEFORE OPTIMIZATION
// The MOS 6526 Complex Interface Adapter (CIA)
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bitmap-plot-0.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
.const CIA_INTERRUPT_CLEAR = $7f
@ -1688,6 +1693,7 @@ ASSEMBLER BEFORE OPTIMIZATION
.label SCREEN = $400
// Counts frames - updated by the IRQ
.label frame_cnt = 8
.segment Code
// __start
__start: {
jmp __init1
@ -2202,6 +2208,7 @@ memset: {
jmp __b2_from___b3
}
// File Data
.segment Data
// Tables for the plotter - initialized by calling bitmap_init();
bitmap_plot_ylo: .fill $100, 0
bitmap_plot_yhi: .fill $100, 0
@ -2444,9 +2451,14 @@ Score: 3232
// The MOS 6526 Complex Interface Adapter (CIA)
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
// Upstart
.pc = $801 "Basic"
// Commodore 64 PRG executable file
.file [name="bitmap-plot-0.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.pc = $80d "Program"
// Global Constants & labels
// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
.const CIA_INTERRUPT_CLEAR = $7f
@ -2484,6 +2496,7 @@ Score: 3232
.label SCREEN = $400
// Counts frames - updated by the IRQ
.label frame_cnt = 8
.segment Code
// __start
__start: {
// __start::__init1
@ -2969,6 +2982,7 @@ memset: {
jmp __b2
}
// File Data
.segment Data
// Tables for the plotter - initialized by calling bitmap_init();
bitmap_plot_ylo: .fill $100, 0
bitmap_plot_yhi: .fill $100, 0

Some files were not shown because too many files have changed in this diff Show More