Fixing struct type size struct F018_DMAGIC to 17 Fixing struct type SIZE_OF struct F018_DMAGIC to 17 Fixing struct type SIZE_OF struct F018_DMAGIC to 17 Setting inferred volatile on symbol affected by address-of: memoryRemap::aVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap::xVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap::yVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap::zVal in asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap256M::lMb in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap256M::uMb in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap256M::aVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap256M::xVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap256M::yVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap256M::zVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Inlined call vicSelectGfxBank::$0 = call toDd00(vicSelectGfxBank::gfx) Eliminating unused variable with no statement memoryRemap::$0 Eliminating unused variable with no statement memoryRemap::$4 Eliminating unused variable with no statement memoryRemap::$5 Eliminating unused variable with no statement memoryRemap::$9 Eliminating unused variable with no statement memoryRemapBlock::$0 Eliminating unused variable with no statement memoryRemapBlock::$1 Eliminating unused variable with no statement memoryRemapBlock::$2 Eliminating unused variable with no statement memoryRemap256M::$1 Eliminating unused variable with no statement memoryRemap256M::$3 Eliminating unused variable with no statement memoryRemap256M::$4 Eliminating unused variable with no statement memoryRemap256M::$8 Eliminating unused variable with no statement memoryRemap256M::$9 Eliminating unused variable with no statement memoryRemap256M::$13 CONTROL FLOW GRAPH SSA void memoryRemap(char remapBlocks , unsigned int lowerPageOffset , unsigned int upperPageOffset) memoryRemap: scope:[memoryRemap] from main::@8 memoryRemapBlock memoryRemap::upperPageOffset#2 = phi( main::@8/memoryRemap::upperPageOffset#1, memoryRemapBlock/memoryRemap::upperPageOffset#0 ) memoryRemap::remapBlocks#2 = phi( main::@8/memoryRemap::remapBlocks#1, memoryRemapBlock/memoryRemap::remapBlocks#0 ) memoryRemap::lowerPageOffset#2 = phi( main::@8/memoryRemap::lowerPageOffset#1, memoryRemapBlock/memoryRemap::lowerPageOffset#0 ) memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#2 memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#2 memoryRemap::$3 = memoryRemap::$2 & $f memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#2 memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#2 memoryRemap::$8 = memoryRemap::$7 & $f memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap::@return memoryRemap::@return: scope:[memoryRemap] from memoryRemap return to:@return void memoryRemapBlock(char blockPage , unsigned int memoryPage) memoryRemapBlock: scope:[memoryRemapBlock] from main main::@7 memoryRemapBlock::blockPage#2 = phi( main/memoryRemapBlock::blockPage#0, main::@7/memoryRemapBlock::blockPage#1 ) memoryRemapBlock::memoryPage#2 = phi( main/memoryRemapBlock::memoryPage#0, main::@7/memoryRemapBlock::memoryPage#1 ) memoryRemapBlock::pageOffset#0 = memoryRemapBlock::memoryPage#2 - memoryRemapBlock::blockPage#2 memoryRemapBlock::block#0 = memoryRemapBlock::blockPage#2 / $20 memoryRemapBlock::blockBits#0 = 1 << memoryRemapBlock::block#0 memoryRemap::remapBlocks#0 = memoryRemapBlock::blockBits#0 memoryRemap::lowerPageOffset#0 = memoryRemapBlock::pageOffset#0 memoryRemap::upperPageOffset#0 = memoryRemapBlock::pageOffset#0 call memoryRemap to:memoryRemapBlock::@1 memoryRemapBlock::@1: scope:[memoryRemapBlock] from memoryRemapBlock to:memoryRemapBlock::@return memoryRemapBlock::@return: scope:[memoryRemapBlock] from memoryRemapBlock::@1 return to:@return void memoryRemap256M(char remapBlocks , unsigned long lowerPageOffset , unsigned long upperPageOffset) memoryRemap256M: scope:[memoryRemap256M] from main::@3 main::@6 memoryRemap256M::remapBlocks#2 = phi( main::@3/memoryRemap256M::remapBlocks#0, main::@6/memoryRemap256M::remapBlocks#1 ) memoryRemap256M::upperPageOffset#2 = phi( main::@3/memoryRemap256M::upperPageOffset#0, main::@6/memoryRemap256M::upperPageOffset#1 ) memoryRemap256M::lowerPageOffset#2 = phi( main::@3/memoryRemap256M::lowerPageOffset#0, main::@6/memoryRemap256M::lowerPageOffset#1 ) memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 memoryRemap256M::lMb = byte1 (unsigned int)memoryRemap256M::$0 memoryRemap256M::$2 = memoryRemap256M::upperPageOffset#2 >> 4 memoryRemap256M::uMb = byte1 (unsigned int)memoryRemap256M::$2 memoryRemap256M::aVal = byte0 memoryRemap256M::lowerPageOffset#2 memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 memoryRemap256M::$6 = byte1 memoryRemap256M::lowerPageOffset#2 memoryRemap256M::$7 = memoryRemap256M::$6 & $f memoryRemap256M::xVal = memoryRemap256M::$5 | memoryRemap256M::$7 memoryRemap256M::yVal = byte0 memoryRemap256M::upperPageOffset#2 memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 memoryRemap256M::$11 = byte1 memoryRemap256M::upperPageOffset#2 memoryRemap256M::$12 = memoryRemap256M::$11 & $f memoryRemap256M::zVal = memoryRemap256M::$10 | memoryRemap256M::$12 asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap256M::@return memoryRemap256M::@return: scope:[memoryRemap256M] from memoryRemap256M return to:@return void main() main: scope:[main] from __start memoryRemapBlock::blockPage#0 = $40 memoryRemapBlock::memoryPage#0 = $100 call memoryRemapBlock to:main::@7 main::@7: scope:[main] from main main::BLOCK_4000[0] = '-' main::BLOCK_4000[1] = '*' memoryRemapBlock::blockPage#1 = $80 memoryRemapBlock::memoryPage#1 = $100 call memoryRemapBlock to:main::@8 main::@8: scope:[main] from main::@7 main::BLOCK_8000[2] = '-' main::BLOCK_8000[3] = '*' memoryRemap::remapBlocks#1 = MEMORYBLOCK_4000|MEMORYBLOCK_8000 memoryRemap::lowerPageOffset#1 = $c0 memoryRemap::upperPageOffset#1 = $80 call memoryRemap to:main::@9 main::@9: scope:[main] from main::@8 main::BLOCK_8000[4] = main::BLOCK_4000[2] main::BLOCK_4000[5] = main::BLOCK_8000[1] main::i#0 = 0 to:main::@1 main::@1: scope:[main] from main::@2 main::@9 main::i#2 = phi( main::@2/main::i#1, main::@9/main::i#0 ) main::$5 = main::i#2 < 6 if(main::$5) goto main::@2 to:main::@3 main::@2: scope:[main] from main::@1 main::i#3 = phi( main::@1/main::i#2 ) (DEFAULT_SCREEN+$50-6)[main::i#3] = main::BLOCK_4000[main::i#3] main::i#1 = ++ main::i#3 to:main::@1 main::@3: scope:[main] from main::@1 memoryRemap256M::remapBlocks#0 = MEMORYBLOCK_4000 memoryRemap256M::lowerPageOffset#0 = $ff800-$40 memoryRemap256M::upperPageOffset#0 = 0 call memoryRemap256M to:main::@10 main::@10: scope:[main] from main::@3 main::i1#0 = 0 to:main::@4 main::@4: scope:[main] from main::@10 main::@5 main::i1#2 = phi( main::@10/main::i1#0, main::@5/main::i1#1 ) main::$6 = main::i1#2 < $10 if(main::$6) goto main::@5 to:main::@6 main::@5: scope:[main] from main::@4 main::i1#3 = phi( main::@4/main::i1#2 ) main::$7 = $40 + main::i1#3 main::BLOCK_4000[main::i1#3] = main::$7 main::i1#1 = ++ main::i1#3 to:main::@4 main::@6: scope:[main] from main::@4 memoryRemap256M::remapBlocks#1 = 0 memoryRemap256M::lowerPageOffset#1 = 0 memoryRemap256M::upperPageOffset#1 = 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 to:__start::@1 __start::@1: scope:[__start] from __start to:__start::@return __start::@return: scope:[__start] from __start::@1 return to:@return SYMBOL TABLE SSA __constant char * const DEFAULT_SCREEN = (char *)$800 __constant const char MEMORYBLOCK_4000 = 4 __constant const char MEMORYBLOCK_8000 = $10 void __start() void main() bool main::$5 bool main::$6 number main::$7 __constant char *main::BLOCK_4000 = (char *)$4000 __constant char *main::BLOCK_8000 = (char *)$8000 char main::i char main::i#0 char main::i#1 char main::i#2 char main::i#3 char main::i1 char main::i1#0 char main::i1#1 char main::i1#2 char main::i1#3 void memoryRemap(char remapBlocks , unsigned int lowerPageOffset , unsigned int upperPageOffset) char memoryRemap::$1 char memoryRemap::$2 number memoryRemap::$3 number memoryRemap::$6 char memoryRemap::$7 number memoryRemap::$8 __loadstore volatile char memoryRemap::aVal unsigned int memoryRemap::lowerPageOffset unsigned int memoryRemap::lowerPageOffset#0 unsigned int memoryRemap::lowerPageOffset#1 unsigned int memoryRemap::lowerPageOffset#2 char memoryRemap::remapBlocks char memoryRemap::remapBlocks#0 char memoryRemap::remapBlocks#1 char memoryRemap::remapBlocks#2 unsigned int memoryRemap::upperPageOffset unsigned int memoryRemap::upperPageOffset#0 unsigned int memoryRemap::upperPageOffset#1 unsigned int memoryRemap::upperPageOffset#2 __loadstore volatile char memoryRemap::xVal __loadstore volatile char memoryRemap::yVal __loadstore volatile char memoryRemap::zVal void memoryRemap256M(char remapBlocks , unsigned long lowerPageOffset , unsigned long upperPageOffset) unsigned long memoryRemap256M::$0 number memoryRemap256M::$10 char memoryRemap256M::$11 number memoryRemap256M::$12 unsigned long memoryRemap256M::$2 char memoryRemap256M::$5 char memoryRemap256M::$6 number memoryRemap256M::$7 __loadstore volatile char memoryRemap256M::aVal __loadstore volatile char memoryRemap256M::lMb unsigned long memoryRemap256M::lowerPageOffset unsigned long memoryRemap256M::lowerPageOffset#0 unsigned long memoryRemap256M::lowerPageOffset#1 unsigned long memoryRemap256M::lowerPageOffset#2 char memoryRemap256M::remapBlocks char memoryRemap256M::remapBlocks#0 char memoryRemap256M::remapBlocks#1 char memoryRemap256M::remapBlocks#2 __loadstore volatile char memoryRemap256M::uMb unsigned long memoryRemap256M::upperPageOffset unsigned long memoryRemap256M::upperPageOffset#0 unsigned long memoryRemap256M::upperPageOffset#1 unsigned long memoryRemap256M::upperPageOffset#2 __loadstore volatile char memoryRemap256M::xVal __loadstore volatile char memoryRemap256M::yVal __loadstore volatile char memoryRemap256M::zVal void memoryRemapBlock(char blockPage , unsigned int memoryPage) char memoryRemapBlock::block char memoryRemapBlock::block#0 char memoryRemapBlock::blockBits char memoryRemapBlock::blockBits#0 char memoryRemapBlock::blockPage char memoryRemapBlock::blockPage#0 char memoryRemapBlock::blockPage#1 char memoryRemapBlock::blockPage#2 unsigned int memoryRemapBlock::memoryPage unsigned int memoryRemapBlock::memoryPage#0 unsigned int memoryRemapBlock::memoryPage#1 unsigned int memoryRemapBlock::memoryPage#2 unsigned int memoryRemapBlock::pageOffset unsigned int memoryRemapBlock::pageOffset#0 Adding number conversion cast (unumber) 4 in memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 Adding number conversion cast (unumber) $f in memoryRemap::$3 = memoryRemap::$2 & $f Adding number conversion cast (unumber) memoryRemap::$3 in memoryRemap::$3 = memoryRemap::$2 & (unumber)$f Adding number conversion cast (unumber) $f0 in memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 Adding number conversion cast (unumber) memoryRemap::$6 in memoryRemap::$6 = memoryRemap::remapBlocks#2 & (unumber)$f0 Adding number conversion cast (unumber) $f in memoryRemap::$8 = memoryRemap::$7 & $f Adding number conversion cast (unumber) memoryRemap::$8 in memoryRemap::$8 = memoryRemap::$7 & (unumber)$f Adding number conversion cast (unumber) $20 in memoryRemapBlock::block#0 = memoryRemapBlock::blockPage#2 / $20 Adding number conversion cast (unumber) 1 in memoryRemapBlock::blockBits#0 = 1 << memoryRemapBlock::block#0 Adding number conversion cast (unumber) 4 in memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 Adding number conversion cast (unumber) 4 in memoryRemap256M::$2 = memoryRemap256M::upperPageOffset#2 >> 4 Adding number conversion cast (unumber) 4 in memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 Adding number conversion cast (unumber) $f in memoryRemap256M::$7 = memoryRemap256M::$6 & $f Adding number conversion cast (unumber) memoryRemap256M::$7 in memoryRemap256M::$7 = memoryRemap256M::$6 & (unumber)$f Adding number conversion cast (unumber) $f0 in memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 Adding number conversion cast (unumber) memoryRemap256M::$10 in memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & (unumber)$f0 Adding number conversion cast (unumber) $f in memoryRemap256M::$12 = memoryRemap256M::$11 & $f Adding number conversion cast (unumber) memoryRemap256M::$12 in memoryRemap256M::$12 = memoryRemap256M::$11 & (unumber)$f Adding number conversion cast (unumber) $40 in memoryRemapBlock::blockPage#0 = $40 Adding number conversion cast (unumber) $100 in memoryRemapBlock::memoryPage#0 = $100 Adding number conversion cast (unumber) 0 in main::BLOCK_4000[0] = '-' Adding number conversion cast (unumber) 1 in main::BLOCK_4000[1] = '*' Adding number conversion cast (unumber) $80 in memoryRemapBlock::blockPage#1 = $80 Adding number conversion cast (unumber) $100 in memoryRemapBlock::memoryPage#1 = $100 Adding number conversion cast (unumber) 2 in main::BLOCK_8000[2] = '-' Adding number conversion cast (unumber) 3 in main::BLOCK_8000[3] = '*' Adding number conversion cast (unumber) $c0 in memoryRemap::lowerPageOffset#1 = $c0 Adding number conversion cast (unumber) $80 in memoryRemap::upperPageOffset#1 = $80 Adding number conversion cast (unumber) 2 in main::BLOCK_8000[4] = main::BLOCK_4000[2] Adding number conversion cast (unumber) 4 in main::BLOCK_8000[4] = main::BLOCK_4000[(unumber)2] Adding number conversion cast (unumber) 1 in main::BLOCK_4000[5] = main::BLOCK_8000[1] Adding number conversion cast (unumber) 5 in main::BLOCK_4000[5] = main::BLOCK_8000[(unumber)1] Adding number conversion cast (unumber) 6 in main::$5 = main::i#2 < 6 Adding number conversion cast (unumber) 6 in (DEFAULT_SCREEN+$50-6)[main::i#3] = main::BLOCK_4000[main::i#3] Adding number conversion cast (unumber) $50 in (DEFAULT_SCREEN+$50-(unumber)6)[main::i#3] = main::BLOCK_4000[main::i#3] Adding number conversion cast (unumber) $ff800-$40 in memoryRemap256M::lowerPageOffset#0 = $ff800-$40 Adding number conversion cast (unumber) 0 in memoryRemap256M::upperPageOffset#0 = 0 Adding number conversion cast (unumber) $10 in main::$6 = main::i1#2 < $10 Adding number conversion cast (unumber) $40 in main::$7 = $40 + main::i1#3 Adding number conversion cast (unumber) main::$7 in main::$7 = (unumber)$40 + main::i1#3 Adding number conversion cast (unumber) 0 in memoryRemap256M::remapBlocks#1 = 0 Adding number conversion cast (unumber) 0 in memoryRemap256M::lowerPageOffset#1 = 0 Adding number conversion cast (unumber) 0 in memoryRemap256M::upperPageOffset#1 = 0 Successful SSA optimization PassNAddNumberTypeConversions Inlining cast memoryRemapBlock::blockPage#0 = (unumber)$40 Inlining cast memoryRemapBlock::memoryPage#0 = (unumber)$100 Inlining cast memoryRemapBlock::blockPage#1 = (unumber)$80 Inlining cast memoryRemapBlock::memoryPage#1 = (unumber)$100 Inlining cast memoryRemap::lowerPageOffset#1 = (unumber)$c0 Inlining cast memoryRemap::upperPageOffset#1 = (unumber)$80 Inlining cast memoryRemap256M::lowerPageOffset#0 = (unumber)$ff800-$40 Inlining cast memoryRemap256M::upperPageOffset#0 = (unumber)0 Inlining cast memoryRemap256M::remapBlocks#1 = (unumber)0 Inlining cast memoryRemap256M::lowerPageOffset#1 = (unumber)0 Inlining cast memoryRemap256M::upperPageOffset#1 = (unumber)0 Successful SSA optimization Pass2InlineCast Simplifying constant pointer cast (char *) 2048 Simplifying constant pointer cast (char *) 16384 Simplifying constant pointer cast (char *) 32768 Simplifying constant integer cast 4 Simplifying constant integer cast $f Simplifying constant integer cast $f0 Simplifying constant integer cast $f Simplifying constant integer cast $20 Simplifying constant integer cast 1 Simplifying constant integer cast 4 Simplifying constant integer cast 4 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 (char) 4 Finalized unsigned number type (char) $f Finalized unsigned number type (char) $f0 Finalized unsigned number type (char) $f Finalized unsigned number type (char) $20 Finalized unsigned number type (char) 1 Finalized unsigned number type (char) 4 Finalized unsigned number type (char) 4 Finalized unsigned number type (char) 4 Finalized unsigned number type (char) $f Finalized unsigned number type (char) $f0 Finalized unsigned number type (char) $f Finalized unsigned number type (char) $40 Finalized unsigned number type (unsigned int) $100 Finalized unsigned number type (char) 0 Finalized unsigned number type (char) 1 Finalized unsigned number type (char) $80 Finalized unsigned number type (unsigned int) $100 Finalized unsigned number type (char) 2 Finalized unsigned number type (char) 3 Finalized unsigned number type (char) $c0 Finalized unsigned number type (char) $80 Finalized unsigned number type (char) 2 Finalized unsigned number type (char) 4 Finalized unsigned number type (char) 1 Finalized unsigned number type (char) 5 Finalized unsigned number type (char) 6 Finalized unsigned number type (char) $50 Finalized unsigned number type (char) 6 Finalized unsigned number type (char) 0 Finalized unsigned number type (char) $10 Finalized unsigned number type (char) $40 Finalized unsigned number type (char) 0 Finalized unsigned number type (char) 0 Finalized unsigned number type (char) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to char in memoryRemap::$3 = memoryRemap::$2 & $f Inferred type updated to char in memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 Inferred type updated to char in memoryRemap::$8 = memoryRemap::$7 & $f Inferred type updated to char in memoryRemap256M::$7 = memoryRemap256M::$6 & $f Inferred type updated to char in memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 Inferred type updated to char in memoryRemap256M::$12 = memoryRemap256M::$11 & $f Inferred type updated to char in main::$7 = $40 + main::i1#3 Alias main::i#2 = main::i#3 Alias main::i1#2 = main::i1#3 Successful SSA optimization Pass2AliasElimination Simple Condition main::$5 [58] if(main::i#2<6) goto main::@2 Simple Condition main::$6 [68] if(main::i1#2<$10) goto main::@5 Successful SSA optimization Pass2ConditionalJumpSimplification Constant right-side identified [62] memoryRemap256M::lowerPageOffset#0 = (unumber)$ff800-$40 Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemapBlock::blockPage#0 = $40 Constant memoryRemapBlock::memoryPage#0 = $100 Constant memoryRemapBlock::blockPage#1 = $80 Constant memoryRemapBlock::memoryPage#1 = $100 Constant memoryRemap::remapBlocks#1 = MEMORYBLOCK_4000|MEMORYBLOCK_8000 Constant memoryRemap::lowerPageOffset#1 = $c0 Constant memoryRemap::upperPageOffset#1 = $80 Constant main::i#0 = 0 Constant memoryRemap256M::remapBlocks#0 = MEMORYBLOCK_4000 Constant memoryRemap256M::lowerPageOffset#0 = (unumber)$ff800-$40 Constant memoryRemap256M::upperPageOffset#0 = 0 Constant main::i1#0 = 0 Constant memoryRemap256M::remapBlocks#1 = 0 Constant memoryRemap256M::lowerPageOffset#1 = 0 Constant memoryRemap256M::upperPageOffset#1 = 0 Successful SSA optimization Pass2ConstantIdentification Simplifying expression containing zero main::BLOCK_4000 in [42] main::BLOCK_4000[0] = '-' Successful SSA optimization PassNSimplifyExpressionWithZero Removing unused procedure __start Removing unused procedure block __start Removing unused procedure block __start::@1 Removing unused procedure block __start::@return Successful SSA optimization PassNEliminateEmptyStart Rewriting division to use shift [15] memoryRemapBlock::block#0 = memoryRemapBlock::blockPage#2 / $20 Successful SSA optimization Pass2MultiplyToShiftRewriting Inlining constant with var siblings memoryRemap::remapBlocks#1 Inlining constant with var siblings memoryRemap::lowerPageOffset#1 Inlining constant with var siblings memoryRemap::upperPageOffset#1 Inlining constant with var siblings memoryRemapBlock::blockPage#0 Inlining constant with var siblings memoryRemapBlock::memoryPage#0 Inlining constant with var siblings memoryRemapBlock::blockPage#1 Inlining constant with var siblings memoryRemapBlock::memoryPage#1 Inlining constant with var siblings memoryRemap256M::remapBlocks#0 Inlining constant with var siblings memoryRemap256M::lowerPageOffset#0 Inlining constant with var siblings memoryRemap256M::upperPageOffset#0 Inlining constant with var siblings memoryRemap256M::remapBlocks#1 Inlining constant with var siblings memoryRemap256M::lowerPageOffset#1 Inlining constant with var siblings memoryRemap256M::upperPageOffset#1 Inlining constant with var siblings main::i#0 Inlining constant with var siblings main::i1#0 Constant inlined memoryRemap::remapBlocks#1 = MEMORYBLOCK_4000|MEMORYBLOCK_8000 Constant inlined memoryRemapBlock::blockPage#1 = $80 Constant inlined memoryRemapBlock::blockPage#0 = $40 Constant inlined memoryRemap::upperPageOffset#1 = $80 Constant inlined memoryRemapBlock::memoryPage#1 = $100 Constant inlined memoryRemapBlock::memoryPage#0 = $100 Constant inlined memoryRemap256M::upperPageOffset#1 = 0 Constant inlined memoryRemap256M::upperPageOffset#0 = 0 Constant inlined memoryRemap::lowerPageOffset#1 = $c0 Constant inlined main::i#0 = 0 Constant inlined main::i1#0 = 0 Constant inlined memoryRemap256M::lowerPageOffset#0 = (unsigned long)$ff800-$40 Constant inlined memoryRemap256M::lowerPageOffset#1 = 0 Constant inlined memoryRemap256M::remapBlocks#1 = 0 Constant inlined memoryRemap256M::remapBlocks#0 = MEMORYBLOCK_4000 Successful SSA optimization Pass2ConstantInlining 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 memoryRemapBlock::memoryPage#2 $100 Identical Phi Values memoryRemap256M::upperPageOffset#2 0 Successful SSA optimization Pass2IdenticalPhiElimination Constant right-side identified [25] memoryRemap256M::$2 = 0 >> 4 Constant right-side identified [32] memoryRemap256M::yVal = byte0 0 Constant right-side identified [34] memoryRemap256M::$11 = byte1 0 Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemap256M::$2 = 0>>4 Constant memoryRemap256M::$11 = byte1 0 Successful SSA optimization Pass2ConstantIdentification Constant value identified (unsigned int)memoryRemap256M::$2 in [26] memoryRemap256M::uMb = byte1 (unsigned int)memoryRemap256M::$2 Successful SSA optimization Pass2ConstantValues Simplifying constant evaluating to zero 0>>4 in Simplifying constant evaluating to zero byte1 0 in Simplifying constant evaluating to zero (unsigned int)memoryRemap256M::$2 in [26] memoryRemap256M::uMb = byte1 (unsigned int)memoryRemap256M::$2 Simplifying constant evaluating to zero byte0 0 in [32] memoryRemap256M::yVal = byte0 0 Successful SSA optimization PassNSimplifyConstantZero Eliminating unused constant memoryRemap256M::$2 Successful SSA optimization PassNEliminateUnusedVars Constant inlined memoryRemap256M::$11 = 0 Successful SSA optimization Pass2ConstantInlining Constant right-side identified [25] memoryRemap256M::uMb = byte1 0 Constant right-side identified [33] memoryRemap256M::$12 = 0 & $f Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemap256M::$12 = 0&$f Successful SSA optimization Pass2ConstantIdentification Simplifying constant evaluating to zero 0&$f in Simplifying constant evaluating to zero byte1 0 in [25] memoryRemap256M::uMb = byte1 0 Successful SSA optimization PassNSimplifyConstantZero Simplifying expression containing zero memoryRemap256M::$10 in [34] memoryRemap256M::zVal = memoryRemap256M::$10 | memoryRemap256M::$12 Successful SSA optimization PassNSimplifyExpressionWithZero Eliminating unused constant memoryRemap256M::$12 Successful SSA optimization PassNEliminateUnusedVars Alias candidate removed (volatile)memoryRemap256M::zVal = memoryRemap256M::$10 Finalized unsigned number type (char) 8 Finalized unsigned number type (char) 8 Finalized unsigned number type (unsigned long) $ff800 Finalized unsigned number type (char) $40 Successful SSA optimization PassNFinalizeNumberTypeConversions Simplifying constant integer cast $ff800-$40 Successful SSA optimization PassNCastSimplification Alias candidate removed (volatile)memoryRemap256M::zVal = memoryRemap256M::$10 Alias candidate removed (volatile)memoryRemap256M::zVal = memoryRemap256M::$10 Adding NOP phi() at start of main 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:13 memoryRemap256M:18 Calls in [memoryRemapBlock] to memoryRemap:38 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 void main() main: scope:[main] from [0] phi() [1] call memoryRemapBlock to:main::@7 main::@7: scope:[main] from main [2] *main::BLOCK_4000 = '-' [3] *(main::BLOCK_4000+1) = '*' [4] call memoryRemapBlock to:main::@8 main::@8: scope:[main] from main::@7 [5] *(main::BLOCK_8000+2) = '-' [6] *(main::BLOCK_8000+3) = '*' [7] call memoryRemap to:main::@9 main::@9: scope:[main] from main::@8 [8] *(main::BLOCK_8000+4) = *(main::BLOCK_4000+2) [9] *(main::BLOCK_4000+5) = *(main::BLOCK_8000+1) to:main::@1 main::@1: scope:[main] from main::@2 main::@9 [10] main::i#2 = phi( main::@2/main::i#1, main::@9/0 ) [11] if(main::i#2<6) goto main::@2 to:main::@3 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] main::i1#2 = phi( main::@3/0, main::@5/main::i1#1 ) [15] if(main::i1#2<$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::@6 [18] return to:@return main::@5: scope:[main] from main::@4 [19] main::$7 = $40 + main::i1#2 [20] main::BLOCK_4000[main::i1#2] = main::$7 [21] main::i1#1 = ++ main::i1#2 to:main::@4 main::@2: scope:[main] from main::@1 [22] (DEFAULT_SCREEN+$50-6)[main::i#2] = main::BLOCK_4000[main::i#2] [23] main::i#1 = ++ main::i#2 to:main::@1 void memoryRemapBlock(char blockPage , unsigned int memoryPage) memoryRemapBlock: scope:[memoryRemapBlock] from main main::@7 [24] memoryRemapBlock::blockPage#2 = phi( main/$40, main::@7/$80 ) [25] memoryRemapBlock::pageOffset#0 = $100 - memoryRemapBlock::blockPage#2 [26] memoryRemapBlock::block#0 = memoryRemapBlock::blockPage#2 >> 5 [27] memoryRemapBlock::blockBits#0 = 1 << memoryRemapBlock::block#0 [28] memoryRemap::remapBlocks#0 = memoryRemapBlock::blockBits#0 [29] memoryRemap::lowerPageOffset#0 = memoryRemapBlock::pageOffset#0 [30] memoryRemap::upperPageOffset#0 = memoryRemapBlock::pageOffset#0 [31] call memoryRemap to:memoryRemapBlock::@return memoryRemapBlock::@return: scope:[memoryRemapBlock] from memoryRemapBlock [32] return to:@return void memoryRemap(char remapBlocks , unsigned int lowerPageOffset , unsigned int upperPageOffset) memoryRemap: scope:[memoryRemap] from main::@8 memoryRemapBlock [33] memoryRemap::upperPageOffset#2 = phi( main::@8/$80, memoryRemapBlock/memoryRemap::upperPageOffset#0 ) [33] memoryRemap::remapBlocks#2 = phi( main::@8/MEMORYBLOCK_4000|MEMORYBLOCK_8000, memoryRemapBlock/memoryRemap::remapBlocks#0 ) [33] memoryRemap::lowerPageOffset#2 = phi( main::@8/$c0, memoryRemapBlock/memoryRemap::lowerPageOffset#0 ) [34] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#2 [35] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 [36] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#2 [37] memoryRemap::$3 = memoryRemap::$2 & $f [38] memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 [39] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#2 [40] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 [41] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#2 [42] memoryRemap::$8 = memoryRemap::$7 & $f [43] memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap::@return memoryRemap::@return: scope:[memoryRemap] from memoryRemap [45] return to:@return void memoryRemap256M(char remapBlocks , unsigned long lowerPageOffset , unsigned long upperPageOffset) memoryRemap256M: scope:[memoryRemap256M] from main::@3 main::@6 [46] memoryRemap256M::remapBlocks#2 = phi( main::@3/MEMORYBLOCK_4000, main::@6/0 ) [46] memoryRemap256M::lowerPageOffset#2 = phi( main::@3/$ff800-$40, main::@6/0 ) [47] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 [48] memoryRemap256M::lMb = byte1 (unsigned int)memoryRemap256M::$0 [49] memoryRemap256M::uMb = 0 [50] memoryRemap256M::aVal = byte0 memoryRemap256M::lowerPageOffset#2 [51] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 [52] memoryRemap256M::$6 = byte1 memoryRemap256M::lowerPageOffset#2 [53] memoryRemap256M::$7 = memoryRemap256M::$6 & $f [54] memoryRemap256M::xVal = memoryRemap256M::$5 | memoryRemap256M::$7 [55] memoryRemap256M::yVal = 0 [56] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 [57] memoryRemap256M::zVal = memoryRemap256M::$10 asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap256M::@return memoryRemap256M::@return: scope:[memoryRemap256M] from memoryRemap256M [59] return to:@return VARIABLE REGISTER WEIGHTS void main() char main::$7 // 22.0 char main::i char main::i#1 // 22.0 char main::i#2 // 18.333333333333332 char main::i1 char main::i1#1 // 22.0 char main::i1#2 // 13.75 void memoryRemap(char remapBlocks , unsigned int lowerPageOffset , unsigned int upperPageOffset) char memoryRemap::$1 // 67.33333333333333 char memoryRemap::$2 // 202.0 char memoryRemap::$3 // 202.0 char memoryRemap::$6 // 67.33333333333333 char memoryRemap::$7 // 202.0 char memoryRemap::$8 // 202.0 __loadstore volatile char memoryRemap::aVal // 10.1 unsigned int memoryRemap::lowerPageOffset unsigned int memoryRemap::lowerPageOffset#0 // 11.0 unsigned int memoryRemap::lowerPageOffset#2 // 71.0 char memoryRemap::remapBlocks char memoryRemap::remapBlocks#0 // 7.333333333333333 char memoryRemap::remapBlocks#2 // 30.42857142857143 unsigned int memoryRemap::upperPageOffset unsigned int memoryRemap::upperPageOffset#0 // 22.0 unsigned int memoryRemap::upperPageOffset#2 // 26.625 __loadstore volatile char memoryRemap::xVal // 16.833333333333332 __loadstore volatile char memoryRemap::yVal // 20.2 __loadstore volatile char memoryRemap::zVal // 101.0 void memoryRemap256M(char remapBlocks , unsigned long lowerPageOffset , unsigned long upperPageOffset) unsigned long memoryRemap256M::$0 // 11.0 char memoryRemap256M::$10 // 22.0 char memoryRemap256M::$5 // 7.333333333333333 char memoryRemap256M::$6 // 22.0 char memoryRemap256M::$7 // 22.0 __loadstore volatile char memoryRemap256M::aVal // 1.375 __loadstore volatile char memoryRemap256M::lMb // 1.1 unsigned long memoryRemap256M::lowerPageOffset unsigned long memoryRemap256M::lowerPageOffset#2 // 5.5 char memoryRemap256M::remapBlocks char memoryRemap256M::remapBlocks#2 // 2.2 __loadstore volatile char memoryRemap256M::uMb // 1.2222222222222223 unsigned long memoryRemap256M::upperPageOffset __loadstore volatile char memoryRemap256M::xVal // 2.75 __loadstore volatile char memoryRemap256M::yVal // 3.6666666666666665 __loadstore volatile char memoryRemap256M::zVal // 11.0 void memoryRemapBlock(char blockPage , unsigned int memoryPage) char memoryRemapBlock::block char memoryRemapBlock::block#0 // 22.0 char memoryRemapBlock::blockBits char memoryRemapBlock::blockBits#0 // 22.0 char memoryRemapBlock::blockPage char memoryRemapBlock::blockPage#2 // 11.0 unsigned int memoryRemapBlock::memoryPage unsigned int memoryRemapBlock::pageOffset unsigned int 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#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 ] Added variable memoryRemap::aVal to live range equivalence class [ memoryRemap::aVal ] Added variable memoryRemap::$1 to live range equivalence class [ memoryRemap::$1 ] Added variable memoryRemap::$2 to live range equivalence class [ memoryRemap::$2 ] Added variable memoryRemap::$3 to live range equivalence class [ memoryRemap::$3 ] Added variable memoryRemap::xVal to live range equivalence class [ memoryRemap::xVal ] Added variable memoryRemap::yVal to live range equivalence class [ memoryRemap::yVal ] Added variable memoryRemap::$6 to live range equivalence class [ memoryRemap::$6 ] Added variable memoryRemap::$7 to live range equivalence class [ memoryRemap::$7 ] Added variable memoryRemap::$8 to live range equivalence class [ memoryRemap::$8 ] Added variable memoryRemap::zVal to live range equivalence class [ memoryRemap::zVal ] Added variable memoryRemap256M::$0 to live range equivalence class [ memoryRemap256M::$0 ] Added variable memoryRemap256M::lMb to live range equivalence class [ memoryRemap256M::lMb ] Added variable memoryRemap256M::uMb to live range equivalence class [ memoryRemap256M::uMb ] Added variable memoryRemap256M::aVal to live range equivalence class [ memoryRemap256M::aVal ] Added variable memoryRemap256M::$5 to live range equivalence class [ memoryRemap256M::$5 ] Added variable memoryRemap256M::$6 to live range equivalence class [ memoryRemap256M::$6 ] Added variable memoryRemap256M::$7 to live range equivalence class [ memoryRemap256M::$7 ] Added variable memoryRemap256M::xVal to live range equivalence class [ memoryRemap256M::xVal ] Added variable memoryRemap256M::yVal to live range equivalence class [ memoryRemap256M::yVal ] Added variable memoryRemap256M::$10 to live range equivalence class [ memoryRemap256M::$10 ] Added variable memoryRemap256M::zVal to live range equivalence class [ memoryRemap256M::zVal ] Complete equivalence classes [ main::i#2 main::i#1 ] [ main::i1#2 main::i1#1 ] [ memoryRemapBlock::blockPage#2 ] [ 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 ] [ memoryRemap::aVal ] [ memoryRemap::$1 ] [ memoryRemap::$2 ] [ memoryRemap::$3 ] [ memoryRemap::xVal ] [ memoryRemap::yVal ] [ memoryRemap::$6 ] [ memoryRemap::$7 ] [ memoryRemap::$8 ] [ memoryRemap::zVal ] [ memoryRemap256M::$0 ] [ memoryRemap256M::lMb ] [ memoryRemap256M::uMb ] [ memoryRemap256M::aVal ] [ memoryRemap256M::$5 ] [ memoryRemap256M::$6 ] [ memoryRemap256M::$7 ] [ memoryRemap256M::xVal ] [ memoryRemap256M::yVal ] [ memoryRemap256M::$10 ] [ memoryRemap256M::zVal ] Allocated zp[1]:2 [ memoryRemap::$2 ] Allocated zp[1]:3 [ memoryRemap::$3 ] Allocated zp[1]:4 [ memoryRemap::$7 ] Allocated zp[1]:5 [ memoryRemap::$8 ] Allocated zp[1]:6 [ memoryRemap::zVal ] Allocated zp[2]:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] Allocated zp[1]:9 [ memoryRemap::$1 ] Allocated zp[1]:10 [ memoryRemap::$6 ] Allocated zp[2]:11 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] Allocated zp[1]:13 [ main::i#2 main::i#1 ] Allocated zp[1]:14 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] Allocated zp[1]:15 [ main::i1#2 main::i1#1 ] Allocated zp[1]:16 [ main::$7 ] Allocated zp[1]:17 [ memoryRemapBlock::block#0 ] Allocated zp[1]:18 [ memoryRemapBlock::blockBits#0 ] Allocated zp[1]:19 [ memoryRemap256M::$6 ] Allocated zp[1]:20 [ memoryRemap256M::$7 ] Allocated zp[1]:21 [ memoryRemap256M::$10 ] Allocated zp[1]:22 [ memoryRemap::yVal ] Allocated zp[1]:23 [ memoryRemap::xVal ] Allocated zp[1]:24 [ memoryRemapBlock::blockPage#2 ] Allocated zp[4]:25 [ memoryRemap256M::$0 ] Allocated zp[1]:29 [ memoryRemap256M::zVal ] Allocated zp[1]:30 [ memoryRemap::aVal ] Allocated zp[1]:31 [ memoryRemap256M::$5 ] Allocated zp[2]:32 [ memoryRemapBlock::pageOffset#0 ] Allocated zp[4]:34 [ memoryRemap256M::lowerPageOffset#2 ] Allocated zp[1]:38 [ memoryRemap256M::yVal ] Allocated zp[1]:39 [ memoryRemap256M::xVal ] Allocated zp[1]:40 [ memoryRemap256M::remapBlocks#2 ] Allocated zp[1]:41 [ memoryRemap256M::aVal ] Allocated zp[1]:42 [ memoryRemap256M::uMb ] Allocated zp[1]:43 [ memoryRemap256M::lMb ] REGISTER UPLIFT POTENTIAL REGISTERS Statement [2] *main::BLOCK_4000 = '-' [ ] ( [ ] { } ) always clobbers reg byte z Statement [3] *(main::BLOCK_4000+1) = '*' [ ] ( [ ] { } ) always clobbers reg byte z Statement [5] *(main::BLOCK_8000+2) = '-' [ ] ( [ ] { } ) always clobbers reg byte z Statement [6] *(main::BLOCK_8000+3) = '*' [ ] ( [ ] { } ) always clobbers reg byte z Statement [8] *(main::BLOCK_8000+4) = *(main::BLOCK_4000+2) [ ] ( [ ] { } ) always clobbers reg byte a Statement [9] *(main::BLOCK_4000+5) = *(main::BLOCK_8000+1) [ ] ( [ ] { } ) always clobbers reg byte a Statement [19] main::$7 = $40 + 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]:15 [ main::i1#2 main::i1#1 ] Statement [22] (DEFAULT_SCREEN+$50-6)[main::i#2] = main::BLOCK_4000[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]:13 [ main::i#2 main::i#1 ] Statement [25] memoryRemapBlock::pageOffset#0 = $100 - 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]:24 [ memoryRemapBlock::blockPage#2 ] Statement [26] memoryRemapBlock::block#0 = memoryRemapBlock::blockPage#2 >> 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] memoryRemapBlock::blockBits#0 = 1 << 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] memoryRemap::lowerPageOffset#0 = 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]:14 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] Statement [30] memoryRemap::upperPageOffset#0 = 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 [34] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#2 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal ] ( memoryRemap:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal ] { { 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::aVal ] { { 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 [35] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] ( memoryRemap:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal 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::aVal 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 [37] memoryRemap::$3 = memoryRemap::$2 & $f [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] ( memoryRemap:7 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal 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::aVal 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]:9 [ memoryRemap::$1 ] Statement [39] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#2 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal ] ( memoryRemap:7 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal ] { { 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::aVal memoryRemap::xVal memoryRemap::yVal ] { { 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 [40] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] ( memoryRemap:7 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal 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::aVal memoryRemap::xVal memoryRemap::yVal 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 [42] memoryRemap::$8 = memoryRemap::$7 & $f [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] ( memoryRemap:7 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal 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::aVal memoryRemap::xVal memoryRemap::yVal 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]:10 [ 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 [47] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 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]:40 [ memoryRemap256M::remapBlocks#2 ] Statement [48] memoryRemap256M::lMb = byte1 (unsigned int)memoryRemap256M::$0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb ] { } ) always clobbers reg byte a Statement [49] memoryRemap256M::uMb = 0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] { } ) always clobbers reg byte z Removing always clobbered register reg byte z as potential for zp[1]:40 [ memoryRemap256M::remapBlocks#2 ] Statement [50] memoryRemap256M::aVal = byte0 memoryRemap256M::lowerPageOffset#2 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal ] { } ) always clobbers reg byte a Statement [51] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] { } ) always clobbers reg byte a Statement [53] memoryRemap256M::$7 = memoryRemap256M::$6 & $f [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] { } ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp[1]:31 [ memoryRemap256M::$5 ] Statement [55] memoryRemap256M::yVal = 0 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] { } ) always clobbers reg byte z Statement [56] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] ( memoryRemap256M:13 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] { } memoryRemap256M:17 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] { } ) always clobbers reg byte a Statement asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } always clobbers reg byte a reg byte x reg byte y reg byte z Statement [2] *main::BLOCK_4000 = '-' [ ] ( [ ] { } ) always clobbers reg byte z Statement [3] *(main::BLOCK_4000+1) = '*' [ ] ( [ ] { } ) always clobbers reg byte z Statement [5] *(main::BLOCK_8000+2) = '-' [ ] ( [ ] { } ) always clobbers reg byte z Statement [6] *(main::BLOCK_8000+3) = '*' [ ] ( [ ] { } ) always clobbers reg byte z Statement [8] *(main::BLOCK_8000+4) = *(main::BLOCK_4000+2) [ ] ( [ ] { } ) always clobbers reg byte a Statement [9] *(main::BLOCK_4000+5) = *(main::BLOCK_8000+1) [ ] ( [ ] { } ) always clobbers reg byte a Statement [19] main::$7 = $40 + main::i1#2 [ main::i1#2 main::$7 ] ( [ main::i1#2 main::$7 ] { } ) always clobbers reg byte a Statement [22] (DEFAULT_SCREEN+$50-6)[main::i#2] = main::BLOCK_4000[main::i#2] [ main::i#2 ] ( [ main::i#2 ] { } ) always clobbers reg byte a Statement [25] memoryRemapBlock::pageOffset#0 = $100 - 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] memoryRemapBlock::block#0 = memoryRemapBlock::blockPage#2 >> 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] memoryRemapBlock::blockBits#0 = 1 << 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] memoryRemap::lowerPageOffset#0 = 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] memoryRemap::upperPageOffset#0 = 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 [34] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#2 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal ] ( memoryRemap:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal ] { { 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::aVal ] { { 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 [35] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] ( memoryRemap:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal 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::aVal 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 [37] memoryRemap::$3 = memoryRemap::$2 & $f [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] ( memoryRemap:7 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal 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::aVal 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 [39] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#2 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal ] ( memoryRemap:7 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal ] { { 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::aVal memoryRemap::xVal memoryRemap::yVal ] { { 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 [40] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] ( memoryRemap:7 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal 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::aVal memoryRemap::xVal memoryRemap::yVal 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 [42] memoryRemap::$8 = memoryRemap::$7 & $f [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] ( memoryRemap:7 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal 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::aVal memoryRemap::xVal memoryRemap::yVal 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 [47] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 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 [48] memoryRemap256M::lMb = byte1 (unsigned int)memoryRemap256M::$0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb ] { } ) always clobbers reg byte a Statement [49] memoryRemap256M::uMb = 0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] { } ) always clobbers reg byte z Statement [50] memoryRemap256M::aVal = byte0 memoryRemap256M::lowerPageOffset#2 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal ] { } ) always clobbers reg byte a Statement [51] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] { } ) always clobbers reg byte a Statement [53] memoryRemap256M::$7 = memoryRemap256M::$6 & $f [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] { } ) always clobbers reg byte a Statement [55] memoryRemap256M::yVal = 0 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] { } ) always clobbers reg byte z Statement [56] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] ( memoryRemap256M:13 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] { } memoryRemap256M:17 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] { } ) always clobbers reg byte a Statement asm { ldalMb ldx#$0f ldyuMb ldz#$0f 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]:13 [ main::i#2 main::i#1 ] : zp[1]:13 , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:15 [ main::i1#2 main::i1#1 ] : zp[1]:15 , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:24 [ memoryRemapBlock::blockPage#2 ] : zp[1]:24 , reg byte x , reg byte y , reg byte z , Potential registers zp[2]:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] : zp[2]:7 , Potential registers zp[1]:14 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] : zp[1]:14 , reg byte x , reg byte y , reg byte z , Potential registers zp[2]:11 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] : zp[2]:11 , Potential registers zp[4]:34 [ memoryRemap256M::lowerPageOffset#2 ] : zp[4]:34 , Potential registers zp[1]:40 [ memoryRemap256M::remapBlocks#2 ] : zp[1]:40 , reg byte x , reg byte y , Potential registers zp[1]:16 [ main::$7 ] : zp[1]:16 , reg byte a , reg byte x , reg byte y , reg byte z , Potential registers zp[2]:32 [ memoryRemapBlock::pageOffset#0 ] : zp[2]:32 , Potential registers zp[1]:17 [ memoryRemapBlock::block#0 ] : zp[1]:17 , reg byte a , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:18 [ memoryRemapBlock::blockBits#0 ] : zp[1]:18 , reg byte a , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:30 [ memoryRemap::aVal ] : zp[1]:30 , Potential registers zp[1]:9 [ memoryRemap::$1 ] : zp[1]:9 , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:2 [ memoryRemap::$2 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:3 [ memoryRemap::$3 ] : zp[1]:3 , reg byte a , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:23 [ memoryRemap::xVal ] : zp[1]:23 , Potential registers zp[1]:22 [ memoryRemap::yVal ] : zp[1]:22 , Potential registers zp[1]:10 [ memoryRemap::$6 ] : zp[1]:10 , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:4 [ memoryRemap::$7 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:5 [ memoryRemap::$8 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:6 [ memoryRemap::zVal ] : zp[1]:6 , Potential registers zp[4]:25 [ memoryRemap256M::$0 ] : zp[4]:25 , Potential registers zp[1]:43 [ memoryRemap256M::lMb ] : zp[1]:43 , Potential registers zp[1]:42 [ memoryRemap256M::uMb ] : zp[1]:42 , Potential registers zp[1]:41 [ memoryRemap256M::aVal ] : zp[1]:41 , Potential registers zp[1]:31 [ memoryRemap256M::$5 ] : zp[1]:31 , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:19 [ memoryRemap256M::$6 ] : zp[1]:19 , reg byte a , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:20 [ memoryRemap256M::$7 ] : zp[1]:20 , reg byte a , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:39 [ memoryRemap256M::xVal ] : zp[1]:39 , Potential registers zp[1]:38 [ memoryRemap256M::yVal ] : zp[1]:38 , Potential registers zp[1]:21 [ memoryRemap256M::$10 ] : zp[1]:21 , reg byte a , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:29 [ memoryRemap256M::zVal ] : zp[1]:29 , REGISTER UPLIFT SCOPES Uplift Scope [memoryRemap] 202: zp[1]:2 [ memoryRemap::$2 ] 202: zp[1]:3 [ memoryRemap::$3 ] 202: zp[1]:4 [ memoryRemap::$7 ] 202: zp[1]:5 [ memoryRemap::$8 ] 101: zp[1]:6 [ memoryRemap::zVal ] 82: zp[2]:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] 67.33: zp[1]:9 [ memoryRemap::$1 ] 67.33: zp[1]:10 [ memoryRemap::$6 ] 48.62: zp[2]:11 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] 37.76: zp[1]:14 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] 20.2: zp[1]:22 [ memoryRemap::yVal ] 16.83: zp[1]:23 [ memoryRemap::xVal ] 10.1: zp[1]:30 [ memoryRemap::aVal ] Uplift Scope [memoryRemap256M] 22: zp[1]:19 [ memoryRemap256M::$6 ] 22: zp[1]:20 [ memoryRemap256M::$7 ] 22: zp[1]:21 [ memoryRemap256M::$10 ] 11: zp[4]:25 [ memoryRemap256M::$0 ] 11: zp[1]:29 [ memoryRemap256M::zVal ] 7.33: zp[1]:31 [ memoryRemap256M::$5 ] 5.5: zp[4]:34 [ memoryRemap256M::lowerPageOffset#2 ] 3.67: zp[1]:38 [ memoryRemap256M::yVal ] 2.75: zp[1]:39 [ memoryRemap256M::xVal ] 2.2: zp[1]:40 [ memoryRemap256M::remapBlocks#2 ] 1.38: zp[1]:41 [ memoryRemap256M::aVal ] 1.22: zp[1]:42 [ memoryRemap256M::uMb ] 1.1: zp[1]:43 [ memoryRemap256M::lMb ] Uplift Scope [main] 40.33: zp[1]:13 [ main::i#2 main::i#1 ] 35.75: zp[1]:15 [ main::i1#2 main::i1#1 ] 22: zp[1]:16 [ main::$7 ] Uplift Scope [memoryRemapBlock] 22: zp[1]:17 [ memoryRemapBlock::block#0 ] 22: zp[1]:18 [ memoryRemapBlock::blockBits#0 ] 11: zp[1]:24 [ memoryRemapBlock::blockPage#2 ] 6.6: zp[2]:32 [ 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 [F018_DMAGIC] Uplift Scope [DMA_LIST_F018A] Uplift Scope [DMA_LIST_F018B] Uplift Scope [] Uplifting [memoryRemap] best 1374 combination reg byte a [ memoryRemap::$2 ] reg byte a [ memoryRemap::$3 ] reg byte a [ memoryRemap::$7 ] zp[1]:5 [ memoryRemap::$8 ] zp[1]:6 [ memoryRemap::zVal ] zp[2]:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] zp[1]:9 [ memoryRemap::$1 ] zp[1]:10 [ memoryRemap::$6 ] zp[2]:11 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] zp[1]:14 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] zp[1]:22 [ memoryRemap::yVal ] zp[1]:23 [ memoryRemap::xVal ] zp[1]:30 [ memoryRemap::aVal ] Limited combination testing to 100 combinations of 40000 possible. Uplifting [memoryRemap256M] best 1356 combination reg byte a [ memoryRemap256M::$6 ] reg byte a [ memoryRemap256M::$7 ] reg byte a [ memoryRemap256M::$10 ] zp[4]:25 [ memoryRemap256M::$0 ] zp[1]:29 [ memoryRemap256M::zVal ] zp[1]:31 [ memoryRemap256M::$5 ] zp[4]:34 [ memoryRemap256M::lowerPageOffset#2 ] zp[1]:38 [ memoryRemap256M::yVal ] zp[1]:39 [ memoryRemap256M::xVal ] zp[1]:40 [ memoryRemap256M::remapBlocks#2 ] zp[1]:41 [ memoryRemap256M::aVal ] zp[1]:42 [ memoryRemap256M::uMb ] zp[1]:43 [ memoryRemap256M::lMb ] Limited combination testing to 100 combinations of 1500 possible. Uplifting [main] best 1046 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 1032 combination reg byte a [ memoryRemapBlock::block#0 ] reg byte a [ memoryRemapBlock::blockBits#0 ] reg byte x [ memoryRemapBlock::blockPage#2 ] zp[2]:32 [ memoryRemapBlock::pageOffset#0 ] Uplifting [MOS6526_CIA] best 1032 combination Uplifting [MOS6569_VICII] best 1032 combination Uplifting [MOS6581_SID] best 1032 combination Uplifting [MOS4569_VICIII] best 1032 combination Uplifting [MEGA65_VICIV] best 1032 combination Uplifting [F018_DMAGIC] best 1032 combination Uplifting [DMA_LIST_F018A] best 1032 combination Uplifting [DMA_LIST_F018B] best 1032 combination Uplifting [] best 1032 combination Attempting to uplift remaining variables inzp[1]:5 [ memoryRemap::$8 ] Uplifting [memoryRemap] best 1026 combination reg byte a [ memoryRemap::$8 ] Attempting to uplift remaining variables inzp[1]:6 [ memoryRemap::zVal ] Uplifting [memoryRemap] best 1026 combination zp[1]:6 [ memoryRemap::zVal ] Attempting to uplift remaining variables inzp[1]:9 [ memoryRemap::$1 ] Uplifting [memoryRemap] best 1026 combination zp[1]:9 [ memoryRemap::$1 ] Attempting to uplift remaining variables inzp[1]:10 [ memoryRemap::$6 ] Uplifting [memoryRemap] best 1026 combination zp[1]:10 [ memoryRemap::$6 ] Attempting to uplift remaining variables inzp[1]:14 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] Uplifting [memoryRemap] best 1017 combination reg byte z [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] Attempting to uplift remaining variables inzp[1]:22 [ memoryRemap::yVal ] Uplifting [memoryRemap] best 1017 combination zp[1]:22 [ memoryRemap::yVal ] Attempting to uplift remaining variables inzp[1]:23 [ memoryRemap::xVal ] Uplifting [memoryRemap] best 1017 combination zp[1]:23 [ memoryRemap::xVal ] Attempting to uplift remaining variables inzp[1]:29 [ memoryRemap256M::zVal ] Uplifting [memoryRemap256M] best 1017 combination zp[1]:29 [ memoryRemap256M::zVal ] Attempting to uplift remaining variables inzp[1]:30 [ memoryRemap::aVal ] Uplifting [memoryRemap] best 1017 combination zp[1]:30 [ memoryRemap::aVal ] Attempting to uplift remaining variables inzp[1]:31 [ memoryRemap256M::$5 ] Uplifting [memoryRemap256M] best 1017 combination zp[1]:31 [ memoryRemap256M::$5 ] Attempting to uplift remaining variables inzp[1]:38 [ memoryRemap256M::yVal ] Uplifting [memoryRemap256M] best 1017 combination zp[1]:38 [ memoryRemap256M::yVal ] Attempting to uplift remaining variables inzp[1]:39 [ memoryRemap256M::xVal ] Uplifting [memoryRemap256M] best 1017 combination zp[1]:39 [ memoryRemap256M::xVal ] Attempting to uplift remaining variables inzp[1]:40 [ memoryRemap256M::remapBlocks#2 ] Uplifting [memoryRemap256M] best 1009 combination reg byte x [ memoryRemap256M::remapBlocks#2 ] Attempting to uplift remaining variables inzp[1]:41 [ memoryRemap256M::aVal ] Uplifting [memoryRemap256M] best 1009 combination zp[1]:41 [ memoryRemap256M::aVal ] Attempting to uplift remaining variables inzp[1]:42 [ memoryRemap256M::uMb ] Uplifting [memoryRemap256M] best 1009 combination zp[1]:42 [ memoryRemap256M::uMb ] Attempting to uplift remaining variables inzp[1]:43 [ memoryRemap256M::lMb ] Uplifting [memoryRemap256M] best 1009 combination zp[1]:43 [ memoryRemap256M::lMb ] Coalescing zero page register [ zp[2]:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] ] with [ zp[2]:32 [ memoryRemapBlock::pageOffset#0 ] ] - score: 1 Coalescing zero page register [ zp[1]:31 [ memoryRemap256M::$5 ] ] with [ zp[1]:9 [ memoryRemap::$1 ] ] Allocated (was zp[1]:6) zp[1]:2 [ memoryRemap::zVal ] Allocated (was zp[2]:7) zp[2]:3 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 ] Allocated (was zp[1]:31) zp[1]:5 [ memoryRemap256M::$5 memoryRemap::$1 ] Allocated (was zp[1]:10) zp[1]:6 [ memoryRemap::$6 ] Allocated (was zp[2]:11) zp[2]:7 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] Allocated (was zp[1]:22) zp[1]:9 [ memoryRemap::yVal ] Allocated (was zp[1]:23) zp[1]:10 [ memoryRemap::xVal ] Allocated (was zp[4]:25) zp[4]:11 [ memoryRemap256M::$0 ] Allocated (was zp[1]:29) zp[1]:15 [ memoryRemap256M::zVal ] Allocated (was zp[1]:30) zp[1]:16 [ memoryRemap::aVal ] Allocated (was zp[4]:34) zp[4]:17 [ memoryRemap256M::lowerPageOffset#2 ] Allocated (was zp[1]:38) zp[1]:21 [ memoryRemap256M::yVal ] Allocated (was zp[1]:39) zp[1]:22 [ memoryRemap256M::xVal ] Allocated (was zp[1]:41) zp[1]:23 [ memoryRemap256M::aVal ] Allocated (was zp[1]:42) zp[1]:24 [ memoryRemap256M::uMb ] Allocated (was zp[1]:43) zp[1]:25 [ memoryRemap256M::lMb ] 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 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. /// @file /// MEGA65 Registers and Constants /// @file /// The MOS 6526 Complex Interface Adapter (CIA) /// /// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf // Upstart .cpu _45gs02 // MEGA65 platform PRG executable starting in MEGA65 mode. .file [name="memorymap-test.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$2001] .segmentdef Code [start=$2017] .segmentdef Data [startAfter="Code"] .segment Basic .byte $0a, $20, $0a, $00, $fe, $02, $20, $30, $00 // 10 BANK 0 .byte $15, $20, $14, $00, $9e, $20 // 20 SYS .text toIntString(main) // NNNN .byte $00, $00, $00 // // Global Constants & labels /// Bit representing 8K block #2 of the 64K addressable memory ($4000-$5fff) .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 BLOCK_4000 = $4000 .label BLOCK_8000 = $8000 // [1] call memoryRemapBlock // Remap [$4000-$5fff] to point to [$10000-$11fff] // [24] phi from main to memoryRemapBlock [phi:main->memoryRemapBlock] memoryRemapBlock_from_main: // [24] phi memoryRemapBlock::blockPage#2 = $40 [phi:main->memoryRemapBlock#0] -- vbuxx=vbuc1 ldx #$40 jsr memoryRemapBlock jmp __b7 // main::@7 __b7: // [2] *main::BLOCK_4000 = '-' -- _deref_pbuc1=vbuc2 // Put '-', '*' into $10000 ldz #'-' stz BLOCK_4000 // [3] *(main::BLOCK_4000+1) = '*' -- _deref_pbuc1=vbuc2 ldz #'*' stz BLOCK_4000+1 // [4] call memoryRemapBlock // Remap [$8000-$9fff] to point to [$10000-$11fff] // [24] phi from main::@7 to memoryRemapBlock [phi:main::@7->memoryRemapBlock] memoryRemapBlock_from___b7: // [24] phi memoryRemapBlock::blockPage#2 = $80 [phi:main::@7->memoryRemapBlock#0] -- vbuxx=vbuc1 ldx #$80 jsr memoryRemapBlock jmp __b8 // main::@8 __b8: // [5] *(main::BLOCK_8000+2) = '-' -- _deref_pbuc1=vbuc2 // Put '-', '*' into $10002 ldz #'-' stz BLOCK_8000+2 // [6] *(main::BLOCK_8000+3) = '*' -- _deref_pbuc1=vbuc2 ldz #'*' stz BLOCK_8000+3 // [7] call memoryRemap // Remap [$4000-$5fff] and [$8000-$9fff] to both point to [$10000-$11fff] (notice usage of page offsets) // [33] phi from main::@8 to memoryRemap [phi:main::@8->memoryRemap] memoryRemap_from___b8: // [33] phi memoryRemap::upperPageOffset#2 = $80 [phi:main::@8->memoryRemap#0] -- vwuz1=vbuc1 lda #<$80 sta.z memoryRemap.upperPageOffset lda #>$80 sta.z memoryRemap.upperPageOffset+1 // [33] phi memoryRemap::remapBlocks#2 = MEMORYBLOCK_4000|MEMORYBLOCK_8000 [phi:main::@8->memoryRemap#1] -- vbuzz=vbuc1 ldz #MEMORYBLOCK_4000|MEMORYBLOCK_8000 // [33] phi memoryRemap::lowerPageOffset#2 = $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] *(main::BLOCK_8000+4) = *(main::BLOCK_4000+2) -- _deref_pbuc1=_deref_pbuc2 // Put '-', '*' into $10004 in a convoluted way lda BLOCK_4000+2 sta BLOCK_8000+4 // [9] *(main::BLOCK_4000+5) = *(main::BLOCK_8000+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 main::i#2 = 0 [phi:main::@9->main::@1#0] -- vbuxx=vbuc1 ldx #0 jmp __b1 // copy the resulting values onto the screen - it should show '-*-*-*' // main::@1 __b1: // [11] if(main::i#2<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: // [13] call memoryRemap256M // Remap [$4000-$5fff] to point to [$ff80000-$ff81fff] COLORRAM! (notice usage of page offsets) // [46] phi from main::@3 to memoryRemap256M [phi:main::@3->memoryRemap256M] memoryRemap256M_from___b3: // [46] phi memoryRemap256M::remapBlocks#2 = MEMORYBLOCK_4000 [phi:main::@3->memoryRemap256M#0] -- vbuxx=vbuc1 ldx #MEMORYBLOCK_4000 // [46] phi memoryRemap256M::lowerPageOffset#2 = $ff800-$40 [phi:main::@3->memoryRemap256M#1] -- vduz1=vduc1 lda #<$ff800-$40 sta.z memoryRemap256M.lowerPageOffset lda #>$ff800-$40 sta.z memoryRemap256M.lowerPageOffset+1 lda #<$ff800-$40>>$10 sta.z memoryRemap256M.lowerPageOffset+2 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 main::i1#2 = 0 [phi:main::@3->main::@4#0] -- vbuxx=vbuc1 ldx #0 jmp __b4 // Put colors in the upper screen line // main::@4 __b4: // [15] if(main::i1#2<$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! // [46] phi from main::@6 to memoryRemap256M [phi:main::@6->memoryRemap256M] memoryRemap256M_from___b6: // [46] phi memoryRemap256M::remapBlocks#2 = 0 [phi:main::@6->memoryRemap256M#0] -- vbuxx=vbuc1 ldx #0 // [46] phi memoryRemap256M::lowerPageOffset#2 = 0 [phi:main::@6->memoryRemap256M#1] -- vduz1=vbuc1 lda #0 sta.z memoryRemap256M.lowerPageOffset lda #0 sta.z memoryRemap256M.lowerPageOffset+1 sta.z memoryRemap256M.lowerPageOffset+2 sta.z memoryRemap256M.lowerPageOffset+3 jsr memoryRemap256M jmp __breturn // main::@return __breturn: // [18] return rts // main::@5 __b5: // [19] main::$7 = $40 + main::i1#2 -- vbuaa=vbuc1_plus_vbuxx txa clc adc #$40 // [20] main::BLOCK_4000[main::i1#2] = main::$7 -- pbuc1_derefidx_vbuxx=vbuaa sta BLOCK_4000,x // [21] main::i1#1 = ++ 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 main::i1#2 = main::i1#1 [phi:main::@5->main::@4#0] -- register_copy jmp __b4 // main::@2 __b2: // [22] (DEFAULT_SCREEN+$50-6)[main::i#2] = main::BLOCK_4000[main::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx lda BLOCK_4000,x sta DEFAULT_SCREEN+$50-6,x // [23] main::i#1 = ++ 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 main::i#2 = 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. // 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(__register(X) char blockPage, unsigned int memoryPage) memoryRemapBlock: { .label pageOffset = 3 // [25] memoryRemapBlock::pageOffset#0 = $100 - memoryRemapBlock::blockPage#2 -- vwuz1=vwuc1_minus_vbuxx // Find the page offset (the number of pages to offset the block) stx.z $ff lda #<$100 sec sbc.z $ff sta.z pageOffset lda #>$100 sbc #0 sta.z pageOffset+1 // [26] memoryRemapBlock::block#0 = memoryRemapBlock::blockPage#2 >> 5 -- vbuaa=vbuxx_ror_5 // Which block is being remapped? (0-7) txa lsr lsr lsr lsr lsr // [27] memoryRemapBlock::blockBits#0 = 1 << memoryRemapBlock::block#0 -- vbuaa=vbuc1_rol_vbuaa tay lda #1 cpy #0 beq !e+ !: asl dey bne !- !e: // [28] memoryRemap::remapBlocks#0 = memoryRemapBlock::blockBits#0 -- vbuzz=vbuaa taz // [29] memoryRemap::lowerPageOffset#0 = memoryRemapBlock::pageOffset#0 // [30] memoryRemap::upperPageOffset#0 = memoryRemapBlock::pageOffset#0 -- vwuz1=vwuz2 lda.z pageOffset sta.z memoryRemap.upperPageOffset lda.z pageOffset+1 sta.z memoryRemap.upperPageOffset+1 // [31] call memoryRemap // [33] phi from memoryRemapBlock to memoryRemap [phi:memoryRemapBlock->memoryRemap] memoryRemap_from_memoryRemapBlock: // [33] phi memoryRemap::upperPageOffset#2 = memoryRemap::upperPageOffset#0 [phi:memoryRemapBlock->memoryRemap#0] -- register_copy // [33] phi memoryRemap::remapBlocks#2 = memoryRemap::remapBlocks#0 [phi:memoryRemapBlock->memoryRemap#1] -- register_copy // [33] phi memoryRemap::lowerPageOffset#2 = memoryRemap::lowerPageOffset#0 [phi:memoryRemapBlock->memoryRemap#2] -- register_copy jsr memoryRemap jmp __breturn // memoryRemapBlock::@return __breturn: // [32] return rts } // memoryRemap // 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(__register(Z) char remapBlocks, __zp(3) unsigned int lowerPageOffset, __zp(7) unsigned int upperPageOffset) memoryRemap: { .label aVal = $10 .label xVal = $a .label __1 = 5 .label yVal = 9 .label zVal = 2 .label __6 = 6 .label lowerPageOffset = 3 .label upperPageOffset = 7 // [34] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#2 -- vbuz1=_byte0_vwuz2 // lower blocks offset page low lda.z lowerPageOffset sta.z aVal // [35] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 -- vbuz1=vbuzz_rol_4 tza asl asl asl asl sta.z __1 // [36] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#2 -- vbuaa=_byte1_vwuz1 lda.z lowerPageOffset+1 // [37] memoryRemap::$3 = memoryRemap::$2 & $f -- vbuaa=vbuaa_band_vbuc1 and #$f // [38] memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 -- vbuz1=vbuz2_bor_vbuaa // lower blocks to map + lower blocks offset high nibble ora.z __1 sta.z xVal // [39] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#2 -- vbuz1=_byte0_vwuz2 // upper blocks offset page lda.z upperPageOffset sta.z yVal // [40] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 -- vbuz1=vbuzz_band_vbuc1 tza and #$f0 sta.z __6 // [41] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#2 -- vbuaa=_byte1_vwuz1 lda.z upperPageOffset+1 // [42] memoryRemap::$8 = memoryRemap::$7 & $f -- vbuaa=vbuaa_band_vbuc1 and #$f // [43] memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 -- vbuz1=vbuz2_bor_vbuaa // upper blocks to map + upper blocks offset page high nibble ora.z __6 sta.z zVal // asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } lda aVal ldx xVal ldy yVal ldz zVal map eom jmp __breturn // memoryRemap::@return __breturn: // [45] return rts } // memoryRemap256M // Remap some of the eight 8K memory blocks in the 64K address space of the 6502 to point somewhere else in the entire 256MB memory space of the MEGA65. // After the remapping the CPU will access the mapped memory whenever it uses instructions that access a remapped block. // See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65. // See Appendix G in file:///Users/jespergravgaard/Downloads/MEGA65-Book_draft%20(5).pdf for a description of the CPU memory remapper of the MEGA65. // remapBlocks: Indicates which 8K blocks of the 6502 address space to remap. Each bit represents one 8K block // - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000. // - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000. // - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000. // - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000. // - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000. // - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000. // - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000. // - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000. // lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3). // The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 20bits of the passed value is used. // - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100. // - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000. // - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000. // - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000. // upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7). // The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 20bits of the passed value is used. // - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000 // - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000. // - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000. // - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000. // void memoryRemap256M(__register(X) char remapBlocks, __zp($11) unsigned long lowerPageOffset, unsigned long upperPageOffset) memoryRemap256M: { .label lMb = $19 .label __0 = $b .label uMb = $18 .label aVal = $17 .label xVal = $16 .label __5 = 5 .label yVal = $15 .label zVal = $f .label lowerPageOffset = $11 // [47] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 -- vduz1=vduz2_ror_4 lda.z lowerPageOffset+3 lsr sta.z __0+3 lda.z lowerPageOffset+2 ror sta.z __0+2 lda.z lowerPageOffset+1 ror sta.z __0+1 lda.z lowerPageOffset ror sta.z __0 lsr.z __0+3 ror.z __0+2 ror.z __0+1 ror.z __0 lsr.z __0+3 ror.z __0+2 ror.z __0+1 ror.z __0 lsr.z __0+3 ror.z __0+2 ror.z __0+1 ror.z __0 // [48] memoryRemap256M::lMb = byte1 (unsigned int)memoryRemap256M::$0 -- vbuz1=_byte1__word_vduz2 // lower blocks offset megabytes lda.z __0+1 sta.z lMb // [49] memoryRemap256M::uMb = 0 -- vbuz1=vbuc1 // upper blocks offset megabytes ldz #0 stz.z uMb // [50] memoryRemap256M::aVal = byte0 memoryRemap256M::lowerPageOffset#2 -- vbuz1=_byte0_vduz2 // lower blocks offset page low lda.z lowerPageOffset sta.z aVal // [51] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 -- vbuz1=vbuxx_rol_4 txa asl asl asl asl sta.z __5 // [52] memoryRemap256M::$6 = byte1 memoryRemap256M::lowerPageOffset#2 -- vbuaa=_byte1_vduz1 lda.z lowerPageOffset+1 // [53] memoryRemap256M::$7 = memoryRemap256M::$6 & $f -- vbuaa=vbuaa_band_vbuc1 and #$f // [54] memoryRemap256M::xVal = memoryRemap256M::$5 | memoryRemap256M::$7 -- vbuz1=vbuz2_bor_vbuaa // lower blocks to map + lower blocks offset high nibble ora.z __5 sta.z xVal // [55] memoryRemap256M::yVal = 0 -- vbuz1=vbuc1 // upper blocks offset page ldz #0 stz.z yVal // [56] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 -- vbuaa=vbuxx_band_vbuc1 txa and #$f0 // [57] memoryRemap256M::zVal = memoryRemap256M::$10 -- vbuz1=vbuaa // upper blocks to map + upper blocks offset page high nibble sta.z zVal // asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } lda lMb ldx #$f ldy uMb ldz #$f map lda aVal ldx xVal ldy yVal ldz zVal map eom jmp __breturn // memoryRemap256M::@return __breturn: // [59] 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 __b3 Removing instruction jmp __b4 Removing instruction jmp __b6 Removing instruction jmp __breturn Removing instruction jmp __breturn Removing instruction jmp __breturn Removing instruction jmp __breturn Succesful ASM optimization Pass5NextJumpElimination Replacing instruction lda #0 with TXA Removing instruction lda #0 Removing instruction ldz #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 __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_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: Removing instruction __breturn: Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE __constant char * const DEFAULT_SCREEN = (char *) 2048 __constant const char MEMORYBLOCK_4000 = 4 __constant const char MEMORYBLOCK_8000 = $10 void main() char main::$7 // reg byte a 22.0 __constant char *main::BLOCK_4000 = (char *) 16384 __constant char *main::BLOCK_8000 = (char *) 32768 char main::i char main::i#1 // reg byte x 22.0 char main::i#2 // reg byte x 18.333333333333332 char main::i1 char main::i1#1 // reg byte x 22.0 char main::i1#2 // reg byte x 13.75 void memoryRemap(char remapBlocks , unsigned int lowerPageOffset , unsigned int upperPageOffset) char memoryRemap::$1 // zp[1]:5 67.33333333333333 char memoryRemap::$2 // reg byte a 202.0 char memoryRemap::$3 // reg byte a 202.0 char memoryRemap::$6 // zp[1]:6 67.33333333333333 char memoryRemap::$7 // reg byte a 202.0 char memoryRemap::$8 // reg byte a 202.0 __loadstore volatile char memoryRemap::aVal // zp[1]:16 10.1 unsigned int memoryRemap::lowerPageOffset unsigned int memoryRemap::lowerPageOffset#0 // lowerPageOffset zp[2]:3 11.0 unsigned int memoryRemap::lowerPageOffset#2 // lowerPageOffset zp[2]:3 71.0 char memoryRemap::remapBlocks char memoryRemap::remapBlocks#0 // reg byte z 7.333333333333333 char memoryRemap::remapBlocks#2 // reg byte z 30.42857142857143 unsigned int memoryRemap::upperPageOffset unsigned int memoryRemap::upperPageOffset#0 // upperPageOffset zp[2]:7 22.0 unsigned int memoryRemap::upperPageOffset#2 // upperPageOffset zp[2]:7 26.625 __loadstore volatile char memoryRemap::xVal // zp[1]:10 16.833333333333332 __loadstore volatile char memoryRemap::yVal // zp[1]:9 20.2 __loadstore volatile char memoryRemap::zVal // zp[1]:2 101.0 void memoryRemap256M(char remapBlocks , unsigned long lowerPageOffset , unsigned long upperPageOffset) unsigned long memoryRemap256M::$0 // zp[4]:11 11.0 char memoryRemap256M::$10 // reg byte a 22.0 char memoryRemap256M::$5 // zp[1]:5 7.333333333333333 char memoryRemap256M::$6 // reg byte a 22.0 char memoryRemap256M::$7 // reg byte a 22.0 __loadstore volatile char memoryRemap256M::aVal // zp[1]:23 1.375 __loadstore volatile char memoryRemap256M::lMb // zp[1]:25 1.1 unsigned long memoryRemap256M::lowerPageOffset unsigned long memoryRemap256M::lowerPageOffset#2 // lowerPageOffset zp[4]:17 5.5 char memoryRemap256M::remapBlocks char memoryRemap256M::remapBlocks#2 // reg byte x 2.2 __loadstore volatile char memoryRemap256M::uMb // zp[1]:24 1.2222222222222223 unsigned long memoryRemap256M::upperPageOffset __loadstore volatile char memoryRemap256M::xVal // zp[1]:22 2.75 __loadstore volatile char memoryRemap256M::yVal // zp[1]:21 3.6666666666666665 __loadstore volatile char memoryRemap256M::zVal // zp[1]:15 11.0 void memoryRemapBlock(char blockPage , unsigned int memoryPage) char memoryRemapBlock::block char memoryRemapBlock::block#0 // reg byte a 22.0 char memoryRemapBlock::blockBits char memoryRemapBlock::blockBits#0 // reg byte a 22.0 char memoryRemapBlock::blockPage char memoryRemapBlock::blockPage#2 // reg byte x 11.0 unsigned int memoryRemapBlock::memoryPage unsigned int memoryRemapBlock::pageOffset unsigned int memoryRemapBlock::pageOffset#0 // pageOffset zp[2]:3 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 ] zp[2]:3 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 ] reg byte z [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] zp[2]:7 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] zp[4]:17 [ memoryRemap256M::lowerPageOffset#2 ] reg byte x [ memoryRemap256M::remapBlocks#2 ] reg byte a [ main::$7 ] reg byte a [ memoryRemapBlock::block#0 ] reg byte a [ memoryRemapBlock::blockBits#0 ] zp[1]:16 [ memoryRemap::aVal ] reg byte a [ memoryRemap::$2 ] reg byte a [ memoryRemap::$3 ] zp[1]:10 [ memoryRemap::xVal ] zp[1]:9 [ memoryRemap::yVal ] zp[1]:6 [ memoryRemap::$6 ] reg byte a [ memoryRemap::$7 ] reg byte a [ memoryRemap::$8 ] zp[1]:2 [ memoryRemap::zVal ] zp[4]:11 [ memoryRemap256M::$0 ] zp[1]:25 [ memoryRemap256M::lMb ] zp[1]:24 [ memoryRemap256M::uMb ] zp[1]:23 [ memoryRemap256M::aVal ] zp[1]:5 [ memoryRemap256M::$5 memoryRemap::$1 ] reg byte a [ memoryRemap256M::$6 ] reg byte a [ memoryRemap256M::$7 ] zp[1]:22 [ memoryRemap256M::xVal ] zp[1]:21 [ memoryRemap256M::yVal ] reg byte a [ memoryRemap256M::$10 ] zp[1]:15 [ memoryRemap256M::zVal ] FINAL ASSEMBLER Score: 906 // 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 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. /// @file /// MEGA65 Registers and Constants /// @file /// The MOS 6526 Complex Interface Adapter (CIA) /// /// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf // Upstart .cpu _45gs02 // MEGA65 platform PRG executable starting in MEGA65 mode. .file [name="memorymap-test.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$2001] .segmentdef Code [start=$2017] .segmentdef Data [startAfter="Code"] .segment Basic .byte $0a, $20, $0a, $00, $fe, $02, $20, $30, $00 // 10 BANK 0 .byte $15, $20, $14, $00, $9e, $20 // 20 SYS .text toIntString(main) // NNNN .byte $00, $00, $00 // // Global Constants & labels /// Bit representing 8K block #2 of the 64K addressable memory ($4000-$5fff) .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 BLOCK_4000 = $4000 .label BLOCK_8000 = $8000 // memoryRemapBlock(0x40, 0x100) // [1] call memoryRemapBlock // Remap [$4000-$5fff] to point to [$10000-$11fff] // [24] phi from main to memoryRemapBlock [phi:main->memoryRemapBlock] // [24] phi memoryRemapBlock::blockPage#2 = $40 [phi:main->memoryRemapBlock#0] -- vbuxx=vbuc1 ldx #$40 jsr memoryRemapBlock // main::@7 // BLOCK_4000[0] = '-' // [2] *main::BLOCK_4000 = '-' -- _deref_pbuc1=vbuc2 // Put '-', '*' into $10000 ldz #'-' stz BLOCK_4000 // BLOCK_4000[1] = '*' // [3] *(main::BLOCK_4000+1) = '*' -- _deref_pbuc1=vbuc2 ldz #'*' stz BLOCK_4000+1 // memoryRemapBlock(0x80, 0x100) // [4] call memoryRemapBlock // Remap [$8000-$9fff] to point to [$10000-$11fff] // [24] phi from main::@7 to memoryRemapBlock [phi:main::@7->memoryRemapBlock] // [24] phi memoryRemapBlock::blockPage#2 = $80 [phi:main::@7->memoryRemapBlock#0] -- vbuxx=vbuc1 ldx #$80 jsr memoryRemapBlock // main::@8 // BLOCK_8000[2] = '-' // [5] *(main::BLOCK_8000+2) = '-' -- _deref_pbuc1=vbuc2 // Put '-', '*' into $10002 ldz #'-' stz BLOCK_8000+2 // BLOCK_8000[3] = '*' // [6] *(main::BLOCK_8000+3) = '*' -- _deref_pbuc1=vbuc2 ldz #'*' stz 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) // [33] phi from main::@8 to memoryRemap [phi:main::@8->memoryRemap] // [33] phi memoryRemap::upperPageOffset#2 = $80 [phi:main::@8->memoryRemap#0] -- vwuz1=vbuc1 lda #<$80 sta.z memoryRemap.upperPageOffset lda #>$80 sta.z memoryRemap.upperPageOffset+1 // [33] phi memoryRemap::remapBlocks#2 = MEMORYBLOCK_4000|MEMORYBLOCK_8000 [phi:main::@8->memoryRemap#1] -- vbuzz=vbuc1 ldz #MEMORYBLOCK_4000|MEMORYBLOCK_8000 // [33] phi memoryRemap::lowerPageOffset#2 = $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] *(main::BLOCK_8000+4) = *(main::BLOCK_4000+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] *(main::BLOCK_4000+5) = *(main::BLOCK_8000+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 main::i#2 = 0 [phi:main::@9->main::@1#0] -- vbuxx=vbuc1 ldx #0 // copy the resulting values onto the screen - it should show '-*-*-*' // main::@1 __b1: // for(char i=0;i<6;i++) // [11] if(main::i#2<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 // memoryRemap256M(MEMORYBLOCK_4000, 0xff800-0x00040, 0) // [13] call memoryRemap256M // Remap [$4000-$5fff] to point to [$ff80000-$ff81fff] COLORRAM! (notice usage of page offsets) // [46] phi from main::@3 to memoryRemap256M [phi:main::@3->memoryRemap256M] // [46] phi memoryRemap256M::remapBlocks#2 = MEMORYBLOCK_4000 [phi:main::@3->memoryRemap256M#0] -- vbuxx=vbuc1 ldx #MEMORYBLOCK_4000 // [46] phi memoryRemap256M::lowerPageOffset#2 = $ff800-$40 [phi:main::@3->memoryRemap256M#1] -- vduz1=vduc1 lda #<$ff800-$40 sta.z memoryRemap256M.lowerPageOffset lda #>$ff800-$40 sta.z memoryRemap256M.lowerPageOffset+1 lda #<$ff800-$40>>$10 sta.z memoryRemap256M.lowerPageOffset+2 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 main::i1#2 = 0 [phi:main::@3->main::@4#0] -- vbuxx=vbuc1 ldx #0 // Put colors in the upper screen line // main::@4 __b4: // for( char i=0; i<16; i++) // [15] if(main::i1#2<$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) // [17] call memoryRemap256M // Remap [$4000-$5fff] back to normal memory! // [46] phi from main::@6 to memoryRemap256M [phi:main::@6->memoryRemap256M] // [46] phi memoryRemap256M::remapBlocks#2 = 0 [phi:main::@6->memoryRemap256M#0] -- vbuxx=vbuc1 ldx #0 // [46] phi memoryRemap256M::lowerPageOffset#2 = 0 [phi:main::@6->memoryRemap256M#1] -- vduz1=vbuc1 txa sta.z memoryRemap256M.lowerPageOffset sta.z memoryRemap256M.lowerPageOffset+1 sta.z memoryRemap256M.lowerPageOffset+2 sta.z memoryRemap256M.lowerPageOffset+3 jsr memoryRemap256M // main::@return // } // [18] return rts // main::@5 __b5: // 0x40+i // [19] main::$7 = $40 + main::i1#2 -- vbuaa=vbuc1_plus_vbuxx txa clc adc #$40 // BLOCK_4000[i] = 0x40+i // [20] main::BLOCK_4000[main::i1#2] = main::$7 -- pbuc1_derefidx_vbuxx=vbuaa sta BLOCK_4000,x // for( char i=0; i<16; i++) // [21] main::i1#1 = ++ main::i1#2 -- vbuxx=_inc_vbuxx inx // [14] phi from main::@5 to main::@4 [phi:main::@5->main::@4] // [14] phi main::i1#2 = 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] (DEFAULT_SCREEN+$50-6)[main::i#2] = main::BLOCK_4000[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] main::i#1 = ++ main::i#2 -- vbuxx=_inc_vbuxx inx // [10] phi from main::@2 to main::@1 [phi:main::@2->main::@1] // [10] phi main::i#2 = 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. // 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(__register(X) char blockPage, unsigned int memoryPage) memoryRemapBlock: { .label pageOffset = 3 // unsigned int pageOffset = memoryPage-blockPage // [25] memoryRemapBlock::pageOffset#0 = $100 - memoryRemapBlock::blockPage#2 -- vwuz1=vwuc1_minus_vbuxx // Find the page offset (the number of pages to offset the block) stx.z $ff lda #<$100 sec sbc.z $ff sta.z pageOffset lda #>$100 sbc #0 sta.z pageOffset+1 // char block = blockPage / 0x20 // [26] memoryRemapBlock::block#0 = memoryRemapBlock::blockPage#2 >> 5 -- vbuaa=vbuxx_ror_5 // Which block is being remapped? (0-7) txa lsr lsr lsr lsr lsr // char blockBits = 1<memoryRemap] // [33] phi memoryRemap::upperPageOffset#2 = memoryRemap::upperPageOffset#0 [phi:memoryRemapBlock->memoryRemap#0] -- register_copy // [33] phi memoryRemap::remapBlocks#2 = memoryRemap::remapBlocks#0 [phi:memoryRemapBlock->memoryRemap#1] -- register_copy // [33] phi memoryRemap::lowerPageOffset#2 = memoryRemap::lowerPageOffset#0 [phi:memoryRemapBlock->memoryRemap#2] -- register_copy jsr memoryRemap // memoryRemapBlock::@return // } // [32] return rts } // memoryRemap // 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(__register(Z) char remapBlocks, __zp(3) unsigned int lowerPageOffset, __zp(7) unsigned int upperPageOffset) memoryRemap: { .label aVal = $10 .label xVal = $a .label __1 = 5 .label yVal = 9 .label zVal = 2 .label __6 = 6 .label lowerPageOffset = 3 .label upperPageOffset = 7 // char aVal = BYTE0(lowerPageOffset) // [34] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#2 -- vbuz1=_byte0_vwuz2 // lower blocks offset page low lda.z lowerPageOffset sta.z aVal // remapBlocks << 4 // [35] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 -- vbuz1=vbuzz_rol_4 tza asl asl asl asl sta.z __1 // BYTE1(lowerPageOffset) // [36] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#2 -- vbuaa=_byte1_vwuz1 lda.z lowerPageOffset+1 // BYTE1(lowerPageOffset) & 0xf // [37] memoryRemap::$3 = memoryRemap::$2 & $f -- vbuaa=vbuaa_band_vbuc1 and #$f // char xVal = (remapBlocks << 4) | (BYTE1(lowerPageOffset) & 0xf) // [38] memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 -- vbuz1=vbuz2_bor_vbuaa // lower blocks to map + lower blocks offset high nibble ora.z __1 sta.z xVal // char yVal = BYTE0(upperPageOffset) // [39] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#2 -- vbuz1=_byte0_vwuz2 // upper blocks offset page lda.z upperPageOffset sta.z yVal // remapBlocks & 0xf0 // [40] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 -- vbuz1=vbuzz_band_vbuc1 tza and #$f0 sta.z __6 // BYTE1(upperPageOffset) // [41] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#2 -- vbuaa=_byte1_vwuz1 lda.z upperPageOffset+1 // BYTE1(upperPageOffset) & 0xf // [42] memoryRemap::$8 = memoryRemap::$7 & $f -- vbuaa=vbuaa_band_vbuc1 and #$f // char zVal = (remapBlocks & 0xf0) | (BYTE1(upperPageOffset) & 0xf) // [43] memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 -- vbuz1=vbuz2_bor_vbuaa // upper blocks to map + upper blocks offset page high nibble ora.z __6 sta.z zVal // asm // asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } lda aVal ldx xVal ldy yVal ldz zVal map eom // memoryRemap::@return // } // [45] return rts } // memoryRemap256M // Remap some of the eight 8K memory blocks in the 64K address space of the 6502 to point somewhere else in the entire 256MB memory space of the MEGA65. // After the remapping the CPU will access the mapped memory whenever it uses instructions that access a remapped block. // See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65. // See Appendix G in file:///Users/jespergravgaard/Downloads/MEGA65-Book_draft%20(5).pdf for a description of the CPU memory remapper of the MEGA65. // remapBlocks: Indicates which 8K blocks of the 6502 address space to remap. Each bit represents one 8K block // - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000. // - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000. // - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000. // - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000. // - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000. // - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000. // - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000. // - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000. // lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3). // The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 20bits of the passed value is used. // - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100. // - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000. // - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000. // - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000. // upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7). // The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 20bits of the passed value is used. // - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000 // - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000. // - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000. // - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000. // void memoryRemap256M(__register(X) char remapBlocks, __zp($11) unsigned long lowerPageOffset, unsigned long upperPageOffset) memoryRemap256M: { .label lMb = $19 .label __0 = $b .label uMb = $18 .label aVal = $17 .label xVal = $16 .label __5 = 5 .label yVal = $15 .label zVal = $f .label lowerPageOffset = $11 // lowerPageOffset>>4 // [47] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 -- vduz1=vduz2_ror_4 lda.z lowerPageOffset+3 lsr sta.z __0+3 lda.z lowerPageOffset+2 ror sta.z __0+2 lda.z lowerPageOffset+1 ror sta.z __0+1 lda.z lowerPageOffset ror sta.z __0 lsr.z __0+3 ror.z __0+2 ror.z __0+1 ror.z __0 lsr.z __0+3 ror.z __0+2 ror.z __0+1 ror.z __0 lsr.z __0+3 ror.z __0+2 ror.z __0+1 ror.z __0 // char lMb = BYTE1((unsigned int)(lowerPageOffset>>4)) // [48] memoryRemap256M::lMb = byte1 (unsigned int)memoryRemap256M::$0 -- vbuz1=_byte1__word_vduz2 // lower blocks offset megabytes lda.z __0+1 sta.z lMb // char uMb = BYTE1((unsigned int)(upperPageOffset>>4)) // [49] memoryRemap256M::uMb = 0 -- vbuz1=vbuc1 // upper blocks offset megabytes ldz #0 stz.z uMb // char aVal = BYTE0(lowerPageOffset) // [50] memoryRemap256M::aVal = byte0 memoryRemap256M::lowerPageOffset#2 -- vbuz1=_byte0_vduz2 // lower blocks offset page low lda.z lowerPageOffset sta.z aVal // remapBlocks << 4 // [51] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 -- vbuz1=vbuxx_rol_4 txa asl asl asl asl sta.z __5 // BYTE1(lowerPageOffset) // [52] memoryRemap256M::$6 = byte1 memoryRemap256M::lowerPageOffset#2 -- vbuaa=_byte1_vduz1 lda.z lowerPageOffset+1 // BYTE1(lowerPageOffset) & 0xf // [53] memoryRemap256M::$7 = memoryRemap256M::$6 & $f -- vbuaa=vbuaa_band_vbuc1 and #$f // char xVal = (remapBlocks << 4) | (BYTE1(lowerPageOffset) & 0xf) // [54] memoryRemap256M::xVal = memoryRemap256M::$5 | memoryRemap256M::$7 -- vbuz1=vbuz2_bor_vbuaa // lower blocks to map + lower blocks offset high nibble ora.z __5 sta.z xVal // char yVal = BYTE0(upperPageOffset) // [55] memoryRemap256M::yVal = 0 -- vbuz1=vbuc1 // upper blocks offset page stz.z yVal // remapBlocks & 0xf0 // [56] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 -- vbuaa=vbuxx_band_vbuc1 txa and #$f0 // char zVal = (remapBlocks & 0xf0) | (BYTE1(upperPageOffset) & 0xf) // [57] memoryRemap256M::zVal = memoryRemap256M::$10 -- vbuz1=vbuaa // upper blocks to map + upper blocks offset page high nibble sta.z zVal // asm // asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } lda lMb ldx #$f ldy uMb ldz #$f map lda aVal ldx xVal ldy yVal ldz zVal map eom // memoryRemap256M::@return // } // [59] return rts } // File Data