mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-01-11 20:30:08 +00:00
Added memory mapper to mega65.h
This commit is contained in:
parent
a57b77f911
commit
79963be64c
@ -1348,3 +1348,892 @@ sta {z1}+3
|
||||
NO_SYNTHESIS
|
||||
//FRAGMENT vduz1=vwsc1
|
||||
NO_SYNTHESIS
|
||||
//FRAGMENT vwuz1=vbuc1
|
||||
lda #<{c1}
|
||||
sta {z1}
|
||||
lda #>{c1}
|
||||
sta {z1}+1
|
||||
//FRAGMENT _deref_pbuc1=_deref_pbuc2
|
||||
lda {c2}
|
||||
sta {c1}
|
||||
//FRAGMENT vduz1=vbuc1
|
||||
lda #{c1}
|
||||
sta {z1}
|
||||
lda #0
|
||||
sta {z1}+1
|
||||
sta {z1}+2
|
||||
sta {z1}+3
|
||||
//FRAGMENT vbuz1=vbuc1_plus_vbuz2
|
||||
lda #{c1}
|
||||
clc
|
||||
adc {z2}
|
||||
sta {z1}
|
||||
//FRAGMENT vwuz1=vwuc1_minus_vbuz2
|
||||
sec
|
||||
lda #<{c1}
|
||||
sbc {z2}
|
||||
sta {z1}
|
||||
lda #>{c1}
|
||||
sbc #0
|
||||
sta {z1}+1
|
||||
//FRAGMENT vbuz1=vbuz2_ror_5
|
||||
lda {z2}
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
sta {z1}
|
||||
//FRAGMENT vbuz1=vbuc1_rol_vbuz2
|
||||
lda #{c1}
|
||||
ldy {z2}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
sta {z1}
|
||||
//FRAGMENT vwuz1=vwuz2
|
||||
lda {z2}
|
||||
sta {z1}
|
||||
lda {z2}+1
|
||||
sta {z1}+1
|
||||
//FRAGMENT vbuz1=_lo_vwuz2
|
||||
lda {z2}
|
||||
sta {z1}
|
||||
//FRAGMENT vbuz1=_hi_vwuz2
|
||||
lda {z2}+1
|
||||
sta {z1}
|
||||
//FRAGMENT vbuz1=vbuz2_bor_vbuz3
|
||||
lda {z2}
|
||||
ora {z3}
|
||||
sta {z1}
|
||||
//FRAGMENT vduz1=vduz2_ror_4
|
||||
lda {z2}+3
|
||||
lsr
|
||||
sta {z1}+3
|
||||
lda {z2}+2
|
||||
ror
|
||||
sta {z1}+2
|
||||
lda {z2}+1
|
||||
ror
|
||||
sta {z1}+1
|
||||
lda {z2}
|
||||
ror
|
||||
sta {z1}
|
||||
lsr {z1}+3
|
||||
ror {z1}+2
|
||||
ror {z1}+1
|
||||
ror {z1}
|
||||
lsr {z1}+3
|
||||
ror {z1}+2
|
||||
ror {z1}+1
|
||||
ror {z1}
|
||||
lsr {z1}+3
|
||||
ror {z1}+2
|
||||
ror {z1}+1
|
||||
ror {z1}
|
||||
//FRAGMENT vbuz1=_hi__word_vduz2
|
||||
lda {z2}+1
|
||||
sta {z1}
|
||||
//FRAGMENT vwuz1=_lo_vduz2
|
||||
lda {z2}
|
||||
sta {z1}
|
||||
lda {z2}+1
|
||||
sta {z1}+1
|
||||
//FRAGMENT vbuz1=vbuc1_plus_vbuaa
|
||||
clc
|
||||
adc #{c1}
|
||||
sta {z1}
|
||||
//FRAGMENT vbuz1=vbuc1_plus_vbuxx
|
||||
txa
|
||||
clc
|
||||
adc #{c1}
|
||||
sta {z1}
|
||||
//FRAGMENT vbuz1=vbuc1_plus_vbuyy
|
||||
tya
|
||||
clc
|
||||
adc #{c1}
|
||||
sta {z1}
|
||||
//FRAGMENT vbuz1=vbuc1_plus_vbuzz
|
||||
tza
|
||||
clc
|
||||
adc #{c1}
|
||||
sta {z1}
|
||||
//FRAGMENT vbuaa=vbuc1_plus_vbuz1
|
||||
lda #{c1}
|
||||
clc
|
||||
adc {z1}
|
||||
//FRAGMENT vbuaa=vbuc1_plus_vbuaa
|
||||
clc
|
||||
adc #{c1}
|
||||
//FRAGMENT vbuaa=vbuc1_plus_vbuxx
|
||||
txa
|
||||
clc
|
||||
adc #{c1}
|
||||
//FRAGMENT vbuaa=vbuc1_plus_vbuyy
|
||||
tya
|
||||
clc
|
||||
adc #{c1}
|
||||
//FRAGMENT vbuaa=vbuc1_plus_vbuzz
|
||||
tza
|
||||
clc
|
||||
adc #{c1}
|
||||
//FRAGMENT vbuxx=vbuc1_plus_vbuz1
|
||||
lda #{c1}
|
||||
clc
|
||||
adc {z1}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbuc1_plus_vbuaa
|
||||
clc
|
||||
adc #{c1}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbuc1_plus_vbuxx
|
||||
txa
|
||||
clc
|
||||
adc #{c1}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbuc1_plus_vbuyy
|
||||
tya
|
||||
clc
|
||||
adc #{c1}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbuc1_plus_vbuzz
|
||||
tza
|
||||
clc
|
||||
adc #{c1}
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuc1_plus_vbuz1
|
||||
lda #{c1}
|
||||
clc
|
||||
adc {z1}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbuc1_plus_vbuaa
|
||||
clc
|
||||
adc #{c1}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbuc1_plus_vbuxx
|
||||
txa
|
||||
clc
|
||||
adc #{c1}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbuc1_plus_vbuyy
|
||||
tya
|
||||
clc
|
||||
adc #{c1}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbuc1_plus_vbuzz
|
||||
tza
|
||||
clc
|
||||
adc #{c1}
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuc1_plus_vbuz1
|
||||
lda #{c1}
|
||||
clc
|
||||
adc {z1}
|
||||
taz
|
||||
//FRAGMENT vbuzz=vbuc1_plus_vbuaa
|
||||
clc
|
||||
adc #{c1}
|
||||
taz
|
||||
//FRAGMENT vbuzz=vbuc1_plus_vbuxx
|
||||
txa
|
||||
clc
|
||||
adc #{c1}
|
||||
taz
|
||||
//FRAGMENT vbuzz=vbuc1_plus_vbuyy
|
||||
tya
|
||||
clc
|
||||
adc #{c1}
|
||||
taz
|
||||
//FRAGMENT vbuzz=vbuc1_plus_vbuzz
|
||||
tza
|
||||
clc
|
||||
adc #{c1}
|
||||
taz
|
||||
//FRAGMENT vwuz1=vwuc1_minus_vbuaa
|
||||
tax
|
||||
stx $ff
|
||||
lda #<{c1}
|
||||
sec
|
||||
sbc $ff
|
||||
sta {z1}
|
||||
lda #>{c1}
|
||||
sbc #00
|
||||
sta {z1}+1
|
||||
//FRAGMENT vwuz1=vwuc1_minus_vbuxx
|
||||
stx $ff
|
||||
lda #<{c1}
|
||||
sec
|
||||
sbc $ff
|
||||
sta {z1}
|
||||
lda #>{c1}
|
||||
sbc #00
|
||||
sta {z1}+1
|
||||
//FRAGMENT vwuz1=vwuc1_minus_vbuyy
|
||||
tya
|
||||
tax
|
||||
stx $ff
|
||||
lda #<{c1}
|
||||
sec
|
||||
sbc $ff
|
||||
sta {z1}
|
||||
lda #>{c1}
|
||||
sbc #00
|
||||
sta {z1}+1
|
||||
//FRAGMENT vwuz1=vwuc1_minus_vbuzz
|
||||
tza
|
||||
tax
|
||||
stx $ff
|
||||
lda #<{c1}
|
||||
sec
|
||||
sbc $ff
|
||||
sta {z1}
|
||||
lda #>{c1}
|
||||
sbc #00
|
||||
sta {z1}+1
|
||||
//FRAGMENT vbuz1=vbuxx_ror_5
|
||||
txa
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
sta {z1}
|
||||
//FRAGMENT vbuz1=vbuyy_ror_5
|
||||
tya
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
sta {z1}
|
||||
//FRAGMENT vbuz1=vbuzz_ror_5
|
||||
tza
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
sta {z1}
|
||||
//FRAGMENT vbuaa=vbuz1_ror_5
|
||||
lda {z1}
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
//FRAGMENT vbuaa=vbuxx_ror_5
|
||||
txa
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
//FRAGMENT vbuaa=vbuyy_ror_5
|
||||
tya
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
//FRAGMENT vbuaa=vbuzz_ror_5
|
||||
tza
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
//FRAGMENT vbuxx=vbuz1_ror_5
|
||||
lda {z1}
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbuxx_ror_5
|
||||
txa
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbuyy_ror_5
|
||||
tya
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbuzz_ror_5
|
||||
tza
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuz1_ror_5
|
||||
lda {z1}
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbuxx_ror_5
|
||||
txa
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbuyy_ror_5
|
||||
tya
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbuzz_ror_5
|
||||
tza
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuz1_ror_5
|
||||
lda {z1}
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
taz
|
||||
//FRAGMENT vbuzz=vbuxx_ror_5
|
||||
txa
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
taz
|
||||
//FRAGMENT vbuzz=vbuyy_ror_5
|
||||
tya
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
taz
|
||||
//FRAGMENT vbuzz=vbuzz_ror_5
|
||||
tza
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
taz
|
||||
//FRAGMENT vbuaa=vbuc1_rol_vbuz1
|
||||
lda #{c1}
|
||||
ldy {z1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
//FRAGMENT vbuxx=vbuc1_rol_vbuz1
|
||||
lda #{c1}
|
||||
ldx {z1}
|
||||
cpx #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dex
|
||||
bne !-
|
||||
!e:
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuc1_rol_vbuz1
|
||||
lda #{c1}
|
||||
ldy {z1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuc1_rol_vbuz1
|
||||
lda #{c1}
|
||||
ldy {z1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
taz
|
||||
//FRAGMENT vbuz1=vbuc1_rol_vbuaa
|
||||
tay
|
||||
lda #{c1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
sta {z1}
|
||||
//FRAGMENT vbuaa=vbuc1_rol_vbuaa
|
||||
tay
|
||||
lda #{c1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
//FRAGMENT vbuxx=vbuc1_rol_vbuaa
|
||||
tax
|
||||
lda #{c1}
|
||||
cpx #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dex
|
||||
bne !-
|
||||
!e:
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuc1_rol_vbuaa
|
||||
tay
|
||||
lda #{c1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuc1_rol_vbuaa
|
||||
tay
|
||||
lda #{c1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
taz
|
||||
//FRAGMENT vbuz1=vbuc1_rol_vbuxx
|
||||
lda #{c1}
|
||||
cpx #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dex
|
||||
bne !-
|
||||
!e:
|
||||
sta {z1}
|
||||
//FRAGMENT vbuaa=vbuc1_rol_vbuxx
|
||||
lda #{c1}
|
||||
cpx #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dex
|
||||
bne !-
|
||||
!e:
|
||||
//FRAGMENT vbuxx=vbuc1_rol_vbuxx
|
||||
lda #{c1}
|
||||
cpx #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dex
|
||||
bne !-
|
||||
!e:
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuc1_rol_vbuxx
|
||||
lda #{c1}
|
||||
cpx #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dex
|
||||
bne !-
|
||||
!e:
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuc1_rol_vbuxx
|
||||
lda #{c1}
|
||||
cpx #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dex
|
||||
bne !-
|
||||
!e:
|
||||
taz
|
||||
//FRAGMENT vbuz1=vbuc1_rol_vbuyy
|
||||
lda #{c1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
sta {z1}
|
||||
//FRAGMENT vbuaa=vbuc1_rol_vbuyy
|
||||
lda #{c1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
//FRAGMENT vbuxx=vbuc1_rol_vbuyy
|
||||
lda #{c1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuc1_rol_vbuyy
|
||||
lda #{c1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuc1_rol_vbuyy
|
||||
lda #{c1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
taz
|
||||
//FRAGMENT vbuz1=vbuc1_rol_vbuzz
|
||||
tza
|
||||
tay
|
||||
lda #{c1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
sta {z1}
|
||||
//FRAGMENT vbuaa=vbuc1_rol_vbuzz
|
||||
tza
|
||||
tay
|
||||
lda #{c1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
//FRAGMENT vbuxx=vbuc1_rol_vbuzz
|
||||
tza
|
||||
tax
|
||||
lda #{c1}
|
||||
cpx #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dex
|
||||
bne !-
|
||||
!e:
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuc1_rol_vbuzz
|
||||
tza
|
||||
tay
|
||||
lda #{c1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuc1_rol_vbuzz
|
||||
tza
|
||||
tay
|
||||
lda #{c1}
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
asl
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
taz
|
||||
//FRAGMENT vbuaa=_lo_vwuz1
|
||||
lda {z1}
|
||||
//FRAGMENT vbuxx=_lo_vwuz1
|
||||
ldx {z1}
|
||||
//FRAGMENT vbuaa=_hi_vwuz1
|
||||
lda {z1}+1
|
||||
//FRAGMENT vbuxx=_hi_vwuz1
|
||||
ldx {z1}+1
|
||||
//FRAGMENT vbuz1=vbuxx_bor_vbuz2
|
||||
txa
|
||||
ora {z2}
|
||||
sta {z1}
|
||||
//FRAGMENT vbuz1=vbuyy_bor_vbuz2
|
||||
tya
|
||||
ora {z2}
|
||||
sta {z1}
|
||||
//FRAGMENT vbuz1=vbuzz_bor_vbuz2
|
||||
tza
|
||||
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=vbuzz_bor_vbuaa
|
||||
tay
|
||||
tza
|
||||
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=_hi__word_vduz1
|
||||
lda {z1}+1
|
||||
//FRAGMENT vbuxx=_hi__word_vduz1
|
||||
ldx {z1}+1
|
||||
//FRAGMENT vbuaa=vbuz1_bor_vbuz2
|
||||
lda {z1}
|
||||
ora {z2}
|
||||
//FRAGMENT vbuxx=vbuz1_bor_vbuz2
|
||||
lda {z1}
|
||||
ora {z2}
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuz1_bor_vbuz2
|
||||
lda {z1}
|
||||
ora {z2}
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuz1_bor_vbuz2
|
||||
lda {z1}
|
||||
ora {z2}
|
||||
taz
|
||||
//FRAGMENT vbuaa=vbuxx_bor_vbuz1
|
||||
txa
|
||||
ora {z1}
|
||||
//FRAGMENT vbuxx=vbuxx_bor_vbuz1
|
||||
txa
|
||||
ora {z1}
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuxx_bor_vbuz1
|
||||
txa
|
||||
ora {z1}
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuxx_bor_vbuz1
|
||||
txa
|
||||
ora {z1}
|
||||
taz
|
||||
//FRAGMENT vbuaa=vbuyy_bor_vbuz1
|
||||
tya
|
||||
ora {z1}
|
||||
//FRAGMENT vbuxx=vbuyy_bor_vbuz1
|
||||
tya
|
||||
ora {z1}
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuyy_bor_vbuz1
|
||||
tya
|
||||
ora {z1}
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuyy_bor_vbuz1
|
||||
tya
|
||||
ora {z1}
|
||||
taz
|
||||
//FRAGMENT vbuaa=vbuzz_bor_vbuz1
|
||||
tza
|
||||
ora {z1}
|
||||
//FRAGMENT vbuxx=vbuzz_bor_vbuz1
|
||||
tza
|
||||
ora {z1}
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuzz_bor_vbuz1
|
||||
tza
|
||||
ora {z1}
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuzz_bor_vbuz1
|
||||
tza
|
||||
ora {z1}
|
||||
taz
|
||||
//FRAGMENT vbuaa=vbuz1_bor_vbuaa
|
||||
ora {z1}
|
||||
//FRAGMENT vbuxx=vbuz1_bor_vbuaa
|
||||
ora {z1}
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuz1_bor_vbuaa
|
||||
ora {z1}
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuz1_bor_vbuaa
|
||||
ora {z1}
|
||||
taz
|
||||
//FRAGMENT vbuaa=vbuxx_bor_vbuaa
|
||||
stx $ff
|
||||
ora $ff
|
||||
//FRAGMENT vbuxx=vbuxx_bor_vbuaa
|
||||
stx $ff
|
||||
ora $ff
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuxx_bor_vbuaa
|
||||
stx $ff
|
||||
ora $ff
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuxx_bor_vbuaa
|
||||
stx $ff
|
||||
ora $ff
|
||||
taz
|
||||
//FRAGMENT vbuaa=vbuyy_bor_vbuaa
|
||||
sty $ff
|
||||
ora $ff
|
||||
//FRAGMENT vbuxx=vbuyy_bor_vbuaa
|
||||
sty $ff
|
||||
ora $ff
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuyy_bor_vbuaa
|
||||
sty $ff
|
||||
ora $ff
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuyy_bor_vbuaa
|
||||
sty $ff
|
||||
ora $ff
|
||||
taz
|
||||
//FRAGMENT vbuaa=vbuzz_bor_vbuaa
|
||||
tay
|
||||
tza
|
||||
sty $ff
|
||||
ora $ff
|
||||
//FRAGMENT vbuxx=vbuzz_bor_vbuaa
|
||||
tax
|
||||
tza
|
||||
stx $ff
|
||||
ora $ff
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuzz_bor_vbuaa
|
||||
tay
|
||||
tza
|
||||
sty $ff
|
||||
ora $ff
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuzz_bor_vbuaa
|
||||
tay
|
||||
tza
|
||||
sty $ff
|
||||
ora $ff
|
||||
taz
|
||||
//FRAGMENT vbuaa=vbuz1_bor_vbuxx
|
||||
txa
|
||||
ora {z1}
|
||||
//FRAGMENT vbuxx=vbuz1_bor_vbuxx
|
||||
txa
|
||||
ora {z1}
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuz1_bor_vbuxx
|
||||
txa
|
||||
ora {z1}
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuz1_bor_vbuxx
|
||||
txa
|
||||
ora {z1}
|
||||
taz
|
||||
//FRAGMENT vbuyy=_lo_vwuz1
|
||||
ldy {z1}
|
||||
//FRAGMENT vbuzz=_lo_vwuz1
|
||||
ldz {z1}
|
||||
//FRAGMENT vbuyy=_hi_vwuz1
|
||||
ldy {z1}+1
|
||||
//FRAGMENT vbuzz=_hi_vwuz1
|
||||
ldz {z1}+1
|
||||
//FRAGMENT vbuz1=vbuz2_bor_vbuyy
|
||||
tya
|
||||
ora {z2}
|
||||
sta {z1}
|
||||
//FRAGMENT vbuyy=_hi__word_vduz1
|
||||
ldy {z1}+1
|
||||
//FRAGMENT vbuzz=_hi__word_vduz1
|
||||
lda {z1}+1
|
||||
taz
|
||||
//FRAGMENT pbuc1_derefidx_vbuyy=vbuaa
|
||||
sta {c1},y
|
||||
//FRAGMENT pbuc1_derefidx_vbuzz=vbuaa
|
||||
tax
|
||||
tza
|
||||
tay
|
||||
txa
|
||||
sta {c1},y
|
||||
//FRAGMENT pbuc1_derefidx_vbuyy=vbuxx
|
||||
txa
|
||||
sta {c1},y
|
||||
//FRAGMENT pbuc1_derefidx_vbuzz=vbuxx
|
||||
tza
|
||||
tay
|
||||
txa
|
||||
sta {c1},y
|
||||
//FRAGMENT pbuc1_derefidx_vbuzz=vbuyy
|
||||
tza
|
||||
tax
|
||||
tya
|
||||
sta {c1},x
|
||||
//FRAGMENT vbuz1=vbuxx
|
||||
stx {z1}
|
||||
//FRAGMENT vbuz1=vbuyy
|
||||
sty {z1}
|
||||
//FRAGMENT vbuz1=vbuzz
|
||||
tza
|
||||
sta {z1}
|
||||
//FRAGMENT vbuz1=vbuz2_bor_vbuzz
|
||||
tza
|
||||
ora {z2}
|
||||
sta {z1}
|
||||
//FRAGMENT vbuxx=vbuaa
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbuaa
|
||||
tay
|
||||
//FRAGMENT vbuzz=vbuaa
|
||||
taz
|
||||
|
134
src/main/kc/include/mega65-memorymapper.h
Normal file
134
src/main/kc/include/mega65-memorymapper.h
Normal file
@ -0,0 +1,134 @@
|
||||
// MEGA65 Memory Mapper allows the 6502 CPU to access up to 256MB of memory by remapping where the eight 8K blocks point in real memory.
|
||||
// The memory mapping is configured through the new MAP instruction of the MOS 4510.
|
||||
// https://mega65.org/
|
||||
// https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
|
||||
// https://github.com/MEGA65/mega65-core/blob/master/src/vhdl/gs4510.vhdl
|
||||
// http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt
|
||||
// http://anyplatform.net/media/guides/cpus/65xx%20Processor%20Data.txt
|
||||
|
||||
// Bit representing 8K block #0 of the 64K addressable memory ($0000-$1fff)
|
||||
const unsigned char MEMORYBLOCK_0000 = 0b00000001;
|
||||
// Bit representing 8K block #1 of the 64K addressable memory ($2000-$3fff)
|
||||
const unsigned char MEMORYBLOCK_2000 = 0b00000010;
|
||||
// Bit representing 8K block #2 of the 64K addressable memory ($4000-$5fff)
|
||||
const unsigned char MEMORYBLOCK_4000 = 0b00000100;
|
||||
// Bit representing 8K block #3 of the 64K addressable memory ($6000-$7fff)
|
||||
const unsigned char MEMORYBLOCK_6000 = 0b00001000;
|
||||
// Bit representing 8K block #4 of the 64K addressable memory ($8000-$9fff)
|
||||
const unsigned char MEMORYBLOCK_8000 = 0b00010000;
|
||||
// Bit representing 8K block #5 of the 64K addressable memory ($a000-$bfff)
|
||||
const unsigned char MEMORYBLOCK_A000 = 0b00100000;
|
||||
// Bit representing 8K block #6 of the 64K addressable memory ($c000-$dfff)
|
||||
const unsigned char MEMORYBLOCK_C000 = 0b01000000;
|
||||
// Bit representing 8K block #7 of the 64K addressable memory ($e000-$ffff)
|
||||
const unsigned char MEMORYBLOCK_E000 = 0b10000000;
|
||||
|
||||
// Remap some of the eight 8K memory blocks in the 64K address space of the 6502 to point somewhere else in the first 1MB memory space of the MEGA65.
|
||||
// After the remapping the CPU will access the mapped memory whenever it uses instructions that access a remapped block.
|
||||
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
|
||||
// remapBlocks: Indicates which 8K blocks of the 6502 address space to remap. Each bit represents one 8K block
|
||||
// - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000.
|
||||
// - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000.
|
||||
// - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000.
|
||||
// - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000.
|
||||
// - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000.
|
||||
// - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000.
|
||||
// - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000.
|
||||
// - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000.
|
||||
// lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3).
|
||||
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 12bits of the passed value is used.
|
||||
// - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100.
|
||||
// - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000.
|
||||
// - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000.
|
||||
// - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000.
|
||||
// upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7).
|
||||
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 12bits of the passed value is used.
|
||||
// - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000
|
||||
// - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000.
|
||||
// - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000.
|
||||
// - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000.
|
||||
void memoryRemap(unsigned char remapBlocks, unsigned int lowerPageOffset, unsigned int upperPageOffset) {
|
||||
char * aVal = 0xfc;
|
||||
char * xVal = 0xfd;
|
||||
char * yVal = 0xfe;
|
||||
char * zVal = 0xff;
|
||||
*aVal = <lowerPageOffset;
|
||||
*xVal = (remapBlocks << 4) | (>lowerPageOffset & 0xf);
|
||||
*yVal = <upperPageOffset;
|
||||
*zVal = (remapBlocks & 0xf0) | (>upperPageOffset & 0xf);
|
||||
asm {
|
||||
lda aVal // lower blocks offset page low
|
||||
ldx xVal // lower blocks to map + lower blocks offset high nibble
|
||||
ldy yVal // upper blocks offset page
|
||||
ldz zVal // upper blocks to map + upper blocks offset page high nibble
|
||||
map
|
||||
eom
|
||||
}
|
||||
}
|
||||
|
||||
// Remap a single 8K memory block in the 64K address space of the 6502 to point somewhere else in the first 1MB memory space of the MEGA65.
|
||||
// All the other 8K memory blocks will not be mapped and will point to their own address in the lowest 64K of the MEGA65 memory.
|
||||
// blockPage: Page address of the 8K memory block to remap (ie. the block that is remapped is $100 * the passed page address.)
|
||||
// memoryPage: Page address of the memory that the block should point to in the 1MB memory space of the MEGA65.
|
||||
// Ie. the memory that will be pointed to is $100 * the passed page address. Only the lower 12bits of the passed value is used.
|
||||
void memoryRemapBlock(unsigned char blockPage, unsigned int memoryPage) {
|
||||
// Find the page offset (the number of pages to offset the block)
|
||||
unsigned int pageOffset = memoryPage-blockPage;
|
||||
// Which block is being remapped? (0-7)
|
||||
char block = blockPage / $20;
|
||||
char blockBits = 1<<block;
|
||||
memoryRemap(blockBits, pageOffset, pageOffset);
|
||||
}
|
||||
|
||||
// Remap some of the eight 8K memory blocks in the 64K address space of the 6502 to point somewhere else in the entire 256MB memory space of the MEGA65.
|
||||
// After the remapping the CPU will access the mapped memory whenever it uses instructions that access a remapped block.
|
||||
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
|
||||
// See Appendix G in file:///Users/jespergravgaard/Downloads/MEGA65-Book_draft%20(5).pdf for a description of the CPU memory remapper of the MEGA65.
|
||||
// remapBlocks: Indicates which 8K blocks of the 6502 address space to remap. Each bit represents one 8K block
|
||||
// - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000.
|
||||
// - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000.
|
||||
// - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000.
|
||||
// - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000.
|
||||
// - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000.
|
||||
// - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000.
|
||||
// - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000.
|
||||
// - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000.
|
||||
// lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3).
|
||||
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 20bits of the passed value is used.
|
||||
// - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100.
|
||||
// - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000.
|
||||
// - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000.
|
||||
// - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000.
|
||||
// upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7).
|
||||
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 20bits of the passed value is used.
|
||||
// - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000
|
||||
// - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000.
|
||||
// - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000.
|
||||
// - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000.
|
||||
void memoryRemap256M(unsigned char remapBlocks, unsigned long lowerPageOffset, unsigned long upperPageOffset) {
|
||||
char * lMb = 0xfa;
|
||||
char * uMb = 0xfb;
|
||||
char * aVal = 0xfc;
|
||||
char * xVal = 0xfd;
|
||||
char * yVal = 0xfe;
|
||||
char * zVal = 0xff;
|
||||
*lMb = >((unsigned int)(lowerPageOffset>>4));
|
||||
*uMb = >((unsigned int)(upperPageOffset>>4));
|
||||
*aVal = < <lowerPageOffset;
|
||||
*xVal = (remapBlocks << 4) | (> <lowerPageOffset & 0xf);
|
||||
*yVal = < <upperPageOffset;
|
||||
*zVal = (remapBlocks & 0xf0) | (> <upperPageOffset & 0xf);
|
||||
asm {
|
||||
lda lMb // lower blocks offset megabytes
|
||||
ldx #$0f // lower signal for MB offset
|
||||
ldy uMb // upper blocks offset megabytes
|
||||
ldz #$00 // upper signal for MB offset
|
||||
map
|
||||
lda aVal // lower blocks offset page low
|
||||
ldx xVal // lower blocks to map + lower blocks offset high nibble
|
||||
ldy yVal // upper blocks offset page
|
||||
ldz zVal // upper blocks to map + upper blocks offset page high nibble
|
||||
map
|
||||
eom
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@
|
||||
#include <mos6581.h>
|
||||
#include <mos4569.h>
|
||||
#include <mega65-viciv.h>
|
||||
#include <mega65-memorymapper.h>
|
||||
|
||||
// I/O Personality selection
|
||||
volatile char * const IO_KEY = 0xd02f;
|
||||
|
@ -1,170 +1,46 @@
|
||||
// Test the MAP instruction for remapping memory
|
||||
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
|
||||
// See Appendix G in file:///Users/jespergravgaard/Downloads/MEGA65-Book_draft%20(5).pdf for a description of the CPU memory remapper of the MEGA65.
|
||||
// See Appendix G in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf for a description of the CPU memory remapper of the MEGA65.
|
||||
#pragma target(mega65)
|
||||
#include <mega65.h>
|
||||
|
||||
void main() {
|
||||
char * block1 = 0x4000;
|
||||
char * block2 = 0x8000;
|
||||
char * BLOCK_4000 = 0x4000;
|
||||
char * BLOCK_8000 = 0x8000;
|
||||
|
||||
// Remap [$4000-$5fff] to point to [$10000-$11fff]
|
||||
memoryRemapBlock(0x40, 0x100);
|
||||
// Put 0x55, 0xaa into $10000
|
||||
block1[0] = 0x55;
|
||||
block1[1] = 0xaa;
|
||||
// Put '-', '*' into $10000
|
||||
BLOCK_4000[0] = '-';
|
||||
BLOCK_4000[1] = '*';
|
||||
|
||||
// Remap [$8000-$9fff] to point to [$10000-$11fff]
|
||||
memoryRemapBlock(0x80, 0x100);
|
||||
// Put 0x55, 0xaainto $10002
|
||||
block2[2] = 0x55;
|
||||
block2[3] = 0xaa;
|
||||
// Put '-', '*' into $10002
|
||||
BLOCK_8000[2] = '-';
|
||||
BLOCK_8000[3] = '*';
|
||||
|
||||
// Remap [$4000-$5fff] and [$8000-$9fff] to both point to [$10000-$11fff] (notice usage of page offsets)
|
||||
memoryRemap(MEMORYBLOCK_4000|MEMORYBLOCK_8000, 0x0c0, 0x080);
|
||||
// Put 0x55, 0xaa into $10004 in a convoluted way
|
||||
block2[4] = block1[2];
|
||||
block1[5] = block2[1];
|
||||
// Put '-', '*' into $10004 in a convoluted way
|
||||
BLOCK_8000[4] = BLOCK_4000[2];
|
||||
BLOCK_4000[5] = BLOCK_8000[1];
|
||||
|
||||
// copy the resulting values onto the screen
|
||||
for(char i=0;i<6;i++)
|
||||
(DEFAULT_SCREEN+80-6)[i] = BLOCK_4000[i];
|
||||
|
||||
// Remap [$4000-$5fff] to both point to [$ff80000-$ff81fff] COLORAM! (notice usage of page offsets)
|
||||
memoryRemap256M(MEMORYBLOCK_4000, 0xff800-0x00040, 0);
|
||||
// Put colors in the upper left corner!
|
||||
block1[0] = 0;
|
||||
block1[1] = 1;
|
||||
// Put colors in the upper screen line
|
||||
for( char i=0; i<16; i++)
|
||||
BLOCK_4000[i] = 0x40+i;
|
||||
|
||||
// Remap [$4000-$5fff] back to normal memory!
|
||||
memoryRemap256M(0, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Bit representing 8K block #0 of the 64K addressable memory ($0000-$1fff)
|
||||
const unsigned char MEMORYBLOCK_0000 = 0b00000001;
|
||||
// Bit representing 8K block #1 of the 64K addressable memory ($2000-$3fff)
|
||||
const unsigned char MEMORYBLOCK_2000 = 0b00000010;
|
||||
// Bit representing 8K block #2 of the 64K addressable memory ($4000-$5fff)
|
||||
const unsigned char MEMORYBLOCK_4000 = 0b00000100;
|
||||
// Bit representing 8K block #3 of the 64K addressable memory ($6000-$7fff)
|
||||
const unsigned char MEMORYBLOCK_6000 = 0b00001000;
|
||||
// Bit representing 8K block #4 of the 64K addressable memory ($8000-$9fff)
|
||||
const unsigned char MEMORYBLOCK_8000 = 0b00010000;
|
||||
// Bit representing 8K block #5 of the 64K addressable memory ($a000-$bfff)
|
||||
const unsigned char MEMORYBLOCK_A000 = 0b00100000;
|
||||
// Bit representing 8K block #6 of the 64K addressable memory ($c000-$dfff)
|
||||
const unsigned char MEMORYBLOCK_C000 = 0b01000000;
|
||||
// Bit representing 8K block #7 of the 64K addressable memory ($e000-$ffff)
|
||||
const unsigned char MEMORYBLOCK_E000 = 0b10000000;
|
||||
|
||||
// Remap some of the eight 8K memory blocks in the 64K address space of the 6502 to point somewhere else in the first 1MB memory space of the MEGA65.
|
||||
// After the remapping the CPU will access the mapped memory whenever it uses instructions that access a remapped block.
|
||||
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
|
||||
// remapBlocks: Indicates which 8K blocks of the 6502 address space to remap. Each bit represents one 8K block
|
||||
// - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000.
|
||||
// - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000.
|
||||
// - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000.
|
||||
// - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000.
|
||||
// - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000.
|
||||
// - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000.
|
||||
// - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000.
|
||||
// - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000.
|
||||
// lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3).
|
||||
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 12bits of the passed value is used.
|
||||
// - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100.
|
||||
// - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000.
|
||||
// - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000.
|
||||
// - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000.
|
||||
// upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7).
|
||||
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 12bits of the passed value is used.
|
||||
// - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000
|
||||
// - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000.
|
||||
// - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000.
|
||||
// - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000.
|
||||
void memoryRemap(unsigned char remapBlocks, unsigned int lowerPageOffset, unsigned int upperPageOffset) {
|
||||
char * aVal = 0xfc;
|
||||
char * xVal = 0xfd;
|
||||
char * yVal = 0xfe;
|
||||
char * zVal = 0xff;
|
||||
*aVal = <lowerPageOffset;
|
||||
*xVal = (remapBlocks << 4) | (>lowerPageOffset & 0xf);
|
||||
*yVal = <upperPageOffset;
|
||||
*zVal = (remapBlocks & 0xf0) | (>upperPageOffset & 0xf);
|
||||
asm {
|
||||
lda aVal // lower blocks offset page low
|
||||
ldx xVal // lower blocks to map + lower blocks offset high nibble
|
||||
ldy yVal // upper blocks offset page
|
||||
ldz zVal // upper blocks to map + upper blocks offset page high nibble
|
||||
map
|
||||
eom
|
||||
}
|
||||
}
|
||||
|
||||
// Remap a single 8K memory block in the 64K address space of the 6502 to point somewhere else in the first 1MB memory space of the MEGA65.
|
||||
// All the other 8K memory blocks will not be mapped and will point to their own address in the lowest 64K of the MEGA65 memory.
|
||||
// blockPage: Page address of the 8K memory block to remap (ie. the block that is remapped is $100 * the passed page address.)
|
||||
// memoryPage: Page address of the memory that the block should point to in the 1MB memory space of the MEGA65.
|
||||
// Ie. the memory that will be pointed to is $100 * the passed page address. Only the lower 12bits of the passed value is used.
|
||||
void memoryRemapBlock(unsigned char blockPage, unsigned int memoryPage) {
|
||||
// Find the page offset (the number of pages to offset the block)
|
||||
unsigned int pageOffset = memoryPage-blockPage;
|
||||
// Which block is being remapped? (0-7)
|
||||
char block = blockPage / $20;
|
||||
char blockBits = 1<<block;
|
||||
memoryRemap(blockBits, pageOffset, pageOffset);
|
||||
}
|
||||
|
||||
// Remap some of the eight 8K memory blocks in the 64K address space of the 6502 to point somewhere else in the entire 256MB memory space of the MEGA65.
|
||||
// After the remapping the CPU will access the mapped memory whenever it uses instructions that access a remapped block.
|
||||
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
|
||||
// See Appendix G in file:///Users/jespergravgaard/Downloads/MEGA65-Book_draft%20(5).pdf for a description of the CPU memory remapper of the MEGA65.
|
||||
// remapBlocks: Indicates which 8K blocks of the 6502 address space to remap. Each bit represents one 8K block
|
||||
// - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000.
|
||||
// - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000.
|
||||
// - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000.
|
||||
// - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000.
|
||||
// - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000.
|
||||
// - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000.
|
||||
// - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000.
|
||||
// - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000.
|
||||
// lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3).
|
||||
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 20bits of the passed value is used.
|
||||
// - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100.
|
||||
// - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000.
|
||||
// - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000.
|
||||
// - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000.
|
||||
// upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7).
|
||||
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 20bits of the passed value is used.
|
||||
// - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000
|
||||
// - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000.
|
||||
// - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000.
|
||||
// - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000.
|
||||
void memoryRemap256M(unsigned char remapBlocks, unsigned long lowerPageOffset, unsigned long upperPageOffset) {
|
||||
char * lMb = 0xfa;
|
||||
char * uMb = 0xfb;
|
||||
char * aVal = 0xfc;
|
||||
char * xVal = 0xfd;
|
||||
char * yVal = 0xfe;
|
||||
char * zVal = 0xff;
|
||||
*lMb = >((unsigned int)(lowerPageOffset>>4));
|
||||
*uMb = >((unsigned int)(upperPageOffset>>4));
|
||||
*aVal = < <lowerPageOffset;
|
||||
*xVal = (remapBlocks << 4) | (> <lowerPageOffset & 0xf);
|
||||
*yVal = < <upperPageOffset;
|
||||
*zVal = (remapBlocks & 0xf0) | (> <upperPageOffset & 0xf);
|
||||
asm {
|
||||
lda lMb // lower blocks offset megabytes
|
||||
ldx #$0f // lower signal for MB offset
|
||||
ldy uMb // upper blocks offset megabytes
|
||||
ldz #$00 // upper signal for MB offset
|
||||
map
|
||||
lda aVal // lower blocks offset page low
|
||||
ldx xVal // lower blocks to map + lower blocks offset high nibble
|
||||
ldy yVal // upper blocks offset page
|
||||
ldz zVal // upper blocks to map + upper blocks offset page high nibble
|
||||
map
|
||||
eom
|
||||
}
|
||||
}
|
||||
|
||||
// Test more corner case behaviors
|
||||
// - [DONE] Mapping two blocks to the same memory : [$4000-$5fff] >> [$10000-$12000], [$8000-$9fff] >> [$10000-$12000]
|
||||
// - Mapping two blocks to overlapping memory : [$4000-$5fff] >> [$10000-$12000], [$6000-$7f00] >> [$11000-$12ff]
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Test the MAP instruction for remapping memory
|
||||
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
|
||||
// See Appendix G in file:///Users/jespergravgaard/Downloads/MEGA65-Book_draft%20(5).pdf for a description of the CPU memory remapper of the MEGA65.
|
||||
// See Appendix G in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf for a description of the CPU memory remapper of the MEGA65.
|
||||
// MEGA65 Registers and Constants
|
||||
// The MOS 6526 Complex Interface Adapter (CIA)
|
||||
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
|
||||
@ -20,32 +20,34 @@
|
||||
.const MEMORYBLOCK_4000 = 4
|
||||
// Bit representing 8K block #4 of the 64K addressable memory ($8000-$9fff)
|
||||
.const MEMORYBLOCK_8000 = $10
|
||||
// Default address of screen character matrix
|
||||
.label DEFAULT_SCREEN = $800
|
||||
.segment Code
|
||||
main: {
|
||||
.label block1 = $4000
|
||||
.label block2 = $8000
|
||||
.label BLOCK_4000 = $4000
|
||||
.label BLOCK_8000 = $8000
|
||||
// memoryRemapBlock(0x40, 0x100)
|
||||
// Remap [$4000-$5fff] to point to [$10000-$11fff]
|
||||
ldx #$40
|
||||
jsr memoryRemapBlock
|
||||
// block1[0] = 0x55
|
||||
// Put 0x55, 0xaa into $10000
|
||||
lda #$55
|
||||
sta block1
|
||||
// block1[1] = 0xaa
|
||||
lda #$aa
|
||||
sta block1+1
|
||||
// BLOCK_4000[0] = '-'
|
||||
// Put '-', '*' into $10000
|
||||
lda #'-'
|
||||
sta BLOCK_4000
|
||||
// BLOCK_4000[1] = '*'
|
||||
lda #'*'
|
||||
sta BLOCK_4000+1
|
||||
// memoryRemapBlock(0x80, 0x100)
|
||||
// Remap [$8000-$9fff] to point to [$10000-$11fff]
|
||||
ldx #$80
|
||||
jsr memoryRemapBlock
|
||||
// block2[2] = 0x55
|
||||
// Put 0x55, 0xaainto $10002
|
||||
lda #$55
|
||||
sta block2+2
|
||||
// block2[3] = 0xaa
|
||||
lda #$aa
|
||||
sta block2+3
|
||||
// BLOCK_8000[2] = '-'
|
||||
// Put '-', '*' into $10002
|
||||
lda #'-'
|
||||
sta BLOCK_8000+2
|
||||
// BLOCK_8000[3] = '*'
|
||||
lda #'*'
|
||||
sta BLOCK_8000+3
|
||||
// memoryRemap(MEMORYBLOCK_4000|MEMORYBLOCK_8000, 0x0c0, 0x080)
|
||||
// Remap [$4000-$5fff] and [$8000-$9fff] to both point to [$10000-$11fff] (notice usage of page offsets)
|
||||
lda #<$80
|
||||
@ -58,13 +60,19 @@ main: {
|
||||
lda #>$c0
|
||||
sta.z memoryRemap.lowerPageOffset+1
|
||||
jsr memoryRemap
|
||||
// block2[4] = block1[2]
|
||||
// Put 0x55, 0xaa into $10004 in a convoluted way
|
||||
lda block1+2
|
||||
sta block2+4
|
||||
// block1[5] = block2[1]
|
||||
lda block2+1
|
||||
sta block1+5
|
||||
// BLOCK_8000[4] = BLOCK_4000[2]
|
||||
// Put '-', '*' into $10004 in a convoluted way
|
||||
lda BLOCK_4000+2
|
||||
sta BLOCK_8000+4
|
||||
// BLOCK_4000[5] = BLOCK_8000[1]
|
||||
lda BLOCK_8000+1
|
||||
sta BLOCK_4000+5
|
||||
ldx #0
|
||||
// copy the resulting values onto the screen
|
||||
__b1:
|
||||
// for(char i=0;i<6;i++)
|
||||
cpx #6
|
||||
bcc __b2
|
||||
// memoryRemap256M(MEMORYBLOCK_4000, 0xff800-0x00040, 0)
|
||||
// Remap [$4000-$5fff] to both point to [$ff80000-$ff81fff] COLORAM! (notice usage of page offsets)
|
||||
ldz #MEMORYBLOCK_4000
|
||||
@ -77,13 +85,12 @@ main: {
|
||||
lda #>$ff800-$40>>$10
|
||||
sta.z memoryRemap256M.lowerPageOffset+3
|
||||
jsr memoryRemap256M
|
||||
// block1[0] = 0
|
||||
// Put colors in the upper left corner!
|
||||
lda #0
|
||||
sta block1
|
||||
// block1[1] = 1
|
||||
lda #1
|
||||
sta block1+1
|
||||
ldx #0
|
||||
// Put colors in the upper screen line
|
||||
__b4:
|
||||
// for( char i=0; i<16; i++)
|
||||
cpx #$10
|
||||
bcc __b5
|
||||
// memoryRemap256M(0, 0, 0)
|
||||
// Remap [$4000-$5fff] back to normal memory!
|
||||
ldz #0
|
||||
@ -95,11 +102,28 @@ main: {
|
||||
jsr memoryRemap256M
|
||||
// }
|
||||
rts
|
||||
__b5:
|
||||
// 0x40+i
|
||||
txa
|
||||
clc
|
||||
adc #$40
|
||||
// BLOCK_4000[i] = 0x40+i
|
||||
sta BLOCK_4000,x
|
||||
// for( char i=0; i<16; i++)
|
||||
inx
|
||||
jmp __b4
|
||||
__b2:
|
||||
// (DEFAULT_SCREEN+80-6)[i] = BLOCK_4000[i]
|
||||
lda BLOCK_4000,x
|
||||
sta DEFAULT_SCREEN+$50-6,x
|
||||
// for(char i=0;i<6;i++)
|
||||
inx
|
||||
jmp __b1
|
||||
}
|
||||
// Remap a single 8K memory block in the 64K address space of the 6502 to point somewhere else in the first 1MB memory space of the MEGA65.
|
||||
// All the other 8K memory blocks will not be mapped and will point to their own address in the lowest 64K of the MEGA65 memory.
|
||||
// blockPage: Page address of the 8K memory block to remap (ie. the block that is remapped is $100 * the passed page address.)
|
||||
// memoryPage: Page address of the memory that the block should point to in the 1MB memory space of the MEGA65.
|
||||
// blockPage: Page address of the 8K memory block to remap (ie. the block that is remapped is $100 * the passed page address.)
|
||||
// memoryPage: Page address of the memory that the block should point to in the 1MB memory space of the MEGA65.
|
||||
// Ie. the memory that will be pointed to is $100 * the passed page address. Only the lower 12bits of the passed value is used.
|
||||
// memoryRemapBlock(byte register(X) blockPage)
|
||||
memoryRemapBlock: {
|
||||
@ -144,26 +168,26 @@ memoryRemapBlock: {
|
||||
// After the remapping the CPU will access the mapped memory whenever it uses instructions that access a remapped block.
|
||||
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
|
||||
// remapBlocks: Indicates which 8K blocks of the 6502 address space to remap. Each bit represents one 8K block
|
||||
// - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000.
|
||||
// - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000.
|
||||
// - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000.
|
||||
// - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000.
|
||||
// - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000.
|
||||
// - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000.
|
||||
// - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000.
|
||||
// - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000.
|
||||
// lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3).
|
||||
// - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000.
|
||||
// - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000.
|
||||
// - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000.
|
||||
// - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000.
|
||||
// - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000.
|
||||
// - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000.
|
||||
// - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000.
|
||||
// - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000.
|
||||
// lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3).
|
||||
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 12bits of the passed value is used.
|
||||
// - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100.
|
||||
// - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000.
|
||||
// - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000.
|
||||
// - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000.
|
||||
// upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7).
|
||||
// - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100.
|
||||
// - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000.
|
||||
// - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000.
|
||||
// - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000.
|
||||
// upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7).
|
||||
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 12bits of the passed value is used.
|
||||
// - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000
|
||||
// - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000.
|
||||
// - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000.
|
||||
// - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000.
|
||||
// - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000
|
||||
// - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000.
|
||||
// - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000.
|
||||
// - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000.
|
||||
// memoryRemap(byte register(Z) remapBlocks, word zp($d) lowerPageOffset, word zp(2) upperPageOffset)
|
||||
memoryRemap: {
|
||||
.label aVal = $fc
|
||||
@ -224,26 +248,26 @@ memoryRemap: {
|
||||
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
|
||||
// See Appendix G in file:///Users/jespergravgaard/Downloads/MEGA65-Book_draft%20(5).pdf for a description of the CPU memory remapper of the MEGA65.
|
||||
// remapBlocks: Indicates which 8K blocks of the 6502 address space to remap. Each bit represents one 8K block
|
||||
// - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000.
|
||||
// - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000.
|
||||
// - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000.
|
||||
// - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000.
|
||||
// - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000.
|
||||
// - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000.
|
||||
// - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000.
|
||||
// - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000.
|
||||
// lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3).
|
||||
// - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000.
|
||||
// - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000.
|
||||
// - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000.
|
||||
// - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000.
|
||||
// - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000.
|
||||
// - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000.
|
||||
// - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000.
|
||||
// - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000.
|
||||
// lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3).
|
||||
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 20bits of the passed value is used.
|
||||
// - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100.
|
||||
// - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000.
|
||||
// - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000.
|
||||
// - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000.
|
||||
// upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7).
|
||||
// - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100.
|
||||
// - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000.
|
||||
// - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000.
|
||||
// - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000.
|
||||
// upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7).
|
||||
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 20bits of the passed value is used.
|
||||
// - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000
|
||||
// - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000.
|
||||
// - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000.
|
||||
// - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000.
|
||||
// - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000
|
||||
// - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000.
|
||||
// - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000.
|
||||
// - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000.
|
||||
// memoryRemap256M(byte register(Z) remapBlocks, dword zp(4) lowerPageOffset)
|
||||
memoryRemap256M: {
|
||||
.label lMb = $fa
|
||||
|
@ -3,92 +3,111 @@
|
||||
main: scope:[main] from
|
||||
[0] phi()
|
||||
[1] call memoryRemapBlock
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main
|
||||
[2] *((const byte*) main::block1) ← (byte) $55
|
||||
[3] *((const byte*) main::block1+(byte) 1) ← (byte) $aa
|
||||
to:main::@7
|
||||
main::@7: scope:[main] from main
|
||||
[2] *((const byte*) main::BLOCK_4000) ← (byte) '-'
|
||||
[3] *((const byte*) main::BLOCK_4000+(byte) 1) ← (byte) '*'
|
||||
[4] call memoryRemapBlock
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
[5] *((const byte*) main::block2+(byte) 2) ← (byte) $55
|
||||
[6] *((const byte*) main::block2+(byte) 3) ← (byte) $aa
|
||||
to:main::@8
|
||||
main::@8: scope:[main] from main::@7
|
||||
[5] *((const byte*) main::BLOCK_8000+(byte) 2) ← (byte) '-'
|
||||
[6] *((const byte*) main::BLOCK_8000+(byte) 3) ← (byte) '*'
|
||||
[7] call memoryRemap
|
||||
to:main::@9
|
||||
main::@9: scope:[main] from main::@8
|
||||
[8] *((const byte*) main::BLOCK_8000+(byte) 4) ← *((const byte*) main::BLOCK_4000+(byte) 2)
|
||||
[9] *((const byte*) main::BLOCK_4000+(byte) 5) ← *((const byte*) main::BLOCK_8000+(byte) 1)
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main::@2 main::@9
|
||||
[10] (byte) main::i#2 ← phi( main::@2/(byte) main::i#1 main::@9/(byte) 0 )
|
||||
[11] if((byte) main::i#2<(byte) 6) goto main::@2
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@2
|
||||
[8] *((const byte*) main::block2+(byte) 4) ← *((const byte*) main::block1+(byte) 2)
|
||||
[9] *((const byte*) main::block1+(byte) 5) ← *((const byte*) main::block2+(byte) 1)
|
||||
[10] call memoryRemap256M
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@3
|
||||
[11] *((const byte*) main::block1) ← (byte) 0
|
||||
[12] *((const byte*) main::block1+(byte) 1) ← (byte) 1
|
||||
main::@3: scope:[main] from main::@1
|
||||
[12] phi()
|
||||
[13] call memoryRemap256M
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@3 main::@5
|
||||
[14] (byte) main::i1#2 ← phi( main::@3/(byte) 0 main::@5/(byte) main::i1#1 )
|
||||
[15] if((byte) main::i1#2<(byte) $10) goto main::@5
|
||||
to:main::@6
|
||||
main::@6: scope:[main] from main::@4
|
||||
[16] phi()
|
||||
[17] call memoryRemap256M
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@4
|
||||
[14] return
|
||||
main::@return: scope:[main] from main::@6
|
||||
[18] return
|
||||
to:@return
|
||||
main::@5: scope:[main] from main::@4
|
||||
[19] (byte~) main::$7 ← (byte) $40 + (byte) main::i1#2
|
||||
[20] *((const byte*) main::BLOCK_4000 + (byte) main::i1#2) ← (byte~) main::$7
|
||||
[21] (byte) main::i1#1 ← ++ (byte) main::i1#2
|
||||
to:main::@4
|
||||
main::@2: scope:[main] from main::@1
|
||||
[22] *((const nomodify byte*) DEFAULT_SCREEN+(byte) $50-(byte) 6 + (byte) main::i#2) ← *((const byte*) main::BLOCK_4000 + (byte) main::i#2)
|
||||
[23] (byte) main::i#1 ← ++ (byte) main::i#2
|
||||
to:main::@1
|
||||
|
||||
(void()) memoryRemapBlock((byte) memoryRemapBlock::blockPage , (word) memoryRemapBlock::memoryPage)
|
||||
memoryRemapBlock: scope:[memoryRemapBlock] from main main::@1
|
||||
[15] (byte) memoryRemapBlock::blockPage#2 ← phi( main/(byte) $40 main::@1/(byte) $80 )
|
||||
[16] (word) memoryRemapBlock::pageOffset#0 ← (word) $100 - (byte) memoryRemapBlock::blockPage#2
|
||||
[17] (byte) memoryRemapBlock::block#0 ← (byte) memoryRemapBlock::blockPage#2 >> (byte) 5
|
||||
[18] (byte) memoryRemapBlock::blockBits#0 ← (byte) 1 << (byte) memoryRemapBlock::block#0
|
||||
[19] (byte) memoryRemap::remapBlocks#1 ← (byte) memoryRemapBlock::blockBits#0
|
||||
[20] (word) memoryRemap::lowerPageOffset#1 ← (word) memoryRemapBlock::pageOffset#0
|
||||
[21] (word) memoryRemap::upperPageOffset#1 ← (word) memoryRemapBlock::pageOffset#0
|
||||
[22] call memoryRemap
|
||||
memoryRemapBlock: scope:[memoryRemapBlock] from main main::@7
|
||||
[24] (byte) memoryRemapBlock::blockPage#2 ← phi( main/(byte) $40 main::@7/(byte) $80 )
|
||||
[25] (word) memoryRemapBlock::pageOffset#0 ← (word) $100 - (byte) memoryRemapBlock::blockPage#2
|
||||
[26] (byte) memoryRemapBlock::block#0 ← (byte) memoryRemapBlock::blockPage#2 >> (byte) 5
|
||||
[27] (byte) memoryRemapBlock::blockBits#0 ← (byte) 1 << (byte) memoryRemapBlock::block#0
|
||||
[28] (byte) memoryRemap::remapBlocks#0 ← (byte) memoryRemapBlock::blockBits#0
|
||||
[29] (word) memoryRemap::lowerPageOffset#0 ← (word) memoryRemapBlock::pageOffset#0
|
||||
[30] (word) memoryRemap::upperPageOffset#0 ← (word) memoryRemapBlock::pageOffset#0
|
||||
[31] call memoryRemap
|
||||
to:memoryRemapBlock::@return
|
||||
memoryRemapBlock::@return: scope:[memoryRemapBlock] from memoryRemapBlock
|
||||
[23] return
|
||||
[32] return
|
||||
to:@return
|
||||
|
||||
(void()) memoryRemap((byte) memoryRemap::remapBlocks , (word) memoryRemap::lowerPageOffset , (word) memoryRemap::upperPageOffset)
|
||||
memoryRemap: scope:[memoryRemap] from main::@2 memoryRemapBlock
|
||||
[24] (word) memoryRemap::upperPageOffset#2 ← phi( main::@2/(byte) $80 memoryRemapBlock/(word) memoryRemap::upperPageOffset#1 )
|
||||
[24] (byte) memoryRemap::remapBlocks#2 ← phi( main::@2/(const nomodify byte) MEMORYBLOCK_4000|(const nomodify byte) MEMORYBLOCK_8000 memoryRemapBlock/(byte) memoryRemap::remapBlocks#1 )
|
||||
[24] (word) memoryRemap::lowerPageOffset#2 ← phi( main::@2/(byte) $c0 memoryRemapBlock/(word) memoryRemap::lowerPageOffset#1 )
|
||||
[25] (byte~) memoryRemap::$0 ← < (word) memoryRemap::lowerPageOffset#2
|
||||
[26] *((const byte*) memoryRemap::aVal) ← (byte~) memoryRemap::$0
|
||||
[27] (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#2 << (byte) 4
|
||||
[28] (byte~) memoryRemap::$2 ← > (word) memoryRemap::lowerPageOffset#2
|
||||
[29] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f
|
||||
[30] (byte~) memoryRemap::$4 ← (byte~) memoryRemap::$1 | (byte~) memoryRemap::$3
|
||||
[31] *((const byte*) memoryRemap::xVal) ← (byte~) memoryRemap::$4
|
||||
[32] (byte~) memoryRemap::$5 ← < (word) memoryRemap::upperPageOffset#2
|
||||
[33] *((const byte*) memoryRemap::yVal) ← (byte~) memoryRemap::$5
|
||||
[34] (byte~) memoryRemap::$6 ← (byte) memoryRemap::remapBlocks#2 & (byte) $f0
|
||||
[35] (byte~) memoryRemap::$7 ← > (word) memoryRemap::upperPageOffset#2
|
||||
[36] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f
|
||||
[37] (byte~) memoryRemap::$9 ← (byte~) memoryRemap::$6 | (byte~) memoryRemap::$8
|
||||
[38] *((const byte*) memoryRemap::zVal) ← (byte~) memoryRemap::$9
|
||||
memoryRemap: scope:[memoryRemap] from main::@8 memoryRemapBlock
|
||||
[33] (word) memoryRemap::upperPageOffset#2 ← phi( main::@8/(byte) $80 memoryRemapBlock/(word) memoryRemap::upperPageOffset#0 )
|
||||
[33] (byte) memoryRemap::remapBlocks#2 ← phi( main::@8/(const nomodify byte) MEMORYBLOCK_4000|(const nomodify byte) MEMORYBLOCK_8000 memoryRemapBlock/(byte) memoryRemap::remapBlocks#0 )
|
||||
[33] (word) memoryRemap::lowerPageOffset#2 ← phi( main::@8/(byte) $c0 memoryRemapBlock/(word) memoryRemap::lowerPageOffset#0 )
|
||||
[34] (byte~) memoryRemap::$0 ← < (word) memoryRemap::lowerPageOffset#2
|
||||
[35] *((const byte*) memoryRemap::aVal) ← (byte~) memoryRemap::$0
|
||||
[36] (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#2 << (byte) 4
|
||||
[37] (byte~) memoryRemap::$2 ← > (word) memoryRemap::lowerPageOffset#2
|
||||
[38] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f
|
||||
[39] (byte~) memoryRemap::$4 ← (byte~) memoryRemap::$1 | (byte~) memoryRemap::$3
|
||||
[40] *((const byte*) memoryRemap::xVal) ← (byte~) memoryRemap::$4
|
||||
[41] (byte~) memoryRemap::$5 ← < (word) memoryRemap::upperPageOffset#2
|
||||
[42] *((const byte*) memoryRemap::yVal) ← (byte~) memoryRemap::$5
|
||||
[43] (byte~) memoryRemap::$6 ← (byte) memoryRemap::remapBlocks#2 & (byte) $f0
|
||||
[44] (byte~) memoryRemap::$7 ← > (word) memoryRemap::upperPageOffset#2
|
||||
[45] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f
|
||||
[46] (byte~) memoryRemap::$9 ← (byte~) memoryRemap::$6 | (byte~) memoryRemap::$8
|
||||
[47] *((const byte*) memoryRemap::zVal) ← (byte~) memoryRemap::$9
|
||||
asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
|
||||
to:memoryRemap::@return
|
||||
memoryRemap::@return: scope:[memoryRemap] from memoryRemap
|
||||
[40] return
|
||||
[49] return
|
||||
to:@return
|
||||
|
||||
(void()) memoryRemap256M((byte) memoryRemap256M::remapBlocks , (dword) memoryRemap256M::lowerPageOffset , (dword) memoryRemap256M::upperPageOffset)
|
||||
memoryRemap256M: scope:[memoryRemap256M] from main::@3 main::@4
|
||||
[41] (byte) memoryRemap256M::remapBlocks#2 ← phi( main::@3/(const nomodify byte) MEMORYBLOCK_4000 main::@4/(byte) 0 )
|
||||
[41] (dword) memoryRemap256M::lowerPageOffset#2 ← phi( main::@3/(dword)(number) $ff800-(number) $40 main::@4/(byte) 0 )
|
||||
[42] (dword~) memoryRemap256M::$0 ← (dword) memoryRemap256M::lowerPageOffset#2 >> (byte) 4
|
||||
[43] (byte~) memoryRemap256M::$1 ← > (word)(dword~) memoryRemap256M::$0
|
||||
[44] *((const byte*) memoryRemap256M::lMb) ← (byte~) memoryRemap256M::$1
|
||||
[45] *((const byte*) memoryRemap256M::uMb) ← (byte) 0
|
||||
[46] (word~) memoryRemap256M::$7 ← < (dword) memoryRemap256M::lowerPageOffset#2
|
||||
[47] (byte~) memoryRemap256M::$5 ← < (word~) memoryRemap256M::$7
|
||||
[48] *((const byte*) memoryRemap256M::aVal) ← (byte~) memoryRemap256M::$5
|
||||
[49] (byte~) memoryRemap256M::$6 ← (byte) memoryRemap256M::remapBlocks#2 << (byte) 4
|
||||
[50] (byte~) memoryRemap256M::$8 ← > (word~) memoryRemap256M::$7
|
||||
[51] (byte~) memoryRemap256M::$9 ← (byte~) memoryRemap256M::$8 & (byte) $f
|
||||
[52] (byte~) memoryRemap256M::$10 ← (byte~) memoryRemap256M::$6 | (byte~) memoryRemap256M::$9
|
||||
[53] *((const byte*) memoryRemap256M::xVal) ← (byte~) memoryRemap256M::$10
|
||||
[54] *((const byte*) memoryRemap256M::yVal) ← (byte) 0
|
||||
[55] (byte~) memoryRemap256M::$17 ← (byte) memoryRemap256M::remapBlocks#2 & (byte) $f0
|
||||
[56] *((const byte*) memoryRemap256M::zVal) ← (byte~) memoryRemap256M::$17
|
||||
memoryRemap256M: scope:[memoryRemap256M] from main::@3 main::@6
|
||||
[50] (byte) memoryRemap256M::remapBlocks#2 ← phi( main::@3/(const nomodify byte) MEMORYBLOCK_4000 main::@6/(byte) 0 )
|
||||
[50] (dword) memoryRemap256M::lowerPageOffset#2 ← phi( main::@3/(dword)(number) $ff800-(number) $40 main::@6/(byte) 0 )
|
||||
[51] (dword~) memoryRemap256M::$0 ← (dword) memoryRemap256M::lowerPageOffset#2 >> (byte) 4
|
||||
[52] (byte~) memoryRemap256M::$1 ← > (word)(dword~) memoryRemap256M::$0
|
||||
[53] *((const byte*) memoryRemap256M::lMb) ← (byte~) memoryRemap256M::$1
|
||||
[54] *((const byte*) memoryRemap256M::uMb) ← (byte) 0
|
||||
[55] (word~) memoryRemap256M::$7 ← < (dword) memoryRemap256M::lowerPageOffset#2
|
||||
[56] (byte~) memoryRemap256M::$5 ← < (word~) memoryRemap256M::$7
|
||||
[57] *((const byte*) memoryRemap256M::aVal) ← (byte~) memoryRemap256M::$5
|
||||
[58] (byte~) memoryRemap256M::$6 ← (byte) memoryRemap256M::remapBlocks#2 << (byte) 4
|
||||
[59] (byte~) memoryRemap256M::$8 ← > (word~) memoryRemap256M::$7
|
||||
[60] (byte~) memoryRemap256M::$9 ← (byte~) memoryRemap256M::$8 & (byte) $f
|
||||
[61] (byte~) memoryRemap256M::$10 ← (byte~) memoryRemap256M::$6 | (byte~) memoryRemap256M::$9
|
||||
[62] *((const byte*) memoryRemap256M::xVal) ← (byte~) memoryRemap256M::$10
|
||||
[63] *((const byte*) memoryRemap256M::yVal) ← (byte) 0
|
||||
[64] (byte~) memoryRemap256M::$17 ← (byte) memoryRemap256M::remapBlocks#2 & (byte) $f0
|
||||
[65] *((const byte*) memoryRemap256M::zVal) ← (byte~) memoryRemap256M::$17
|
||||
asm { ldalMb ldx#$0f ldyuMb ldz#$00 map ldaaVal ldxxVal ldyyVal ldzzVal map eom }
|
||||
to:memoryRemap256M::@return
|
||||
memoryRemap256M::@return: scope:[memoryRemap256M] from memoryRemap256M
|
||||
[58] return
|
||||
[67] return
|
||||
to:@return
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,4 @@
|
||||
(const nomodify byte*) DEFAULT_SCREEN = (byte*) 2048
|
||||
(byte) MEGA65_VICIV::ALPHADELAY
|
||||
(byte) MEGA65_VICIV::B0PIX
|
||||
(byte) MEGA65_VICIV::B0_ADDR
|
||||
@ -285,13 +286,25 @@
|
||||
(byte) MOS6581_SID::POT_Y
|
||||
(byte) MOS6581_SID::VOLUME_FILTER_MODE
|
||||
(void()) main()
|
||||
(byte~) main::$7 reg byte a 22.0
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@7
|
||||
(label) main::@8
|
||||
(label) main::@9
|
||||
(label) main::@return
|
||||
(const byte*) main::block1 = (byte*) 16384
|
||||
(const byte*) main::block2 = (byte*) 32768
|
||||
(const byte*) main::BLOCK_4000 = (byte*) 16384
|
||||
(const byte*) main::BLOCK_8000 = (byte*) 32768
|
||||
(byte) main::i
|
||||
(byte) main::i#1 reg byte x 22.0
|
||||
(byte) main::i#2 reg byte x 18.333333333333332
|
||||
(byte) main::i1
|
||||
(byte) main::i1#1 reg byte x 22.0
|
||||
(byte) main::i1#2 reg byte x 13.75
|
||||
(void()) memoryRemap((byte) memoryRemap::remapBlocks , (word) memoryRemap::lowerPageOffset , (word) memoryRemap::upperPageOffset)
|
||||
(byte~) memoryRemap::$0 reg byte a 202.0
|
||||
(byte~) memoryRemap::$1 zp[1]:15 67.33333333333333
|
||||
@ -306,13 +319,13 @@
|
||||
(label) memoryRemap::@return
|
||||
(const byte*) memoryRemap::aVal = (byte*) 252
|
||||
(word) memoryRemap::lowerPageOffset
|
||||
(word) memoryRemap::lowerPageOffset#1 lowerPageOffset zp[2]:13 11.0
|
||||
(word) memoryRemap::lowerPageOffset#0 lowerPageOffset zp[2]:13 11.0
|
||||
(word) memoryRemap::lowerPageOffset#2 lowerPageOffset zp[2]:13 53.25
|
||||
(byte) memoryRemap::remapBlocks
|
||||
(byte) memoryRemap::remapBlocks#1 reg byte z 7.333333333333333
|
||||
(byte) memoryRemap::remapBlocks#0 reg byte z 7.333333333333333
|
||||
(byte) memoryRemap::remapBlocks#2 reg byte z 21.299999999999997
|
||||
(word) memoryRemap::upperPageOffset
|
||||
(word) memoryRemap::upperPageOffset#1 upperPageOffset zp[2]:2 22.0
|
||||
(word) memoryRemap::upperPageOffset#0 upperPageOffset zp[2]:2 22.0
|
||||
(word) memoryRemap::upperPageOffset#2 upperPageOffset zp[2]:2 19.363636363636363
|
||||
(const byte*) memoryRemap::xVal = (byte*) 253
|
||||
(const byte*) memoryRemap::yVal = (byte*) 254
|
||||
@ -351,11 +364,14 @@
|
||||
(word) memoryRemapBlock::pageOffset
|
||||
(word) memoryRemapBlock::pageOffset#0 pageOffset zp[2]:13 6.6000000000000005
|
||||
|
||||
reg byte x [ main::i#2 main::i#1 ]
|
||||
reg byte x [ main::i1#2 main::i1#1 ]
|
||||
reg byte x [ memoryRemapBlock::blockPage#2 ]
|
||||
reg byte z [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#1 ]
|
||||
zp[2]:2 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#1 ]
|
||||
reg byte z [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ]
|
||||
zp[2]:2 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ]
|
||||
zp[4]:4 [ memoryRemap256M::lowerPageOffset#2 ]
|
||||
reg byte z [ memoryRemap256M::remapBlocks#2 ]
|
||||
reg byte a [ main::$7 ]
|
||||
reg byte a [ memoryRemapBlock::block#0 ]
|
||||
reg byte a [ memoryRemapBlock::blockBits#0 ]
|
||||
reg byte a [ memoryRemap::$0 ]
|
||||
@ -369,7 +385,7 @@ reg byte a [ memoryRemap::$8 ]
|
||||
reg byte a [ memoryRemap::$9 ]
|
||||
zp[4]:9 [ memoryRemap256M::$0 ]
|
||||
reg byte a [ memoryRemap256M::$1 ]
|
||||
zp[2]:13 [ memoryRemap256M::$7 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 ]
|
||||
zp[2]:13 [ memoryRemap256M::$7 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 ]
|
||||
reg byte a [ memoryRemap256M::$5 ]
|
||||
zp[1]:15 [ memoryRemap256M::$6 memoryRemap::$1 ]
|
||||
reg byte a [ memoryRemap256M::$8 ]
|
||||
|
Loading…
x
Reference in New Issue
Block a user