From 79963be64ca2e48bb58b4679a2b24e0214c8679d Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Tue, 22 Sep 2020 19:51:26 +0200 Subject: [PATCH] Added memory mapper to mega65.h --- .../cache/fragment-cache-mega45gs02.asm | 889 +++++++ src/main/kc/include/mega65-memorymapper.h | 134 ++ src/main/kc/include/mega65.h | 1 + src/test/kc/examples/mega65/memorymap-test.c | 162 +- .../ref/examples/mega65/memorymap-test.asm | 162 +- .../ref/examples/mega65/memorymap-test.cfg | 151 +- .../ref/examples/mega65/memorymap-test.log | 2047 ++++++++++------- .../ref/examples/mega65/memorymap-test.sym | 32 +- 8 files changed, 2400 insertions(+), 1178 deletions(-) create mode 100644 src/main/kc/include/mega65-memorymapper.h diff --git a/src/main/fragment/cache/fragment-cache-mega45gs02.asm b/src/main/fragment/cache/fragment-cache-mega45gs02.asm index 84209f35e..2ac2add8b 100644 --- a/src/main/fragment/cache/fragment-cache-mega45gs02.asm +++ b/src/main/fragment/cache/fragment-cache-mega45gs02.asm @@ -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 diff --git a/src/main/kc/include/mega65-memorymapper.h b/src/main/kc/include/mega65-memorymapper.h new file mode 100644 index 000000000..94ce2c440 --- /dev/null +++ b/src/main/kc/include/mega65-memorymapper.h @@ -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 & 0xf); + *yVal = 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<((unsigned int)(lowerPageOffset>>4)); + *uMb = >((unsigned int)(upperPageOffset>>4)); + *aVal = < #include #include +#include // I/O Personality selection volatile char * const IO_KEY = 0xd02f; diff --git a/src/test/kc/examples/mega65/memorymap-test.c b/src/test/kc/examples/mega65/memorymap-test.c index f9d9624eb..d2d6a1f98 100644 --- a/src/test/kc/examples/mega65/memorymap-test.c +++ b/src/test/kc/examples/mega65/memorymap-test.c @@ -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 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 & 0xf); - *yVal = 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<((unsigned int)(lowerPageOffset>>4)); - *uMb = >((unsigned int)(upperPageOffset>>4)); - *aVal = < > [$10000-$12000], [$8000-$9fff] >> [$10000-$12000] // - Mapping two blocks to overlapping memory : [$4000-$5fff] >> [$10000-$12000], [$6000-$7f00] >> [$11000-$12ff] diff --git a/src/test/ref/examples/mega65/memorymap-test.asm b/src/test/ref/examples/mega65/memorymap-test.asm index af5e8a8bd..6576458ef 100644 --- a/src/test/ref/examples/mega65/memorymap-test.asm +++ b/src/test/ref/examples/mega65/memorymap-test.asm @@ -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 diff --git a/src/test/ref/examples/mega65/memorymap-test.cfg b/src/test/ref/examples/mega65/memorymap-test.cfg index 70151c491..16474ec4a 100644 --- a/src/test/ref/examples/mega65/memorymap-test.cfg +++ b/src/test/ref/examples/mega65/memorymap-test.cfg @@ -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 diff --git a/src/test/ref/examples/mega65/memorymap-test.log b/src/test/ref/examples/mega65/memorymap-test.log index e4679a0aa..e41d3e60f 100644 --- a/src/test/ref/examples/mega65/memorymap-test.log +++ b/src/test/ref/examples/mega65/memorymap-test.log @@ -1,59 +1,12 @@ -Resolved forward reference MEMORYBLOCK_4000 to (const nomodify byte) MEMORYBLOCK_4000 -Resolved forward reference MEMORYBLOCK_8000 to (const nomodify byte) MEMORYBLOCK_8000 -Resolved forward reference MEMORYBLOCK_4000 to (const nomodify byte) MEMORYBLOCK_4000 Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx CONTROL FLOW GRAPH SSA -(void()) main() -main: scope:[main] from __start - (byte) memoryRemapBlock::blockPage#0 ← (number) $40 - (word) memoryRemapBlock::memoryPage#0 ← (number) $100 - call memoryRemapBlock - to:main::@1 -main::@1: scope:[main] from main - *((const byte*) main::block1 + (number) 0) ← (number) $55 - *((const byte*) main::block1 + (number) 1) ← (number) $aa - (byte) memoryRemapBlock::blockPage#1 ← (number) $80 - (word) memoryRemapBlock::memoryPage#1 ← (number) $100 - call memoryRemapBlock - to:main::@2 -main::@2: scope:[main] from main::@1 - *((const byte*) main::block2 + (number) 2) ← (number) $55 - *((const byte*) main::block2 + (number) 3) ← (number) $aa - (byte~) main::$2 ← (const nomodify byte) MEMORYBLOCK_4000 | (const nomodify byte) MEMORYBLOCK_8000 - (byte) memoryRemap::remapBlocks#0 ← (byte~) main::$2 - (word) memoryRemap::lowerPageOffset#0 ← (number) $c0 - (word) memoryRemap::upperPageOffset#0 ← (number) $80 - call memoryRemap - to:main::@3 -main::@3: scope:[main] from main::@2 - *((const byte*) main::block2 + (number) 4) ← *((const byte*) main::block1 + (number) 2) - *((const byte*) main::block1 + (number) 5) ← *((const byte*) main::block2 + (number) 1) - (byte) memoryRemap256M::remapBlocks#0 ← (const nomodify byte) MEMORYBLOCK_4000 - (dword) memoryRemap256M::lowerPageOffset#0 ← (number) $ff800-(number) $40 - (dword) memoryRemap256M::upperPageOffset#0 ← (number) 0 - call memoryRemap256M - to:main::@4 -main::@4: scope:[main] from main::@3 - *((const byte*) main::block1 + (number) 0) ← (number) 0 - *((const byte*) main::block1 + (number) 1) ← (number) 1 - (byte) memoryRemap256M::remapBlocks#1 ← (number) 0 - (dword) memoryRemap256M::lowerPageOffset#1 ← (number) 0 - (dword) memoryRemap256M::upperPageOffset#1 ← (number) 0 - call memoryRemap256M - to:main::@5 -main::@5: scope:[main] from main::@4 - to:main::@return -main::@return: scope:[main] from main::@5 - return - to:@return - (void()) memoryRemap((byte) memoryRemap::remapBlocks , (word) memoryRemap::lowerPageOffset , (word) memoryRemap::upperPageOffset) -memoryRemap: scope:[memoryRemap] from main::@2 memoryRemapBlock - (word) memoryRemap::upperPageOffset#2 ← phi( main::@2/(word) memoryRemap::upperPageOffset#0 memoryRemapBlock/(word) memoryRemap::upperPageOffset#1 ) - (byte) memoryRemap::remapBlocks#2 ← phi( main::@2/(byte) memoryRemap::remapBlocks#0 memoryRemapBlock/(byte) memoryRemap::remapBlocks#1 ) - (word) memoryRemap::lowerPageOffset#2 ← phi( main::@2/(word) memoryRemap::lowerPageOffset#0 memoryRemapBlock/(word) memoryRemap::lowerPageOffset#1 ) +memoryRemap: scope:[memoryRemap] from main::@8 memoryRemapBlock + (word) memoryRemap::upperPageOffset#2 ← phi( main::@8/(word) memoryRemap::upperPageOffset#1 memoryRemapBlock/(word) memoryRemap::upperPageOffset#0 ) + (byte) memoryRemap::remapBlocks#2 ← phi( main::@8/(byte) memoryRemap::remapBlocks#1 memoryRemapBlock/(byte) memoryRemap::remapBlocks#0 ) + (word) memoryRemap::lowerPageOffset#2 ← phi( main::@8/(word) memoryRemap::lowerPageOffset#1 memoryRemapBlock/(word) memoryRemap::lowerPageOffset#0 ) (byte~) memoryRemap::$0 ← < (word) memoryRemap::lowerPageOffset#2 *((const byte*) memoryRemap::aVal) ← (byte~) memoryRemap::$0 (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#2 << (number) 4 @@ -75,18 +28,18 @@ memoryRemap::@return: scope:[memoryRemap] from memoryRemap to:@return (void()) memoryRemapBlock((byte) memoryRemapBlock::blockPage , (word) memoryRemapBlock::memoryPage) -memoryRemapBlock: scope:[memoryRemapBlock] from main main::@1 - (byte) memoryRemapBlock::blockPage#2 ← phi( main/(byte) memoryRemapBlock::blockPage#0 main::@1/(byte) memoryRemapBlock::blockPage#1 ) - (word) memoryRemapBlock::memoryPage#2 ← phi( main/(word) memoryRemapBlock::memoryPage#0 main::@1/(word) memoryRemapBlock::memoryPage#1 ) +memoryRemapBlock: scope:[memoryRemapBlock] from main main::@7 + (byte) memoryRemapBlock::blockPage#2 ← phi( main/(byte) memoryRemapBlock::blockPage#0 main::@7/(byte) memoryRemapBlock::blockPage#1 ) + (word) memoryRemapBlock::memoryPage#2 ← phi( main/(word) memoryRemapBlock::memoryPage#0 main::@7/(word) memoryRemapBlock::memoryPage#1 ) (word~) memoryRemapBlock::$0 ← (word) memoryRemapBlock::memoryPage#2 - (byte) memoryRemapBlock::blockPage#2 (word) memoryRemapBlock::pageOffset#0 ← (word~) memoryRemapBlock::$0 (number~) memoryRemapBlock::$1 ← (byte) memoryRemapBlock::blockPage#2 / (number) $20 (byte) memoryRemapBlock::block#0 ← (number~) memoryRemapBlock::$1 (number~) memoryRemapBlock::$2 ← (number) 1 << (byte) memoryRemapBlock::block#0 (byte) memoryRemapBlock::blockBits#0 ← (number~) memoryRemapBlock::$2 - (byte) memoryRemap::remapBlocks#1 ← (byte) memoryRemapBlock::blockBits#0 - (word) memoryRemap::lowerPageOffset#1 ← (word) memoryRemapBlock::pageOffset#0 - (word) memoryRemap::upperPageOffset#1 ← (word) memoryRemapBlock::pageOffset#0 + (byte) memoryRemap::remapBlocks#0 ← (byte) memoryRemapBlock::blockBits#0 + (word) memoryRemap::lowerPageOffset#0 ← (word) memoryRemapBlock::pageOffset#0 + (word) memoryRemap::upperPageOffset#0 ← (word) memoryRemapBlock::pageOffset#0 call memoryRemap to:memoryRemapBlock::@1 memoryRemapBlock::@1: scope:[memoryRemapBlock] from memoryRemapBlock @@ -96,10 +49,10 @@ memoryRemapBlock::@return: scope:[memoryRemapBlock] from memoryRemapBlock::@1 to:@return (void()) memoryRemap256M((byte) memoryRemap256M::remapBlocks , (dword) memoryRemap256M::lowerPageOffset , (dword) memoryRemap256M::upperPageOffset) -memoryRemap256M: scope:[memoryRemap256M] from main::@3 main::@4 - (byte) memoryRemap256M::remapBlocks#2 ← phi( main::@3/(byte) memoryRemap256M::remapBlocks#0 main::@4/(byte) memoryRemap256M::remapBlocks#1 ) - (dword) memoryRemap256M::upperPageOffset#2 ← phi( main::@3/(dword) memoryRemap256M::upperPageOffset#0 main::@4/(dword) memoryRemap256M::upperPageOffset#1 ) - (dword) memoryRemap256M::lowerPageOffset#2 ← phi( main::@3/(dword) memoryRemap256M::lowerPageOffset#0 main::@4/(dword) memoryRemap256M::lowerPageOffset#1 ) +memoryRemap256M: scope:[memoryRemap256M] from main::@3 main::@6 + (byte) memoryRemap256M::remapBlocks#2 ← phi( main::@3/(byte) memoryRemap256M::remapBlocks#0 main::@6/(byte) memoryRemap256M::remapBlocks#1 ) + (dword) memoryRemap256M::upperPageOffset#2 ← phi( main::@3/(dword) memoryRemap256M::upperPageOffset#0 main::@6/(dword) memoryRemap256M::upperPageOffset#1 ) + (dword) memoryRemap256M::lowerPageOffset#2 ← phi( main::@3/(dword) memoryRemap256M::lowerPageOffset#0 main::@6/(dword) memoryRemap256M::lowerPageOffset#1 ) (dword~) memoryRemap256M::$0 ← (dword) memoryRemap256M::lowerPageOffset#2 >> (number) 4 (byte~) memoryRemap256M::$1 ← > (word)(dword~) memoryRemap256M::$0 *((const byte*) memoryRemap256M::lMb) ← (byte~) memoryRemap256M::$1 @@ -130,6 +83,74 @@ memoryRemap256M::@return: scope:[memoryRemap256M] from memoryRemap256M return to:@return +(void()) main() +main: scope:[main] from __start + (byte) memoryRemapBlock::blockPage#0 ← (number) $40 + (word) memoryRemapBlock::memoryPage#0 ← (number) $100 + call memoryRemapBlock + to:main::@7 +main::@7: scope:[main] from main + *((const byte*) main::BLOCK_4000 + (number) 0) ← (byte) '-' + *((const byte*) main::BLOCK_4000 + (number) 1) ← (byte) '*' + (byte) memoryRemapBlock::blockPage#1 ← (number) $80 + (word) memoryRemapBlock::memoryPage#1 ← (number) $100 + call memoryRemapBlock + to:main::@8 +main::@8: scope:[main] from main::@7 + *((const byte*) main::BLOCK_8000 + (number) 2) ← (byte) '-' + *((const byte*) main::BLOCK_8000 + (number) 3) ← (byte) '*' + (byte) memoryRemap::remapBlocks#1 ← (const nomodify byte) MEMORYBLOCK_4000|(const nomodify byte) MEMORYBLOCK_8000 + (word) memoryRemap::lowerPageOffset#1 ← (number) $c0 + (word) memoryRemap::upperPageOffset#1 ← (number) $80 + call memoryRemap + to:main::@9 +main::@9: scope:[main] from main::@8 + *((const byte*) main::BLOCK_8000 + (number) 4) ← *((const byte*) main::BLOCK_4000 + (number) 2) + *((const byte*) main::BLOCK_4000 + (number) 5) ← *((const byte*) main::BLOCK_8000 + (number) 1) + (byte) main::i#0 ← (byte) 0 + to:main::@1 +main::@1: scope:[main] from main::@2 main::@9 + (byte) main::i#2 ← phi( main::@2/(byte) main::i#1 main::@9/(byte) main::i#0 ) + (bool~) main::$5 ← (byte) main::i#2 < (number) 6 + if((bool~) main::$5) goto main::@2 + to:main::@3 +main::@2: scope:[main] from main::@1 + (byte) main::i#3 ← phi( main::@1/(byte) main::i#2 ) + *((const nomodify byte*) DEFAULT_SCREEN+(number) $50-(number) 6 + (byte) main::i#3) ← *((const byte*) main::BLOCK_4000 + (byte) main::i#3) + (byte) main::i#1 ← ++ (byte) main::i#3 + to:main::@1 +main::@3: scope:[main] from main::@1 + (byte) memoryRemap256M::remapBlocks#0 ← (const nomodify byte) MEMORYBLOCK_4000 + (dword) memoryRemap256M::lowerPageOffset#0 ← (number) $ff800-(number) $40 + (dword) memoryRemap256M::upperPageOffset#0 ← (number) 0 + call memoryRemap256M + to:main::@10 +main::@10: scope:[main] from main::@3 + (byte) main::i1#0 ← (byte) 0 + to:main::@4 +main::@4: scope:[main] from main::@10 main::@5 + (byte) main::i1#2 ← phi( main::@10/(byte) main::i1#0 main::@5/(byte) main::i1#1 ) + (bool~) main::$6 ← (byte) main::i1#2 < (number) $10 + if((bool~) main::$6) goto main::@5 + to:main::@6 +main::@5: scope:[main] from main::@4 + (byte) main::i1#3 ← phi( main::@4/(byte) main::i1#2 ) + (number~) main::$7 ← (number) $40 + (byte) main::i1#3 + *((const byte*) main::BLOCK_4000 + (byte) main::i1#3) ← (number~) main::$7 + (byte) main::i1#1 ← ++ (byte) main::i1#3 + to:main::@4 +main::@6: scope:[main] from main::@4 + (byte) memoryRemap256M::remapBlocks#1 ← (number) 0 + (dword) memoryRemap256M::lowerPageOffset#1 ← (number) 0 + (dword) memoryRemap256M::upperPageOffset#1 ← (number) 0 + call memoryRemap256M + to:main::@11 +main::@11: scope:[main] from main::@6 + to:main::@return +main::@return: scope:[main] from main::@11 + return + to:@return + (void()) __start() __start: scope:[__start] from call main @@ -141,6 +162,7 @@ __start::@return: scope:[__start] from __start::@1 to:@return SYMBOL TABLE SSA +(const nomodify byte*) DEFAULT_SCREEN = (byte*)(number) $800 (byte) MEGA65_VICIV::ALPHADELAY (byte) MEGA65_VICIV::B0PIX (byte) MEGA65_VICIV::B0_ADDR @@ -431,15 +453,33 @@ SYMBOL TABLE SSA (label) __start::@1 (label) __start::@return (void()) main() -(byte~) main::$2 +(bool~) main::$5 +(bool~) main::$6 +(number~) main::$7 (label) main::@1 +(label) main::@10 +(label) main::@11 (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*)(number) $4000 -(const byte*) main::block2 = (byte*)(number) $8000 +(const byte*) main::BLOCK_4000 = (byte*)(number) $4000 +(const byte*) main::BLOCK_8000 = (byte*)(number) $8000 +(byte) main::i +(byte) main::i#0 +(byte) main::i#1 +(byte) main::i#2 +(byte) main::i#3 +(byte) main::i1 +(byte) main::i1#0 +(byte) main::i1#1 +(byte) main::i1#2 +(byte) main::i1#3 (void()) memoryRemap((byte) memoryRemap::remapBlocks , (word) memoryRemap::lowerPageOffset , (word) memoryRemap::upperPageOffset) (byte~) memoryRemap::$0 (byte~) memoryRemap::$1 @@ -527,33 +567,6 @@ SYMBOL TABLE SSA (word) memoryRemapBlock::pageOffset (word) memoryRemapBlock::pageOffset#0 -Adding number conversion cast (unumber) $40 in (byte) memoryRemapBlock::blockPage#0 ← (number) $40 -Adding number conversion cast (unumber) $100 in (word) memoryRemapBlock::memoryPage#0 ← (number) $100 -Adding number conversion cast (unumber) $55 in *((const byte*) main::block1 + (number) 0) ← (number) $55 -Adding number conversion cast (unumber) 0 in *((const byte*) main::block1 + (number) 0) ← ((unumber)) (number) $55 -Adding number conversion cast (unumber) $aa in *((const byte*) main::block1 + (number) 1) ← (number) $aa -Adding number conversion cast (unumber) 1 in *((const byte*) main::block1 + (number) 1) ← ((unumber)) (number) $aa -Adding number conversion cast (unumber) $80 in (byte) memoryRemapBlock::blockPage#1 ← (number) $80 -Adding number conversion cast (unumber) $100 in (word) memoryRemapBlock::memoryPage#1 ← (number) $100 -Adding number conversion cast (unumber) $55 in *((const byte*) main::block2 + (number) 2) ← (number) $55 -Adding number conversion cast (unumber) 2 in *((const byte*) main::block2 + (number) 2) ← ((unumber)) (number) $55 -Adding number conversion cast (unumber) $aa in *((const byte*) main::block2 + (number) 3) ← (number) $aa -Adding number conversion cast (unumber) 3 in *((const byte*) main::block2 + (number) 3) ← ((unumber)) (number) $aa -Adding number conversion cast (unumber) $c0 in (word) memoryRemap::lowerPageOffset#0 ← (number) $c0 -Adding number conversion cast (unumber) $80 in (word) memoryRemap::upperPageOffset#0 ← (number) $80 -Adding number conversion cast (unumber) 2 in *((const byte*) main::block2 + (number) 4) ← *((const byte*) main::block1 + (number) 2) -Adding number conversion cast (unumber) 4 in *((const byte*) main::block2 + (number) 4) ← *((const byte*) main::block1 + (unumber)(number) 2) -Adding number conversion cast (unumber) 1 in *((const byte*) main::block1 + (number) 5) ← *((const byte*) main::block2 + (number) 1) -Adding number conversion cast (unumber) 5 in *((const byte*) main::block1 + (number) 5) ← *((const byte*) main::block2 + (unumber)(number) 1) -Adding number conversion cast (unumber) $ff800-$40 in (dword) memoryRemap256M::lowerPageOffset#0 ← (number) $ff800-(number) $40 -Adding number conversion cast (unumber) 0 in (dword) memoryRemap256M::upperPageOffset#0 ← (number) 0 -Adding number conversion cast (unumber) 0 in *((const byte*) main::block1 + (number) 0) ← (number) 0 -Adding number conversion cast (unumber) 0 in *((const byte*) main::block1 + (number) 0) ← ((unumber)) (number) 0 -Adding number conversion cast (unumber) 1 in *((const byte*) main::block1 + (number) 1) ← (number) 1 -Adding number conversion cast (unumber) 1 in *((const byte*) main::block1 + (number) 1) ← ((unumber)) (number) 1 -Adding number conversion cast (unumber) 0 in (byte) memoryRemap256M::remapBlocks#1 ← (number) 0 -Adding number conversion cast (unumber) 0 in (dword) memoryRemap256M::lowerPageOffset#1 ← (number) 0 -Adding number conversion cast (unumber) 0 in (dword) memoryRemap256M::upperPageOffset#1 ← (number) 0 Adding number conversion cast (unumber) 4 in (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#2 << (number) 4 Adding number conversion cast (unumber) $f in (number~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (number) $f Adding number conversion cast (unumber) memoryRemap::$3 in (number~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (unumber)(number) $f @@ -578,27 +591,44 @@ Adding number conversion cast (unumber) memoryRemap256M::$13 in (number~) memory Adding number conversion cast (unumber) $f in (number~) memoryRemap256M::$16 ← (byte~) memoryRemap256M::$15 & (number) $f Adding number conversion cast (unumber) memoryRemap256M::$16 in (number~) memoryRemap256M::$16 ← (byte~) memoryRemap256M::$15 & (unumber)(number) $f Adding number conversion cast (unumber) memoryRemap256M::$17 in (number~) memoryRemap256M::$17 ← (unumber~) memoryRemap256M::$13 | (unumber~) memoryRemap256M::$16 +Adding number conversion cast (unumber) $40 in (byte) memoryRemapBlock::blockPage#0 ← (number) $40 +Adding number conversion cast (unumber) $100 in (word) memoryRemapBlock::memoryPage#0 ← (number) $100 +Adding number conversion cast (unumber) 0 in *((const byte*) main::BLOCK_4000 + (number) 0) ← (byte) '-' +Adding number conversion cast (unumber) 1 in *((const byte*) main::BLOCK_4000 + (number) 1) ← (byte) '*' +Adding number conversion cast (unumber) $80 in (byte) memoryRemapBlock::blockPage#1 ← (number) $80 +Adding number conversion cast (unumber) $100 in (word) memoryRemapBlock::memoryPage#1 ← (number) $100 +Adding number conversion cast (unumber) 2 in *((const byte*) main::BLOCK_8000 + (number) 2) ← (byte) '-' +Adding number conversion cast (unumber) 3 in *((const byte*) main::BLOCK_8000 + (number) 3) ← (byte) '*' +Adding number conversion cast (unumber) $c0 in (word) memoryRemap::lowerPageOffset#1 ← (number) $c0 +Adding number conversion cast (unumber) $80 in (word) memoryRemap::upperPageOffset#1 ← (number) $80 +Adding number conversion cast (unumber) 2 in *((const byte*) main::BLOCK_8000 + (number) 4) ← *((const byte*) main::BLOCK_4000 + (number) 2) +Adding number conversion cast (unumber) 4 in *((const byte*) main::BLOCK_8000 + (number) 4) ← *((const byte*) main::BLOCK_4000 + (unumber)(number) 2) +Adding number conversion cast (unumber) 1 in *((const byte*) main::BLOCK_4000 + (number) 5) ← *((const byte*) main::BLOCK_8000 + (number) 1) +Adding number conversion cast (unumber) 5 in *((const byte*) main::BLOCK_4000 + (number) 5) ← *((const byte*) main::BLOCK_8000 + (unumber)(number) 1) +Adding number conversion cast (unumber) 6 in (bool~) main::$5 ← (byte) main::i#2 < (number) 6 +Adding number conversion cast (unumber) 6 in *((const nomodify byte*) DEFAULT_SCREEN+(number) $50-(number) 6 + (byte) main::i#3) ← *((const byte*) main::BLOCK_4000 + (byte) main::i#3) +Adding number conversion cast (unumber) $50 in *((const nomodify byte*) DEFAULT_SCREEN+(number) $50-(unumber)(number) 6 + (byte) main::i#3) ← *((const byte*) main::BLOCK_4000 + (byte) main::i#3) +Adding number conversion cast (unumber) $ff800-$40 in (dword) memoryRemap256M::lowerPageOffset#0 ← (number) $ff800-(number) $40 +Adding number conversion cast (unumber) 0 in (dword) memoryRemap256M::upperPageOffset#0 ← (number) 0 +Adding number conversion cast (unumber) $10 in (bool~) main::$6 ← (byte) main::i1#2 < (number) $10 +Adding number conversion cast (unumber) $40 in (number~) main::$7 ← (number) $40 + (byte) main::i1#3 +Adding number conversion cast (unumber) main::$7 in (number~) main::$7 ← (unumber)(number) $40 + (byte) main::i1#3 +Adding number conversion cast (unumber) 0 in (byte) memoryRemap256M::remapBlocks#1 ← (number) 0 +Adding number conversion cast (unumber) 0 in (dword) memoryRemap256M::lowerPageOffset#1 ← (number) 0 +Adding number conversion cast (unumber) 0 in (dword) memoryRemap256M::upperPageOffset#1 ← (number) 0 Successful SSA optimization PassNAddNumberTypeConversions Inlining cast (byte) memoryRemapBlock::blockPage#0 ← (unumber)(number) $40 Inlining cast (word) memoryRemapBlock::memoryPage#0 ← (unumber)(number) $100 -Inlining cast *((const byte*) main::block1 + (unumber)(number) 0) ← (unumber)(number) $55 -Inlining cast *((const byte*) main::block1 + (unumber)(number) 1) ← (unumber)(number) $aa Inlining cast (byte) memoryRemapBlock::blockPage#1 ← (unumber)(number) $80 Inlining cast (word) memoryRemapBlock::memoryPage#1 ← (unumber)(number) $100 -Inlining cast *((const byte*) main::block2 + (unumber)(number) 2) ← (unumber)(number) $55 -Inlining cast *((const byte*) main::block2 + (unumber)(number) 3) ← (unumber)(number) $aa -Inlining cast (word) memoryRemap::lowerPageOffset#0 ← (unumber)(number) $c0 -Inlining cast (word) memoryRemap::upperPageOffset#0 ← (unumber)(number) $80 +Inlining cast (word) memoryRemap::lowerPageOffset#1 ← (unumber)(number) $c0 +Inlining cast (word) memoryRemap::upperPageOffset#1 ← (unumber)(number) $80 Inlining cast (dword) memoryRemap256M::lowerPageOffset#0 ← (unumber)(number) $ff800-(number) $40 Inlining cast (dword) memoryRemap256M::upperPageOffset#0 ← (unumber)(number) 0 -Inlining cast *((const byte*) main::block1 + (unumber)(number) 0) ← (unumber)(number) 0 -Inlining cast *((const byte*) main::block1 + (unumber)(number) 1) ← (unumber)(number) 1 Inlining cast (byte) memoryRemap256M::remapBlocks#1 ← (unumber)(number) 0 Inlining cast (dword) memoryRemap256M::lowerPageOffset#1 ← (unumber)(number) 0 Inlining cast (dword) memoryRemap256M::upperPageOffset#1 ← (unumber)(number) 0 Successful SSA optimization Pass2InlineCast -Simplifying constant pointer cast (byte*) 16384 -Simplifying constant pointer cast (byte*) 32768 Simplifying constant pointer cast (byte*) 252 Simplifying constant pointer cast (byte*) 253 Simplifying constant pointer cast (byte*) 254 @@ -609,32 +639,9 @@ Simplifying constant pointer cast (byte*) 252 Simplifying constant pointer cast (byte*) 253 Simplifying constant pointer cast (byte*) 254 Simplifying constant pointer cast (byte*) 255 -Simplifying constant integer cast $40 -Simplifying constant integer cast $100 -Simplifying constant integer cast $55 -Simplifying constant integer cast 0 -Simplifying constant integer cast $aa -Simplifying constant integer cast 1 -Simplifying constant integer cast $80 -Simplifying constant integer cast $100 -Simplifying constant integer cast $55 -Simplifying constant integer cast 2 -Simplifying constant integer cast $aa -Simplifying constant integer cast 3 -Simplifying constant integer cast $c0 -Simplifying constant integer cast $80 -Simplifying constant integer cast 2 -Simplifying constant integer cast 4 -Simplifying constant integer cast 1 -Simplifying constant integer cast 5 -Simplifying constant integer cast 0 -Simplifying constant integer cast 0 -Simplifying constant integer cast 0 -Simplifying constant integer cast 1 -Simplifying constant integer cast 1 -Simplifying constant integer cast 0 -Simplifying constant integer cast 0 -Simplifying constant integer cast 0 +Simplifying constant pointer cast (byte*) 2048 +Simplifying constant pointer cast (byte*) 16384 +Simplifying constant pointer cast (byte*) 32768 Simplifying constant integer cast 4 Simplifying constant integer cast $f Simplifying constant integer cast $f0 @@ -647,33 +654,30 @@ Simplifying constant integer cast 4 Simplifying constant integer cast $f Simplifying constant integer cast $f0 Simplifying constant integer cast $f +Simplifying constant integer cast $40 +Simplifying constant integer cast $100 +Simplifying constant integer cast 0 +Simplifying constant integer cast 1 +Simplifying constant integer cast $80 +Simplifying constant integer cast $100 +Simplifying constant integer cast 2 +Simplifying constant integer cast 3 +Simplifying constant integer cast $c0 +Simplifying constant integer cast $80 +Simplifying constant integer cast 2 +Simplifying constant integer cast 4 +Simplifying constant integer cast 1 +Simplifying constant integer cast 5 +Simplifying constant integer cast 6 +Simplifying constant integer cast $50 +Simplifying constant integer cast 6 +Simplifying constant integer cast 0 +Simplifying constant integer cast $10 +Simplifying constant integer cast $40 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 Successful SSA optimization PassNCastSimplification -Finalized unsigned number type (byte) $40 -Finalized unsigned number type (word) $100 -Finalized unsigned number type (byte) $55 -Finalized unsigned number type (byte) 0 -Finalized unsigned number type (byte) $aa -Finalized unsigned number type (byte) 1 -Finalized unsigned number type (byte) $80 -Finalized unsigned number type (word) $100 -Finalized unsigned number type (byte) $55 -Finalized unsigned number type (byte) 2 -Finalized unsigned number type (byte) $aa -Finalized unsigned number type (byte) 3 -Finalized unsigned number type (byte) $c0 -Finalized unsigned number type (byte) $80 -Finalized unsigned number type (byte) 2 -Finalized unsigned number type (byte) 4 -Finalized unsigned number type (byte) 1 -Finalized unsigned number type (byte) 5 -Finalized unsigned number type (byte) 0 -Finalized unsigned number type (byte) 0 -Finalized unsigned number type (byte) 0 -Finalized unsigned number type (byte) 1 -Finalized unsigned number type (byte) 1 -Finalized unsigned number type (byte) 0 -Finalized unsigned number type (byte) 0 -Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 4 Finalized unsigned number type (byte) $f Finalized unsigned number type (byte) $f0 @@ -686,6 +690,29 @@ Finalized unsigned number type (byte) 4 Finalized unsigned number type (byte) $f Finalized unsigned number type (byte) $f0 Finalized unsigned number type (byte) $f +Finalized unsigned number type (byte) $40 +Finalized unsigned number type (word) $100 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 1 +Finalized unsigned number type (byte) $80 +Finalized unsigned number type (word) $100 +Finalized unsigned number type (byte) 2 +Finalized unsigned number type (byte) 3 +Finalized unsigned number type (byte) $c0 +Finalized unsigned number type (byte) $80 +Finalized unsigned number type (byte) 2 +Finalized unsigned number type (byte) 4 +Finalized unsigned number type (byte) 1 +Finalized unsigned number type (byte) 5 +Finalized unsigned number type (byte) 6 +Finalized unsigned number type (byte) $50 +Finalized unsigned number type (byte) 6 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) $10 +Finalized unsigned number type (byte) $40 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in (unumber~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f Inferred type updated to byte in (unumber~) memoryRemap::$4 ← (byte~) memoryRemap::$1 | (byte~) memoryRemap::$3 @@ -699,33 +726,38 @@ Inferred type updated to byte in (unumber~) memoryRemap256M::$10 ← (byte~) mem Inferred type updated to byte in (unumber~) memoryRemap256M::$13 ← (byte) memoryRemap256M::remapBlocks#2 & (byte) $f0 Inferred type updated to byte in (unumber~) memoryRemap256M::$16 ← (byte~) memoryRemap256M::$15 & (byte) $f Inferred type updated to byte in (unumber~) memoryRemap256M::$17 ← (byte~) memoryRemap256M::$13 | (byte~) memoryRemap256M::$16 -Alias memoryRemap::remapBlocks#0 = main::$2 +Inferred type updated to byte in (unumber~) main::$7 ← (byte) $40 + (byte) main::i1#3 Alias memoryRemapBlock::pageOffset#0 = memoryRemapBlock::$0 Alias memoryRemapBlock::block#0 = memoryRemapBlock::$1 Alias memoryRemapBlock::blockBits#0 = memoryRemapBlock::$2 +Alias main::i#2 = main::i#3 +Alias main::i1#2 = main::i1#3 Successful SSA optimization Pass2AliasElimination -Identified duplicate assignment right side [68] (word~) memoryRemap256M::$7 ← < (dword) memoryRemap256M::lowerPageOffset#2 -Identified duplicate assignment right side [77] (word~) memoryRemap256M::$14 ← < (dword) memoryRemap256M::upperPageOffset#2 +Identified duplicate assignment right side [40] (word~) memoryRemap256M::$7 ← < (dword) memoryRemap256M::lowerPageOffset#2 +Identified duplicate assignment right side [49] (word~) memoryRemap256M::$14 ← < (dword) memoryRemap256M::upperPageOffset#2 Successful SSA optimization Pass2DuplicateRValueIdentification -Constant right-side identified [10] (byte) memoryRemap::remapBlocks#0 ← (const nomodify byte) MEMORYBLOCK_4000 | (const nomodify byte) MEMORYBLOCK_8000 -Constant right-side identified [17] (dword) memoryRemap256M::lowerPageOffset#0 ← (unumber)(number) $ff800-(number) $40 +Simple Condition (bool~) main::$5 [72] if((byte) main::i#2<(byte) 6) goto main::@2 +Simple Condition (bool~) main::$6 [82] if((byte) main::i1#2<(byte) $10) goto main::@5 +Successful SSA optimization Pass2ConditionalJumpSimplification +Constant right-side identified [76] (dword) memoryRemap256M::lowerPageOffset#0 ← (unumber)(number) $ff800-(number) $40 Successful SSA optimization Pass2ConstantRValueConsolidation Constant (const byte) memoryRemapBlock::blockPage#0 = $40 Constant (const word) memoryRemapBlock::memoryPage#0 = $100 Constant (const byte) memoryRemapBlock::blockPage#1 = $80 Constant (const word) memoryRemapBlock::memoryPage#1 = $100 -Constant (const byte) memoryRemap::remapBlocks#0 = MEMORYBLOCK_4000|MEMORYBLOCK_8000 -Constant (const word) memoryRemap::lowerPageOffset#0 = $c0 -Constant (const word) memoryRemap::upperPageOffset#0 = $80 +Constant (const byte) memoryRemap::remapBlocks#1 = MEMORYBLOCK_4000|MEMORYBLOCK_8000 +Constant (const word) memoryRemap::lowerPageOffset#1 = $c0 +Constant (const word) memoryRemap::upperPageOffset#1 = $80 +Constant (const byte) main::i#0 = 0 Constant (const byte) memoryRemap256M::remapBlocks#0 = MEMORYBLOCK_4000 Constant (const dword) memoryRemap256M::lowerPageOffset#0 = (unumber)$ff800-$40 Constant (const dword) memoryRemap256M::upperPageOffset#0 = 0 +Constant (const byte) main::i1#0 = 0 Constant (const byte) memoryRemap256M::remapBlocks#1 = 0 Constant (const dword) memoryRemap256M::lowerPageOffset#1 = 0 Constant (const dword) memoryRemap256M::upperPageOffset#1 = 0 Successful SSA optimization Pass2ConstantIdentification -Simplifying expression containing zero main::block1 in [3] *((const byte*) main::block1 + (byte) 0) ← (byte) $55 -Simplifying expression containing zero main::block1 in [20] *((const byte*) main::block1 + (byte) 0) ← (byte) 0 +Simplifying expression containing zero main::BLOCK_4000 in [56] *((const byte*) main::BLOCK_4000 + (byte) 0) ← (byte) '-' Successful SSA optimization PassNSimplifyExpressionWithZero Removing unused procedure __start Removing unused procedure block __start @@ -735,11 +767,11 @@ Successful SSA optimization PassNEliminateEmptyStart Alias memoryRemap256M::$7 = memoryRemap256M::$4 Alias memoryRemap256M::$14 = memoryRemap256M::$11 Successful SSA optimization Pass2AliasElimination -Rewriting division to use shift [33] (byte) memoryRemapBlock::block#0 ← (byte) memoryRemapBlock::blockPage#2 / (byte) $20 +Rewriting division to use shift [19] (byte) memoryRemapBlock::block#0 ← (byte) memoryRemapBlock::blockPage#2 / (byte) $20 Successful SSA optimization Pass2MultiplyToShiftRewriting -Inlining constant with var siblings (const byte) memoryRemap::remapBlocks#0 -Inlining constant with var siblings (const word) memoryRemap::lowerPageOffset#0 -Inlining constant with var siblings (const word) memoryRemap::upperPageOffset#0 +Inlining constant with var siblings (const byte) memoryRemap::remapBlocks#1 +Inlining constant with var siblings (const word) memoryRemap::lowerPageOffset#1 +Inlining constant with var siblings (const word) memoryRemap::upperPageOffset#1 Inlining constant with var siblings (const byte) memoryRemapBlock::blockPage#0 Inlining constant with var siblings (const word) memoryRemapBlock::memoryPage#0 Inlining constant with var siblings (const byte) memoryRemapBlock::blockPage#1 @@ -750,51 +782,54 @@ Inlining constant with var siblings (const dword) memoryRemap256M::upperPageOffs Inlining constant with var siblings (const byte) memoryRemap256M::remapBlocks#1 Inlining constant with var siblings (const dword) memoryRemap256M::lowerPageOffset#1 Inlining constant with var siblings (const dword) memoryRemap256M::upperPageOffset#1 +Inlining constant with var siblings (const byte) main::i#0 +Inlining constant with var siblings (const byte) main::i1#0 +Constant inlined memoryRemap::remapBlocks#1 = (const nomodify byte) MEMORYBLOCK_4000|(const nomodify byte) MEMORYBLOCK_8000 Constant inlined memoryRemapBlock::blockPage#1 = (byte) $80 -Constant inlined memoryRemap::remapBlocks#0 = (const nomodify byte) MEMORYBLOCK_4000|(const nomodify byte) MEMORYBLOCK_8000 Constant inlined memoryRemapBlock::blockPage#0 = (byte) $40 +Constant inlined memoryRemap::upperPageOffset#1 = (byte) $80 Constant inlined memoryRemapBlock::memoryPage#1 = (word) $100 Constant inlined memoryRemapBlock::memoryPage#0 = (word) $100 -Constant inlined memoryRemap::upperPageOffset#0 = (byte) $80 Constant inlined memoryRemap256M::upperPageOffset#1 = (byte) 0 Constant inlined memoryRemap256M::upperPageOffset#0 = (byte) 0 -Constant inlined memoryRemap::lowerPageOffset#0 = (byte) $c0 +Constant inlined memoryRemap::lowerPageOffset#1 = (byte) $c0 +Constant inlined main::i#0 = (byte) 0 +Constant inlined main::i1#0 = (byte) 0 Constant inlined memoryRemap256M::lowerPageOffset#0 = (dword)(number) $ff800-(number) $40 Constant inlined memoryRemap256M::lowerPageOffset#1 = (byte) 0 Constant inlined memoryRemap256M::remapBlocks#1 = (byte) 0 Constant inlined memoryRemap256M::remapBlocks#0 = (const nomodify byte) MEMORYBLOCK_4000 Successful SSA optimization Pass2ConstantInlining -Consolidated array index constant in *(main::block1+1) -Consolidated array index constant in *(main::block2+2) -Consolidated array index constant in *(main::block2+3) -Consolidated array index constant in *(main::block1+2) -Consolidated array index constant in *(main::block2+4) -Consolidated array index constant in *(main::block2+1) -Consolidated array index constant in *(main::block1+5) -Consolidated array index constant in *(main::block1+1) +Consolidated array index constant in *(main::BLOCK_4000+1) +Consolidated array index constant in *(main::BLOCK_8000+2) +Consolidated array index constant in *(main::BLOCK_8000+3) +Consolidated array index constant in *(main::BLOCK_4000+2) +Consolidated array index constant in *(main::BLOCK_8000+4) +Consolidated array index constant in *(main::BLOCK_8000+1) +Consolidated array index constant in *(main::BLOCK_4000+5) Successful SSA optimization Pass2ConstantAdditionElimination Identical Phi Values (word) memoryRemapBlock::memoryPage#2 (word) $100 Identical Phi Values (dword) memoryRemap256M::upperPageOffset#2 (byte) 0 Successful SSA optimization Pass2IdenticalPhiElimination -Constant right-side identified [44] (dword~) memoryRemap256M::$2 ← (byte) 0 >> (byte) 4 -Constant right-side identified [55] (word~) memoryRemap256M::$14 ← < (byte) 0 +Constant right-side identified [30] (dword~) memoryRemap256M::$2 ← (byte) 0 >> (byte) 4 +Constant right-side identified [41] (word~) memoryRemap256M::$14 ← < (byte) 0 Successful SSA optimization Pass2ConstantRValueConsolidation Constant (const dword) memoryRemap256M::$2 = 0>>4 Constant (const word) memoryRemap256M::$14 = <0 Successful SSA optimization Pass2ConstantIdentification -Constant value identified (word)memoryRemap256M::$2 in [45] (byte~) memoryRemap256M::$3 ← > (word)(const dword) memoryRemap256M::$2 +Constant value identified (word)memoryRemap256M::$2 in [31] (byte~) memoryRemap256M::$3 ← > (word)(const dword) memoryRemap256M::$2 Successful SSA optimization Pass2ConstantValues Simplifying constant evaluating to zero (byte) 0>>(byte) 4 in Simplifying constant evaluating to zero <(byte) 0 in -Simplifying constant evaluating to zero (word)(const dword) memoryRemap256M::$2 in [45] (byte~) memoryRemap256M::$3 ← > (word)(const dword) memoryRemap256M::$2 +Simplifying constant evaluating to zero (word)(const dword) memoryRemap256M::$2 in [31] (byte~) memoryRemap256M::$3 ← > (word)(const dword) memoryRemap256M::$2 Successful SSA optimization PassNSimplifyConstantZero Eliminating unused constant (const dword) memoryRemap256M::$2 Successful SSA optimization PassNEliminateUnusedVars Constant inlined memoryRemap256M::$14 = (byte) 0 Successful SSA optimization Pass2ConstantInlining -Constant right-side identified [44] (byte~) memoryRemap256M::$3 ← > (word) 0 -Constant right-side identified [54] (byte~) memoryRemap256M::$12 ← < (byte) 0 -Constant right-side identified [57] (byte~) memoryRemap256M::$15 ← > (byte) 0 +Constant right-side identified [30] (byte~) memoryRemap256M::$3 ← > (word) 0 +Constant right-side identified [40] (byte~) memoryRemap256M::$12 ← < (byte) 0 +Constant right-side identified [43] (byte~) memoryRemap256M::$15 ← > (byte) 0 Successful SSA optimization Pass2ConstantRValueConsolidation Constant (const byte) memoryRemap256M::$3 = >0 Constant (const byte) memoryRemap256M::$12 = <0 @@ -808,33 +843,41 @@ Constant inlined memoryRemap256M::$15 = (byte) 0 Constant inlined memoryRemap256M::$12 = (byte) 0 Constant inlined memoryRemap256M::$3 = (byte) 0 Successful SSA optimization Pass2ConstantInlining -Constant right-side identified [55] (byte~) memoryRemap256M::$16 ← (byte) 0 & (byte) $f +Constant right-side identified [41] (byte~) memoryRemap256M::$16 ← (byte) 0 & (byte) $f Successful SSA optimization Pass2ConstantRValueConsolidation Constant (const byte) memoryRemap256M::$16 = 0&$f Successful SSA optimization Pass2ConstantIdentification Simplifying constant evaluating to zero (byte) 0&(byte) $f in Successful SSA optimization PassNSimplifyConstantZero -Simplifying expression containing zero memoryRemap256M::$13 in [56] (byte~) memoryRemap256M::$17 ← (byte~) memoryRemap256M::$13 | (const byte) memoryRemap256M::$16 +Simplifying expression containing zero memoryRemap256M::$13 in [42] (byte~) memoryRemap256M::$17 ← (byte~) memoryRemap256M::$13 | (const byte) memoryRemap256M::$16 Successful SSA optimization PassNSimplifyExpressionWithZero Eliminating unused constant (const byte) memoryRemap256M::$16 Successful SSA optimization PassNEliminateUnusedVars Alias memoryRemap256M::$17 = memoryRemap256M::$13 Successful SSA optimization Pass2AliasElimination Adding NOP phi() at start of main -Adding NOP phi() at start of main::@5 +Adding NOP phi() at start of main::@3 +Adding NOP phi() at start of main::@10 +Adding NOP phi() at start of main::@6 +Adding NOP phi() at start of main::@11 Adding NOP phi() at start of memoryRemapBlock::@1 CALL GRAPH -Calls in [main] to memoryRemapBlock:1 memoryRemapBlock:4 memoryRemap:7 memoryRemap256M:10 memoryRemap256M:13 -Calls in [memoryRemapBlock] to memoryRemap:26 +Calls in [main] to memoryRemapBlock:1 memoryRemapBlock:4 memoryRemap:7 memoryRemap256M:13 memoryRemap256M:18 +Calls in [memoryRemapBlock] to memoryRemap:38 -Created 6 initial phi equivalence classes -Coalesced [23] memoryRemap::lowerPageOffset#3 ← memoryRemap::lowerPageOffset#1 -Coalesced [24] memoryRemap::remapBlocks#3 ← memoryRemap::remapBlocks#1 -Coalesced [25] memoryRemap::upperPageOffset#3 ← memoryRemap::upperPageOffset#1 -Coalesced down to 6 phi equivalence classes -Culled Empty Block (label) main::@5 +Created 8 initial phi equivalence classes +Coalesced [24] main::i1#4 ← main::i1#1 +Coalesced [27] main::i#4 ← main::i#1 +Coalesced [35] memoryRemap::lowerPageOffset#3 ← memoryRemap::lowerPageOffset#0 +Coalesced [36] memoryRemap::remapBlocks#3 ← memoryRemap::remapBlocks#0 +Coalesced [37] memoryRemap::upperPageOffset#3 ← memoryRemap::upperPageOffset#0 +Coalesced down to 8 phi equivalence classes +Culled Empty Block (label) main::@10 +Culled Empty Block (label) main::@11 Culled Empty Block (label) memoryRemapBlock::@1 Adding NOP phi() at start of main +Adding NOP phi() at start of main::@3 +Adding NOP phi() at start of main::@6 FINAL CONTROL FLOW GRAPH @@ -842,94 +885,113 @@ FINAL CONTROL FLOW GRAPH 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 @@ -1219,6 +1281,13 @@ VARIABLE REGISTER WEIGHTS (byte) MOS6581_SID::POT_Y (byte) MOS6581_SID::VOLUME_FILTER_MODE (void()) main() +(byte~) main::$7 22.0 +(byte) main::i +(byte) main::i#1 22.0 +(byte) main::i#2 18.333333333333332 +(byte) main::i1 +(byte) main::i1#1 22.0 +(byte) main::i1#2 13.75 (void()) memoryRemap((byte) memoryRemap::remapBlocks , (word) memoryRemap::lowerPageOffset , (word) memoryRemap::upperPageOffset) (byte~) memoryRemap::$0 202.0 (byte~) memoryRemap::$1 67.33333333333333 @@ -1231,13 +1300,13 @@ VARIABLE REGISTER WEIGHTS (byte~) memoryRemap::$8 202.0 (byte~) memoryRemap::$9 202.0 (word) memoryRemap::lowerPageOffset -(word) memoryRemap::lowerPageOffset#1 11.0 +(word) memoryRemap::lowerPageOffset#0 11.0 (word) memoryRemap::lowerPageOffset#2 53.25 (byte) memoryRemap::remapBlocks -(byte) memoryRemap::remapBlocks#1 7.333333333333333 +(byte) memoryRemap::remapBlocks#0 7.333333333333333 (byte) memoryRemap::remapBlocks#2 21.299999999999997 (word) memoryRemap::upperPageOffset -(word) memoryRemap::upperPageOffset#1 22.0 +(word) memoryRemap::upperPageOffset#0 22.0 (word) memoryRemap::upperPageOffset#2 19.363636363636363 (void()) memoryRemap256M((byte) memoryRemap256M::remapBlocks , (dword) memoryRemap256M::lowerPageOffset , (dword) memoryRemap256M::upperPageOffset) (dword~) memoryRemap256M::$0 11.0 @@ -1266,12 +1335,15 @@ VARIABLE REGISTER WEIGHTS (word) memoryRemapBlock::pageOffset#0 6.6000000000000005 Initial phi equivalence classes +[ main::i#2 main::i#1 ] +[ main::i1#2 main::i1#1 ] [ memoryRemapBlock::blockPage#2 ] -[ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 ] -[ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#1 ] -[ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#1 ] +[ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] +[ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] +[ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] [ memoryRemap256M::lowerPageOffset#2 ] [ memoryRemap256M::remapBlocks#2 ] +Added variable main::$7 to live range equivalence class [ main::$7 ] Added variable memoryRemapBlock::pageOffset#0 to live range equivalence class [ memoryRemapBlock::pageOffset#0 ] Added variable memoryRemapBlock::block#0 to live range equivalence class [ memoryRemapBlock::block#0 ] Added variable memoryRemapBlock::blockBits#0 to live range equivalence class [ memoryRemapBlock::blockBits#0 ] @@ -1295,12 +1367,15 @@ Added variable memoryRemap256M::$9 to live range equivalence class [ memoryRemap Added variable memoryRemap256M::$10 to live range equivalence class [ memoryRemap256M::$10 ] Added variable memoryRemap256M::$17 to live range equivalence class [ memoryRemap256M::$17 ] Complete equivalence classes +[ main::i#2 main::i#1 ] +[ main::i1#2 main::i1#1 ] [ memoryRemapBlock::blockPage#2 ] -[ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 ] -[ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#1 ] -[ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#1 ] +[ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] +[ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] +[ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] [ memoryRemap256M::lowerPageOffset#2 ] [ memoryRemap256M::remapBlocks#2 ] +[ main::$7 ] [ memoryRemapBlock::pageOffset#0 ] [ memoryRemapBlock::block#0 ] [ memoryRemapBlock::blockBits#0 ] @@ -1323,41 +1398,44 @@ Complete equivalence classes [ memoryRemap256M::$9 ] [ memoryRemap256M::$10 ] [ memoryRemap256M::$17 ] -Allocated zp[1]:2 [ memoryRemapBlock::blockPage#2 ] -Allocated zp[2]:3 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 ] -Allocated zp[1]:5 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#1 ] -Allocated zp[2]:6 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#1 ] -Allocated zp[4]:8 [ memoryRemap256M::lowerPageOffset#2 ] -Allocated zp[1]:12 [ memoryRemap256M::remapBlocks#2 ] -Allocated zp[2]:13 [ memoryRemapBlock::pageOffset#0 ] -Allocated zp[1]:15 [ memoryRemapBlock::block#0 ] -Allocated zp[1]:16 [ memoryRemapBlock::blockBits#0 ] -Allocated zp[1]:17 [ memoryRemap::$0 ] -Allocated zp[1]:18 [ memoryRemap::$1 ] -Allocated zp[1]:19 [ memoryRemap::$2 ] -Allocated zp[1]:20 [ memoryRemap::$3 ] -Allocated zp[1]:21 [ memoryRemap::$4 ] -Allocated zp[1]:22 [ memoryRemap::$5 ] -Allocated zp[1]:23 [ memoryRemap::$6 ] -Allocated zp[1]:24 [ memoryRemap::$7 ] -Allocated zp[1]:25 [ memoryRemap::$8 ] -Allocated zp[1]:26 [ memoryRemap::$9 ] -Allocated zp[4]:27 [ memoryRemap256M::$0 ] -Allocated zp[1]:31 [ memoryRemap256M::$1 ] -Allocated zp[2]:32 [ memoryRemap256M::$7 ] -Allocated zp[1]:34 [ memoryRemap256M::$5 ] -Allocated zp[1]:35 [ memoryRemap256M::$6 ] -Allocated zp[1]:36 [ memoryRemap256M::$8 ] -Allocated zp[1]:37 [ memoryRemap256M::$9 ] -Allocated zp[1]:38 [ memoryRemap256M::$10 ] -Allocated zp[1]:39 [ memoryRemap256M::$17 ] +Allocated zp[1]:2 [ main::i#2 main::i#1 ] +Allocated zp[1]:3 [ main::i1#2 main::i1#1 ] +Allocated zp[1]:4 [ memoryRemapBlock::blockPage#2 ] +Allocated zp[2]:5 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] +Allocated zp[1]:7 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] +Allocated zp[2]:8 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] +Allocated zp[4]:10 [ memoryRemap256M::lowerPageOffset#2 ] +Allocated zp[1]:14 [ memoryRemap256M::remapBlocks#2 ] +Allocated zp[1]:15 [ main::$7 ] +Allocated zp[2]:16 [ memoryRemapBlock::pageOffset#0 ] +Allocated zp[1]:18 [ memoryRemapBlock::block#0 ] +Allocated zp[1]:19 [ memoryRemapBlock::blockBits#0 ] +Allocated zp[1]:20 [ memoryRemap::$0 ] +Allocated zp[1]:21 [ memoryRemap::$1 ] +Allocated zp[1]:22 [ memoryRemap::$2 ] +Allocated zp[1]:23 [ memoryRemap::$3 ] +Allocated zp[1]:24 [ memoryRemap::$4 ] +Allocated zp[1]:25 [ memoryRemap::$5 ] +Allocated zp[1]:26 [ memoryRemap::$6 ] +Allocated zp[1]:27 [ memoryRemap::$7 ] +Allocated zp[1]:28 [ memoryRemap::$8 ] +Allocated zp[1]:29 [ memoryRemap::$9 ] +Allocated zp[4]:30 [ memoryRemap256M::$0 ] +Allocated zp[1]:34 [ memoryRemap256M::$1 ] +Allocated zp[2]:35 [ memoryRemap256M::$7 ] +Allocated zp[1]:37 [ memoryRemap256M::$5 ] +Allocated zp[1]:38 [ memoryRemap256M::$6 ] +Allocated zp[1]:39 [ memoryRemap256M::$8 ] +Allocated zp[1]:40 [ memoryRemap256M::$9 ] +Allocated zp[1]:41 [ memoryRemap256M::$10 ] +Allocated zp[1]:42 [ memoryRemap256M::$17 ] INITIAL ASM Target platform is mega65 / MEGA45GS02 // File Comments // 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 @@ -1379,83 +1457,106 @@ Target platform is mega65 / MEGA45GS02 .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 main: { - .label block1 = $4000 - .label block2 = $8000 + .label BLOCK_4000 = $4000 + .label BLOCK_8000 = $8000 + .label __7 = $f + .label i = 2 + .label i1 = 3 // [1] call memoryRemapBlock // Remap [$4000-$5fff] to point to [$10000-$11fff] - // [15] phi from main to memoryRemapBlock [phi:main->memoryRemapBlock] + // [24] phi from main to memoryRemapBlock [phi:main->memoryRemapBlock] memoryRemapBlock_from_main: - // [15] phi (byte) memoryRemapBlock::blockPage#2 = (byte) $40 [phi:main->memoryRemapBlock#0] -- vbuz1=vbuc1 + // [24] phi (byte) memoryRemapBlock::blockPage#2 = (byte) $40 [phi:main->memoryRemapBlock#0] -- vbuz1=vbuc1 lda #$40 sta.z memoryRemapBlock.blockPage jsr memoryRemapBlock - jmp __b1 - // main::@1 - __b1: - // [2] *((const byte*) main::block1) ← (byte) $55 -- _deref_pbuc1=vbuc2 - // Put 0x55, 0xaa into $10000 - lda #$55 - sta block1 - // [3] *((const byte*) main::block1+(byte) 1) ← (byte) $aa -- _deref_pbuc1=vbuc2 - lda #$aa - sta block1+1 + jmp __b7 + // main::@7 + __b7: + // [2] *((const byte*) main::BLOCK_4000) ← (byte) '-' -- _deref_pbuc1=vbuc2 + // Put '-', '*' into $10000 + lda #'-' + sta BLOCK_4000 + // [3] *((const byte*) main::BLOCK_4000+(byte) 1) ← (byte) '*' -- _deref_pbuc1=vbuc2 + lda #'*' + sta BLOCK_4000+1 // [4] call memoryRemapBlock // Remap [$8000-$9fff] to point to [$10000-$11fff] - // [15] phi from main::@1 to memoryRemapBlock [phi:main::@1->memoryRemapBlock] - memoryRemapBlock_from___b1: - // [15] phi (byte) memoryRemapBlock::blockPage#2 = (byte) $80 [phi:main::@1->memoryRemapBlock#0] -- vbuz1=vbuc1 + // [24] phi from main::@7 to memoryRemapBlock [phi:main::@7->memoryRemapBlock] + memoryRemapBlock_from___b7: + // [24] phi (byte) memoryRemapBlock::blockPage#2 = (byte) $80 [phi:main::@7->memoryRemapBlock#0] -- vbuz1=vbuc1 lda #$80 sta.z memoryRemapBlock.blockPage jsr memoryRemapBlock - jmp __b2 - // main::@2 - __b2: - // [5] *((const byte*) main::block2+(byte) 2) ← (byte) $55 -- _deref_pbuc1=vbuc2 - // Put 0x55, 0xaainto $10002 - lda #$55 - sta block2+2 - // [6] *((const byte*) main::block2+(byte) 3) ← (byte) $aa -- _deref_pbuc1=vbuc2 - lda #$aa - sta block2+3 + jmp __b8 + // main::@8 + __b8: + // [5] *((const byte*) main::BLOCK_8000+(byte) 2) ← (byte) '-' -- _deref_pbuc1=vbuc2 + // Put '-', '*' into $10002 + lda #'-' + sta BLOCK_8000+2 + // [6] *((const byte*) main::BLOCK_8000+(byte) 3) ← (byte) '*' -- _deref_pbuc1=vbuc2 + lda #'*' + sta BLOCK_8000+3 // [7] call memoryRemap // Remap [$4000-$5fff] and [$8000-$9fff] to both point to [$10000-$11fff] (notice usage of page offsets) - // [24] phi from main::@2 to memoryRemap [phi:main::@2->memoryRemap] - memoryRemap_from___b2: - // [24] phi (word) memoryRemap::upperPageOffset#2 = (byte) $80 [phi:main::@2->memoryRemap#0] -- vwuz1=vbuc1 + // [33] phi from main::@8 to memoryRemap [phi:main::@8->memoryRemap] + memoryRemap_from___b8: + // [33] phi (word) memoryRemap::upperPageOffset#2 = (byte) $80 [phi:main::@8->memoryRemap#0] -- vwuz1=vbuc1 lda #<$80 sta.z memoryRemap.upperPageOffset lda #>$80 sta.z memoryRemap.upperPageOffset+1 - // [24] phi (byte) memoryRemap::remapBlocks#2 = (const nomodify byte) MEMORYBLOCK_4000|(const nomodify byte) MEMORYBLOCK_8000 [phi:main::@2->memoryRemap#1] -- vbuz1=vbuc1 + // [33] phi (byte) memoryRemap::remapBlocks#2 = (const nomodify byte) MEMORYBLOCK_4000|(const nomodify byte) MEMORYBLOCK_8000 [phi:main::@8->memoryRemap#1] -- vbuz1=vbuc1 lda #MEMORYBLOCK_4000|MEMORYBLOCK_8000 sta.z memoryRemap.remapBlocks - // [24] phi (word) memoryRemap::lowerPageOffset#2 = (byte) $c0 [phi:main::@2->memoryRemap#2] -- vwuz1=vbuc1 + // [33] phi (word) memoryRemap::lowerPageOffset#2 = (byte) $c0 [phi:main::@8->memoryRemap#2] -- vwuz1=vbuc1 lda #<$c0 sta.z memoryRemap.lowerPageOffset lda #>$c0 sta.z memoryRemap.lowerPageOffset+1 jsr memoryRemap + jmp __b9 + // main::@9 + __b9: + // [8] *((const byte*) main::BLOCK_8000+(byte) 4) ← *((const byte*) main::BLOCK_4000+(byte) 2) -- _deref_pbuc1=_deref_pbuc2 + // Put '-', '*' into $10004 in a convoluted way + lda BLOCK_4000+2 + sta BLOCK_8000+4 + // [9] *((const byte*) main::BLOCK_4000+(byte) 5) ← *((const byte*) main::BLOCK_8000+(byte) 1) -- _deref_pbuc1=_deref_pbuc2 + lda BLOCK_8000+1 + sta BLOCK_4000+5 + // [10] phi from main::@9 to main::@1 [phi:main::@9->main::@1] + __b1_from___b9: + // [10] phi (byte) main::i#2 = (byte) 0 [phi:main::@9->main::@1#0] -- vbuz1=vbuc1 + lda #0 + sta.z i + jmp __b1 + // copy the resulting values onto the screen + // main::@1 + __b1: + // [11] if((byte) main::i#2<(byte) 6) goto main::@2 -- vbuz1_lt_vbuc1_then_la1 + lda.z i + cmp #6 + bcc __b2 + // [12] phi from main::@1 to main::@3 [phi:main::@1->main::@3] + __b3_from___b1: jmp __b3 // main::@3 __b3: - // [8] *((const byte*) main::block2+(byte) 4) ← *((const byte*) main::block1+(byte) 2) -- _deref_pbuc1=_deref_pbuc2 - // Put 0x55, 0xaa into $10004 in a convoluted way - lda block1+2 - sta block2+4 - // [9] *((const byte*) main::block1+(byte) 5) ← *((const byte*) main::block2+(byte) 1) -- _deref_pbuc1=_deref_pbuc2 - lda block2+1 - sta block1+5 - // [10] call memoryRemap256M + // [13] call memoryRemap256M // Remap [$4000-$5fff] to both point to [$ff80000-$ff81fff] COLORAM! (notice usage of page offsets) - // [41] phi from main::@3 to memoryRemap256M [phi:main::@3->memoryRemap256M] + // [50] phi from main::@3 to memoryRemap256M [phi:main::@3->memoryRemap256M] memoryRemap256M_from___b3: - // [41] phi (byte) memoryRemap256M::remapBlocks#2 = (const nomodify byte) MEMORYBLOCK_4000 [phi:main::@3->memoryRemap256M#0] -- vbuz1=vbuc1 + // [50] phi (byte) memoryRemap256M::remapBlocks#2 = (const nomodify byte) MEMORYBLOCK_4000 [phi:main::@3->memoryRemap256M#0] -- vbuz1=vbuc1 lda #MEMORYBLOCK_4000 sta.z memoryRemap256M.remapBlocks - // [41] phi (dword) memoryRemap256M::lowerPageOffset#2 = (dword)(number) $ff800-(number) $40 [phi:main::@3->memoryRemap256M#1] -- vduz1=vduc1 + // [50] phi (dword) memoryRemap256M::lowerPageOffset#2 = (dword)(number) $ff800-(number) $40 [phi:main::@3->memoryRemap256M#1] -- vduz1=vduc1 lda #<$ff800-$40 sta.z memoryRemap256M.lowerPageOffset lda #>$ff800-$40 @@ -1465,24 +1566,32 @@ main: { lda #>$ff800-$40>>$10 sta.z memoryRemap256M.lowerPageOffset+3 jsr memoryRemap256M + // [14] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + __b4_from___b3: + // [14] phi (byte) main::i1#2 = (byte) 0 [phi:main::@3->main::@4#0] -- vbuz1=vbuc1 + lda #0 + sta.z i1 jmp __b4 + // Put colors in the upper screen line // main::@4 __b4: - // [11] *((const byte*) main::block1) ← (byte) 0 -- _deref_pbuc1=vbuc2 - // Put colors in the upper left corner! - lda #0 - sta block1 - // [12] *((const byte*) main::block1+(byte) 1) ← (byte) 1 -- _deref_pbuc1=vbuc2 - lda #1 - sta block1+1 - // [13] call memoryRemap256M + // [15] if((byte) main::i1#2<(byte) $10) goto main::@5 -- vbuz1_lt_vbuc1_then_la1 + lda.z i1 + cmp #$10 + bcc __b5 + // [16] phi from main::@4 to main::@6 [phi:main::@4->main::@6] + __b6_from___b4: + jmp __b6 + // main::@6 + __b6: + // [17] call memoryRemap256M // Remap [$4000-$5fff] back to normal memory! - // [41] phi from main::@4 to memoryRemap256M [phi:main::@4->memoryRemap256M] - memoryRemap256M_from___b4: - // [41] phi (byte) memoryRemap256M::remapBlocks#2 = (byte) 0 [phi:main::@4->memoryRemap256M#0] -- vbuz1=vbuc1 + // [50] phi from main::@6 to memoryRemap256M [phi:main::@6->memoryRemap256M] + memoryRemap256M_from___b6: + // [50] phi (byte) memoryRemap256M::remapBlocks#2 = (byte) 0 [phi:main::@6->memoryRemap256M#0] -- vbuz1=vbuc1 lda #0 sta.z memoryRemap256M.remapBlocks - // [41] phi (dword) memoryRemap256M::lowerPageOffset#2 = (byte) 0 [phi:main::@4->memoryRemap256M#1] -- vduz1=vbuc1 + // [50] phi (dword) memoryRemap256M::lowerPageOffset#2 = (byte) 0 [phi:main::@6->memoryRemap256M#1] -- vduz1=vbuc1 lda #0 sta.z memoryRemap256M.lowerPageOffset lda #0 @@ -1493,22 +1602,51 @@ main: { jmp __breturn // main::@return __breturn: - // [14] return + // [18] return rts + // main::@5 + __b5: + // [19] (byte~) main::$7 ← (byte) $40 + (byte) main::i1#2 -- vbuz1=vbuc1_plus_vbuz2 + lda #$40 + clc + adc.z i1 + sta.z __7 + // [20] *((const byte*) main::BLOCK_4000 + (byte) main::i1#2) ← (byte~) main::$7 -- pbuc1_derefidx_vbuz1=vbuz2 + lda.z __7 + ldy.z i1 + sta BLOCK_4000,y + // [21] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuz1=_inc_vbuz1 + inc.z i1 + // [14] phi from main::@5 to main::@4 [phi:main::@5->main::@4] + __b4_from___b5: + // [14] phi (byte) main::i1#2 = (byte) main::i1#1 [phi:main::@5->main::@4#0] -- register_copy + jmp __b4 + // main::@2 + __b2: + // [22] *((const nomodify byte*) DEFAULT_SCREEN+(byte) $50-(byte) 6 + (byte) main::i#2) ← *((const byte*) main::BLOCK_4000 + (byte) main::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1 + ldy.z i + lda BLOCK_4000,y + sta DEFAULT_SCREEN+$50-6,y + // [23] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 + inc.z i + // [10] phi from main::@2 to main::@1 [phi:main::@2->main::@1] + __b1_from___b2: + // [10] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#0] -- register_copy + jmp __b1 } // memoryRemapBlock // 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 zp(2) blockPage) +// memoryRemapBlock(byte zp(4) blockPage) memoryRemapBlock: { - .label pageOffset = $d - .label block = $f - .label blockBits = $10 - .label blockPage = 2 - // [16] (word) memoryRemapBlock::pageOffset#0 ← (word) $100 - (byte) memoryRemapBlock::blockPage#2 -- vwuz1=vwuc1_minus_vbuz2 + .label pageOffset = $10 + .label block = $12 + .label blockBits = $13 + .label blockPage = 4 + // [25] (word) memoryRemapBlock::pageOffset#0 ← (word) $100 - (byte) memoryRemapBlock::blockPage#2 -- vwuz1=vwuc1_minus_vbuz2 sec lda #<$100 sbc.z blockPage @@ -1516,7 +1654,7 @@ memoryRemapBlock: { lda #>$100 sbc #0 sta.z pageOffset+1 - // [17] (byte) memoryRemapBlock::block#0 ← (byte) memoryRemapBlock::blockPage#2 >> (byte) 5 -- vbuz1=vbuz2_ror_5 + // [26] (byte) memoryRemapBlock::block#0 ← (byte) memoryRemapBlock::blockPage#2 >> (byte) 5 -- vbuz1=vbuz2_ror_5 lda.z blockPage lsr lsr @@ -1524,7 +1662,7 @@ memoryRemapBlock: { lsr lsr sta.z block - // [18] (byte) memoryRemapBlock::blockBits#0 ← (byte) 1 << (byte) memoryRemapBlock::block#0 -- vbuz1=vbuc1_rol_vbuz2 + // [27] (byte) memoryRemapBlock::blockBits#0 ← (byte) 1 << (byte) memoryRemapBlock::block#0 -- vbuz1=vbuc1_rol_vbuz2 lda #1 ldy.z block cpy #0 @@ -1535,30 +1673,30 @@ memoryRemapBlock: { bne !- !e: sta.z blockBits - // [19] (byte) memoryRemap::remapBlocks#1 ← (byte) memoryRemapBlock::blockBits#0 -- vbuz1=vbuz2 + // [28] (byte) memoryRemap::remapBlocks#0 ← (byte) memoryRemapBlock::blockBits#0 -- vbuz1=vbuz2 lda.z blockBits sta.z memoryRemap.remapBlocks - // [20] (word) memoryRemap::lowerPageOffset#1 ← (word) memoryRemapBlock::pageOffset#0 -- vwuz1=vwuz2 + // [29] (word) memoryRemap::lowerPageOffset#0 ← (word) memoryRemapBlock::pageOffset#0 -- vwuz1=vwuz2 lda.z pageOffset sta.z memoryRemap.lowerPageOffset lda.z pageOffset+1 sta.z memoryRemap.lowerPageOffset+1 - // [21] (word) memoryRemap::upperPageOffset#1 ← (word) memoryRemapBlock::pageOffset#0 -- vwuz1=vwuz2 + // [30] (word) memoryRemap::upperPageOffset#0 ← (word) memoryRemapBlock::pageOffset#0 -- vwuz1=vwuz2 lda.z pageOffset sta.z memoryRemap.upperPageOffset lda.z pageOffset+1 sta.z memoryRemap.upperPageOffset+1 - // [22] call memoryRemap - // [24] phi from memoryRemapBlock to memoryRemap [phi:memoryRemapBlock->memoryRemap] + // [31] call memoryRemap + // [33] phi from memoryRemapBlock to memoryRemap [phi:memoryRemapBlock->memoryRemap] memoryRemap_from_memoryRemapBlock: - // [24] phi (word) memoryRemap::upperPageOffset#2 = (word) memoryRemap::upperPageOffset#1 [phi:memoryRemapBlock->memoryRemap#0] -- register_copy - // [24] phi (byte) memoryRemap::remapBlocks#2 = (byte) memoryRemap::remapBlocks#1 [phi:memoryRemapBlock->memoryRemap#1] -- register_copy - // [24] phi (word) memoryRemap::lowerPageOffset#2 = (word) memoryRemap::lowerPageOffset#1 [phi:memoryRemapBlock->memoryRemap#2] -- register_copy + // [33] phi (word) memoryRemap::upperPageOffset#2 = (word) memoryRemap::upperPageOffset#0 [phi:memoryRemapBlock->memoryRemap#0] -- register_copy + // [33] phi (byte) memoryRemap::remapBlocks#2 = (byte) memoryRemap::remapBlocks#0 [phi:memoryRemapBlock->memoryRemap#1] -- register_copy + // [33] phi (word) memoryRemap::lowerPageOffset#2 = (word) memoryRemap::lowerPageOffset#0 [phi:memoryRemapBlock->memoryRemap#2] -- register_copy jsr memoryRemap jmp __breturn // memoryRemapBlock::@return __breturn: - // [23] return + // [32] return rts } // memoryRemap @@ -1566,94 +1704,94 @@ 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. -// memoryRemap(byte zp(5) remapBlocks, word zp(3) lowerPageOffset, word zp(6) upperPageOffset) +// - 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 zp(7) remapBlocks, word zp(5) lowerPageOffset, word zp(8) upperPageOffset) memoryRemap: { .label aVal = $fc .label xVal = $fd .label yVal = $fe .label zVal = $ff - .label __0 = $11 - .label __1 = $12 - .label __2 = $13 - .label __3 = $14 - .label __4 = $15 - .label __5 = $16 - .label __6 = $17 - .label __7 = $18 - .label __8 = $19 - .label __9 = $1a - .label remapBlocks = 5 - .label lowerPageOffset = 3 - .label upperPageOffset = 6 - // [25] (byte~) memoryRemap::$0 ← < (word) memoryRemap::lowerPageOffset#2 -- vbuz1=_lo_vwuz2 + .label __0 = $14 + .label __1 = $15 + .label __2 = $16 + .label __3 = $17 + .label __4 = $18 + .label __5 = $19 + .label __6 = $1a + .label __7 = $1b + .label __8 = $1c + .label __9 = $1d + .label remapBlocks = 7 + .label lowerPageOffset = 5 + .label upperPageOffset = 8 + // [34] (byte~) memoryRemap::$0 ← < (word) memoryRemap::lowerPageOffset#2 -- vbuz1=_lo_vwuz2 lda.z lowerPageOffset sta.z __0 - // [26] *((const byte*) memoryRemap::aVal) ← (byte~) memoryRemap::$0 -- _deref_pbuc1=vbuz1 + // [35] *((const byte*) memoryRemap::aVal) ← (byte~) memoryRemap::$0 -- _deref_pbuc1=vbuz1 lda.z __0 sta aVal - // [27] (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#2 << (byte) 4 -- vbuz1=vbuz2_rol_4 + // [36] (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#2 << (byte) 4 -- vbuz1=vbuz2_rol_4 lda.z remapBlocks asl asl asl asl sta.z __1 - // [28] (byte~) memoryRemap::$2 ← > (word) memoryRemap::lowerPageOffset#2 -- vbuz1=_hi_vwuz2 + // [37] (byte~) memoryRemap::$2 ← > (word) memoryRemap::lowerPageOffset#2 -- vbuz1=_hi_vwuz2 lda.z lowerPageOffset+1 sta.z __2 - // [29] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f -- vbuz1=vbuz2_band_vbuc1 + // [38] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f -- vbuz1=vbuz2_band_vbuc1 lda #$f and.z __2 sta.z __3 - // [30] (byte~) memoryRemap::$4 ← (byte~) memoryRemap::$1 | (byte~) memoryRemap::$3 -- vbuz1=vbuz2_bor_vbuz3 + // [39] (byte~) memoryRemap::$4 ← (byte~) memoryRemap::$1 | (byte~) memoryRemap::$3 -- vbuz1=vbuz2_bor_vbuz3 lda.z __1 ora.z __3 sta.z __4 - // [31] *((const byte*) memoryRemap::xVal) ← (byte~) memoryRemap::$4 -- _deref_pbuc1=vbuz1 + // [40] *((const byte*) memoryRemap::xVal) ← (byte~) memoryRemap::$4 -- _deref_pbuc1=vbuz1 lda.z __4 sta xVal - // [32] (byte~) memoryRemap::$5 ← < (word) memoryRemap::upperPageOffset#2 -- vbuz1=_lo_vwuz2 + // [41] (byte~) memoryRemap::$5 ← < (word) memoryRemap::upperPageOffset#2 -- vbuz1=_lo_vwuz2 lda.z upperPageOffset sta.z __5 - // [33] *((const byte*) memoryRemap::yVal) ← (byte~) memoryRemap::$5 -- _deref_pbuc1=vbuz1 + // [42] *((const byte*) memoryRemap::yVal) ← (byte~) memoryRemap::$5 -- _deref_pbuc1=vbuz1 lda.z __5 sta yVal - // [34] (byte~) memoryRemap::$6 ← (byte) memoryRemap::remapBlocks#2 & (byte) $f0 -- vbuz1=vbuz2_band_vbuc1 + // [43] (byte~) memoryRemap::$6 ← (byte) memoryRemap::remapBlocks#2 & (byte) $f0 -- vbuz1=vbuz2_band_vbuc1 lda #$f0 and.z remapBlocks sta.z __6 - // [35] (byte~) memoryRemap::$7 ← > (word) memoryRemap::upperPageOffset#2 -- vbuz1=_hi_vwuz2 + // [44] (byte~) memoryRemap::$7 ← > (word) memoryRemap::upperPageOffset#2 -- vbuz1=_hi_vwuz2 lda.z upperPageOffset+1 sta.z __7 - // [36] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f -- vbuz1=vbuz2_band_vbuc1 + // [45] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f -- vbuz1=vbuz2_band_vbuc1 lda #$f and.z __7 sta.z __8 - // [37] (byte~) memoryRemap::$9 ← (byte~) memoryRemap::$6 | (byte~) memoryRemap::$8 -- vbuz1=vbuz2_bor_vbuz3 + // [46] (byte~) memoryRemap::$9 ← (byte~) memoryRemap::$6 | (byte~) memoryRemap::$8 -- vbuz1=vbuz2_bor_vbuz3 lda.z __6 ora.z __8 sta.z __9 - // [38] *((const byte*) memoryRemap::zVal) ← (byte~) memoryRemap::$9 -- _deref_pbuc1=vbuz1 + // [47] *((const byte*) memoryRemap::zVal) ← (byte~) memoryRemap::$9 -- _deref_pbuc1=vbuz1 lda.z __9 sta zVal // asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } @@ -1666,7 +1804,7 @@ memoryRemap: { jmp __breturn // memoryRemap::@return __breturn: - // [40] return + // [49] return rts } // memoryRemap256M @@ -1675,27 +1813,27 @@ 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. -// memoryRemap256M(byte zp($c) remapBlocks, dword zp(8) lowerPageOffset) +// - 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 zp($e) remapBlocks, dword zp($a) lowerPageOffset) memoryRemap256M: { .label lMb = $fa .label uMb = $fb @@ -1703,18 +1841,18 @@ memoryRemap256M: { .label xVal = $fd .label yVal = $fe .label zVal = $ff - .label __0 = $1b - .label __1 = $1f - .label __5 = $22 - .label __6 = $23 - .label __7 = $20 - .label __8 = $24 - .label __9 = $25 - .label __10 = $26 - .label __17 = $27 - .label lowerPageOffset = 8 - .label remapBlocks = $c - // [42] (dword~) memoryRemap256M::$0 ← (dword) memoryRemap256M::lowerPageOffset#2 >> (byte) 4 -- vduz1=vduz2_ror_4 + .label __0 = $1e + .label __1 = $22 + .label __5 = $25 + .label __6 = $26 + .label __7 = $23 + .label __8 = $27 + .label __9 = $28 + .label __10 = $29 + .label __17 = $2a + .label lowerPageOffset = $a + .label remapBlocks = $e + // [51] (dword~) memoryRemap256M::$0 ← (dword) memoryRemap256M::lowerPageOffset#2 >> (byte) 4 -- vduz1=vduz2_ror_4 lda.z lowerPageOffset+3 lsr sta.z __0+3 @@ -1739,55 +1877,55 @@ memoryRemap256M: { ror.z __0+2 ror.z __0+1 ror.z __0 - // [43] (byte~) memoryRemap256M::$1 ← > (word)(dword~) memoryRemap256M::$0 -- vbuz1=_hi__word_vduz2 + // [52] (byte~) memoryRemap256M::$1 ← > (word)(dword~) memoryRemap256M::$0 -- vbuz1=_hi__word_vduz2 lda.z __0+1 sta.z __1 - // [44] *((const byte*) memoryRemap256M::lMb) ← (byte~) memoryRemap256M::$1 -- _deref_pbuc1=vbuz1 + // [53] *((const byte*) memoryRemap256M::lMb) ← (byte~) memoryRemap256M::$1 -- _deref_pbuc1=vbuz1 lda.z __1 sta lMb - // [45] *((const byte*) memoryRemap256M::uMb) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // [54] *((const byte*) memoryRemap256M::uMb) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta uMb - // [46] (word~) memoryRemap256M::$7 ← < (dword) memoryRemap256M::lowerPageOffset#2 -- vwuz1=_lo_vduz2 + // [55] (word~) memoryRemap256M::$7 ← < (dword) memoryRemap256M::lowerPageOffset#2 -- vwuz1=_lo_vduz2 lda.z lowerPageOffset sta.z __7 lda.z lowerPageOffset+1 sta.z __7+1 - // [47] (byte~) memoryRemap256M::$5 ← < (word~) memoryRemap256M::$7 -- vbuz1=_lo_vwuz2 + // [56] (byte~) memoryRemap256M::$5 ← < (word~) memoryRemap256M::$7 -- vbuz1=_lo_vwuz2 lda.z __7 sta.z __5 - // [48] *((const byte*) memoryRemap256M::aVal) ← (byte~) memoryRemap256M::$5 -- _deref_pbuc1=vbuz1 + // [57] *((const byte*) memoryRemap256M::aVal) ← (byte~) memoryRemap256M::$5 -- _deref_pbuc1=vbuz1 lda.z __5 sta aVal - // [49] (byte~) memoryRemap256M::$6 ← (byte) memoryRemap256M::remapBlocks#2 << (byte) 4 -- vbuz1=vbuz2_rol_4 + // [58] (byte~) memoryRemap256M::$6 ← (byte) memoryRemap256M::remapBlocks#2 << (byte) 4 -- vbuz1=vbuz2_rol_4 lda.z remapBlocks asl asl asl asl sta.z __6 - // [50] (byte~) memoryRemap256M::$8 ← > (word~) memoryRemap256M::$7 -- vbuz1=_hi_vwuz2 + // [59] (byte~) memoryRemap256M::$8 ← > (word~) memoryRemap256M::$7 -- vbuz1=_hi_vwuz2 lda.z __7+1 sta.z __8 - // [51] (byte~) memoryRemap256M::$9 ← (byte~) memoryRemap256M::$8 & (byte) $f -- vbuz1=vbuz2_band_vbuc1 + // [60] (byte~) memoryRemap256M::$9 ← (byte~) memoryRemap256M::$8 & (byte) $f -- vbuz1=vbuz2_band_vbuc1 lda #$f and.z __8 sta.z __9 - // [52] (byte~) memoryRemap256M::$10 ← (byte~) memoryRemap256M::$6 | (byte~) memoryRemap256M::$9 -- vbuz1=vbuz2_bor_vbuz3 + // [61] (byte~) memoryRemap256M::$10 ← (byte~) memoryRemap256M::$6 | (byte~) memoryRemap256M::$9 -- vbuz1=vbuz2_bor_vbuz3 lda.z __6 ora.z __9 sta.z __10 - // [53] *((const byte*) memoryRemap256M::xVal) ← (byte~) memoryRemap256M::$10 -- _deref_pbuc1=vbuz1 + // [62] *((const byte*) memoryRemap256M::xVal) ← (byte~) memoryRemap256M::$10 -- _deref_pbuc1=vbuz1 lda.z __10 sta xVal - // [54] *((const byte*) memoryRemap256M::yVal) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // [63] *((const byte*) memoryRemap256M::yVal) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta yVal - // [55] (byte~) memoryRemap256M::$17 ← (byte) memoryRemap256M::remapBlocks#2 & (byte) $f0 -- vbuz1=vbuz2_band_vbuc1 + // [64] (byte~) memoryRemap256M::$17 ← (byte) memoryRemap256M::remapBlocks#2 & (byte) $f0 -- vbuz1=vbuz2_band_vbuc1 lda #$f0 and.z remapBlocks sta.z __17 - // [56] *((const byte*) memoryRemap256M::zVal) ← (byte~) memoryRemap256M::$17 -- _deref_pbuc1=vbuz1 + // [65] *((const byte*) memoryRemap256M::zVal) ← (byte~) memoryRemap256M::$17 -- _deref_pbuc1=vbuz1 lda.z __17 sta zVal // asm { ldalMb ldx#$0f ldyuMb ldz#$00 map ldaaVal ldxxVal ldyyVal ldzzVal map eom } @@ -1805,164 +1943,169 @@ memoryRemap256M: { jmp __breturn // memoryRemap256M::@return __breturn: - // [58] return + // [67] return rts } // File Data REGISTER UPLIFT POTENTIAL REGISTERS -Statement [2] *((const byte*) main::block1) ← (byte) $55 [ ] ( [ ] { } ) always clobbers reg byte a -Statement [3] *((const byte*) main::block1+(byte) 1) ← (byte) $aa [ ] ( [ ] { } ) always clobbers reg byte a -Statement [5] *((const byte*) main::block2+(byte) 2) ← (byte) $55 [ ] ( [ ] { } ) always clobbers reg byte a -Statement [6] *((const byte*) main::block2+(byte) 3) ← (byte) $aa [ ] ( [ ] { } ) always clobbers reg byte a -Statement [8] *((const byte*) main::block2+(byte) 4) ← *((const byte*) main::block1+(byte) 2) [ ] ( [ ] { } ) always clobbers reg byte a -Statement [9] *((const byte*) main::block1+(byte) 5) ← *((const byte*) main::block2+(byte) 1) [ ] ( [ ] { } ) always clobbers reg byte a -Statement [11] *((const byte*) main::block1) ← (byte) 0 [ ] ( [ ] { } ) always clobbers reg byte a -Statement [12] *((const byte*) main::block1+(byte) 1) ← (byte) 1 [ ] ( [ ] { } ) always clobbers reg byte a -Statement [16] (word) memoryRemapBlock::pageOffset#0 ← (word) $100 - (byte) memoryRemapBlock::blockPage#2 [ memoryRemapBlock::blockPage#2 memoryRemapBlock::pageOffset#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::blockPage#2 memoryRemapBlock::pageOffset#0 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::blockPage#2 memoryRemapBlock::pageOffset#0 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp[1]:2 [ memoryRemapBlock::blockPage#2 ] -Statement [17] (byte) memoryRemapBlock::block#0 ← (byte) memoryRemapBlock::blockPage#2 >> (byte) 5 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::block#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::block#0 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::block#0 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [18] (byte) memoryRemapBlock::blockBits#0 ← (byte) 1 << (byte) memoryRemapBlock::block#0 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::blockBits#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::blockBits#0 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::blockBits#0 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [20] (word) memoryRemap::lowerPageOffset#1 ← (word) memoryRemapBlock::pageOffset#0 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#1 memoryRemap::lowerPageOffset#1 ] ( memoryRemapBlock:1 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#1 memoryRemap::lowerPageOffset#1 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#1 memoryRemap::lowerPageOffset#1 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp[1]:5 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#1 ] -Statement [21] (word) memoryRemap::upperPageOffset#1 ← (word) memoryRemapBlock::pageOffset#0 [ memoryRemap::remapBlocks#1 memoryRemap::lowerPageOffset#1 memoryRemap::upperPageOffset#1 ] ( memoryRemapBlock:1 [ memoryRemap::remapBlocks#1 memoryRemap::lowerPageOffset#1 memoryRemap::upperPageOffset#1 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemap::remapBlocks#1 memoryRemap::lowerPageOffset#1 memoryRemap::upperPageOffset#1 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [27] (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#2 << (byte) 4 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] ( memoryRemap:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] { } memoryRemapBlock:1::memoryRemap:22 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:22 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [29] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] ( memoryRemap:7 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] { } memoryRemapBlock:1::memoryRemap:22 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:22 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp[1]:18 [ memoryRemap::$1 ] -Statement [34] (byte~) memoryRemap::$6 ← (byte) memoryRemap::remapBlocks#2 & (byte) $f0 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] ( memoryRemap:7 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] { } memoryRemapBlock:1::memoryRemap:22 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:22 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [36] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f [ memoryRemap::$6 memoryRemap::$8 ] ( memoryRemap:7 [ memoryRemap::$6 memoryRemap::$8 ] { } memoryRemapBlock:1::memoryRemap:22 [ memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:22 [ memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp[1]:23 [ memoryRemap::$6 ] +Statement [2] *((const byte*) main::BLOCK_4000) ← (byte) '-' [ ] ( [ ] { } ) always clobbers reg byte a +Statement [3] *((const byte*) main::BLOCK_4000+(byte) 1) ← (byte) '*' [ ] ( [ ] { } ) always clobbers reg byte a +Statement [5] *((const byte*) main::BLOCK_8000+(byte) 2) ← (byte) '-' [ ] ( [ ] { } ) always clobbers reg byte a +Statement [6] *((const byte*) main::BLOCK_8000+(byte) 3) ← (byte) '*' [ ] ( [ ] { } ) always clobbers reg byte a +Statement [8] *((const byte*) main::BLOCK_8000+(byte) 4) ← *((const byte*) main::BLOCK_4000+(byte) 2) [ ] ( [ ] { } ) always clobbers reg byte a +Statement [9] *((const byte*) main::BLOCK_4000+(byte) 5) ← *((const byte*) main::BLOCK_8000+(byte) 1) [ ] ( [ ] { } ) always clobbers reg byte a +Statement [19] (byte~) main::$7 ← (byte) $40 + (byte) main::i1#2 [ main::i1#2 main::$7 ] ( [ main::i1#2 main::$7 ] { } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:3 [ main::i1#2 main::i1#1 ] +Statement [22] *((const nomodify byte*) DEFAULT_SCREEN+(byte) $50-(byte) 6 + (byte) main::i#2) ← *((const byte*) main::BLOCK_4000 + (byte) main::i#2) [ main::i#2 ] ( [ main::i#2 ] { } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::i#2 main::i#1 ] +Statement [25] (word) memoryRemapBlock::pageOffset#0 ← (word) $100 - (byte) memoryRemapBlock::blockPage#2 [ memoryRemapBlock::blockPage#2 memoryRemapBlock::pageOffset#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::blockPage#2 memoryRemapBlock::pageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::blockPage#2 memoryRemapBlock::pageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:4 [ memoryRemapBlock::blockPage#2 ] +Statement [26] (byte) memoryRemapBlock::block#0 ← (byte) memoryRemapBlock::blockPage#2 >> (byte) 5 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::block#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::block#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::block#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [27] (byte) memoryRemapBlock::blockBits#0 ← (byte) 1 << (byte) memoryRemapBlock::block#0 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::blockBits#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::blockBits#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::blockBits#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [29] (word) memoryRemap::lowerPageOffset#0 ← (word) memoryRemapBlock::pageOffset#0 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:7 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] +Statement [30] (word) memoryRemap::upperPageOffset#0 ← (word) memoryRemapBlock::pageOffset#0 [ memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 memoryRemap::upperPageOffset#0 ] ( memoryRemapBlock:1 [ memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 memoryRemap::upperPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 memoryRemap::upperPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [36] (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#2 << (byte) 4 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] ( memoryRemap:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [38] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] ( memoryRemap:7 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:21 [ memoryRemap::$1 ] +Statement [43] (byte~) memoryRemap::$6 ← (byte) memoryRemap::remapBlocks#2 & (byte) $f0 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] ( memoryRemap:7 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [45] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f [ memoryRemap::$6 memoryRemap::$8 ] ( memoryRemap:7 [ memoryRemap::$6 memoryRemap::$8 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:26 [ memoryRemap::$6 ] Statement asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } always clobbers reg byte a reg byte x reg byte y reg byte z -Statement [42] (dword~) memoryRemap256M::$0 ← (dword) memoryRemap256M::lowerPageOffset#2 >> (byte) 4 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] ( memoryRemap256M:10 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp[1]:12 [ memoryRemap256M::remapBlocks#2 ] -Statement [45] *((const byte*) memoryRemap256M::uMb) ← (byte) 0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 ] ( memoryRemap256M:10 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 ] { } memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 ] { } ) always clobbers reg byte a -Statement [46] (word~) memoryRemap256M::$7 ← < (dword) memoryRemap256M::lowerPageOffset#2 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 ] ( memoryRemap256M:10 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 ] { } memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 ] { } ) always clobbers reg byte a -Statement [49] (byte~) memoryRemap256M::$6 ← (byte) memoryRemap256M::remapBlocks#2 << (byte) 4 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 memoryRemap256M::$6 ] ( memoryRemap256M:10 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 memoryRemap256M::$6 ] { } memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 memoryRemap256M::$6 ] { } ) always clobbers reg byte a -Statement [51] (byte~) memoryRemap256M::$9 ← (byte~) memoryRemap256M::$8 & (byte) $f [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$6 memoryRemap256M::$9 ] ( memoryRemap256M:10 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$6 memoryRemap256M::$9 ] { } memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$6 memoryRemap256M::$9 ] { } ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp[1]:35 [ memoryRemap256M::$6 ] -Statement [54] *((const byte*) memoryRemap256M::yVal) ← (byte) 0 [ memoryRemap256M::remapBlocks#2 ] ( memoryRemap256M:10 [ memoryRemap256M::remapBlocks#2 ] { } memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 ] { } ) always clobbers reg byte a -Statement [55] (byte~) memoryRemap256M::$17 ← (byte) memoryRemap256M::remapBlocks#2 & (byte) $f0 [ memoryRemap256M::$17 ] ( memoryRemap256M:10 [ memoryRemap256M::$17 ] { } memoryRemap256M:13 [ memoryRemap256M::$17 ] { } ) always clobbers reg byte a +Statement [51] (dword~) memoryRemap256M::$0 ← (dword) memoryRemap256M::lowerPageOffset#2 >> (byte) 4 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:14 [ memoryRemap256M::remapBlocks#2 ] +Statement [54] *((const byte*) memoryRemap256M::uMb) ← (byte) 0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 ] { } ) always clobbers reg byte a +Statement [55] (word~) memoryRemap256M::$7 ← < (dword) memoryRemap256M::lowerPageOffset#2 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 ] { } ) always clobbers reg byte a +Statement [58] (byte~) memoryRemap256M::$6 ← (byte) memoryRemap256M::remapBlocks#2 << (byte) 4 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 memoryRemap256M::$6 ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 memoryRemap256M::$6 ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 memoryRemap256M::$6 ] { } ) always clobbers reg byte a +Statement [60] (byte~) memoryRemap256M::$9 ← (byte~) memoryRemap256M::$8 & (byte) $f [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$6 memoryRemap256M::$9 ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$6 memoryRemap256M::$9 ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$6 memoryRemap256M::$9 ] { } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:38 [ memoryRemap256M::$6 ] +Statement [63] *((const byte*) memoryRemap256M::yVal) ← (byte) 0 [ memoryRemap256M::remapBlocks#2 ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 ] { } ) always clobbers reg byte a +Statement [64] (byte~) memoryRemap256M::$17 ← (byte) memoryRemap256M::remapBlocks#2 & (byte) $f0 [ memoryRemap256M::$17 ] ( memoryRemap256M:13 [ memoryRemap256M::$17 ] { } memoryRemap256M:17 [ memoryRemap256M::$17 ] { } ) always clobbers reg byte a Statement asm { ldalMb ldx#$0f ldyuMb ldz#$00 map ldaaVal ldxxVal ldyyVal ldzzVal map eom } always clobbers reg byte a reg byte x reg byte y reg byte z -Statement [2] *((const byte*) main::block1) ← (byte) $55 [ ] ( [ ] { } ) always clobbers reg byte a -Statement [3] *((const byte*) main::block1+(byte) 1) ← (byte) $aa [ ] ( [ ] { } ) always clobbers reg byte a -Statement [5] *((const byte*) main::block2+(byte) 2) ← (byte) $55 [ ] ( [ ] { } ) always clobbers reg byte a -Statement [6] *((const byte*) main::block2+(byte) 3) ← (byte) $aa [ ] ( [ ] { } ) always clobbers reg byte a -Statement [8] *((const byte*) main::block2+(byte) 4) ← *((const byte*) main::block1+(byte) 2) [ ] ( [ ] { } ) always clobbers reg byte a -Statement [9] *((const byte*) main::block1+(byte) 5) ← *((const byte*) main::block2+(byte) 1) [ ] ( [ ] { } ) always clobbers reg byte a -Statement [11] *((const byte*) main::block1) ← (byte) 0 [ ] ( [ ] { } ) always clobbers reg byte a -Statement [12] *((const byte*) main::block1+(byte) 1) ← (byte) 1 [ ] ( [ ] { } ) always clobbers reg byte a -Statement [16] (word) memoryRemapBlock::pageOffset#0 ← (word) $100 - (byte) memoryRemapBlock::blockPage#2 [ memoryRemapBlock::blockPage#2 memoryRemapBlock::pageOffset#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::blockPage#2 memoryRemapBlock::pageOffset#0 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::blockPage#2 memoryRemapBlock::pageOffset#0 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [17] (byte) memoryRemapBlock::block#0 ← (byte) memoryRemapBlock::blockPage#2 >> (byte) 5 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::block#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::block#0 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::block#0 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [18] (byte) memoryRemapBlock::blockBits#0 ← (byte) 1 << (byte) memoryRemapBlock::block#0 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::blockBits#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::blockBits#0 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::blockBits#0 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [20] (word) memoryRemap::lowerPageOffset#1 ← (word) memoryRemapBlock::pageOffset#0 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#1 memoryRemap::lowerPageOffset#1 ] ( memoryRemapBlock:1 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#1 memoryRemap::lowerPageOffset#1 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#1 memoryRemap::lowerPageOffset#1 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [21] (word) memoryRemap::upperPageOffset#1 ← (word) memoryRemapBlock::pageOffset#0 [ memoryRemap::remapBlocks#1 memoryRemap::lowerPageOffset#1 memoryRemap::upperPageOffset#1 ] ( memoryRemapBlock:1 [ memoryRemap::remapBlocks#1 memoryRemap::lowerPageOffset#1 memoryRemap::upperPageOffset#1 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemap::remapBlocks#1 memoryRemap::lowerPageOffset#1 memoryRemap::upperPageOffset#1 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [27] (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#2 << (byte) 4 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] ( memoryRemap:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] { } memoryRemapBlock:1::memoryRemap:22 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:22 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [29] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] ( memoryRemap:7 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] { } memoryRemapBlock:1::memoryRemap:22 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:22 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [34] (byte~) memoryRemap::$6 ← (byte) memoryRemap::remapBlocks#2 & (byte) $f0 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] ( memoryRemap:7 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] { } memoryRemapBlock:1::memoryRemap:22 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:22 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [36] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f [ memoryRemap::$6 memoryRemap::$8 ] ( memoryRemap:7 [ memoryRemap::$6 memoryRemap::$8 ] { } memoryRemapBlock:1::memoryRemap:22 [ memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:22 [ memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#1 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#1 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [2] *((const byte*) main::BLOCK_4000) ← (byte) '-' [ ] ( [ ] { } ) always clobbers reg byte a +Statement [3] *((const byte*) main::BLOCK_4000+(byte) 1) ← (byte) '*' [ ] ( [ ] { } ) always clobbers reg byte a +Statement [5] *((const byte*) main::BLOCK_8000+(byte) 2) ← (byte) '-' [ ] ( [ ] { } ) always clobbers reg byte a +Statement [6] *((const byte*) main::BLOCK_8000+(byte) 3) ← (byte) '*' [ ] ( [ ] { } ) always clobbers reg byte a +Statement [8] *((const byte*) main::BLOCK_8000+(byte) 4) ← *((const byte*) main::BLOCK_4000+(byte) 2) [ ] ( [ ] { } ) always clobbers reg byte a +Statement [9] *((const byte*) main::BLOCK_4000+(byte) 5) ← *((const byte*) main::BLOCK_8000+(byte) 1) [ ] ( [ ] { } ) always clobbers reg byte a +Statement [19] (byte~) main::$7 ← (byte) $40 + (byte) main::i1#2 [ main::i1#2 main::$7 ] ( [ main::i1#2 main::$7 ] { } ) always clobbers reg byte a +Statement [22] *((const nomodify byte*) DEFAULT_SCREEN+(byte) $50-(byte) 6 + (byte) main::i#2) ← *((const byte*) main::BLOCK_4000 + (byte) main::i#2) [ main::i#2 ] ( [ main::i#2 ] { } ) always clobbers reg byte a +Statement [25] (word) memoryRemapBlock::pageOffset#0 ← (word) $100 - (byte) memoryRemapBlock::blockPage#2 [ memoryRemapBlock::blockPage#2 memoryRemapBlock::pageOffset#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::blockPage#2 memoryRemapBlock::pageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::blockPage#2 memoryRemapBlock::pageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [26] (byte) memoryRemapBlock::block#0 ← (byte) memoryRemapBlock::blockPage#2 >> (byte) 5 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::block#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::block#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::block#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [27] (byte) memoryRemapBlock::blockBits#0 ← (byte) 1 << (byte) memoryRemapBlock::block#0 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::blockBits#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::blockBits#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::blockBits#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [29] (word) memoryRemap::lowerPageOffset#0 ← (word) memoryRemapBlock::pageOffset#0 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [30] (word) memoryRemap::upperPageOffset#0 ← (word) memoryRemapBlock::pageOffset#0 [ memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 memoryRemap::upperPageOffset#0 ] ( memoryRemapBlock:1 [ memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 memoryRemap::upperPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 memoryRemap::upperPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [36] (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#2 << (byte) 4 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] ( memoryRemap:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [38] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] ( memoryRemap:7 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [43] (byte~) memoryRemap::$6 ← (byte) memoryRemap::remapBlocks#2 & (byte) $f0 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] ( memoryRemap:7 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::upperPageOffset#2 memoryRemap::$6 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [45] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f [ memoryRemap::$6 memoryRemap::$8 ] ( memoryRemap:7 [ memoryRemap::$6 memoryRemap::$8 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a Statement asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } always clobbers reg byte a reg byte x reg byte y reg byte z -Statement [42] (dword~) memoryRemap256M::$0 ← (dword) memoryRemap256M::lowerPageOffset#2 >> (byte) 4 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] ( memoryRemap256M:10 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } ) always clobbers reg byte a -Statement [45] *((const byte*) memoryRemap256M::uMb) ← (byte) 0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 ] ( memoryRemap256M:10 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 ] { } memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 ] { } ) always clobbers reg byte a -Statement [46] (word~) memoryRemap256M::$7 ← < (dword) memoryRemap256M::lowerPageOffset#2 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 ] ( memoryRemap256M:10 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 ] { } memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 ] { } ) always clobbers reg byte a -Statement [49] (byte~) memoryRemap256M::$6 ← (byte) memoryRemap256M::remapBlocks#2 << (byte) 4 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 memoryRemap256M::$6 ] ( memoryRemap256M:10 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 memoryRemap256M::$6 ] { } memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 memoryRemap256M::$6 ] { } ) always clobbers reg byte a -Statement [51] (byte~) memoryRemap256M::$9 ← (byte~) memoryRemap256M::$8 & (byte) $f [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$6 memoryRemap256M::$9 ] ( memoryRemap256M:10 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$6 memoryRemap256M::$9 ] { } memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$6 memoryRemap256M::$9 ] { } ) always clobbers reg byte a -Statement [54] *((const byte*) memoryRemap256M::yVal) ← (byte) 0 [ memoryRemap256M::remapBlocks#2 ] ( memoryRemap256M:10 [ memoryRemap256M::remapBlocks#2 ] { } memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 ] { } ) always clobbers reg byte a -Statement [55] (byte~) memoryRemap256M::$17 ← (byte) memoryRemap256M::remapBlocks#2 & (byte) $f0 [ memoryRemap256M::$17 ] ( memoryRemap256M:10 [ memoryRemap256M::$17 ] { } memoryRemap256M:13 [ memoryRemap256M::$17 ] { } ) always clobbers reg byte a +Statement [51] (dword~) memoryRemap256M::$0 ← (dword) memoryRemap256M::lowerPageOffset#2 >> (byte) 4 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } ) always clobbers reg byte a +Statement [54] *((const byte*) memoryRemap256M::uMb) ← (byte) 0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 ] { } ) always clobbers reg byte a +Statement [55] (word~) memoryRemap256M::$7 ← < (dword) memoryRemap256M::lowerPageOffset#2 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 ] { } ) always clobbers reg byte a +Statement [58] (byte~) memoryRemap256M::$6 ← (byte) memoryRemap256M::remapBlocks#2 << (byte) 4 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 memoryRemap256M::$6 ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 memoryRemap256M::$6 ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$7 memoryRemap256M::$6 ] { } ) always clobbers reg byte a +Statement [60] (byte~) memoryRemap256M::$9 ← (byte~) memoryRemap256M::$8 & (byte) $f [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$6 memoryRemap256M::$9 ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$6 memoryRemap256M::$9 ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::$6 memoryRemap256M::$9 ] { } ) always clobbers reg byte a +Statement [63] *((const byte*) memoryRemap256M::yVal) ← (byte) 0 [ memoryRemap256M::remapBlocks#2 ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 ] { } ) always clobbers reg byte a +Statement [64] (byte~) memoryRemap256M::$17 ← (byte) memoryRemap256M::remapBlocks#2 & (byte) $f0 [ memoryRemap256M::$17 ] ( memoryRemap256M:13 [ memoryRemap256M::$17 ] { } memoryRemap256M:17 [ memoryRemap256M::$17 ] { } ) always clobbers reg byte a Statement asm { ldalMb ldx#$0f ldyuMb ldz#$00 map ldaaVal ldxxVal ldyyVal ldzzVal map eom } always clobbers reg byte a reg byte x reg byte y reg byte z -Potential registers zp[1]:2 [ memoryRemapBlock::blockPage#2 ] : zp[1]:2 , reg byte x , reg byte y , reg byte z , -Potential registers zp[2]:3 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 ] : zp[2]:3 , -Potential registers zp[1]:5 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#1 ] : zp[1]:5 , reg byte x , reg byte y , reg byte z , -Potential registers zp[2]:6 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#1 ] : zp[2]:6 , -Potential registers zp[4]:8 [ memoryRemap256M::lowerPageOffset#2 ] : zp[4]:8 , -Potential registers zp[1]:12 [ memoryRemap256M::remapBlocks#2 ] : zp[1]:12 , reg byte x , reg byte y , reg byte z , -Potential registers zp[2]:13 [ memoryRemapBlock::pageOffset#0 ] : zp[2]:13 , -Potential registers zp[1]:15 [ memoryRemapBlock::block#0 ] : zp[1]:15 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:16 [ memoryRemapBlock::blockBits#0 ] : zp[1]:16 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:17 [ memoryRemap::$0 ] : zp[1]:17 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:18 [ memoryRemap::$1 ] : zp[1]:18 , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:19 [ memoryRemap::$2 ] : zp[1]:19 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:20 [ memoryRemap::$3 ] : zp[1]:20 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:21 [ memoryRemap::$4 ] : zp[1]:21 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:22 [ memoryRemap::$5 ] : zp[1]:22 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:23 [ memoryRemap::$6 ] : zp[1]:23 , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:24 [ memoryRemap::$7 ] : zp[1]:24 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:25 [ memoryRemap::$8 ] : zp[1]:25 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:26 [ memoryRemap::$9 ] : zp[1]:26 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[4]:27 [ memoryRemap256M::$0 ] : zp[4]:27 , -Potential registers zp[1]:31 [ memoryRemap256M::$1 ] : zp[1]:31 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[2]:32 [ memoryRemap256M::$7 ] : zp[2]:32 , -Potential registers zp[1]:34 [ memoryRemap256M::$5 ] : zp[1]:34 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:35 [ memoryRemap256M::$6 ] : zp[1]:35 , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:36 [ memoryRemap256M::$8 ] : zp[1]:36 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:37 [ memoryRemap256M::$9 ] : zp[1]:37 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:38 [ memoryRemap256M::$10 ] : zp[1]:38 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:39 [ memoryRemap256M::$17 ] : zp[1]:39 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:3 [ main::i1#2 main::i1#1 ] : zp[1]:3 , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:4 [ memoryRemapBlock::blockPage#2 ] : zp[1]:4 , reg byte x , reg byte y , reg byte z , +Potential registers zp[2]:5 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] : zp[2]:5 , +Potential registers zp[1]:7 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] : zp[1]:7 , reg byte x , reg byte y , reg byte z , +Potential registers zp[2]:8 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] : zp[2]:8 , +Potential registers zp[4]:10 [ memoryRemap256M::lowerPageOffset#2 ] : zp[4]:10 , +Potential registers zp[1]:14 [ memoryRemap256M::remapBlocks#2 ] : zp[1]:14 , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:15 [ main::$7 ] : zp[1]:15 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[2]:16 [ memoryRemapBlock::pageOffset#0 ] : zp[2]:16 , +Potential registers zp[1]:18 [ memoryRemapBlock::block#0 ] : zp[1]:18 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:19 [ memoryRemapBlock::blockBits#0 ] : zp[1]:19 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:20 [ memoryRemap::$0 ] : zp[1]:20 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:21 [ memoryRemap::$1 ] : zp[1]:21 , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:22 [ memoryRemap::$2 ] : zp[1]:22 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:23 [ memoryRemap::$3 ] : zp[1]:23 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:24 [ memoryRemap::$4 ] : zp[1]:24 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:25 [ memoryRemap::$5 ] : zp[1]:25 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:26 [ memoryRemap::$6 ] : zp[1]:26 , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:27 [ memoryRemap::$7 ] : zp[1]:27 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:28 [ memoryRemap::$8 ] : zp[1]:28 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:29 [ memoryRemap::$9 ] : zp[1]:29 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[4]:30 [ memoryRemap256M::$0 ] : zp[4]:30 , +Potential registers zp[1]:34 [ memoryRemap256M::$1 ] : zp[1]:34 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[2]:35 [ memoryRemap256M::$7 ] : zp[2]:35 , +Potential registers zp[1]:37 [ memoryRemap256M::$5 ] : zp[1]:37 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:38 [ memoryRemap256M::$6 ] : zp[1]:38 , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:39 [ memoryRemap256M::$8 ] : zp[1]:39 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:40 [ memoryRemap256M::$9 ] : zp[1]:40 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:41 [ memoryRemap256M::$10 ] : zp[1]:41 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:42 [ memoryRemap256M::$17 ] : zp[1]:42 , reg byte a , reg byte x , reg byte y , reg byte z , REGISTER UPLIFT SCOPES -Uplift Scope [memoryRemap] 202: zp[1]:17 [ memoryRemap::$0 ] 202: zp[1]:19 [ memoryRemap::$2 ] 202: zp[1]:20 [ memoryRemap::$3 ] 202: zp[1]:21 [ memoryRemap::$4 ] 202: zp[1]:22 [ memoryRemap::$5 ] 202: zp[1]:24 [ memoryRemap::$7 ] 202: zp[1]:25 [ memoryRemap::$8 ] 202: zp[1]:26 [ memoryRemap::$9 ] 67.33: zp[1]:18 [ memoryRemap::$1 ] 67.33: zp[1]:23 [ memoryRemap::$6 ] 64.25: zp[2]:3 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 ] 41.36: zp[2]:6 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#1 ] 28.63: zp[1]:5 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#1 ] -Uplift Scope [memoryRemap256M] 22: zp[1]:31 [ memoryRemap256M::$1 ] 22: zp[1]:34 [ memoryRemap256M::$5 ] 22: zp[1]:36 [ memoryRemap256M::$8 ] 22: zp[1]:37 [ memoryRemap256M::$9 ] 22: zp[1]:38 [ memoryRemap256M::$10 ] 22: zp[1]:39 [ memoryRemap256M::$17 ] 11: zp[4]:27 [ memoryRemap256M::$0 ] 8.25: zp[2]:32 [ memoryRemap256M::$7 ] 7.33: zp[1]:35 [ memoryRemap256M::$6 ] 4.4: zp[4]:8 [ memoryRemap256M::lowerPageOffset#2 ] 1.57: zp[1]:12 [ memoryRemap256M::remapBlocks#2 ] -Uplift Scope [memoryRemapBlock] 22: zp[1]:15 [ memoryRemapBlock::block#0 ] 22: zp[1]:16 [ memoryRemapBlock::blockBits#0 ] 11: zp[1]:2 [ memoryRemapBlock::blockPage#2 ] 6.6: zp[2]:13 [ memoryRemapBlock::pageOffset#0 ] +Uplift Scope [memoryRemap] 202: zp[1]:20 [ memoryRemap::$0 ] 202: zp[1]:22 [ memoryRemap::$2 ] 202: zp[1]:23 [ memoryRemap::$3 ] 202: zp[1]:24 [ memoryRemap::$4 ] 202: zp[1]:25 [ memoryRemap::$5 ] 202: zp[1]:27 [ memoryRemap::$7 ] 202: zp[1]:28 [ memoryRemap::$8 ] 202: zp[1]:29 [ memoryRemap::$9 ] 67.33: zp[1]:21 [ memoryRemap::$1 ] 67.33: zp[1]:26 [ memoryRemap::$6 ] 64.25: zp[2]:5 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] 41.36: zp[2]:8 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] 28.63: zp[1]:7 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] +Uplift Scope [memoryRemap256M] 22: zp[1]:34 [ memoryRemap256M::$1 ] 22: zp[1]:37 [ memoryRemap256M::$5 ] 22: zp[1]:39 [ memoryRemap256M::$8 ] 22: zp[1]:40 [ memoryRemap256M::$9 ] 22: zp[1]:41 [ memoryRemap256M::$10 ] 22: zp[1]:42 [ memoryRemap256M::$17 ] 11: zp[4]:30 [ memoryRemap256M::$0 ] 8.25: zp[2]:35 [ memoryRemap256M::$7 ] 7.33: zp[1]:38 [ memoryRemap256M::$6 ] 4.4: zp[4]:10 [ memoryRemap256M::lowerPageOffset#2 ] 1.57: zp[1]:14 [ memoryRemap256M::remapBlocks#2 ] +Uplift Scope [main] 40.33: zp[1]:2 [ main::i#2 main::i#1 ] 35.75: zp[1]:3 [ main::i1#2 main::i1#1 ] 22: zp[1]:15 [ main::$7 ] +Uplift Scope [memoryRemapBlock] 22: zp[1]:18 [ memoryRemapBlock::block#0 ] 22: zp[1]:19 [ memoryRemapBlock::blockBits#0 ] 11: zp[1]:4 [ memoryRemapBlock::blockPage#2 ] 6.6: zp[2]:16 [ memoryRemapBlock::pageOffset#0 ] Uplift Scope [MOS6526_CIA] Uplift Scope [MOS6569_VICII] Uplift Scope [MOS6581_SID] Uplift Scope [MOS4569_VICIII] Uplift Scope [MEGA65_VICIV] -Uplift Scope [main] Uplift Scope [] -Uplifting [memoryRemap] best 642 combination reg byte a [ memoryRemap::$0 ] reg byte a [ memoryRemap::$2 ] reg byte a [ memoryRemap::$3 ] zp[1]:21 [ memoryRemap::$4 ] zp[1]:22 [ memoryRemap::$5 ] zp[1]:24 [ memoryRemap::$7 ] zp[1]:25 [ memoryRemap::$8 ] zp[1]:26 [ memoryRemap::$9 ] zp[1]:18 [ memoryRemap::$1 ] zp[1]:23 [ memoryRemap::$6 ] zp[2]:3 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 ] zp[2]:6 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#1 ] zp[1]:5 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#1 ] +Uplifting [memoryRemap] best 1438 combination reg byte a [ memoryRemap::$0 ] reg byte a [ memoryRemap::$2 ] reg byte a [ memoryRemap::$3 ] zp[1]:24 [ memoryRemap::$4 ] zp[1]:25 [ memoryRemap::$5 ] zp[1]:27 [ memoryRemap::$7 ] zp[1]:28 [ memoryRemap::$8 ] zp[1]:29 [ memoryRemap::$9 ] zp[1]:21 [ memoryRemap::$1 ] zp[1]:26 [ memoryRemap::$6 ] zp[2]:5 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] zp[2]:8 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] zp[1]:7 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] Limited combination testing to 100 combinations of 25000000 possible. -Uplifting [memoryRemap256M] best 624 combination reg byte a [ memoryRemap256M::$1 ] reg byte a [ memoryRemap256M::$5 ] reg byte a [ memoryRemap256M::$8 ] zp[1]:37 [ memoryRemap256M::$9 ] zp[1]:38 [ memoryRemap256M::$10 ] zp[1]:39 [ memoryRemap256M::$17 ] zp[4]:27 [ memoryRemap256M::$0 ] zp[2]:32 [ memoryRemap256M::$7 ] zp[1]:35 [ memoryRemap256M::$6 ] zp[4]:8 [ memoryRemap256M::lowerPageOffset#2 ] zp[1]:12 [ memoryRemap256M::remapBlocks#2 ] +Uplifting [memoryRemap256M] best 1420 combination reg byte a [ memoryRemap256M::$1 ] reg byte a [ memoryRemap256M::$5 ] reg byte a [ memoryRemap256M::$8 ] zp[1]:40 [ memoryRemap256M::$9 ] zp[1]:41 [ memoryRemap256M::$10 ] zp[1]:42 [ memoryRemap256M::$17 ] zp[4]:30 [ memoryRemap256M::$0 ] zp[2]:35 [ memoryRemap256M::$7 ] zp[1]:38 [ memoryRemap256M::$6 ] zp[4]:10 [ memoryRemap256M::lowerPageOffset#2 ] zp[1]:14 [ memoryRemap256M::remapBlocks#2 ] Limited combination testing to 100 combinations of 250000 possible. -Uplifting [memoryRemapBlock] best 610 combination reg byte a [ memoryRemapBlock::block#0 ] reg byte a [ memoryRemapBlock::blockBits#0 ] reg byte x [ memoryRemapBlock::blockPage#2 ] zp[2]:13 [ memoryRemapBlock::pageOffset#0 ] -Uplifting [MOS6526_CIA] best 610 combination -Uplifting [MOS6569_VICII] best 610 combination -Uplifting [MOS6581_SID] best 610 combination -Uplifting [MOS4569_VICIII] best 610 combination -Uplifting [MEGA65_VICIV] best 610 combination -Uplifting [main] best 610 combination -Uplifting [] best 610 combination -Attempting to uplift remaining variables inzp[1]:21 [ memoryRemap::$4 ] -Uplifting [memoryRemap] best 604 combination reg byte a [ memoryRemap::$4 ] -Attempting to uplift remaining variables inzp[1]:22 [ memoryRemap::$5 ] -Uplifting [memoryRemap] best 598 combination reg byte a [ memoryRemap::$5 ] -Attempting to uplift remaining variables inzp[1]:24 [ memoryRemap::$7 ] -Uplifting [memoryRemap] best 592 combination reg byte a [ memoryRemap::$7 ] -Attempting to uplift remaining variables inzp[1]:25 [ memoryRemap::$8 ] -Uplifting [memoryRemap] best 586 combination reg byte a [ memoryRemap::$8 ] -Attempting to uplift remaining variables inzp[1]:26 [ memoryRemap::$9 ] -Uplifting [memoryRemap] best 580 combination reg byte a [ memoryRemap::$9 ] -Attempting to uplift remaining variables inzp[1]:18 [ memoryRemap::$1 ] -Uplifting [memoryRemap] best 580 combination zp[1]:18 [ memoryRemap::$1 ] -Attempting to uplift remaining variables inzp[1]:23 [ memoryRemap::$6 ] -Uplifting [memoryRemap] best 580 combination zp[1]:23 [ memoryRemap::$6 ] -Attempting to uplift remaining variables inzp[1]:5 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#1 ] -Uplifting [memoryRemap] best 571 combination reg byte z [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#1 ] -Attempting to uplift remaining variables inzp[1]:37 [ memoryRemap256M::$9 ] -Uplifting [memoryRemap256M] best 565 combination reg byte a [ memoryRemap256M::$9 ] -Attempting to uplift remaining variables inzp[1]:38 [ memoryRemap256M::$10 ] -Uplifting [memoryRemap256M] best 559 combination reg byte a [ memoryRemap256M::$10 ] -Attempting to uplift remaining variables inzp[1]:39 [ memoryRemap256M::$17 ] -Uplifting [memoryRemap256M] best 553 combination reg byte a [ memoryRemap256M::$17 ] -Attempting to uplift remaining variables inzp[1]:35 [ memoryRemap256M::$6 ] -Uplifting [memoryRemap256M] best 553 combination zp[1]:35 [ memoryRemap256M::$6 ] -Attempting to uplift remaining variables inzp[1]:12 [ memoryRemap256M::remapBlocks#2 ] -Uplifting [memoryRemap256M] best 543 combination reg byte z [ memoryRemap256M::remapBlocks#2 ] -Coalescing zero page register [ zp[2]:3 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 ] ] with [ zp[2]:13 [ memoryRemapBlock::pageOffset#0 ] ] - score: 1 -Coalescing zero page register [ zp[2]:32 [ memoryRemap256M::$7 ] ] with [ zp[2]:3 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 ] ] -Coalescing zero page register [ zp[1]:35 [ memoryRemap256M::$6 ] ] with [ zp[1]:18 [ memoryRemap::$1 ] ] -Allocated (was zp[2]:6) zp[2]:2 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#1 ] -Allocated (was zp[4]:8) zp[4]:4 [ memoryRemap256M::lowerPageOffset#2 ] -Allocated (was zp[1]:23) zp[1]:8 [ memoryRemap::$6 ] -Allocated (was zp[4]:27) zp[4]:9 [ memoryRemap256M::$0 ] -Allocated (was zp[2]:32) zp[2]:13 [ memoryRemap256M::$7 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#1 memoryRemapBlock::pageOffset#0 ] -Allocated (was zp[1]:35) zp[1]:15 [ memoryRemap256M::$6 memoryRemap::$1 ] +Uplifting [main] best 1110 combination reg byte x [ main::i#2 main::i#1 ] reg byte x [ main::i1#2 main::i1#1 ] reg byte a [ main::$7 ] +Uplifting [memoryRemapBlock] best 1096 combination reg byte a [ memoryRemapBlock::block#0 ] reg byte a [ memoryRemapBlock::blockBits#0 ] reg byte x [ memoryRemapBlock::blockPage#2 ] zp[2]:16 [ memoryRemapBlock::pageOffset#0 ] +Uplifting [MOS6526_CIA] best 1096 combination +Uplifting [MOS6569_VICII] best 1096 combination +Uplifting [MOS6581_SID] best 1096 combination +Uplifting [MOS4569_VICIII] best 1096 combination +Uplifting [MEGA65_VICIV] best 1096 combination +Uplifting [] best 1096 combination +Attempting to uplift remaining variables inzp[1]:24 [ memoryRemap::$4 ] +Uplifting [memoryRemap] best 1090 combination reg byte a [ memoryRemap::$4 ] +Attempting to uplift remaining variables inzp[1]:25 [ memoryRemap::$5 ] +Uplifting [memoryRemap] best 1084 combination reg byte a [ memoryRemap::$5 ] +Attempting to uplift remaining variables inzp[1]:27 [ memoryRemap::$7 ] +Uplifting [memoryRemap] best 1078 combination reg byte a [ memoryRemap::$7 ] +Attempting to uplift remaining variables inzp[1]:28 [ memoryRemap::$8 ] +Uplifting [memoryRemap] best 1072 combination reg byte a [ memoryRemap::$8 ] +Attempting to uplift remaining variables inzp[1]:29 [ memoryRemap::$9 ] +Uplifting [memoryRemap] best 1066 combination reg byte a [ memoryRemap::$9 ] +Attempting to uplift remaining variables inzp[1]:21 [ memoryRemap::$1 ] +Uplifting [memoryRemap] best 1066 combination zp[1]:21 [ memoryRemap::$1 ] +Attempting to uplift remaining variables inzp[1]:26 [ memoryRemap::$6 ] +Uplifting [memoryRemap] best 1066 combination zp[1]:26 [ memoryRemap::$6 ] +Attempting to uplift remaining variables inzp[1]:7 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] +Uplifting [memoryRemap] best 1057 combination reg byte z [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] +Attempting to uplift remaining variables inzp[1]:40 [ memoryRemap256M::$9 ] +Uplifting [memoryRemap256M] best 1051 combination reg byte a [ memoryRemap256M::$9 ] +Attempting to uplift remaining variables inzp[1]:41 [ memoryRemap256M::$10 ] +Uplifting [memoryRemap256M] best 1045 combination reg byte a [ memoryRemap256M::$10 ] +Attempting to uplift remaining variables inzp[1]:42 [ memoryRemap256M::$17 ] +Uplifting [memoryRemap256M] best 1039 combination reg byte a [ memoryRemap256M::$17 ] +Attempting to uplift remaining variables inzp[1]:38 [ memoryRemap256M::$6 ] +Uplifting [memoryRemap256M] best 1039 combination zp[1]:38 [ memoryRemap256M::$6 ] +Attempting to uplift remaining variables inzp[1]:14 [ memoryRemap256M::remapBlocks#2 ] +Uplifting [memoryRemap256M] best 1029 combination reg byte z [ memoryRemap256M::remapBlocks#2 ] +Coalescing zero page register [ zp[2]:5 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] ] with [ zp[2]:16 [ memoryRemapBlock::pageOffset#0 ] ] - score: 1 +Coalescing zero page register [ zp[2]:35 [ memoryRemap256M::$7 ] ] with [ zp[2]:5 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 ] ] +Coalescing zero page register [ zp[1]:38 [ memoryRemap256M::$6 ] ] with [ zp[1]:21 [ memoryRemap::$1 ] ] +Allocated (was zp[2]:8) zp[2]:2 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] +Allocated (was zp[4]:10) zp[4]:4 [ memoryRemap256M::lowerPageOffset#2 ] +Allocated (was zp[1]:26) zp[1]:8 [ memoryRemap::$6 ] +Allocated (was zp[4]:30) zp[4]:9 [ memoryRemap256M::$0 ] +Allocated (was zp[2]:35) zp[2]:13 [ memoryRemap256M::$7 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 ] +Allocated (was zp[1]:38) zp[1]:15 [ memoryRemap256M::$6 memoryRemap::$1 ] ASSEMBLER BEFORE OPTIMIZATION // File Comments // 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 @@ -1984,79 +2127,97 @@ ASSEMBLER BEFORE OPTIMIZATION .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 main: { - .label block1 = $4000 - .label block2 = $8000 + .label BLOCK_4000 = $4000 + .label BLOCK_8000 = $8000 // [1] call memoryRemapBlock // Remap [$4000-$5fff] to point to [$10000-$11fff] - // [15] phi from main to memoryRemapBlock [phi:main->memoryRemapBlock] + // [24] phi from main to memoryRemapBlock [phi:main->memoryRemapBlock] memoryRemapBlock_from_main: - // [15] phi (byte) memoryRemapBlock::blockPage#2 = (byte) $40 [phi:main->memoryRemapBlock#0] -- vbuxx=vbuc1 + // [24] phi (byte) memoryRemapBlock::blockPage#2 = (byte) $40 [phi:main->memoryRemapBlock#0] -- vbuxx=vbuc1 ldx #$40 jsr memoryRemapBlock - jmp __b1 - // main::@1 - __b1: - // [2] *((const byte*) main::block1) ← (byte) $55 -- _deref_pbuc1=vbuc2 - // Put 0x55, 0xaa into $10000 - lda #$55 - sta block1 - // [3] *((const byte*) main::block1+(byte) 1) ← (byte) $aa -- _deref_pbuc1=vbuc2 - lda #$aa - sta block1+1 + jmp __b7 + // main::@7 + __b7: + // [2] *((const byte*) main::BLOCK_4000) ← (byte) '-' -- _deref_pbuc1=vbuc2 + // Put '-', '*' into $10000 + lda #'-' + sta BLOCK_4000 + // [3] *((const byte*) main::BLOCK_4000+(byte) 1) ← (byte) '*' -- _deref_pbuc1=vbuc2 + lda #'*' + sta BLOCK_4000+1 // [4] call memoryRemapBlock // Remap [$8000-$9fff] to point to [$10000-$11fff] - // [15] phi from main::@1 to memoryRemapBlock [phi:main::@1->memoryRemapBlock] - memoryRemapBlock_from___b1: - // [15] phi (byte) memoryRemapBlock::blockPage#2 = (byte) $80 [phi:main::@1->memoryRemapBlock#0] -- vbuxx=vbuc1 + // [24] phi from main::@7 to memoryRemapBlock [phi:main::@7->memoryRemapBlock] + memoryRemapBlock_from___b7: + // [24] phi (byte) memoryRemapBlock::blockPage#2 = (byte) $80 [phi:main::@7->memoryRemapBlock#0] -- vbuxx=vbuc1 ldx #$80 jsr memoryRemapBlock - jmp __b2 - // main::@2 - __b2: - // [5] *((const byte*) main::block2+(byte) 2) ← (byte) $55 -- _deref_pbuc1=vbuc2 - // Put 0x55, 0xaainto $10002 - lda #$55 - sta block2+2 - // [6] *((const byte*) main::block2+(byte) 3) ← (byte) $aa -- _deref_pbuc1=vbuc2 - lda #$aa - sta block2+3 + jmp __b8 + // main::@8 + __b8: + // [5] *((const byte*) main::BLOCK_8000+(byte) 2) ← (byte) '-' -- _deref_pbuc1=vbuc2 + // Put '-', '*' into $10002 + lda #'-' + sta BLOCK_8000+2 + // [6] *((const byte*) main::BLOCK_8000+(byte) 3) ← (byte) '*' -- _deref_pbuc1=vbuc2 + lda #'*' + sta BLOCK_8000+3 // [7] call memoryRemap // Remap [$4000-$5fff] and [$8000-$9fff] to both point to [$10000-$11fff] (notice usage of page offsets) - // [24] phi from main::@2 to memoryRemap [phi:main::@2->memoryRemap] - memoryRemap_from___b2: - // [24] phi (word) memoryRemap::upperPageOffset#2 = (byte) $80 [phi:main::@2->memoryRemap#0] -- vwuz1=vbuc1 + // [33] phi from main::@8 to memoryRemap [phi:main::@8->memoryRemap] + memoryRemap_from___b8: + // [33] phi (word) memoryRemap::upperPageOffset#2 = (byte) $80 [phi:main::@8->memoryRemap#0] -- vwuz1=vbuc1 lda #<$80 sta.z memoryRemap.upperPageOffset lda #>$80 sta.z memoryRemap.upperPageOffset+1 - // [24] phi (byte) memoryRemap::remapBlocks#2 = (const nomodify byte) MEMORYBLOCK_4000|(const nomodify byte) MEMORYBLOCK_8000 [phi:main::@2->memoryRemap#1] -- vbuzz=vbuc1 + // [33] phi (byte) memoryRemap::remapBlocks#2 = (const nomodify byte) MEMORYBLOCK_4000|(const nomodify byte) MEMORYBLOCK_8000 [phi:main::@8->memoryRemap#1] -- vbuzz=vbuc1 ldz #MEMORYBLOCK_4000|MEMORYBLOCK_8000 - // [24] phi (word) memoryRemap::lowerPageOffset#2 = (byte) $c0 [phi:main::@2->memoryRemap#2] -- vwuz1=vbuc1 + // [33] phi (word) memoryRemap::lowerPageOffset#2 = (byte) $c0 [phi:main::@8->memoryRemap#2] -- vwuz1=vbuc1 lda #<$c0 sta.z memoryRemap.lowerPageOffset lda #>$c0 sta.z memoryRemap.lowerPageOffset+1 jsr memoryRemap + jmp __b9 + // main::@9 + __b9: + // [8] *((const byte*) main::BLOCK_8000+(byte) 4) ← *((const byte*) main::BLOCK_4000+(byte) 2) -- _deref_pbuc1=_deref_pbuc2 + // Put '-', '*' into $10004 in a convoluted way + lda BLOCK_4000+2 + sta BLOCK_8000+4 + // [9] *((const byte*) main::BLOCK_4000+(byte) 5) ← *((const byte*) main::BLOCK_8000+(byte) 1) -- _deref_pbuc1=_deref_pbuc2 + lda BLOCK_8000+1 + sta BLOCK_4000+5 + // [10] phi from main::@9 to main::@1 [phi:main::@9->main::@1] + __b1_from___b9: + // [10] phi (byte) main::i#2 = (byte) 0 [phi:main::@9->main::@1#0] -- vbuxx=vbuc1 + ldx #0 + jmp __b1 + // copy the resulting values onto the screen + // main::@1 + __b1: + // [11] if((byte) main::i#2<(byte) 6) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 + cpx #6 + bcc __b2 + // [12] phi from main::@1 to main::@3 [phi:main::@1->main::@3] + __b3_from___b1: jmp __b3 // main::@3 __b3: - // [8] *((const byte*) main::block2+(byte) 4) ← *((const byte*) main::block1+(byte) 2) -- _deref_pbuc1=_deref_pbuc2 - // Put 0x55, 0xaa into $10004 in a convoluted way - lda block1+2 - sta block2+4 - // [9] *((const byte*) main::block1+(byte) 5) ← *((const byte*) main::block2+(byte) 1) -- _deref_pbuc1=_deref_pbuc2 - lda block2+1 - sta block1+5 - // [10] call memoryRemap256M + // [13] call memoryRemap256M // Remap [$4000-$5fff] to both point to [$ff80000-$ff81fff] COLORAM! (notice usage of page offsets) - // [41] phi from main::@3 to memoryRemap256M [phi:main::@3->memoryRemap256M] + // [50] phi from main::@3 to memoryRemap256M [phi:main::@3->memoryRemap256M] memoryRemap256M_from___b3: - // [41] phi (byte) memoryRemap256M::remapBlocks#2 = (const nomodify byte) MEMORYBLOCK_4000 [phi:main::@3->memoryRemap256M#0] -- vbuzz=vbuc1 + // [50] phi (byte) memoryRemap256M::remapBlocks#2 = (const nomodify byte) MEMORYBLOCK_4000 [phi:main::@3->memoryRemap256M#0] -- vbuzz=vbuc1 ldz #MEMORYBLOCK_4000 - // [41] phi (dword) memoryRemap256M::lowerPageOffset#2 = (dword)(number) $ff800-(number) $40 [phi:main::@3->memoryRemap256M#1] -- vduz1=vduc1 + // [50] phi (dword) memoryRemap256M::lowerPageOffset#2 = (dword)(number) $ff800-(number) $40 [phi:main::@3->memoryRemap256M#1] -- vduz1=vduc1 lda #<$ff800-$40 sta.z memoryRemap256M.lowerPageOffset lda #>$ff800-$40 @@ -2066,23 +2227,29 @@ main: { lda #>$ff800-$40>>$10 sta.z memoryRemap256M.lowerPageOffset+3 jsr memoryRemap256M + // [14] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + __b4_from___b3: + // [14] phi (byte) main::i1#2 = (byte) 0 [phi:main::@3->main::@4#0] -- vbuxx=vbuc1 + ldx #0 jmp __b4 + // Put colors in the upper screen line // main::@4 __b4: - // [11] *((const byte*) main::block1) ← (byte) 0 -- _deref_pbuc1=vbuc2 - // Put colors in the upper left corner! - lda #0 - sta block1 - // [12] *((const byte*) main::block1+(byte) 1) ← (byte) 1 -- _deref_pbuc1=vbuc2 - lda #1 - sta block1+1 - // [13] call memoryRemap256M + // [15] if((byte) main::i1#2<(byte) $10) goto main::@5 -- vbuxx_lt_vbuc1_then_la1 + cpx #$10 + bcc __b5 + // [16] phi from main::@4 to main::@6 [phi:main::@4->main::@6] + __b6_from___b4: + jmp __b6 + // main::@6 + __b6: + // [17] call memoryRemap256M // Remap [$4000-$5fff] back to normal memory! - // [41] phi from main::@4 to memoryRemap256M [phi:main::@4->memoryRemap256M] - memoryRemap256M_from___b4: - // [41] phi (byte) memoryRemap256M::remapBlocks#2 = (byte) 0 [phi:main::@4->memoryRemap256M#0] -- vbuzz=vbuc1 + // [50] phi from main::@6 to memoryRemap256M [phi:main::@6->memoryRemap256M] + memoryRemap256M_from___b6: + // [50] phi (byte) memoryRemap256M::remapBlocks#2 = (byte) 0 [phi:main::@6->memoryRemap256M#0] -- vbuzz=vbuc1 ldz #0 - // [41] phi (dword) memoryRemap256M::lowerPageOffset#2 = (byte) 0 [phi:main::@4->memoryRemap256M#1] -- vduz1=vbuc1 + // [50] phi (dword) memoryRemap256M::lowerPageOffset#2 = (byte) 0 [phi:main::@6->memoryRemap256M#1] -- vduz1=vbuc1 lda #0 sta.z memoryRemap256M.lowerPageOffset lda #0 @@ -2093,19 +2260,44 @@ main: { jmp __breturn // main::@return __breturn: - // [14] return + // [18] return rts + // main::@5 + __b5: + // [19] (byte~) main::$7 ← (byte) $40 + (byte) main::i1#2 -- vbuaa=vbuc1_plus_vbuxx + txa + clc + adc #$40 + // [20] *((const byte*) main::BLOCK_4000 + (byte) main::i1#2) ← (byte~) main::$7 -- pbuc1_derefidx_vbuxx=vbuaa + sta BLOCK_4000,x + // [21] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuxx=_inc_vbuxx + inx + // [14] phi from main::@5 to main::@4 [phi:main::@5->main::@4] + __b4_from___b5: + // [14] phi (byte) main::i1#2 = (byte) main::i1#1 [phi:main::@5->main::@4#0] -- register_copy + jmp __b4 + // main::@2 + __b2: + // [22] *((const nomodify byte*) DEFAULT_SCREEN+(byte) $50-(byte) 6 + (byte) main::i#2) ← *((const byte*) main::BLOCK_4000 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx + lda BLOCK_4000,x + sta DEFAULT_SCREEN+$50-6,x + // [23] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx + inx + // [10] phi from main::@2 to main::@1 [phi:main::@2->main::@1] + __b1_from___b2: + // [10] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#0] -- register_copy + jmp __b1 } // memoryRemapBlock // 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: { .label pageOffset = $d - // [16] (word) memoryRemapBlock::pageOffset#0 ← (word) $100 - (byte) memoryRemapBlock::blockPage#2 -- vwuz1=vwuc1_minus_vbuxx + // [25] (word) memoryRemapBlock::pageOffset#0 ← (word) $100 - (byte) memoryRemapBlock::blockPage#2 -- vwuz1=vwuc1_minus_vbuxx stx.z $ff lda #<$100 sec @@ -2114,14 +2306,14 @@ memoryRemapBlock: { lda #>$100 sbc #0 sta.z pageOffset+1 - // [17] (byte) memoryRemapBlock::block#0 ← (byte) memoryRemapBlock::blockPage#2 >> (byte) 5 -- vbuaa=vbuxx_ror_5 + // [26] (byte) memoryRemapBlock::block#0 ← (byte) memoryRemapBlock::blockPage#2 >> (byte) 5 -- vbuaa=vbuxx_ror_5 txa lsr lsr lsr lsr lsr - // [18] (byte) memoryRemapBlock::blockBits#0 ← (byte) 1 << (byte) memoryRemapBlock::block#0 -- vbuaa=vbuc1_rol_vbuaa + // [27] (byte) memoryRemapBlock::blockBits#0 ← (byte) 1 << (byte) memoryRemapBlock::block#0 -- vbuaa=vbuc1_rol_vbuaa tay lda #1 cpy #0 @@ -2131,25 +2323,25 @@ memoryRemapBlock: { dey bne !- !e: - // [19] (byte) memoryRemap::remapBlocks#1 ← (byte) memoryRemapBlock::blockBits#0 -- vbuzz=vbuaa + // [28] (byte) memoryRemap::remapBlocks#0 ← (byte) memoryRemapBlock::blockBits#0 -- vbuzz=vbuaa taz - // [20] (word) memoryRemap::lowerPageOffset#1 ← (word) memoryRemapBlock::pageOffset#0 - // [21] (word) memoryRemap::upperPageOffset#1 ← (word) memoryRemapBlock::pageOffset#0 -- vwuz1=vwuz2 + // [29] (word) memoryRemap::lowerPageOffset#0 ← (word) memoryRemapBlock::pageOffset#0 + // [30] (word) memoryRemap::upperPageOffset#0 ← (word) memoryRemapBlock::pageOffset#0 -- vwuz1=vwuz2 lda.z pageOffset sta.z memoryRemap.upperPageOffset lda.z pageOffset+1 sta.z memoryRemap.upperPageOffset+1 - // [22] call memoryRemap - // [24] phi from memoryRemapBlock to memoryRemap [phi:memoryRemapBlock->memoryRemap] + // [31] call memoryRemap + // [33] phi from memoryRemapBlock to memoryRemap [phi:memoryRemapBlock->memoryRemap] memoryRemap_from_memoryRemapBlock: - // [24] phi (word) memoryRemap::upperPageOffset#2 = (word) memoryRemap::upperPageOffset#1 [phi:memoryRemapBlock->memoryRemap#0] -- register_copy - // [24] phi (byte) memoryRemap::remapBlocks#2 = (byte) memoryRemap::remapBlocks#1 [phi:memoryRemapBlock->memoryRemap#1] -- register_copy - // [24] phi (word) memoryRemap::lowerPageOffset#2 = (word) memoryRemap::lowerPageOffset#1 [phi:memoryRemapBlock->memoryRemap#2] -- register_copy + // [33] phi (word) memoryRemap::upperPageOffset#2 = (word) memoryRemap::upperPageOffset#0 [phi:memoryRemapBlock->memoryRemap#0] -- register_copy + // [33] phi (byte) memoryRemap::remapBlocks#2 = (byte) memoryRemap::remapBlocks#0 [phi:memoryRemapBlock->memoryRemap#1] -- register_copy + // [33] phi (word) memoryRemap::lowerPageOffset#2 = (word) memoryRemap::lowerPageOffset#0 [phi:memoryRemapBlock->memoryRemap#2] -- register_copy jsr memoryRemap jmp __breturn // memoryRemapBlock::@return __breturn: - // [23] return + // [32] return rts } // memoryRemap @@ -2157,26 +2349,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 @@ -2187,40 +2379,40 @@ memoryRemap: { .label __6 = 8 .label lowerPageOffset = $d .label upperPageOffset = 2 - // [25] (byte~) memoryRemap::$0 ← < (word) memoryRemap::lowerPageOffset#2 -- vbuaa=_lo_vwuz1 + // [34] (byte~) memoryRemap::$0 ← < (word) memoryRemap::lowerPageOffset#2 -- vbuaa=_lo_vwuz1 lda.z lowerPageOffset - // [26] *((const byte*) memoryRemap::aVal) ← (byte~) memoryRemap::$0 -- _deref_pbuc1=vbuaa + // [35] *((const byte*) memoryRemap::aVal) ← (byte~) memoryRemap::$0 -- _deref_pbuc1=vbuaa sta aVal - // [27] (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#2 << (byte) 4 -- vbuz1=vbuzz_rol_4 + // [36] (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#2 << (byte) 4 -- vbuz1=vbuzz_rol_4 tza asl asl asl asl sta.z __1 - // [28] (byte~) memoryRemap::$2 ← > (word) memoryRemap::lowerPageOffset#2 -- vbuaa=_hi_vwuz1 + // [37] (byte~) memoryRemap::$2 ← > (word) memoryRemap::lowerPageOffset#2 -- vbuaa=_hi_vwuz1 lda.z lowerPageOffset+1 - // [29] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f -- vbuaa=vbuaa_band_vbuc1 + // [38] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f -- vbuaa=vbuaa_band_vbuc1 and #$f - // [30] (byte~) memoryRemap::$4 ← (byte~) memoryRemap::$1 | (byte~) memoryRemap::$3 -- vbuaa=vbuz1_bor_vbuaa + // [39] (byte~) memoryRemap::$4 ← (byte~) memoryRemap::$1 | (byte~) memoryRemap::$3 -- vbuaa=vbuz1_bor_vbuaa ora.z __1 - // [31] *((const byte*) memoryRemap::xVal) ← (byte~) memoryRemap::$4 -- _deref_pbuc1=vbuaa + // [40] *((const byte*) memoryRemap::xVal) ← (byte~) memoryRemap::$4 -- _deref_pbuc1=vbuaa sta xVal - // [32] (byte~) memoryRemap::$5 ← < (word) memoryRemap::upperPageOffset#2 -- vbuaa=_lo_vwuz1 + // [41] (byte~) memoryRemap::$5 ← < (word) memoryRemap::upperPageOffset#2 -- vbuaa=_lo_vwuz1 lda.z upperPageOffset - // [33] *((const byte*) memoryRemap::yVal) ← (byte~) memoryRemap::$5 -- _deref_pbuc1=vbuaa + // [42] *((const byte*) memoryRemap::yVal) ← (byte~) memoryRemap::$5 -- _deref_pbuc1=vbuaa sta yVal - // [34] (byte~) memoryRemap::$6 ← (byte) memoryRemap::remapBlocks#2 & (byte) $f0 -- vbuz1=vbuzz_band_vbuc1 + // [43] (byte~) memoryRemap::$6 ← (byte) memoryRemap::remapBlocks#2 & (byte) $f0 -- vbuz1=vbuzz_band_vbuc1 tza and #$f0 sta.z __6 - // [35] (byte~) memoryRemap::$7 ← > (word) memoryRemap::upperPageOffset#2 -- vbuaa=_hi_vwuz1 + // [44] (byte~) memoryRemap::$7 ← > (word) memoryRemap::upperPageOffset#2 -- vbuaa=_hi_vwuz1 lda.z upperPageOffset+1 - // [36] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f -- vbuaa=vbuaa_band_vbuc1 + // [45] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f -- vbuaa=vbuaa_band_vbuc1 and #$f - // [37] (byte~) memoryRemap::$9 ← (byte~) memoryRemap::$6 | (byte~) memoryRemap::$8 -- vbuaa=vbuz1_bor_vbuaa + // [46] (byte~) memoryRemap::$9 ← (byte~) memoryRemap::$6 | (byte~) memoryRemap::$8 -- vbuaa=vbuz1_bor_vbuaa ora.z __6 - // [38] *((const byte*) memoryRemap::zVal) ← (byte~) memoryRemap::$9 -- _deref_pbuc1=vbuaa + // [47] *((const byte*) memoryRemap::zVal) ← (byte~) memoryRemap::$9 -- _deref_pbuc1=vbuaa sta zVal // asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } lda aVal @@ -2232,7 +2424,7 @@ memoryRemap: { jmp __breturn // memoryRemap::@return __breturn: - // [40] return + // [49] return rts } // memoryRemap256M @@ -2241,26 +2433,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 @@ -2273,7 +2465,7 @@ memoryRemap256M: { .label __6 = $f .label __7 = $d .label lowerPageOffset = 4 - // [42] (dword~) memoryRemap256M::$0 ← (dword) memoryRemap256M::lowerPageOffset#2 >> (byte) 4 -- vduz1=vduz2_ror_4 + // [51] (dword~) memoryRemap256M::$0 ← (dword) memoryRemap256M::lowerPageOffset#2 >> (byte) 4 -- vduz1=vduz2_ror_4 lda.z lowerPageOffset+3 lsr sta.z __0+3 @@ -2298,44 +2490,44 @@ memoryRemap256M: { ror.z __0+2 ror.z __0+1 ror.z __0 - // [43] (byte~) memoryRemap256M::$1 ← > (word)(dword~) memoryRemap256M::$0 -- vbuaa=_hi__word_vduz1 + // [52] (byte~) memoryRemap256M::$1 ← > (word)(dword~) memoryRemap256M::$0 -- vbuaa=_hi__word_vduz1 lda.z __0+1 - // [44] *((const byte*) memoryRemap256M::lMb) ← (byte~) memoryRemap256M::$1 -- _deref_pbuc1=vbuaa + // [53] *((const byte*) memoryRemap256M::lMb) ← (byte~) memoryRemap256M::$1 -- _deref_pbuc1=vbuaa sta lMb - // [45] *((const byte*) memoryRemap256M::uMb) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // [54] *((const byte*) memoryRemap256M::uMb) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta uMb - // [46] (word~) memoryRemap256M::$7 ← < (dword) memoryRemap256M::lowerPageOffset#2 -- vwuz1=_lo_vduz2 + // [55] (word~) memoryRemap256M::$7 ← < (dword) memoryRemap256M::lowerPageOffset#2 -- vwuz1=_lo_vduz2 lda.z lowerPageOffset sta.z __7 lda.z lowerPageOffset+1 sta.z __7+1 - // [47] (byte~) memoryRemap256M::$5 ← < (word~) memoryRemap256M::$7 -- vbuaa=_lo_vwuz1 + // [56] (byte~) memoryRemap256M::$5 ← < (word~) memoryRemap256M::$7 -- vbuaa=_lo_vwuz1 lda.z __7 - // [48] *((const byte*) memoryRemap256M::aVal) ← (byte~) memoryRemap256M::$5 -- _deref_pbuc1=vbuaa + // [57] *((const byte*) memoryRemap256M::aVal) ← (byte~) memoryRemap256M::$5 -- _deref_pbuc1=vbuaa sta aVal - // [49] (byte~) memoryRemap256M::$6 ← (byte) memoryRemap256M::remapBlocks#2 << (byte) 4 -- vbuz1=vbuzz_rol_4 + // [58] (byte~) memoryRemap256M::$6 ← (byte) memoryRemap256M::remapBlocks#2 << (byte) 4 -- vbuz1=vbuzz_rol_4 tza asl asl asl asl sta.z __6 - // [50] (byte~) memoryRemap256M::$8 ← > (word~) memoryRemap256M::$7 -- vbuaa=_hi_vwuz1 + // [59] (byte~) memoryRemap256M::$8 ← > (word~) memoryRemap256M::$7 -- vbuaa=_hi_vwuz1 lda.z __7+1 - // [51] (byte~) memoryRemap256M::$9 ← (byte~) memoryRemap256M::$8 & (byte) $f -- vbuaa=vbuaa_band_vbuc1 + // [60] (byte~) memoryRemap256M::$9 ← (byte~) memoryRemap256M::$8 & (byte) $f -- vbuaa=vbuaa_band_vbuc1 and #$f - // [52] (byte~) memoryRemap256M::$10 ← (byte~) memoryRemap256M::$6 | (byte~) memoryRemap256M::$9 -- vbuaa=vbuz1_bor_vbuaa + // [61] (byte~) memoryRemap256M::$10 ← (byte~) memoryRemap256M::$6 | (byte~) memoryRemap256M::$9 -- vbuaa=vbuz1_bor_vbuaa ora.z __6 - // [53] *((const byte*) memoryRemap256M::xVal) ← (byte~) memoryRemap256M::$10 -- _deref_pbuc1=vbuaa + // [62] *((const byte*) memoryRemap256M::xVal) ← (byte~) memoryRemap256M::$10 -- _deref_pbuc1=vbuaa sta xVal - // [54] *((const byte*) memoryRemap256M::yVal) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // [63] *((const byte*) memoryRemap256M::yVal) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta yVal - // [55] (byte~) memoryRemap256M::$17 ← (byte) memoryRemap256M::remapBlocks#2 & (byte) $f0 -- vbuaa=vbuzz_band_vbuc1 + // [64] (byte~) memoryRemap256M::$17 ← (byte) memoryRemap256M::remapBlocks#2 & (byte) $f0 -- vbuaa=vbuzz_band_vbuc1 tza and #$f0 - // [56] *((const byte*) memoryRemap256M::zVal) ← (byte~) memoryRemap256M::$17 -- _deref_pbuc1=vbuaa + // [65] *((const byte*) memoryRemap256M::zVal) ← (byte~) memoryRemap256M::$17 -- _deref_pbuc1=vbuaa sta zVal // asm { ldalMb ldx#$0f ldyuMb ldz#$00 map ldaaVal ldxxVal ldyyVal ldzzVal map eom } lda lMb @@ -2352,16 +2544,19 @@ memoryRemap256M: { jmp __breturn // memoryRemap256M::@return __breturn: - // [58] return + // [67] return rts } // File Data ASSEMBLER OPTIMIZATIONS +Removing instruction jmp __b7 +Removing instruction jmp __b8 +Removing instruction jmp __b9 Removing instruction jmp __b1 -Removing instruction jmp __b2 Removing instruction jmp __b3 Removing instruction jmp __b4 +Removing instruction jmp __b6 Removing instruction jmp __breturn Removing instruction jmp __breturn Removing instruction jmp __breturn @@ -2369,16 +2564,24 @@ Removing instruction jmp __breturn Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #0 Succesful ASM optimization Pass5UnnecesaryLoadElimination +Removing instruction __b3_from___b1: +Removing instruction __b6_from___b4: +Succesful ASM optimization Pass5RedundantLabelElimination Removing instruction memoryRemapBlock_from_main: -Removing instruction __b1: -Removing instruction memoryRemapBlock_from___b1: -Removing instruction __b2: -Removing instruction memoryRemap_from___b2: +Removing instruction __b7: +Removing instruction memoryRemapBlock_from___b7: +Removing instruction __b8: +Removing instruction memoryRemap_from___b8: +Removing instruction __b9: +Removing instruction __b1_from___b9: Removing instruction __b3: Removing instruction memoryRemap256M_from___b3: -Removing instruction __b4: -Removing instruction memoryRemap256M_from___b4: +Removing instruction __b4_from___b3: +Removing instruction __b6: +Removing instruction memoryRemap256M_from___b6: Removing instruction __breturn: +Removing instruction __b4_from___b5: +Removing instruction __b1_from___b2: Removing instruction memoryRemap_from_memoryRemapBlock: Removing instruction __breturn: Removing instruction __breturn: @@ -2386,6 +2589,7 @@ Removing instruction __breturn: Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE +(const nomodify byte*) DEFAULT_SCREEN = (byte*) 2048 (byte) MEGA65_VICIV::ALPHADELAY (byte) MEGA65_VICIV::B0PIX (byte) MEGA65_VICIV::B0_ADDR @@ -2673,13 +2877,25 @@ FINAL SYMBOL TABLE (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 @@ -2694,13 +2910,13 @@ FINAL SYMBOL TABLE (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 @@ -2739,11 +2955,14 @@ FINAL SYMBOL TABLE (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 ] @@ -2757,7 +2976,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 ] @@ -2767,12 +2986,12 @@ reg byte a [ memoryRemap256M::$17 ] FINAL ASSEMBLER -Score: 505 +Score: 928 // File Comments // 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 @@ -2794,79 +3013,93 @@ Score: 505 .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 main: { - .label block1 = $4000 - .label block2 = $8000 + .label BLOCK_4000 = $4000 + .label BLOCK_8000 = $8000 // memoryRemapBlock(0x40, 0x100) // [1] call memoryRemapBlock // Remap [$4000-$5fff] to point to [$10000-$11fff] - // [15] phi from main to memoryRemapBlock [phi:main->memoryRemapBlock] - // [15] phi (byte) memoryRemapBlock::blockPage#2 = (byte) $40 [phi:main->memoryRemapBlock#0] -- vbuxx=vbuc1 + // [24] phi from main to memoryRemapBlock [phi:main->memoryRemapBlock] + // [24] phi (byte) memoryRemapBlock::blockPage#2 = (byte) $40 [phi:main->memoryRemapBlock#0] -- vbuxx=vbuc1 ldx #$40 jsr memoryRemapBlock - // main::@1 - // block1[0] = 0x55 - // [2] *((const byte*) main::block1) ← (byte) $55 -- _deref_pbuc1=vbuc2 - // Put 0x55, 0xaa into $10000 - lda #$55 - sta block1 - // block1[1] = 0xaa - // [3] *((const byte*) main::block1+(byte) 1) ← (byte) $aa -- _deref_pbuc1=vbuc2 - lda #$aa - sta block1+1 + // main::@7 + // BLOCK_4000[0] = '-' + // [2] *((const byte*) main::BLOCK_4000) ← (byte) '-' -- _deref_pbuc1=vbuc2 + // Put '-', '*' into $10000 + lda #'-' + sta BLOCK_4000 + // BLOCK_4000[1] = '*' + // [3] *((const byte*) main::BLOCK_4000+(byte) 1) ← (byte) '*' -- _deref_pbuc1=vbuc2 + lda #'*' + sta BLOCK_4000+1 // memoryRemapBlock(0x80, 0x100) // [4] call memoryRemapBlock // Remap [$8000-$9fff] to point to [$10000-$11fff] - // [15] phi from main::@1 to memoryRemapBlock [phi:main::@1->memoryRemapBlock] - // [15] phi (byte) memoryRemapBlock::blockPage#2 = (byte) $80 [phi:main::@1->memoryRemapBlock#0] -- vbuxx=vbuc1 + // [24] phi from main::@7 to memoryRemapBlock [phi:main::@7->memoryRemapBlock] + // [24] phi (byte) memoryRemapBlock::blockPage#2 = (byte) $80 [phi:main::@7->memoryRemapBlock#0] -- vbuxx=vbuc1 ldx #$80 jsr memoryRemapBlock - // main::@2 - // block2[2] = 0x55 - // [5] *((const byte*) main::block2+(byte) 2) ← (byte) $55 -- _deref_pbuc1=vbuc2 - // Put 0x55, 0xaainto $10002 - lda #$55 - sta block2+2 - // block2[3] = 0xaa - // [6] *((const byte*) main::block2+(byte) 3) ← (byte) $aa -- _deref_pbuc1=vbuc2 - lda #$aa - sta block2+3 + // main::@8 + // BLOCK_8000[2] = '-' + // [5] *((const byte*) main::BLOCK_8000+(byte) 2) ← (byte) '-' -- _deref_pbuc1=vbuc2 + // Put '-', '*' into $10002 + lda #'-' + sta BLOCK_8000+2 + // BLOCK_8000[3] = '*' + // [6] *((const byte*) main::BLOCK_8000+(byte) 3) ← (byte) '*' -- _deref_pbuc1=vbuc2 + lda #'*' + sta BLOCK_8000+3 // memoryRemap(MEMORYBLOCK_4000|MEMORYBLOCK_8000, 0x0c0, 0x080) // [7] call memoryRemap // Remap [$4000-$5fff] and [$8000-$9fff] to both point to [$10000-$11fff] (notice usage of page offsets) - // [24] phi from main::@2 to memoryRemap [phi:main::@2->memoryRemap] - // [24] phi (word) memoryRemap::upperPageOffset#2 = (byte) $80 [phi:main::@2->memoryRemap#0] -- vwuz1=vbuc1 + // [33] phi from main::@8 to memoryRemap [phi:main::@8->memoryRemap] + // [33] phi (word) memoryRemap::upperPageOffset#2 = (byte) $80 [phi:main::@8->memoryRemap#0] -- vwuz1=vbuc1 lda #<$80 sta.z memoryRemap.upperPageOffset lda #>$80 sta.z memoryRemap.upperPageOffset+1 - // [24] phi (byte) memoryRemap::remapBlocks#2 = (const nomodify byte) MEMORYBLOCK_4000|(const nomodify byte) MEMORYBLOCK_8000 [phi:main::@2->memoryRemap#1] -- vbuzz=vbuc1 + // [33] phi (byte) memoryRemap::remapBlocks#2 = (const nomodify byte) MEMORYBLOCK_4000|(const nomodify byte) MEMORYBLOCK_8000 [phi:main::@8->memoryRemap#1] -- vbuzz=vbuc1 ldz #MEMORYBLOCK_4000|MEMORYBLOCK_8000 - // [24] phi (word) memoryRemap::lowerPageOffset#2 = (byte) $c0 [phi:main::@2->memoryRemap#2] -- vwuz1=vbuc1 + // [33] phi (word) memoryRemap::lowerPageOffset#2 = (byte) $c0 [phi:main::@8->memoryRemap#2] -- vwuz1=vbuc1 lda #<$c0 sta.z memoryRemap.lowerPageOffset lda #>$c0 sta.z memoryRemap.lowerPageOffset+1 jsr memoryRemap + // main::@9 + // BLOCK_8000[4] = BLOCK_4000[2] + // [8] *((const byte*) main::BLOCK_8000+(byte) 4) ← *((const byte*) main::BLOCK_4000+(byte) 2) -- _deref_pbuc1=_deref_pbuc2 + // Put '-', '*' into $10004 in a convoluted way + lda BLOCK_4000+2 + sta BLOCK_8000+4 + // BLOCK_4000[5] = BLOCK_8000[1] + // [9] *((const byte*) main::BLOCK_4000+(byte) 5) ← *((const byte*) main::BLOCK_8000+(byte) 1) -- _deref_pbuc1=_deref_pbuc2 + lda BLOCK_8000+1 + sta BLOCK_4000+5 + // [10] phi from main::@9 to main::@1 [phi:main::@9->main::@1] + // [10] phi (byte) main::i#2 = (byte) 0 [phi:main::@9->main::@1#0] -- vbuxx=vbuc1 + ldx #0 + // copy the resulting values onto the screen + // main::@1 + __b1: + // for(char i=0;i<6;i++) + // [11] if((byte) main::i#2<(byte) 6) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 + cpx #6 + bcc __b2 + // [12] phi from main::@1 to main::@3 [phi:main::@1->main::@3] // main::@3 - // block2[4] = block1[2] - // [8] *((const byte*) main::block2+(byte) 4) ← *((const byte*) main::block1+(byte) 2) -- _deref_pbuc1=_deref_pbuc2 - // Put 0x55, 0xaa into $10004 in a convoluted way - lda block1+2 - sta block2+4 - // block1[5] = block2[1] - // [9] *((const byte*) main::block1+(byte) 5) ← *((const byte*) main::block2+(byte) 1) -- _deref_pbuc1=_deref_pbuc2 - lda block2+1 - sta block1+5 // memoryRemap256M(MEMORYBLOCK_4000, 0xff800-0x00040, 0) - // [10] call memoryRemap256M + // [13] call memoryRemap256M // Remap [$4000-$5fff] to both point to [$ff80000-$ff81fff] COLORAM! (notice usage of page offsets) - // [41] phi from main::@3 to memoryRemap256M [phi:main::@3->memoryRemap256M] - // [41] phi (byte) memoryRemap256M::remapBlocks#2 = (const nomodify byte) MEMORYBLOCK_4000 [phi:main::@3->memoryRemap256M#0] -- vbuzz=vbuc1 + // [50] phi from main::@3 to memoryRemap256M [phi:main::@3->memoryRemap256M] + // [50] phi (byte) memoryRemap256M::remapBlocks#2 = (const nomodify byte) MEMORYBLOCK_4000 [phi:main::@3->memoryRemap256M#0] -- vbuzz=vbuc1 ldz #MEMORYBLOCK_4000 - // [41] phi (dword) memoryRemap256M::lowerPageOffset#2 = (dword)(number) $ff800-(number) $40 [phi:main::@3->memoryRemap256M#1] -- vduz1=vduc1 + // [50] phi (dword) memoryRemap256M::lowerPageOffset#2 = (dword)(number) $ff800-(number) $40 [phi:main::@3->memoryRemap256M#1] -- vduz1=vduc1 lda #<$ff800-$40 sta.z memoryRemap256M.lowerPageOffset lda #>$ff800-$40 @@ -2876,23 +3109,25 @@ main: { lda #>$ff800-$40>>$10 sta.z memoryRemap256M.lowerPageOffset+3 jsr memoryRemap256M + // [14] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + // [14] phi (byte) main::i1#2 = (byte) 0 [phi:main::@3->main::@4#0] -- vbuxx=vbuc1 + ldx #0 + // Put colors in the upper screen line // main::@4 - // block1[0] = 0 - // [11] *((const byte*) main::block1) ← (byte) 0 -- _deref_pbuc1=vbuc2 - // Put colors in the upper left corner! - lda #0 - sta block1 - // block1[1] = 1 - // [12] *((const byte*) main::block1+(byte) 1) ← (byte) 1 -- _deref_pbuc1=vbuc2 - lda #1 - sta block1+1 + __b4: + // for( char i=0; i<16; i++) + // [15] if((byte) main::i1#2<(byte) $10) goto main::@5 -- vbuxx_lt_vbuc1_then_la1 + cpx #$10 + bcc __b5 + // [16] phi from main::@4 to main::@6 [phi:main::@4->main::@6] + // main::@6 // memoryRemap256M(0, 0, 0) - // [13] call memoryRemap256M + // [17] call memoryRemap256M // Remap [$4000-$5fff] back to normal memory! - // [41] phi from main::@4 to memoryRemap256M [phi:main::@4->memoryRemap256M] - // [41] phi (byte) memoryRemap256M::remapBlocks#2 = (byte) 0 [phi:main::@4->memoryRemap256M#0] -- vbuzz=vbuc1 + // [50] phi from main::@6 to memoryRemap256M [phi:main::@6->memoryRemap256M] + // [50] phi (byte) memoryRemap256M::remapBlocks#2 = (byte) 0 [phi:main::@6->memoryRemap256M#0] -- vbuzz=vbuc1 ldz #0 - // [41] phi (dword) memoryRemap256M::lowerPageOffset#2 = (byte) 0 [phi:main::@4->memoryRemap256M#1] -- vduz1=vbuc1 + // [50] phi (dword) memoryRemap256M::lowerPageOffset#2 = (byte) 0 [phi:main::@6->memoryRemap256M#1] -- vduz1=vbuc1 lda #0 sta.z memoryRemap256M.lowerPageOffset sta.z memoryRemap256M.lowerPageOffset+1 @@ -2901,20 +3136,48 @@ main: { jsr memoryRemap256M // main::@return // } - // [14] return + // [18] return rts + // main::@5 + __b5: + // 0x40+i + // [19] (byte~) main::$7 ← (byte) $40 + (byte) main::i1#2 -- vbuaa=vbuc1_plus_vbuxx + txa + clc + adc #$40 + // BLOCK_4000[i] = 0x40+i + // [20] *((const byte*) main::BLOCK_4000 + (byte) main::i1#2) ← (byte~) main::$7 -- pbuc1_derefidx_vbuxx=vbuaa + sta BLOCK_4000,x + // for( char i=0; i<16; i++) + // [21] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuxx=_inc_vbuxx + inx + // [14] phi from main::@5 to main::@4 [phi:main::@5->main::@4] + // [14] phi (byte) main::i1#2 = (byte) main::i1#1 [phi:main::@5->main::@4#0] -- register_copy + jmp __b4 + // main::@2 + __b2: + // (DEFAULT_SCREEN+80-6)[i] = BLOCK_4000[i] + // [22] *((const nomodify byte*) DEFAULT_SCREEN+(byte) $50-(byte) 6 + (byte) main::i#2) ← *((const byte*) main::BLOCK_4000 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx + lda BLOCK_4000,x + sta DEFAULT_SCREEN+$50-6,x + // for(char i=0;i<6;i++) + // [23] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx + inx + // [10] phi from main::@2 to main::@1 [phi:main::@2->main::@1] + // [10] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#0] -- register_copy + jmp __b1 } // memoryRemapBlock // 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: { .label pageOffset = $d // pageOffset = memoryPage-blockPage - // [16] (word) memoryRemapBlock::pageOffset#0 ← (word) $100 - (byte) memoryRemapBlock::blockPage#2 -- vwuz1=vwuc1_minus_vbuxx + // [25] (word) memoryRemapBlock::pageOffset#0 ← (word) $100 - (byte) memoryRemapBlock::blockPage#2 -- vwuz1=vwuc1_minus_vbuxx stx.z $ff lda #<$100 sec @@ -2924,7 +3187,7 @@ memoryRemapBlock: { sbc #0 sta.z pageOffset+1 // block = blockPage / $20 - // [17] (byte) memoryRemapBlock::block#0 ← (byte) memoryRemapBlock::blockPage#2 >> (byte) 5 -- vbuaa=vbuxx_ror_5 + // [26] (byte) memoryRemapBlock::block#0 ← (byte) memoryRemapBlock::blockPage#2 >> (byte) 5 -- vbuaa=vbuxx_ror_5 txa lsr lsr @@ -2932,7 +3195,7 @@ memoryRemapBlock: { lsr lsr // blockBits = 1<memoryRemap] - // [24] phi (word) memoryRemap::upperPageOffset#2 = (word) memoryRemap::upperPageOffset#1 [phi:memoryRemapBlock->memoryRemap#0] -- register_copy - // [24] phi (byte) memoryRemap::remapBlocks#2 = (byte) memoryRemap::remapBlocks#1 [phi:memoryRemapBlock->memoryRemap#1] -- register_copy - // [24] phi (word) memoryRemap::lowerPageOffset#2 = (word) memoryRemap::lowerPageOffset#1 [phi:memoryRemapBlock->memoryRemap#2] -- register_copy + // [31] call memoryRemap + // [33] phi from memoryRemapBlock to memoryRemap [phi:memoryRemapBlock->memoryRemap] + // [33] phi (word) memoryRemap::upperPageOffset#2 = (word) memoryRemap::upperPageOffset#0 [phi:memoryRemapBlock->memoryRemap#0] -- register_copy + // [33] phi (byte) memoryRemap::remapBlocks#2 = (byte) memoryRemap::remapBlocks#0 [phi:memoryRemapBlock->memoryRemap#1] -- register_copy + // [33] phi (word) memoryRemap::lowerPageOffset#2 = (word) memoryRemap::lowerPageOffset#0 [phi:memoryRemapBlock->memoryRemap#2] -- register_copy jsr memoryRemap // memoryRemapBlock::@return // } - // [23] return + // [32] return rts } // memoryRemap @@ -2967,26 +3230,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 @@ -2998,13 +3261,13 @@ memoryRemap: { .label lowerPageOffset = $d .label upperPageOffset = 2 // lowerPageOffset - // [28] (byte~) memoryRemap::$2 ← > (word) memoryRemap::lowerPageOffset#2 -- vbuaa=_hi_vwuz1 + // [37] (byte~) memoryRemap::$2 ← > (word) memoryRemap::lowerPageOffset#2 -- vbuaa=_hi_vwuz1 lda.z lowerPageOffset+1 // >lowerPageOffset & 0xf - // [29] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f -- vbuaa=vbuaa_band_vbuc1 + // [38] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f -- vbuaa=vbuaa_band_vbuc1 and #$f // (remapBlocks << 4) | (>lowerPageOffset & 0xf) - // [30] (byte~) memoryRemap::$4 ← (byte~) memoryRemap::$1 | (byte~) memoryRemap::$3 -- vbuaa=vbuz1_bor_vbuaa + // [39] (byte~) memoryRemap::$4 ← (byte~) memoryRemap::$1 | (byte~) memoryRemap::$3 -- vbuaa=vbuz1_bor_vbuaa ora.z __1 // *xVal = (remapBlocks << 4) | (>lowerPageOffset & 0xf) - // [31] *((const byte*) memoryRemap::xVal) ← (byte~) memoryRemap::$4 -- _deref_pbuc1=vbuaa + // [40] *((const byte*) memoryRemap::xVal) ← (byte~) memoryRemap::$4 -- _deref_pbuc1=vbuaa sta xVal // upperPageOffset - // [35] (byte~) memoryRemap::$7 ← > (word) memoryRemap::upperPageOffset#2 -- vbuaa=_hi_vwuz1 + // [44] (byte~) memoryRemap::$7 ← > (word) memoryRemap::upperPageOffset#2 -- vbuaa=_hi_vwuz1 lda.z upperPageOffset+1 // >upperPageOffset & 0xf - // [36] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f -- vbuaa=vbuaa_band_vbuc1 + // [45] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f -- vbuaa=vbuaa_band_vbuc1 and #$f // (remapBlocks & 0xf0) | (>upperPageOffset & 0xf) - // [37] (byte~) memoryRemap::$9 ← (byte~) memoryRemap::$6 | (byte~) memoryRemap::$8 -- vbuaa=vbuz1_bor_vbuaa + // [46] (byte~) memoryRemap::$9 ← (byte~) memoryRemap::$6 | (byte~) memoryRemap::$8 -- vbuaa=vbuz1_bor_vbuaa ora.z __6 // *zVal = (remapBlocks & 0xf0) | (>upperPageOffset & 0xf) - // [38] *((const byte*) memoryRemap::zVal) ← (byte~) memoryRemap::$9 -- _deref_pbuc1=vbuaa + // [47] *((const byte*) memoryRemap::zVal) ← (byte~) memoryRemap::$9 -- _deref_pbuc1=vbuaa sta zVal // asm // asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } @@ -3056,7 +3319,7 @@ memoryRemap: { eom // memoryRemap::@return // } - // [40] return + // [49] return rts } // memoryRemap256M @@ -3065,26 +3328,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 @@ -3098,7 +3361,7 @@ memoryRemap256M: { .label __7 = $d .label lowerPageOffset = 4 // lowerPageOffset>>4 - // [42] (dword~) memoryRemap256M::$0 ← (dword) memoryRemap256M::lowerPageOffset#2 >> (byte) 4 -- vduz1=vduz2_ror_4 + // [51] (dword~) memoryRemap256M::$0 ← (dword) memoryRemap256M::lowerPageOffset#2 >> (byte) 4 -- vduz1=vduz2_ror_4 lda.z lowerPageOffset+3 lsr sta.z __0+3 @@ -3124,29 +3387,29 @@ memoryRemap256M: { ror.z __0+1 ror.z __0 // >((unsigned int)(lowerPageOffset>>4)) - // [43] (byte~) memoryRemap256M::$1 ← > (word)(dword~) memoryRemap256M::$0 -- vbuaa=_hi__word_vduz1 + // [52] (byte~) memoryRemap256M::$1 ← > (word)(dword~) memoryRemap256M::$0 -- vbuaa=_hi__word_vduz1 lda.z __0+1 // *lMb = >((unsigned int)(lowerPageOffset>>4)) - // [44] *((const byte*) memoryRemap256M::lMb) ← (byte~) memoryRemap256M::$1 -- _deref_pbuc1=vbuaa + // [53] *((const byte*) memoryRemap256M::lMb) ← (byte~) memoryRemap256M::$1 -- _deref_pbuc1=vbuaa sta lMb // *uMb = >((unsigned int)(upperPageOffset>>4)) - // [45] *((const byte*) memoryRemap256M::uMb) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // [54] *((const byte*) memoryRemap256M::uMb) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta uMb // (word~) memoryRemap256M::$7 -- vbuaa=_hi_vwuz1 + // [59] (byte~) memoryRemap256M::$8 ← > (word~) memoryRemap256M::$7 -- vbuaa=_hi_vwuz1 lda.z __7+1 // >