From d8f6331d3820451d86b1504c0ba63e1dd125f1d9 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Tue, 26 May 2020 21:04:52 +0200 Subject: [PATCH] Added NES tiles. Improved NES library. Closes #457 --- .../mos6502-common/vbuaa=_hi_pvom1.asm | 1 + .../mos6502-common/vbuaa=_lo_pvom1.asm | 1 + src/main/kc/include/nes.h | 49 + src/main/kc/include/ricoh_2c02.h | 26 +- src/main/kc/lib/nes.c | 110 +- src/test/kc/examples/nes/nes-demo.c | 155 +- src/test/ref/examples/nes/nes-demo.asm | 353 +- src/test/ref/examples/nes/nes-demo.cfg | 325 +- src/test/ref/examples/nes/nes-demo.log | 4917 ++++++++++++----- src/test/ref/examples/nes/nes-demo.sym | 178 +- 10 files changed, 4292 insertions(+), 1823 deletions(-) create mode 100644 src/main/fragment/mos6502-common/vbuaa=_hi_pvom1.asm create mode 100644 src/main/fragment/mos6502-common/vbuaa=_lo_pvom1.asm diff --git a/src/main/fragment/mos6502-common/vbuaa=_hi_pvom1.asm b/src/main/fragment/mos6502-common/vbuaa=_hi_pvom1.asm new file mode 100644 index 000000000..0d95da3e7 --- /dev/null +++ b/src/main/fragment/mos6502-common/vbuaa=_hi_pvom1.asm @@ -0,0 +1 @@ +lda {m1}+1 \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vbuaa=_lo_pvom1.asm b/src/main/fragment/mos6502-common/vbuaa=_lo_pvom1.asm new file mode 100644 index 000000000..33194a2c1 --- /dev/null +++ b/src/main/fragment/mos6502-common/vbuaa=_lo_pvom1.asm @@ -0,0 +1 @@ +lda {m1} \ No newline at end of file diff --git a/src/main/kc/include/nes.h b/src/main/kc/include/nes.h index e7473ca9f..fa4129d90 100644 --- a/src/main/kc/include/nes.h +++ b/src/main/kc/include/nes.h @@ -13,6 +13,19 @@ struct RICOH_2A03 * APU = 0x4000; // Pointer to the start of RAM memory char * const MEMORY = 0; +// Sprite Object Attribute Memory Structure +// The memory layout of a sprite in the PPU's OAM memory +struct SpriteData { + char y; + char tile; + char attributes; + char x; +}; + +// DMA transfer a complete sprite memory buffer to the PPU +// - The Sprite OAM buffer to transfer (must be aligned to $100 in memory) +void ppuSpriteBufferDmaTransfer(struct SpriteData* spriteBuffer); + // Disable audio output void disableAudioOutput(); @@ -27,3 +40,39 @@ void waitForVBlank(); // Clear the vblank flag void clearVBlankFlag(); + +// Initialize the NES after a RESET. +// Clears the memory and sets up the stack +// Note: Calling this will destroy the stack, so it only works if called directly inside the reset routine. +void initNES(); + + +// Prepare for transferring data from the CPU to the PPU +// - ppuData : Pointer in the PPU memory +void ppuDataPrepare(void* const ppuData); + +// Put one byte into PPU memory +// The byte is put into the current PPU address pointed to by the (autoincrementing) PPU->PPUADDR +void ppuDataPut(char val); + +// Fill a number of bytes in the PPU memory +// - ppuData : Pointer in the PPU memory +// - size : The number of bytes to transfer +void ppuDataFill(void* const ppuData, char val, unsigned int size); + +// Transfer a number of bytes from the CPU memory to the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) +// - ppuData : Pointer in the PPU memory +// - size : The number of bytes to transfer +void ppuDataTransfer(void* const ppuData, void* const cpuData, unsigned int size); + +// Transfer a 2x2 tile into the PPU memory +// - ppuData : Pointer in the PPU memory +// - tile : The tile to transfer +void ppuDataPutTile(void* const ppuData, char* tile); + + +// Set one byte in PPU memory +// - ppuData : Pointer in the PPU memory +// - val : The value to set +void ppuDataSet(void* const ppuData, char val); \ No newline at end of file diff --git a/src/main/kc/include/ricoh_2c02.h b/src/main/kc/include/ricoh_2c02.h index c0266d877..1cb5503d1 100644 --- a/src/main/kc/include/ricoh_2c02.h +++ b/src/main/kc/include/ricoh_2c02.h @@ -6,22 +6,30 @@ // Based on: https://github.com/gregkrsak/first_nes written by Greg M. Krsak, 2018. // PPU Memory Map -// $0000-$0FFF $1000 Pattern table 0 +// $0000-$0fff $1000 Pattern table 0 char * const PPU_PATTERN_TABLE_0 = 0x0000; -// $1000-$1FFF $1000 Pattern table 1 +// $1000-$1fff $1000 Pattern table 1 char * const PPU_PATTERN_TABLE_1 = 0x1000; -// $2000-$23FF $0400 Nametable 0 +// $2000-$23bf $03c0 Name table 0 char * const PPU_NAME_TABLE_0 = 0x2000; -// $2400-$27FF $0400 Nametable 1 +// $23c0-$23ff $0040 Attribute table 0 +char * const PPU_ATTRIBUTE_TABLE_0 = 0x23c0; +// $2400-$27bf $03c0 Name table 1 char * const PPU_NAME_TABLE_1 = 0x2400; -// $2800-$2BFF $0400 Nametable 2 +// $27c0-$27ff $0040 Attribute table 1 +char * const PPU_ATTRIBUTE_TABLE_1 = 0x27c0; +// $2800-$2bbf $03c0 Name table 2 char * const PPU_NAME_TABLE_2 = 0x2800; -// $2C00-$2FFF $0400 Nametable 3 +// $2bc0-$2bff $0040 Attribute table 2 +char * const PPU_ATTRIBUTE_TABLE_2 = 0x2bc0; +// $2c00-$2fbf $03c0 Name table 3 char * const PPU_NAME_TABLE_3 = 0x2c00; -// $3000-$3EFF $0F00 Mirrors of $2000-$2EFF -// $3F00-$3F1F $0020 Palette RAM indexes +// $2fc0-$2fff $0040 Attribute table 3 +char * const PPU_ATTRIBUTE_TABLE_3 = 0x2fc0; +// $3000-$3eff $0f00 Mirrors of $2000-$2eff +// $3f00-$3f1f $0020 Palette RAM indexes char * const PPU_PALETTE = 0x3f00; -// $3F20-$3FFF $00E0 Mirrors of $3F00-$3F1F +// $3f20-$3fff $00e0 Mirrors of $3f00-$3f1f struct RICOH_2C02 { // ------+-----+--------------------------------------------------------------- diff --git a/src/main/kc/lib/nes.c b/src/main/kc/lib/nes.c index d053b3ace..0f26af137 100644 --- a/src/main/kc/lib/nes.c +++ b/src/main/kc/lib/nes.c @@ -23,8 +23,8 @@ inline void disableVideoOutput() { inline void enableVideoOutput() { // Enable vertical blank interrupt PPU->PPUCTRL = 0b10000000; - // Enable sprite rendering - PPU->PPUMASK = 0b00010000; + // Enable sprite and tile rendering + PPU->PPUMASK = 0b00011000; } // Wait for vblank to start @@ -36,3 +36,109 @@ inline void waitForVBlank() { inline void clearVBlankFlag() { asm { lda PPU_PPUSTATUS } } + +// Initialize the NES after a RESET. +// Clears the memory and sets up the stack +// Note: Calling this will destroy the stack, so it only works if called directly inside the reset routine. +inline void initNES() { + // Initialize decimal-mode and stack + asm { + cld + ldx #$ff + txs + } + // Initialize the video & audio + disableVideoOutput(); + disableAudioOutput(); + // Note: When the system is first turned on or reset, the PPU may not be in a usable state right + // away. You should wait at least 30,000 (thirty thousand) CPU cycles for the PPU to initialize, + // which may be accomplished by waiting for 2 (two) vertical blank intervals. + clearVBlankFlag(); + waitForVBlank(); + // Clear RAM - since it has all variables and the stack it is necesary to do it inline + char i=0; + do { + (MEMORY+0x000)[i] = 0; + (MEMORY+0x100)[i] = 0; + (MEMORY+0x200)[i] = 0; + (MEMORY+0x300)[i] = 0; + (MEMORY+0x400)[i] = 0; + (MEMORY+0x500)[i] = 0; + (MEMORY+0x600)[i] = 0; + (MEMORY+0x700)[i] = 0; + } while (++i); + waitForVBlank(); + // Now the PPU is ready. + + // Reset the high/low latch to "high" + asm { lda PPU_PPUSTATUS } + +} + +// DMA transfer the entire sprite buffer to the PPU +// - The Sprite OAM buffer to transfer (must be aligned to $100 in memory) +inline void ppuSpriteBufferDmaTransfer(struct SpriteData* spriteBuffer) { + // Set OAM start address to sprite#0 + PPU->OAMADDR = 0; + // Set the high byte (02) of the RAM address and start the DMA transfer to OAM memory + APU->OAMDMA = >spriteBuffer; +} + +// Prepare for transfering data from the CPU to the PPU +// - ppuData : Pointer in the PPU memory +inline void ppuDataPrepare(void* const ppuData) { + // Write the high byte of PPU address + PPU->PPUADDR = >ppuData; + // Write the low byte of PPU address + PPU->PPUADDR = PPUADDR +inline void ppuDataPut(char val) { + // Transfer to PPU + PPU->PPUDATA = val; +} + +// Fill a number of bytes in the PPU memory +// - ppuData : Pointer in the PPU memory +// - size : The number of bytes to transfer +void ppuDataFill(void* const ppuData, char val, unsigned int size) { + ppuDataPrepare(ppuData); + // Transfer to PPU + for(unsigned int i=0;i #include +// Sprite OAM Buffer +// Will be transfered to the PPU via DMA during vblank +struct SpriteData * const OAM_BUFFER = 0x0200; + // RESET Called when the NES is reset, including when it is turned on. void main() { - // Initialize decimal-mode and stack - asm { - cld - ldx #$ff - txs - } - // Initialize the video & audio - disableVideoOutput(); - disableAudioOutput(); - // Note: When the system is first turned on or reset, the PPU may not be in a usable state right - // away. You should wait at least 30,000 (thirty thousand) CPU cycles for the PPU to initialize, - // which may be accomplished by waiting for 2 (two) vertical blank intervals. - clearVBlankFlag(); - waitForVBlank(); - // Clear RAM - since it has all variables and the stack it is necesary to do it inline - char i=0; - do { - (MEMORY+0x000)[i] = 0; - (MEMORY+0x100)[i] = 0; - (MEMORY+0x200)[i] = 0; - (MEMORY+0x300)[i] = 0; - (MEMORY+0x400)[i] = 0; - (MEMORY+0x500)[i] = 0; - (MEMORY+0x600)[i] = 0; - (MEMORY+0x700)[i] = 0; - } while (++i); - waitForVBlank(); - // Now the PPU is ready. - - initPalette(); - initSpriteBuffer(); + // Initialize NES after RESET + initNES(); + // Transfer the palette + ppuDataTransfer(PPU_PALETTE, PALETTE, sizeof(PALETTE)); + // Clear the name table + ppuDataFill(PPU_NAME_TABLE_0, 0xfc, 0x3c0); + // Fill the PPU attribute table + ppuDataFill(PPU_ATTRIBUTE_TABLE_0, 0, 0x40); + // Show the entire tile set + //char ch=0; + //for(char y=0;y!=16;y++) { + // ppuDataPrepare(PPU_NAME_TABLE_0+32*4+4+(unsigned int)y*32); + // for(char x=0;x!=16;x++) + // ppuDataPut(ch++); + //} + // Show floor + for(char x=0;x<32;x+=2) + ppuDataPutTile(PPU_NAME_TABLE_0+20*32+x, FLOOR); + // Show flag + ppuDataPutTile(PPU_NAME_TABLE_0+18*32+28, FLAG); + // Initialize Sprite OAM Buffer with the SPRITE data + for(char i=0;iPPUSCROLL = 0; + PPU->PPUSCROLL = -8; + // Enable screen rendering and vblank enableVideoOutput(); - // Infinite loop while(1) { } - } // NMI Called when the PPU refreshes the screen (also known as the V-Blank period) interrupt(hardware_stack) void vblank() { - // Transfer the entire sprite buffer to the PPU - transferSpriteBufferToPpu(); + // DMA transfer the entire sprite buffer to the PPU + ppuSpriteBufferDmaTransfer(OAM_BUFFER); - // Freeze the button positions. + // Latch the controller buttons APU->JOY1 = 1; APU->JOY1 = 0; // Controllers for first and second player are now latched and will not change // Read button A on controller 1 if(APU->JOY1&0b00000001) { - moveLuigiRight(); + // move the Luigi sprites right + OAM_BUFFER[0].y++; + OAM_BUFFER[1].y++; + OAM_BUFFER[2].y++; + OAM_BUFFER[3].y++; } // Read button B on controller 1 if(APU->JOY1&0b00000001) { - moveLuigiLeft(); + // move the Luigi sprites left + OAM_BUFFER[0].y--; + OAM_BUFFER[1].y--; + OAM_BUFFER[2].y--; + OAM_BUFFER[3].y--; } } -// Sprite Object Attribute Memory Structure -struct ObjectAttribute { - char y; - char tile; - char attributes; - char x; -}; -// OAM (Object Attribute Memory) Buffer -// Will be transfered to the PPU via DMA -struct ObjectAttribute * const OAM_BUFFER = 0x0200; - -// move the Luigi sprites right -void moveLuigiRight() { - OAM_BUFFER[0].x++; - OAM_BUFFER[1].x++; - OAM_BUFFER[2].x++; - OAM_BUFFER[3].x++; -} - -// move the Luigi sprites left -void moveLuigiLeft() { - OAM_BUFFER[0].x--; - OAM_BUFFER[1].x--; - OAM_BUFFER[2].x--; - OAM_BUFFER[3].x--; -} - -// DMA transfer the entire sprite buffer to the PPU -inline void transferSpriteBufferToPpu() { - // Set OAM start address to sprite#0 - PPU->OAMADDR = 0; - // Set the high byte (02) of the RAM address and start the DMA transfer to OAM memory - APU->OAMDMA = >OAM_BUFFER; -} - -// Initialize OAM (Object Attribute Memory) Buffer with the SPRITE data -void initSpriteBuffer() { - char i=0; - do { - ((char*)OAM_BUFFER)[i] = ((char*)SPRITES)[i]; - } while (++i!=sizeof(SPRITES)); -} +// Flag tile +char FLAG[] = { 0x54, 0x55, 0x56, 0x57}; +// Floor tile +char FLOOR[] = { 0x85, 0x85, 0x86, 0x86}; // Small Luigi Sprite Data -struct ObjectAttribute SPRITES[] = { +struct SpriteData SPRITES[] = { // Y , TILE, ATTR , X { 128, 0x36, 0b00000010, 128 }, // Sprite 0 { 128, 0x37, 0b00000010, 136 }, // Sprite 1 @@ -120,26 +88,13 @@ struct ObjectAttribute SPRITES[] = { { 136, 0x39, 0b00000010, 136 } // Sprite 3 }; - -// Copy palette values to PPU -void initPalette() { - // Reset the high/low latch to "high" - asm { lda PPU_PPUSTATUS } - // Write the high byte of PPU Palette address - PPU->PPUADDR = >PPU_PALETTE; - // Write the low byte of PPU Palette address - PPU->PPUADDR = PPUDATA = PALETTE[i]; -} - +// Color Palette char PALETTE[0x20] = { // Background palettes - 0x0f, 0x31, 0x32, 0x33, - 0x0f, 0x35, 0x36, 0x37, - 0x0f, 0x39, 0x3a, 0x3b, - 0x0f, 0x3d, 0x3e, 0x0f, + 0x0f, 0x13, 0x23, 0x33, + 0x0f, 0x06, 0x15, 0x36, + 0x0f, 0x39, 0x4a, 0x5b, + 0x0f, 0x3d, 0x4e, 0x5f, // Sprite palettes (selected by the attribute bits 0-1 of the sprites) 0x0f, 0x1c, 0x15, 0x14, 0x0f, 0x02, 0x38, 0x3c, @@ -147,7 +102,7 @@ char PALETTE[0x20] = { 0x0f, 0x0f, 0x0f, 0x0f // All black }; -// Tiles +// Tile Set #pragma data_seg(Tiles) export char TILES[] = kickasm(resource "smb1_chr.bin") {{ .import binary "smb1_chr.bin" diff --git a/src/test/ref/examples/nes/nes-demo.asm b/src/test/ref/examples/nes/nes-demo.asm index dcad3e0ba..3325737de 100644 --- a/src/test/ref/examples/nes/nes-demo.asm +++ b/src/test/ref/examples/nes/nes-demo.asm @@ -28,19 +28,23 @@ // Mirroring nibble 0001 == Vertical mirroring only .segment Code - .const SIZEOF_STRUCT_OBJECTATTRIBUTE = 4 + .const SIZEOF_STRUCT_SPRITEDATA = 4 .const OFFSET_STRUCT_RICOH_2A03_DMC_FREQ = $10 .const OFFSET_STRUCT_RICOH_2C02_PPUMASK = 1 .const OFFSET_STRUCT_RICOH_2C02_PPUSTATUS = 2 - .const OFFSET_STRUCT_RICOH_2A03_JOY1 = $16 - .const OFFSET_STRUCT_OBJECTATTRIBUTE_X = 3 .const OFFSET_STRUCT_RICOH_2C02_OAMADDR = 3 .const OFFSET_STRUCT_RICOH_2A03_OAMDMA = $14 .const OFFSET_STRUCT_RICOH_2C02_PPUADDR = 6 .const OFFSET_STRUCT_RICOH_2C02_PPUDATA = 7 + .const OFFSET_STRUCT_RICOH_2C02_PPUSCROLL = 5 + .const OFFSET_STRUCT_RICOH_2A03_JOY1 = $16 .const SIZEOF_BYTE = 1 - // $3000-$3EFF $0F00 Mirrors of $2000-$2EFF - // $3F00-$3F1F $0020 Palette RAM indexes + // $2000-$23bf $03c0 Name table 0 + .label PPU_NAME_TABLE_0 = $2000 + // $23c0-$23ff $0040 Attribute table 0 + .label PPU_ATTRIBUTE_TABLE_0 = $23c0 + // $3000-$3eff $0f00 Mirrors of $2000-$2eff + // $3f00-$3f1f $0020 Palette RAM indexes .label PPU_PALETTE = $3f00 // APU Frame Counter // generates low-frequency clocks for the channels and an optional 60 Hz interrupt. @@ -56,8 +60,8 @@ .label FR_COUNTER = $4017 // Pointer to the start of RAM memory .label MEMORY = 0 - // OAM (Object Attribute Memory) Buffer - // Will be transfered to the PPU via DMA + // Sprite OAM Buffer + // Will be transfered to the PPU via DMA during vblank .label OAM_BUFFER = $200 // PPU Status Register for reading in ASM .label PPU_PPUSTATUS = $2002 @@ -69,7 +73,6 @@ // RESET Called when the NES is reset, including when it is turned on. main: { // asm - // Initialize decimal-mode and stack cld ldx #$ff txs @@ -85,15 +88,15 @@ main: { sta APU+OFFSET_STRUCT_RICOH_2A03_DMC_FREQ // asm lda PPU_PPUSTATUS - waitForVBlank1: + initNES1_waitForVBlank1: // PPU->PPUSTATUS&0x80 lda #$80 and PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS // while(!(PPU->PPUSTATUS&0x80)) cmp #0 - beq waitForVBlank1 + beq initNES1_waitForVBlank1 ldx #0 - __b1: + initNES1___b1: // (MEMORY+0x000)[i] = 0 lda #0 sta MEMORY,x @@ -114,70 +117,265 @@ main: { // while (++i) inx cpx #0 - bne __b1 - waitForVBlank2: + bne initNES1___b1 + initNES1_waitForVBlank2: // PPU->PPUSTATUS&0x80 lda #$80 and PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS // while(!(PPU->PPUSTATUS&0x80)) cmp #0 - beq waitForVBlank2 - // initPalette() - // Now the PPU is ready. - jsr initPalette - // initSpriteBuffer() - jsr initSpriteBuffer + beq initNES1_waitForVBlank2 + // asm + lda PPU_PPUSTATUS + // ppuDataTransfer(PPU_PALETTE, PALETTE, sizeof(PALETTE)) + // Transfer the palette + jsr ppuDataTransfer + // ppuDataFill(PPU_NAME_TABLE_0, 0xfc, 0x3c0) + // Clear the name table + ldx #$fc + lda #<$3c0 + sta.z ppuDataFill.size + lda #>$3c0 + sta.z ppuDataFill.size+1 + lda #PPU_NAME_TABLE_0 + sta.z ppuDataFill.ppuDataPrepare1_ppuData+1 + jsr ppuDataFill + // ppuDataFill(PPU_ATTRIBUTE_TABLE_0, 0, 0x40) + // Fill the PPU attribute table + ldx #0 + lda #<$40 + sta.z ppuDataFill.size + lda #>$40 + sta.z ppuDataFill.size+1 + lda #PPU_ATTRIBUTE_TABLE_0 + sta.z ppuDataFill.ppuDataPrepare1_ppuData+1 + jsr ppuDataFill + ldx #0 + // Show the entire tile set + //char ch=0; + //for(char y=0;y!=16;y++) { + // ppuDataPrepare(PPU_NAME_TABLE_0+32*4+4+(unsigned int)y*32); + // for(char x=0;x!=16;x++) + // ppuDataPut(ch++); + //} + // Show floor + __b1: + // for(char x=0;x<32;x+=2) + cpx #$20 + bcc __b2 + // ppuDataPutTile(PPU_NAME_TABLE_0+18*32+28, FLAG) + // Show flag + lda #FLAG + sta.z ppuDataPutTile.tile+1 + lda #PPU_NAME_TABLE_0+$12*$20+$1c + sta.z ppuDataPutTile.ppuData+1 + jsr ppuDataPutTile + ldx #0 + // Initialize Sprite OAM Buffer with the SPRITE data + __b4: + // for(char i=0;iPPUSCROLL = 0 + // Set initial scroll + lda #0 + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL + // PPU->PPUSCROLL = -8 + lda #-8 + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL // PPU->PPUCTRL = 0b10000000 lda #$80 sta PPU - // PPU->PPUMASK = 0b00010000 - lda #$10 + // PPU->PPUMASK = 0b00011000 + lda #$18 sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK - __b2: + __b3: // Infinite loop - jmp __b2 -} -// Initialize OAM (Object Attribute Memory) Buffer with the SPRITE data -initSpriteBuffer: { - ldx #0 - __b1: + jmp __b3 + __b5: // ((char*)OAM_BUFFER)[i] = ((char*)SPRITES)[i] lda SPRITES,x sta OAM_BUFFER,x - // while (++i!=sizeof(SPRITES)) + // for(char i=0;iPPU_NAME_TABLE_0+$14*$20 + adc #0 + sta.z ppuDataPutTile.ppuData+1 + // ppuDataPutTile(PPU_NAME_TABLE_0+20*32+x, FLOOR) + lda #FLOOR + sta.z ppuDataPutTile.tile+1 + jsr ppuDataPutTile + // x+=2 + inx + inx + jmp __b1 +} +// Transfer a 2x2 tile into the PPU memory +// - ppuData : Pointer in the PPU memory +// - tile : The tile to transfer +// ppuDataPutTile(byte* zp(6) ppuData, byte* zp(2) tile) +ppuDataPutTile: { + .label ppuDataPrepare2_ppuData = 6 + .label ppuData = 6 + .label tile = 2 + // >ppuData + lda.z ppuData+1 + // PPU->PPUADDR = >ppuData + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + // PPUADDR = PPUDATA = val + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + // ppuDataPut(tile[1]) + ldy #1 + lda (tile),y + // PPU->PPUDATA = val + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + // (char*)ppuData+32 + lda #$20 + clc + adc.z ppuDataPrepare2_ppuData + sta.z ppuDataPrepare2_ppuData + bcc !+ + inc.z ppuDataPrepare2_ppuData+1 + !: + // >ppuData + lda.z ppuDataPrepare2_ppuData+1 + // PPU->PPUADDR = >ppuData + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + // PPUADDR = PPUDATA = val + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + // ppuDataPut(tile[3]) + ldy #3 + lda (tile),y + // PPU->PPUDATA = val + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA // } rts } -// Copy palette values to PPU -initPalette: { - // asm - // Reset the high/low latch to "high" - lda PPU_PPUSTATUS - // PPU->PPUADDR = >PPU_PALETTE - // Write the high byte of PPU Palette address - lda #>PPU_PALETTE +// Fill a number of bytes in the PPU memory +// - ppuData : Pointer in the PPU memory +// - size : The number of bytes to transfer +// ppuDataFill(byte register(X) val, word zp(2) size) +ppuDataFill: { + .label ppuDataPrepare1_ppuData = 6 + .label i = 4 + .label size = 2 + // >ppuData + lda.z ppuDataPrepare1_ppuData+1 + // PPU->PPUADDR = >ppuData sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR - // PPU->PPUADDR = PPUADDR = PPUDATA = val + stx PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + // for(unsigned int i=0;iPPUADDR = >ppuData + lda #>ppuData + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + // PPU->PPUADDR = cpuData + sta.z cpuSrc+1 + lda #<0 + sta.z i + sta.z i+1 __b1: - // for(char i=0;isize bcc __b2 + bne !+ + lda.z i + cmp #PPUDATA = PALETTE[i] - lda PALETTE,x + // ppuDataPut(*cpuSrc++) + ldy #0 + lda (cpuSrc),y + // PPU->PPUDATA = val sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA - // for(char i=0;iOAMADDR = 0 lda #0 sta PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR - // APU->OAMDMA = >OAM_BUFFER + // APU->OAMDMA = >spriteBuffer lda #>OAM_BUFFER sta APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA // APU->JOY1 = 1 - // Freeze the button positions. + // Latch the controller buttons lda #1 sta APU+OFFSET_STRUCT_RICOH_2A03_JOY1 // APU->JOY1 = 0 @@ -206,8 +404,14 @@ vblank: { // if(APU->JOY1&0b00000001) cmp #0 beq __b1 - // moveLuigiRight() - jsr moveLuigiRight + // OAM_BUFFER[0].y++; + inc OAM_BUFFER + // OAM_BUFFER[1].y++; + inc OAM_BUFFER+1*SIZEOF_STRUCT_SPRITEDATA + // OAM_BUFFER[2].y++; + inc OAM_BUFFER+2*SIZEOF_STRUCT_SPRITEDATA + // OAM_BUFFER[3].y++; + inc OAM_BUFFER+3*SIZEOF_STRUCT_SPRITEDATA __b1: // APU->JOY1&0b00000001 lda #1 @@ -215,8 +419,14 @@ vblank: { // if(APU->JOY1&0b00000001) cmp #0 beq __breturn - // moveLuigiLeft() - jsr moveLuigiLeft + // OAM_BUFFER[0].y--; + dec OAM_BUFFER + // OAM_BUFFER[1].y--; + dec OAM_BUFFER+1*SIZEOF_STRUCT_SPRITEDATA + // OAM_BUFFER[2].y--; + dec OAM_BUFFER+2*SIZEOF_STRUCT_SPRITEDATA + // OAM_BUFFER[3].y--; + dec OAM_BUFFER+3*SIZEOF_STRUCT_SPRITEDATA __breturn: // } pla @@ -226,36 +436,15 @@ vblank: { pla rti } -// move the Luigi sprites left -moveLuigiLeft: { - // OAM_BUFFER[0].x--; - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X - // OAM_BUFFER[1].x--; - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+1*SIZEOF_STRUCT_OBJECTATTRIBUTE - // OAM_BUFFER[2].x--; - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+2*SIZEOF_STRUCT_OBJECTATTRIBUTE - // OAM_BUFFER[3].x--; - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+3*SIZEOF_STRUCT_OBJECTATTRIBUTE - // } - rts -} -// move the Luigi sprites right -moveLuigiRight: { - // OAM_BUFFER[0].x++; - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X - // OAM_BUFFER[1].x++; - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+1*SIZEOF_STRUCT_OBJECTATTRIBUTE - // OAM_BUFFER[2].x++; - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+2*SIZEOF_STRUCT_OBJECTATTRIBUTE - // OAM_BUFFER[3].x++; - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+3*SIZEOF_STRUCT_OBJECTATTRIBUTE - // } - rts -} .segment Data + // Flag tile + FLAG: .byte $54, $55, $56, $57 + // Floor tile + FLOOR: .byte $85, $85, $86, $86 // Small Luigi Sprite Data SPRITES: .byte $80, $36, 2, $80, $80, $37, 2, $88, $88, $38, 2, $80, $88, $39, 2, $88 - PALETTE: .byte $f, $31, $32, $33, $f, $35, $36, $37, $f, $39, $3a, $3b, $f, $3d, $3e, $f, $f, $1c, $15, $14, $f, 2, $38, $3c, $f, $30, $37, $1a, $f, $f, $f, $f + // Color Palette + PALETTE: .byte $f, $13, $23, $33, $f, 6, $15, $36, $f, $39, $4a, $5b, $f, $3d, $4e, $5f, $f, $1c, $15, $14, $f, 2, $38, $3c, $f, $30, $37, $1a, $f, $f, $f, $f .segment Tiles TILES: .import binary "smb1_chr.bin" diff --git a/src/test/ref/examples/nes/nes-demo.cfg b/src/test/ref/examples/nes/nes-demo.cfg index 2e4dca522..6c4c4aae6 100644 --- a/src/test/ref/examples/nes/nes-demo.cfg +++ b/src/test/ref/examples/nes/nes-demo.cfg @@ -10,142 +10,231 @@ (void()) main() main: scope:[main] from @1 + [4] phi() + to:main::initNES1 +main::initNES1: scope:[main] from main asm { cld ldx#$ff txs } - to:main::disableVideoOutput1 -main::disableVideoOutput1: scope:[main] from main - [5] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0 - [6] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) 0 - to:main::disableAudioOutput1 -main::disableAudioOutput1: scope:[main] from main::disableVideoOutput1 - [7] *((const nomodify byte*) FR_COUNTER) ← (byte) $40 - [8] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) ← (byte) $40 - to:main::clearVBlankFlag1 -main::clearVBlankFlag1: scope:[main] from main::disableAudioOutput1 + to:main::initNES1_disableVideoOutput1 +main::initNES1_disableVideoOutput1: scope:[main] from main::initNES1 + [6] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0 + [7] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) 0 + to:main::initNES1_disableAudioOutput1 +main::initNES1_disableAudioOutput1: scope:[main] from main::initNES1_disableVideoOutput1 + [8] *((const nomodify byte*) FR_COUNTER) ← (byte) $40 + [9] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) ← (byte) $40 + to:main::initNES1_clearVBlankFlag1 +main::initNES1_clearVBlankFlag1: scope:[main] from main::initNES1_disableAudioOutput1 asm { ldaPPU_PPUSTATUS } - to:main::waitForVBlank1 -main::waitForVBlank1: scope:[main] from main::clearVBlankFlag1 - [10] phi() - to:main::waitForVBlank1_@1 -main::waitForVBlank1_@1: scope:[main] from main::waitForVBlank1 main::waitForVBlank1_@1 - [11] (byte~) main::waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 - [12] if((byte) 0==(byte~) main::waitForVBlank1_$0) goto main::waitForVBlank1_@1 - to:main::@1 -main::@1: scope:[main] from main::@1 main::waitForVBlank1_@1 - [13] (byte) main::i#2 ← phi( main::@1/(byte) main::i#1 main::waitForVBlank1_@1/(byte) 0 ) - [14] *((const nomodify byte*) MEMORY + (byte) main::i#2) ← (byte) 0 - [15] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::i#2) ← (byte) 0 - [16] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::i#2) ← (byte) 0 - [17] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::i#2) ← (byte) 0 - [18] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::i#2) ← (byte) 0 - [19] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::i#2) ← (byte) 0 - [20] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::i#2) ← (byte) 0 - [21] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::i#2) ← (byte) 0 - [22] (byte) main::i#1 ← ++ (byte) main::i#2 - [23] if((byte) 0!=(byte) main::i#1) goto main::@1 - to:main::waitForVBlank2 -main::waitForVBlank2: scope:[main] from main::@1 - [24] phi() - to:main::waitForVBlank2_@1 -main::waitForVBlank2_@1: scope:[main] from main::waitForVBlank2 main::waitForVBlank2_@1 - [25] (byte~) main::waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 - [26] if((byte) 0==(byte~) main::waitForVBlank2_$0) goto main::waitForVBlank2_@1 - to:main::@3 -main::@3: scope:[main] from main::waitForVBlank2_@1 - [27] phi() - [28] call initPalette - to:main::@4 -main::@4: scope:[main] from main::@3 + to:main::initNES1_waitForVBlank1 +main::initNES1_waitForVBlank1: scope:[main] from main::initNES1_clearVBlankFlag1 + [11] phi() + to:main::initNES1_waitForVBlank1_@1 +main::initNES1_waitForVBlank1_@1: scope:[main] from main::initNES1_waitForVBlank1 main::initNES1_waitForVBlank1_@1 + [12] (byte~) main::initNES1_waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 + [13] if((byte) 0==(byte~) main::initNES1_waitForVBlank1_$0) goto main::initNES1_waitForVBlank1_@1 + to:main::initNES1_@1 +main::initNES1_@1: scope:[main] from main::initNES1_@1 main::initNES1_waitForVBlank1_@1 + [14] (byte) main::initNES1_i#2 ← phi( main::initNES1_@1/(byte) main::initNES1_i#1 main::initNES1_waitForVBlank1_@1/(byte) 0 ) + [15] *((const nomodify byte*) MEMORY + (byte) main::initNES1_i#2) ← (byte) 0 + [16] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::initNES1_i#2) ← (byte) 0 + [17] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::initNES1_i#2) ← (byte) 0 + [18] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::initNES1_i#2) ← (byte) 0 + [19] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::initNES1_i#2) ← (byte) 0 + [20] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::initNES1_i#2) ← (byte) 0 + [21] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::initNES1_i#2) ← (byte) 0 + [22] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::initNES1_i#2) ← (byte) 0 + [23] (byte) main::initNES1_i#1 ← ++ (byte) main::initNES1_i#2 + [24] if((byte) 0!=(byte) main::initNES1_i#1) goto main::initNES1_@1 + to:main::initNES1_waitForVBlank2 +main::initNES1_waitForVBlank2: scope:[main] from main::initNES1_@1 + [25] phi() + to:main::initNES1_waitForVBlank2_@1 +main::initNES1_waitForVBlank2_@1: scope:[main] from main::initNES1_waitForVBlank2 main::initNES1_waitForVBlank2_@1 + [26] (byte~) main::initNES1_waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 + [27] if((byte) 0==(byte~) main::initNES1_waitForVBlank2_$0) goto main::initNES1_waitForVBlank2_@1 + to:main::initNES1_@7 +main::initNES1_@7: scope:[main] from main::initNES1_waitForVBlank2_@1 + asm { ldaPPU_PPUSTATUS } + to:main::@8 +main::@8: scope:[main] from main::initNES1_@7 [29] phi() - [30] call initSpriteBuffer - to:main::enableVideoOutput1 -main::enableVideoOutput1: scope:[main] from main::@4 - [31] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80 - [32] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $10 - to:main::@2 -main::@2: scope:[main] from main::@2 main::enableVideoOutput1 + [30] call ppuDataTransfer + to:main::@9 +main::@9: scope:[main] from main::@8 + [31] phi() + [32] call ppuDataFill + to:main::@10 +main::@10: scope:[main] from main::@9 [33] phi() - to:main::@2 + [34] call ppuDataFill + to:main::@1 +main::@1: scope:[main] from main::@10 main::@11 + [35] (byte) main::x#2 ← phi( main::@10/(byte) 0 main::@11/(byte) main::x#1 ) + [36] if((byte) main::x#2<(byte) $20) goto main::@2 + to:main::@3 +main::@3: scope:[main] from main::@1 + [37] phi() + [38] call ppuDataPutTile + to:main::@4 +main::@4: scope:[main] from main::@3 main::@5 + [39] (byte) main::i#2 ← phi( main::@3/(byte) 0 main::@5/(byte) main::i#1 ) + [40] if((byte) main::i#2<(byte) 4*(const byte) SIZEOF_STRUCT_SPRITEDATA) goto main::@5 + to:main::@6 +main::@6: scope:[main] from main::@4 + [41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) 0 + [42] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) -8 + to:main::enableVideoOutput1 +main::enableVideoOutput1: scope:[main] from main::@6 + [43] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80 + [44] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $18 + to:main::@7 +main::@7: scope:[main] from main::@7 main::enableVideoOutput1 + [45] phi() + to:main::@7 +main::@5: scope:[main] from main::@4 + [46] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER + (byte) main::i#2) ← *((byte*)(const struct SpriteData*) SPRITES + (byte) main::i#2) + [47] (byte) main::i#1 ← ++ (byte) main::i#2 + to:main::@4 +main::@2: scope:[main] from main::@1 + [48] (nomodify byte*) ppuDataPutTile::ppuData#0 ← (const nomodify byte*) PPU_NAME_TABLE_0+(word)(number) $14*(number) $20 + (byte) main::x#2 + [49] (nomodify void*) ppuDataPutTile::ppuData#9 ← (void*)(nomodify byte*) ppuDataPutTile::ppuData#0 + [50] call ppuDataPutTile + to:main::@11 +main::@11: scope:[main] from main::@2 + [51] (byte) main::x#1 ← (byte) main::x#2 + (byte) 2 + to:main::@1 -(void()) initSpriteBuffer() -initSpriteBuffer: scope:[initSpriteBuffer] from main::@4 - [34] phi() - to:initSpriteBuffer::@1 -initSpriteBuffer::@1: scope:[initSpriteBuffer] from initSpriteBuffer initSpriteBuffer::@1 - [35] (byte) initSpriteBuffer::i#2 ← phi( initSpriteBuffer/(byte) 0 initSpriteBuffer::@1/(byte) initSpriteBuffer::i#1 ) - [36] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER + (byte) initSpriteBuffer::i#2) ← *((byte*)(const struct ObjectAttribute*) SPRITES + (byte) initSpriteBuffer::i#2) - [37] (byte) initSpriteBuffer::i#1 ← ++ (byte) initSpriteBuffer::i#2 - [38] if((byte) initSpriteBuffer::i#1!=(byte) 4*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) goto initSpriteBuffer::@1 - to:initSpriteBuffer::@return -initSpriteBuffer::@return: scope:[initSpriteBuffer] from initSpriteBuffer::@1 - [39] return +(void()) ppuDataPutTile((nomodify void*) ppuDataPutTile::ppuData , (byte*) ppuDataPutTile::tile) +ppuDataPutTile: scope:[ppuDataPutTile] from main::@2 main::@3 + [52] (byte*) ppuDataPutTile::tile#10 ← phi( main::@2/(const byte*) FLOOR main::@3/(const byte*) FLAG ) + [52] (nomodify void*) ppuDataPutTile::ppuData#2 ← phi( main::@2/(nomodify void*) ppuDataPutTile::ppuData#9 main::@3/(void*)(const nomodify byte*) PPU_NAME_TABLE_0+(word)(number) $12*(number) $20+(byte) $1c ) + to:ppuDataPutTile::ppuDataPrepare1 +ppuDataPutTile::ppuDataPrepare1: scope:[ppuDataPutTile] from ppuDataPutTile + [53] (byte~) ppuDataPutTile::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataPutTile::ppuData#2 + [54] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare1_$0 + [55] (byte~) ppuDataPutTile::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataPutTile::ppuData#2 + [56] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare1_$1 + to:ppuDataPutTile::@1 +ppuDataPutTile::@1: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPrepare1 + [57] (byte) ppuDataPutTile::ppuDataPut1_val#0 ← *((byte*) ppuDataPutTile::tile#10) + to:ppuDataPutTile::ppuDataPut1 +ppuDataPutTile::ppuDataPut1: scope:[ppuDataPutTile] from ppuDataPutTile::@1 + [58] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut1_val#0 + to:ppuDataPutTile::@2 +ppuDataPutTile::@2: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPut1 + [59] (byte) ppuDataPutTile::ppuDataPut2_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 1) + to:ppuDataPutTile::ppuDataPut2 +ppuDataPutTile::ppuDataPut2: scope:[ppuDataPutTile] from ppuDataPutTile::@2 + [60] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut2_val#0 + to:ppuDataPutTile::@3 +ppuDataPutTile::@3: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPut2 + [61] (nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 ← (byte*)(nomodify void*) ppuDataPutTile::ppuData#2 + (byte) $20 + to:ppuDataPutTile::ppuDataPrepare2 +ppuDataPutTile::ppuDataPrepare2: scope:[ppuDataPutTile] from ppuDataPutTile::@3 + [62] (byte~) ppuDataPutTile::ppuDataPrepare2_$0 ← > (void*)(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 + [63] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare2_$0 + [64] (byte~) ppuDataPutTile::ppuDataPrepare2_$1 ← < (void*)(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 + [65] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare2_$1 + to:ppuDataPutTile::@4 +ppuDataPutTile::@4: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPrepare2 + [66] (byte) ppuDataPutTile::ppuDataPut3_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 2) + to:ppuDataPutTile::ppuDataPut3 +ppuDataPutTile::ppuDataPut3: scope:[ppuDataPutTile] from ppuDataPutTile::@4 + [67] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut3_val#0 + to:ppuDataPutTile::@5 +ppuDataPutTile::@5: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPut3 + [68] (byte) ppuDataPutTile::ppuDataPut4_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 3) + to:ppuDataPutTile::ppuDataPut4 +ppuDataPutTile::ppuDataPut4: scope:[ppuDataPutTile] from ppuDataPutTile::@5 + [69] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut4_val#0 + to:ppuDataPutTile::@return +ppuDataPutTile::@return: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPut4 + [70] return to:@return -(void()) initPalette() -initPalette: scope:[initPalette] from main::@3 - asm { ldaPPU_PPUSTATUS } - [41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify byte*) PPU_PALETTE - [42] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0 - to:initPalette::@1 -initPalette::@1: scope:[initPalette] from initPalette initPalette::@2 - [43] (byte) initPalette::i#2 ← phi( initPalette/(byte) 0 initPalette::@2/(byte) initPalette::i#1 ) - [44] if((byte) initPalette::i#2<(byte) $20*(const byte) SIZEOF_BYTE) goto initPalette::@2 - to:initPalette::@return -initPalette::@return: scope:[initPalette] from initPalette::@1 - [45] return +(void()) ppuDataFill((nomodify void*) ppuDataFill::ppuData , (byte) ppuDataFill::val , (word) ppuDataFill::size) +ppuDataFill: scope:[ppuDataFill] from main::@10 main::@9 + [71] (byte) ppuDataFill::val#4 ← phi( main::@10/(byte) 0 main::@9/(byte) $fc ) + [71] (word) ppuDataFill::size#3 ← phi( main::@10/(byte) $40 main::@9/(word) $3c0 ) + [71] (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ← phi( main::@10/(void*)(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 main::@9/(void*)(const nomodify byte*) PPU_NAME_TABLE_0 ) + to:ppuDataFill::ppuDataPrepare1 +ppuDataFill::ppuDataPrepare1: scope:[ppuDataFill] from ppuDataFill + [72] (byte~) ppuDataFill::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 + [73] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$0 + [74] (byte~) ppuDataFill::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 + [75] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$1 + to:ppuDataFill::@1 +ppuDataFill::@1: scope:[ppuDataFill] from ppuDataFill::@2 ppuDataFill::ppuDataPrepare1 + [76] (word) ppuDataFill::i#2 ← phi( ppuDataFill::ppuDataPrepare1/(word) 0 ppuDataFill::@2/(word) ppuDataFill::i#1 ) + [77] if((word) ppuDataFill::i#2<(word) ppuDataFill::size#3) goto ppuDataFill::ppuDataPut1 + to:ppuDataFill::@return +ppuDataFill::@return: scope:[ppuDataFill] from ppuDataFill::@1 + [78] return to:@return -initPalette::@2: scope:[initPalette] from initPalette::@1 - [46] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← *((const byte*) PALETTE + (byte) initPalette::i#2) - [47] (byte) initPalette::i#1 ← ++ (byte) initPalette::i#2 - to:initPalette::@1 +ppuDataFill::ppuDataPut1: scope:[ppuDataFill] from ppuDataFill::@1 + [79] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataFill::val#4 + to:ppuDataFill::@2 +ppuDataFill::@2: scope:[ppuDataFill] from ppuDataFill::ppuDataPut1 + [80] (word) ppuDataFill::i#1 ← ++ (word) ppuDataFill::i#2 + to:ppuDataFill::@1 + +(void()) ppuDataTransfer((nomodify void*) ppuDataTransfer::ppuData , (nomodify void*) ppuDataTransfer::cpuData , (word) ppuDataTransfer::size) +ppuDataTransfer: scope:[ppuDataTransfer] from main::@8 + [81] phi() + to:ppuDataTransfer::ppuDataPrepare1 +ppuDataTransfer::ppuDataPrepare1: scope:[ppuDataTransfer] from ppuDataTransfer + [82] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify void*) ppuDataTransfer::ppuData#0 + [83] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0 + to:ppuDataTransfer::@1 +ppuDataTransfer::@1: scope:[ppuDataTransfer] from ppuDataTransfer::@3 ppuDataTransfer::ppuDataPrepare1 + [84] (byte*) ppuDataTransfer::cpuSrc#2 ← phi( ppuDataTransfer::ppuDataPrepare1/(byte*)(const nomodify void*) ppuDataTransfer::cpuData#0 ppuDataTransfer::@3/(byte*) ppuDataTransfer::cpuSrc#1 ) + [84] (word) ppuDataTransfer::i#2 ← phi( ppuDataTransfer::ppuDataPrepare1/(word) 0 ppuDataTransfer::@3/(word) ppuDataTransfer::i#1 ) + [85] if((word) ppuDataTransfer::i#2<(const word) ppuDataTransfer::size#0) goto ppuDataTransfer::@2 + to:ppuDataTransfer::@return +ppuDataTransfer::@return: scope:[ppuDataTransfer] from ppuDataTransfer::@1 + [86] return + to:@return +ppuDataTransfer::@2: scope:[ppuDataTransfer] from ppuDataTransfer::@1 + [87] (byte) ppuDataTransfer::ppuDataPut1_val#0 ← *((byte*) ppuDataTransfer::cpuSrc#2) + to:ppuDataTransfer::ppuDataPut1 +ppuDataTransfer::ppuDataPut1: scope:[ppuDataTransfer] from ppuDataTransfer::@2 + [88] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataTransfer::ppuDataPut1_val#0 + to:ppuDataTransfer::@3 +ppuDataTransfer::@3: scope:[ppuDataTransfer] from ppuDataTransfer::ppuDataPut1 + [89] (byte*) ppuDataTransfer::cpuSrc#1 ← ++ (byte*) ppuDataTransfer::cpuSrc#2 + [90] (word) ppuDataTransfer::i#1 ← ++ (word) ppuDataTransfer::i#2 + to:ppuDataTransfer::@1 interrupt(HARDWARE_STACK)(void()) vblank() vblank: scope:[vblank] from - [48] phi() - to:vblank::transferSpriteBufferToPpu1 -vblank::transferSpriteBufferToPpu1: scope:[vblank] from vblank - [49] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 - [50] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct ObjectAttribute*) OAM_BUFFER + [91] phi() + to:vblank::ppuSpriteBufferDmaTransfer1 +vblank::ppuSpriteBufferDmaTransfer1: scope:[vblank] from vblank + [92] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 + [93] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct SpriteData*) OAM_BUFFER to:vblank::@4 -vblank::@4: scope:[vblank] from vblank::transferSpriteBufferToPpu1 - [51] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1 - [52] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0 - [53] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 - [54] if((byte) 0==(byte~) vblank::$1) goto vblank::@1 +vblank::@4: scope:[vblank] from vblank::ppuSpriteBufferDmaTransfer1 + [94] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1 + [95] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0 + [96] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 + [97] if((byte) 0==(byte~) vblank::$1) goto vblank::@1 to:vblank::@2 vblank::@2: scope:[vblank] from vblank::@4 - [55] phi() - [56] call moveLuigiRight + [98] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) + [99] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) + [100] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) + [101] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) to:vblank::@1 vblank::@1: scope:[vblank] from vblank::@2 vblank::@4 - [57] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 - [58] if((byte) 0==(byte~) vblank::$3) goto vblank::@return + [102] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 + [103] if((byte) 0==(byte~) vblank::$3) goto vblank::@return to:vblank::@3 vblank::@3: scope:[vblank] from vblank::@1 - [59] phi() - [60] call moveLuigiLeft + [104] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) + [105] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) + [106] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) + [107] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) to:vblank::@return vblank::@return: scope:[vblank] from vblank::@1 vblank::@3 - [61] return - to:@return - -(void()) moveLuigiLeft() -moveLuigiLeft: scope:[moveLuigiLeft] from vblank::@3 - [62] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) - [63] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) - [64] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) - [65] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) - to:moveLuigiLeft::@return -moveLuigiLeft::@return: scope:[moveLuigiLeft] from moveLuigiLeft - [66] return - to:@return - -(void()) moveLuigiRight() -moveLuigiRight: scope:[moveLuigiRight] from vblank::@2 - [67] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) - [68] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) - [69] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) - [70] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) - to:moveLuigiRight::@return -moveLuigiRight::@return: scope:[moveLuigiRight] from moveLuigiRight - [71] return + [108] return to:@return diff --git a/src/test/ref/examples/nes/nes-demo.log b/src/test/ref/examples/nes/nes-demo.log index ccd701f0d..e9a9b50fa 100644 --- a/src/test/ref/examples/nes/nes-demo.log +++ b/src/test/ref/examples/nes/nes-demo.log @@ -1,84 +1,367 @@ -Resolved forward reference SPRITES to (const struct ObjectAttribute*) SPRITES -Resolved forward reference SPRITES to (const struct ObjectAttribute*) SPRITES Resolved forward reference PALETTE to (const byte*) PALETTE Resolved forward reference PALETTE to (const byte*) PALETTE +Resolved forward reference FLOOR to (const byte*) FLOOR +Resolved forward reference FLAG to (const byte*) FLAG +Resolved forward reference SPRITES to (const struct SpriteData*) SPRITES +Resolved forward reference SPRITES to (const struct SpriteData*) SPRITES Inlined call call disableVideoOutput Inlined call call disableAudioOutput Inlined call call clearVBlankFlag Inlined call call waitForVBlank Inlined call call waitForVBlank +Inlined call call ppuDataPrepare (nomodify void*) ppuDataFill::ppuData +Inlined call call ppuDataPut (byte) ppuDataFill::val +Inlined call call ppuDataPrepare (nomodify void*) ppuDataTransfer::ppuData +Inlined call call ppuDataPut *((byte*) ppuDataTransfer::cpuSrc) +Inlined call call ppuDataPrepare (nomodify void*) ppuDataPutTile::ppuData +Inlined call call ppuDataPut *((byte*) ppuDataPutTile::tile + (number) 0) +Inlined call call ppuDataPut *((byte*) ppuDataPutTile::tile + (number) 1) +Inlined call call ppuDataPrepare (void*)(byte*~) ppuDataPutTile::$3 +Inlined call call ppuDataPut *((byte*) ppuDataPutTile::tile + (number) 2) +Inlined call call ppuDataPut *((byte*) ppuDataPutTile::tile + (number) 3) +Inlined call call ppuDataPrepare (nomodify void*) ppuDataSet::ppuData +Inlined call call ppuDataPut (byte) ppuDataSet::val +Inlined call call initNES Inlined call call enableVideoOutput -Inlined call call transferSpriteBufferToPpu +Inlined call call ppuSpriteBufferDmaTransfer (const nomodify struct SpriteData*) OAM_BUFFER CONTROL FLOW GRAPH SSA @begin: scope:[] from to:@1 +(void()) ppuDataFill((nomodify void*) ppuDataFill::ppuData , (byte) ppuDataFill::val , (word) ppuDataFill::size) +ppuDataFill: scope:[ppuDataFill] from main::@10 main::@9 + (byte) ppuDataFill::val#8 ← phi( main::@10/(byte) ppuDataFill::val#1 main::@9/(byte) ppuDataFill::val#0 ) + (word) ppuDataFill::size#7 ← phi( main::@10/(word) ppuDataFill::size#1 main::@9/(word) ppuDataFill::size#0 ) + (nomodify void*) ppuDataFill::ppuData#2 ← phi( main::@10/(nomodify void*) ppuDataFill::ppuData#1 main::@9/(nomodify void*) ppuDataFill::ppuData#0 ) + (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ← (nomodify void*) ppuDataFill::ppuData#2 + to:ppuDataFill::ppuDataPrepare1 +ppuDataFill::ppuDataPrepare1: scope:[ppuDataFill] from ppuDataFill + (byte) ppuDataFill::val#6 ← phi( ppuDataFill/(byte) ppuDataFill::val#8 ) + (word) ppuDataFill::size#5 ← phi( ppuDataFill/(word) ppuDataFill::size#7 ) + (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#1 ← phi( ppuDataFill/(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ) + (byte~) ppuDataFill::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#1 + (byte*~) ppuDataFill::ppuDataPrepare1_$4 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) ppuDataFill::ppuDataPrepare1_$2 ← (byte*~) ppuDataFill::ppuDataPrepare1_$4 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR + *((byte*~) ppuDataFill::ppuDataPrepare1_$2) ← (byte~) ppuDataFill::ppuDataPrepare1_$0 + (byte~) ppuDataFill::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#1 + (byte*~) ppuDataFill::ppuDataPrepare1_$5 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) ppuDataFill::ppuDataPrepare1_$3 ← (byte*~) ppuDataFill::ppuDataPrepare1_$5 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR + *((byte*~) ppuDataFill::ppuDataPrepare1_$3) ← (byte~) ppuDataFill::ppuDataPrepare1_$1 + to:ppuDataFill::@3 +ppuDataFill::@3: scope:[ppuDataFill] from ppuDataFill::ppuDataPrepare1 + (byte) ppuDataFill::val#4 ← phi( ppuDataFill::ppuDataPrepare1/(byte) ppuDataFill::val#6 ) + (word) ppuDataFill::size#3 ← phi( ppuDataFill::ppuDataPrepare1/(word) ppuDataFill::size#5 ) + (word) ppuDataFill::i#0 ← (word) 0 + to:ppuDataFill::@1 +ppuDataFill::@1: scope:[ppuDataFill] from ppuDataFill::@3 ppuDataFill::@4 + (byte) ppuDataFill::val#3 ← phi( ppuDataFill::@3/(byte) ppuDataFill::val#4 ppuDataFill::@4/(byte) ppuDataFill::val#5 ) + (word) ppuDataFill::size#2 ← phi( ppuDataFill::@3/(word) ppuDataFill::size#3 ppuDataFill::@4/(word) ppuDataFill::size#4 ) + (word) ppuDataFill::i#2 ← phi( ppuDataFill::@3/(word) ppuDataFill::i#0 ppuDataFill::@4/(word) ppuDataFill::i#1 ) + (bool~) ppuDataFill::$1 ← (word) ppuDataFill::i#2 < (word) ppuDataFill::size#2 + if((bool~) ppuDataFill::$1) goto ppuDataFill::@2 + to:ppuDataFill::@return +ppuDataFill::@2: scope:[ppuDataFill] from ppuDataFill::@1 + (word) ppuDataFill::size#8 ← phi( ppuDataFill::@1/(word) ppuDataFill::size#2 ) + (word) ppuDataFill::i#5 ← phi( ppuDataFill::@1/(word) ppuDataFill::i#2 ) + (byte) ppuDataFill::val#2 ← phi( ppuDataFill::@1/(byte) ppuDataFill::val#3 ) + (byte) ppuDataFill::ppuDataPut1_val#0 ← (byte) ppuDataFill::val#2 + to:ppuDataFill::ppuDataPut1 +ppuDataFill::ppuDataPut1: scope:[ppuDataFill] from ppuDataFill::@2 + (byte) ppuDataFill::val#7 ← phi( ppuDataFill::@2/(byte) ppuDataFill::val#2 ) + (word) ppuDataFill::size#6 ← phi( ppuDataFill::@2/(word) ppuDataFill::size#8 ) + (word) ppuDataFill::i#4 ← phi( ppuDataFill::@2/(word) ppuDataFill::i#5 ) + (byte) ppuDataFill::ppuDataPut1_val#1 ← phi( ppuDataFill::@2/(byte) ppuDataFill::ppuDataPut1_val#0 ) + (byte*~) ppuDataFill::ppuDataPut1_$1 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) ppuDataFill::ppuDataPut1_$0 ← (byte*~) ppuDataFill::ppuDataPut1_$1 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA + *((byte*~) ppuDataFill::ppuDataPut1_$0) ← (byte) ppuDataFill::ppuDataPut1_val#1 + to:ppuDataFill::@4 +ppuDataFill::@4: scope:[ppuDataFill] from ppuDataFill::ppuDataPut1 + (byte) ppuDataFill::val#5 ← phi( ppuDataFill::ppuDataPut1/(byte) ppuDataFill::val#7 ) + (word) ppuDataFill::size#4 ← phi( ppuDataFill::ppuDataPut1/(word) ppuDataFill::size#6 ) + (word) ppuDataFill::i#3 ← phi( ppuDataFill::ppuDataPut1/(word) ppuDataFill::i#4 ) + (word) ppuDataFill::i#1 ← ++ (word) ppuDataFill::i#3 + to:ppuDataFill::@1 +ppuDataFill::@return: scope:[ppuDataFill] from ppuDataFill::@1 + return + to:@return + +(void()) ppuDataTransfer((nomodify void*) ppuDataTransfer::ppuData , (nomodify void*) ppuDataTransfer::cpuData , (word) ppuDataTransfer::size) +ppuDataTransfer: scope:[ppuDataTransfer] from main::@8 + (word) ppuDataTransfer::size#6 ← phi( main::@8/(word) ppuDataTransfer::size#0 ) + (nomodify void*) ppuDataTransfer::cpuData#3 ← phi( main::@8/(nomodify void*) ppuDataTransfer::cpuData#0 ) + (nomodify void*) ppuDataTransfer::ppuData#1 ← phi( main::@8/(nomodify void*) ppuDataTransfer::ppuData#0 ) + (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0 ← (nomodify void*) ppuDataTransfer::ppuData#1 + to:ppuDataTransfer::ppuDataPrepare1 +ppuDataTransfer::ppuDataPrepare1: scope:[ppuDataTransfer] from ppuDataTransfer + (word) ppuDataTransfer::size#4 ← phi( ppuDataTransfer/(word) ppuDataTransfer::size#6 ) + (nomodify void*) ppuDataTransfer::cpuData#2 ← phi( ppuDataTransfer/(nomodify void*) ppuDataTransfer::cpuData#3 ) + (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#1 ← phi( ppuDataTransfer/(nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0 ) + (byte~) ppuDataTransfer::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#1 + (byte*~) ppuDataTransfer::ppuDataPrepare1_$4 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) ppuDataTransfer::ppuDataPrepare1_$2 ← (byte*~) ppuDataTransfer::ppuDataPrepare1_$4 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR + *((byte*~) ppuDataTransfer::ppuDataPrepare1_$2) ← (byte~) ppuDataTransfer::ppuDataPrepare1_$0 + (byte~) ppuDataTransfer::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#1 + (byte*~) ppuDataTransfer::ppuDataPrepare1_$5 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) ppuDataTransfer::ppuDataPrepare1_$3 ← (byte*~) ppuDataTransfer::ppuDataPrepare1_$5 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR + *((byte*~) ppuDataTransfer::ppuDataPrepare1_$3) ← (byte~) ppuDataTransfer::ppuDataPrepare1_$1 + to:ppuDataTransfer::@3 +ppuDataTransfer::@3: scope:[ppuDataTransfer] from ppuDataTransfer::ppuDataPrepare1 + (word) ppuDataTransfer::size#2 ← phi( ppuDataTransfer::ppuDataPrepare1/(word) ppuDataTransfer::size#4 ) + (nomodify void*) ppuDataTransfer::cpuData#1 ← phi( ppuDataTransfer::ppuDataPrepare1/(nomodify void*) ppuDataTransfer::cpuData#2 ) + (byte*) ppuDataTransfer::cpuSrc#0 ← (byte*)(nomodify void*) ppuDataTransfer::cpuData#1 + (word) ppuDataTransfer::i#0 ← (word) 0 + to:ppuDataTransfer::@1 +ppuDataTransfer::@1: scope:[ppuDataTransfer] from ppuDataTransfer::@3 ppuDataTransfer::@4 + (byte*) ppuDataTransfer::cpuSrc#4 ← phi( ppuDataTransfer::@3/(byte*) ppuDataTransfer::cpuSrc#0 ppuDataTransfer::@4/(byte*) ppuDataTransfer::cpuSrc#1 ) + (word) ppuDataTransfer::size#1 ← phi( ppuDataTransfer::@3/(word) ppuDataTransfer::size#2 ppuDataTransfer::@4/(word) ppuDataTransfer::size#3 ) + (word) ppuDataTransfer::i#2 ← phi( ppuDataTransfer::@3/(word) ppuDataTransfer::i#0 ppuDataTransfer::@4/(word) ppuDataTransfer::i#1 ) + (bool~) ppuDataTransfer::$1 ← (word) ppuDataTransfer::i#2 < (word) ppuDataTransfer::size#1 + if((bool~) ppuDataTransfer::$1) goto ppuDataTransfer::@2 + to:ppuDataTransfer::@return +ppuDataTransfer::@2: scope:[ppuDataTransfer] from ppuDataTransfer::@1 + (word) ppuDataTransfer::size#7 ← phi( ppuDataTransfer::@1/(word) ppuDataTransfer::size#1 ) + (word) ppuDataTransfer::i#5 ← phi( ppuDataTransfer::@1/(word) ppuDataTransfer::i#2 ) + (byte*) ppuDataTransfer::cpuSrc#2 ← phi( ppuDataTransfer::@1/(byte*) ppuDataTransfer::cpuSrc#4 ) + (byte) ppuDataTransfer::ppuDataPut1_val#0 ← *((byte*) ppuDataTransfer::cpuSrc#2) + to:ppuDataTransfer::ppuDataPut1 +ppuDataTransfer::ppuDataPut1: scope:[ppuDataTransfer] from ppuDataTransfer::@2 + (word) ppuDataTransfer::size#5 ← phi( ppuDataTransfer::@2/(word) ppuDataTransfer::size#7 ) + (word) ppuDataTransfer::i#4 ← phi( ppuDataTransfer::@2/(word) ppuDataTransfer::i#5 ) + (byte*) ppuDataTransfer::cpuSrc#5 ← phi( ppuDataTransfer::@2/(byte*) ppuDataTransfer::cpuSrc#2 ) + (byte) ppuDataTransfer::ppuDataPut1_val#1 ← phi( ppuDataTransfer::@2/(byte) ppuDataTransfer::ppuDataPut1_val#0 ) + (byte*~) ppuDataTransfer::ppuDataPut1_$1 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) ppuDataTransfer::ppuDataPut1_$0 ← (byte*~) ppuDataTransfer::ppuDataPut1_$1 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA + *((byte*~) ppuDataTransfer::ppuDataPut1_$0) ← (byte) ppuDataTransfer::ppuDataPut1_val#1 + to:ppuDataTransfer::@4 +ppuDataTransfer::@4: scope:[ppuDataTransfer] from ppuDataTransfer::ppuDataPut1 + (word) ppuDataTransfer::size#3 ← phi( ppuDataTransfer::ppuDataPut1/(word) ppuDataTransfer::size#5 ) + (word) ppuDataTransfer::i#3 ← phi( ppuDataTransfer::ppuDataPut1/(word) ppuDataTransfer::i#4 ) + (byte*) ppuDataTransfer::cpuSrc#3 ← phi( ppuDataTransfer::ppuDataPut1/(byte*) ppuDataTransfer::cpuSrc#5 ) + (byte*) ppuDataTransfer::cpuSrc#1 ← ++ (byte*) ppuDataTransfer::cpuSrc#3 + (word) ppuDataTransfer::i#1 ← ++ (word) ppuDataTransfer::i#3 + to:ppuDataTransfer::@1 +ppuDataTransfer::@return: scope:[ppuDataTransfer] from ppuDataTransfer::@1 + return + to:@return + +(void()) ppuDataPutTile((nomodify void*) ppuDataPutTile::ppuData , (byte*) ppuDataPutTile::tile) +ppuDataPutTile: scope:[ppuDataPutTile] from main::@2 main::@3 + (byte*) ppuDataPutTile::tile#10 ← phi( main::@2/(byte*) ppuDataPutTile::tile#0 main::@3/(byte*) ppuDataPutTile::tile#1 ) + (nomodify void*) ppuDataPutTile::ppuData#2 ← phi( main::@2/(nomodify void*) ppuDataPutTile::ppuData#0 main::@3/(nomodify void*) ppuDataPutTile::ppuData#1 ) + (nomodify void*) ppuDataPutTile::ppuDataPrepare1_ppuData#0 ← (nomodify void*) ppuDataPutTile::ppuData#2 + to:ppuDataPutTile::ppuDataPrepare1 +ppuDataPutTile::ppuDataPrepare1: scope:[ppuDataPutTile] from ppuDataPutTile + (nomodify void*) ppuDataPutTile::ppuData#8 ← phi( ppuDataPutTile/(nomodify void*) ppuDataPutTile::ppuData#2 ) + (byte*) ppuDataPutTile::tile#6 ← phi( ppuDataPutTile/(byte*) ppuDataPutTile::tile#10 ) + (nomodify void*) ppuDataPutTile::ppuDataPrepare1_ppuData#1 ← phi( ppuDataPutTile/(nomodify void*) ppuDataPutTile::ppuDataPrepare1_ppuData#0 ) + (byte~) ppuDataPutTile::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataPutTile::ppuDataPrepare1_ppuData#1 + (byte*~) ppuDataPutTile::ppuDataPrepare1_$4 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) ppuDataPutTile::ppuDataPrepare1_$2 ← (byte*~) ppuDataPutTile::ppuDataPrepare1_$4 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR + *((byte*~) ppuDataPutTile::ppuDataPrepare1_$2) ← (byte~) ppuDataPutTile::ppuDataPrepare1_$0 + (byte~) ppuDataPutTile::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataPutTile::ppuDataPrepare1_ppuData#1 + (byte*~) ppuDataPutTile::ppuDataPrepare1_$5 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) ppuDataPutTile::ppuDataPrepare1_$3 ← (byte*~) ppuDataPutTile::ppuDataPrepare1_$5 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR + *((byte*~) ppuDataPutTile::ppuDataPrepare1_$3) ← (byte~) ppuDataPutTile::ppuDataPrepare1_$1 + to:ppuDataPutTile::@1 +ppuDataPutTile::@1: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPrepare1 + (nomodify void*) ppuDataPutTile::ppuData#7 ← phi( ppuDataPutTile::ppuDataPrepare1/(nomodify void*) ppuDataPutTile::ppuData#8 ) + (byte*) ppuDataPutTile::tile#2 ← phi( ppuDataPutTile::ppuDataPrepare1/(byte*) ppuDataPutTile::tile#6 ) + (byte) ppuDataPutTile::ppuDataPut1_val#0 ← *((byte*) ppuDataPutTile::tile#2 + (number) 0) + to:ppuDataPutTile::ppuDataPut1 +ppuDataPutTile::ppuDataPut1: scope:[ppuDataPutTile] from ppuDataPutTile::@1 + (nomodify void*) ppuDataPutTile::ppuData#6 ← phi( ppuDataPutTile::@1/(nomodify void*) ppuDataPutTile::ppuData#7 ) + (byte*) ppuDataPutTile::tile#7 ← phi( ppuDataPutTile::@1/(byte*) ppuDataPutTile::tile#2 ) + (byte) ppuDataPutTile::ppuDataPut1_val#1 ← phi( ppuDataPutTile::@1/(byte) ppuDataPutTile::ppuDataPut1_val#0 ) + (byte*~) ppuDataPutTile::ppuDataPut1_$1 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) ppuDataPutTile::ppuDataPut1_$0 ← (byte*~) ppuDataPutTile::ppuDataPut1_$1 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA + *((byte*~) ppuDataPutTile::ppuDataPut1_$0) ← (byte) ppuDataPutTile::ppuDataPut1_val#1 + to:ppuDataPutTile::@2 +ppuDataPutTile::@2: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPut1 + (nomodify void*) ppuDataPutTile::ppuData#5 ← phi( ppuDataPutTile::ppuDataPut1/(nomodify void*) ppuDataPutTile::ppuData#6 ) + (byte*) ppuDataPutTile::tile#3 ← phi( ppuDataPutTile::ppuDataPut1/(byte*) ppuDataPutTile::tile#7 ) + (byte) ppuDataPutTile::ppuDataPut2_val#0 ← *((byte*) ppuDataPutTile::tile#3 + (number) 1) + to:ppuDataPutTile::ppuDataPut2 +ppuDataPutTile::ppuDataPut2: scope:[ppuDataPutTile] from ppuDataPutTile::@2 + (byte*) ppuDataPutTile::tile#12 ← phi( ppuDataPutTile::@2/(byte*) ppuDataPutTile::tile#3 ) + (nomodify void*) ppuDataPutTile::ppuData#4 ← phi( ppuDataPutTile::@2/(nomodify void*) ppuDataPutTile::ppuData#5 ) + (byte) ppuDataPutTile::ppuDataPut2_val#1 ← phi( ppuDataPutTile::@2/(byte) ppuDataPutTile::ppuDataPut2_val#0 ) + (byte*~) ppuDataPutTile::ppuDataPut2_$1 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) ppuDataPutTile::ppuDataPut2_$0 ← (byte*~) ppuDataPutTile::ppuDataPut2_$1 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA + *((byte*~) ppuDataPutTile::ppuDataPut2_$0) ← (byte) ppuDataPutTile::ppuDataPut2_val#1 + to:ppuDataPutTile::@3 +ppuDataPutTile::@3: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPut2 + (byte*) ppuDataPutTile::tile#11 ← phi( ppuDataPutTile::ppuDataPut2/(byte*) ppuDataPutTile::tile#12 ) + (nomodify void*) ppuDataPutTile::ppuData#3 ← phi( ppuDataPutTile::ppuDataPut2/(nomodify void*) ppuDataPutTile::ppuData#4 ) + (byte*~) ppuDataPutTile::$7 ← (byte*)(nomodify void*) ppuDataPutTile::ppuData#3 + (byte*~) ppuDataPutTile::$3 ← (byte*~) ppuDataPutTile::$7 + (number) $20 + (nomodify void*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 ← (void*)(byte*~) ppuDataPutTile::$3 + to:ppuDataPutTile::ppuDataPrepare2 +ppuDataPutTile::ppuDataPrepare2: scope:[ppuDataPutTile] from ppuDataPutTile::@3 + (byte*) ppuDataPutTile::tile#8 ← phi( ppuDataPutTile::@3/(byte*) ppuDataPutTile::tile#11 ) + (nomodify void*) ppuDataPutTile::ppuDataPrepare2_ppuData#1 ← phi( ppuDataPutTile::@3/(nomodify void*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 ) + (byte~) ppuDataPutTile::ppuDataPrepare2_$0 ← > (nomodify void*) ppuDataPutTile::ppuDataPrepare2_ppuData#1 + (byte*~) ppuDataPutTile::ppuDataPrepare2_$4 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) ppuDataPutTile::ppuDataPrepare2_$2 ← (byte*~) ppuDataPutTile::ppuDataPrepare2_$4 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR + *((byte*~) ppuDataPutTile::ppuDataPrepare2_$2) ← (byte~) ppuDataPutTile::ppuDataPrepare2_$0 + (byte~) ppuDataPutTile::ppuDataPrepare2_$1 ← < (nomodify void*) ppuDataPutTile::ppuDataPrepare2_ppuData#1 + (byte*~) ppuDataPutTile::ppuDataPrepare2_$5 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) ppuDataPutTile::ppuDataPrepare2_$3 ← (byte*~) ppuDataPutTile::ppuDataPrepare2_$5 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR + *((byte*~) ppuDataPutTile::ppuDataPrepare2_$3) ← (byte~) ppuDataPutTile::ppuDataPrepare2_$1 + to:ppuDataPutTile::@4 +ppuDataPutTile::@4: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPrepare2 + (byte*) ppuDataPutTile::tile#4 ← phi( ppuDataPutTile::ppuDataPrepare2/(byte*) ppuDataPutTile::tile#8 ) + (byte) ppuDataPutTile::ppuDataPut3_val#0 ← *((byte*) ppuDataPutTile::tile#4 + (number) 2) + to:ppuDataPutTile::ppuDataPut3 +ppuDataPutTile::ppuDataPut3: scope:[ppuDataPutTile] from ppuDataPutTile::@4 + (byte*) ppuDataPutTile::tile#9 ← phi( ppuDataPutTile::@4/(byte*) ppuDataPutTile::tile#4 ) + (byte) ppuDataPutTile::ppuDataPut3_val#1 ← phi( ppuDataPutTile::@4/(byte) ppuDataPutTile::ppuDataPut3_val#0 ) + (byte*~) ppuDataPutTile::ppuDataPut3_$1 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) ppuDataPutTile::ppuDataPut3_$0 ← (byte*~) ppuDataPutTile::ppuDataPut3_$1 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA + *((byte*~) ppuDataPutTile::ppuDataPut3_$0) ← (byte) ppuDataPutTile::ppuDataPut3_val#1 + to:ppuDataPutTile::@5 +ppuDataPutTile::@5: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPut3 + (byte*) ppuDataPutTile::tile#5 ← phi( ppuDataPutTile::ppuDataPut3/(byte*) ppuDataPutTile::tile#9 ) + (byte) ppuDataPutTile::ppuDataPut4_val#0 ← *((byte*) ppuDataPutTile::tile#5 + (number) 3) + to:ppuDataPutTile::ppuDataPut4 +ppuDataPutTile::ppuDataPut4: scope:[ppuDataPutTile] from ppuDataPutTile::@5 + (byte) ppuDataPutTile::ppuDataPut4_val#1 ← phi( ppuDataPutTile::@5/(byte) ppuDataPutTile::ppuDataPut4_val#0 ) + (byte*~) ppuDataPutTile::ppuDataPut4_$1 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) ppuDataPutTile::ppuDataPut4_$0 ← (byte*~) ppuDataPutTile::ppuDataPut4_$1 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA + *((byte*~) ppuDataPutTile::ppuDataPut4_$0) ← (byte) ppuDataPutTile::ppuDataPut4_val#1 + to:ppuDataPutTile::@return +ppuDataPutTile::@return: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPut4 + return + to:@return + (void()) main() main: scope:[main] from @1 + to:main::initNES1 +main::initNES1: scope:[main] from main asm { cld ldx#$ff txs } - to:main::disableVideoOutput1 -main::disableVideoOutput1: scope:[main] from main - (byte*~) main::disableVideoOutput1_$2 ← (byte*)(const struct RICOH_2C02*) PPU - (byte*~) main::disableVideoOutput1_$0 ← (byte*~) main::disableVideoOutput1_$2 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUCTRL - *((byte*~) main::disableVideoOutput1_$0) ← (number) 0 - (byte*~) main::disableVideoOutput1_$3 ← (byte*)(const struct RICOH_2C02*) PPU - (byte*~) main::disableVideoOutput1_$1 ← (byte*~) main::disableVideoOutput1_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK - *((byte*~) main::disableVideoOutput1_$1) ← (number) 0 - to:main::disableAudioOutput1 -main::disableAudioOutput1: scope:[main] from main::disableVideoOutput1 + to:main::initNES1_disableVideoOutput1 +main::initNES1_disableVideoOutput1: scope:[main] from main::initNES1 + (byte*~) main::initNES1_disableVideoOutput1_$2 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) main::initNES1_disableVideoOutput1_$0 ← (byte*~) main::initNES1_disableVideoOutput1_$2 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUCTRL + *((byte*~) main::initNES1_disableVideoOutput1_$0) ← (number) 0 + (byte*~) main::initNES1_disableVideoOutput1_$3 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) main::initNES1_disableVideoOutput1_$1 ← (byte*~) main::initNES1_disableVideoOutput1_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK + *((byte*~) main::initNES1_disableVideoOutput1_$1) ← (number) 0 + to:main::initNES1_disableAudioOutput1 +main::initNES1_disableAudioOutput1: scope:[main] from main::initNES1_disableVideoOutput1 *((const nomodify byte*) FR_COUNTER) ← (number) $40 - (byte*~) main::disableAudioOutput1_$1 ← (byte*)(const struct RICOH_2A03*) APU - (byte*~) main::disableAudioOutput1_$0 ← (byte*~) main::disableAudioOutput1_$1 + (const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ - *((byte*~) main::disableAudioOutput1_$0) ← (number) $40 - to:main::clearVBlankFlag1 -main::clearVBlankFlag1: scope:[main] from main::disableAudioOutput1 + (byte*~) main::initNES1_disableAudioOutput1_$1 ← (byte*)(const struct RICOH_2A03*) APU + (byte*~) main::initNES1_disableAudioOutput1_$0 ← (byte*~) main::initNES1_disableAudioOutput1_$1 + (const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ + *((byte*~) main::initNES1_disableAudioOutput1_$0) ← (number) $40 + to:main::initNES1_clearVBlankFlag1 +main::initNES1_clearVBlankFlag1: scope:[main] from main::initNES1_disableAudioOutput1 asm { ldaPPU_PPUSTATUS } - to:main::waitForVBlank1 -main::waitForVBlank1: scope:[main] from main::clearVBlankFlag1 - to:main::waitForVBlank1_@1 -main::waitForVBlank1_@1: scope:[main] from main::waitForVBlank1 main::waitForVBlank1_@1 - (byte*~) main::waitForVBlank1_$3 ← (byte*)(const struct RICOH_2C02*) PPU - (byte*~) main::waitForVBlank1_$2 ← (byte*~) main::waitForVBlank1_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS - (number~) main::waitForVBlank1_$0 ← *((byte*~) main::waitForVBlank1_$2) & (number) $80 - (bool~) main::waitForVBlank1_$4 ← (number) 0 != (number~) main::waitForVBlank1_$0 - (bool~) main::waitForVBlank1_$1 ← ! (bool~) main::waitForVBlank1_$4 - if((bool~) main::waitForVBlank1_$1) goto main::waitForVBlank1_@1 - to:main::@3 -main::@3: scope:[main] from main::waitForVBlank1_@1 - (byte) main::i#0 ← (byte) 0 + to:main::initNES1_waitForVBlank1 +main::initNES1_waitForVBlank1: scope:[main] from main::initNES1_clearVBlankFlag1 + to:main::initNES1_waitForVBlank1_@1 +main::initNES1_waitForVBlank1_@1: scope:[main] from main::initNES1_waitForVBlank1 main::initNES1_waitForVBlank1_@1 + (byte*~) main::initNES1_waitForVBlank1_$3 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) main::initNES1_waitForVBlank1_$2 ← (byte*~) main::initNES1_waitForVBlank1_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS + (number~) main::initNES1_waitForVBlank1_$0 ← *((byte*~) main::initNES1_waitForVBlank1_$2) & (number) $80 + (bool~) main::initNES1_waitForVBlank1_$4 ← (number) 0 != (number~) main::initNES1_waitForVBlank1_$0 + (bool~) main::initNES1_waitForVBlank1_$1 ← ! (bool~) main::initNES1_waitForVBlank1_$4 + if((bool~) main::initNES1_waitForVBlank1_$1) goto main::initNES1_waitForVBlank1_@1 + to:main::initNES1_@6 +main::initNES1_@6: scope:[main] from main::initNES1_waitForVBlank1_@1 + (byte) main::initNES1_i#0 ← (byte) 0 + to:main::initNES1_@1 +main::initNES1_@1: scope:[main] from main::initNES1_@1 main::initNES1_@6 + (byte) main::initNES1_i#2 ← phi( main::initNES1_@1/(byte) main::initNES1_i#1 main::initNES1_@6/(byte) main::initNES1_i#0 ) + *((const nomodify byte*) MEMORY+(number) 0 + (byte) main::initNES1_i#2) ← (number) 0 + *((const nomodify byte*) MEMORY+(number) $100 + (byte) main::initNES1_i#2) ← (number) 0 + *((const nomodify byte*) MEMORY+(number) $200 + (byte) main::initNES1_i#2) ← (number) 0 + *((const nomodify byte*) MEMORY+(number) $300 + (byte) main::initNES1_i#2) ← (number) 0 + *((const nomodify byte*) MEMORY+(number) $400 + (byte) main::initNES1_i#2) ← (number) 0 + *((const nomodify byte*) MEMORY+(number) $500 + (byte) main::initNES1_i#2) ← (number) 0 + *((const nomodify byte*) MEMORY+(number) $600 + (byte) main::initNES1_i#2) ← (number) 0 + *((const nomodify byte*) MEMORY+(number) $700 + (byte) main::initNES1_i#2) ← (number) 0 + (byte) main::initNES1_i#1 ← ++ (byte) main::initNES1_i#2 + (bool~) main::initNES1_$5 ← (number) 0 != (byte) main::initNES1_i#1 + if((bool~) main::initNES1_$5) goto main::initNES1_@1 + to:main::initNES1_waitForVBlank2 +main::initNES1_waitForVBlank2: scope:[main] from main::initNES1_@1 + to:main::initNES1_waitForVBlank2_@1 +main::initNES1_waitForVBlank2_@1: scope:[main] from main::initNES1_waitForVBlank2 main::initNES1_waitForVBlank2_@1 + (byte*~) main::initNES1_waitForVBlank2_$3 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) main::initNES1_waitForVBlank2_$2 ← (byte*~) main::initNES1_waitForVBlank2_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS + (number~) main::initNES1_waitForVBlank2_$0 ← *((byte*~) main::initNES1_waitForVBlank2_$2) & (number) $80 + (bool~) main::initNES1_waitForVBlank2_$4 ← (number) 0 != (number~) main::initNES1_waitForVBlank2_$0 + (bool~) main::initNES1_waitForVBlank2_$1 ← ! (bool~) main::initNES1_waitForVBlank2_$4 + if((bool~) main::initNES1_waitForVBlank2_$1) goto main::initNES1_waitForVBlank2_@1 + to:main::initNES1_@7 +main::initNES1_@7: scope:[main] from main::initNES1_waitForVBlank2_@1 + asm { ldaPPU_PPUSTATUS } + to:main::@8 +main::@8: scope:[main] from main::initNES1_@7 + (byte~) main::$1 ← sizeof (const byte*) PALETTE + (nomodify void*) ppuDataTransfer::ppuData#0 ← (void*)(const nomodify byte*) PPU_PALETTE + (nomodify void*) ppuDataTransfer::cpuData#0 ← (void*)(const byte*) PALETTE + (word) ppuDataTransfer::size#0 ← (byte~) main::$1 + call ppuDataTransfer + to:main::@9 +main::@9: scope:[main] from main::@8 + (nomodify void*) ppuDataFill::ppuData#0 ← (void*)(const nomodify byte*) PPU_NAME_TABLE_0 + (byte) ppuDataFill::val#0 ← (number) $fc + (word) ppuDataFill::size#0 ← (number) $3c0 + call ppuDataFill + to:main::@10 +main::@10: scope:[main] from main::@9 + (nomodify void*) ppuDataFill::ppuData#1 ← (void*)(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 + (byte) ppuDataFill::val#1 ← (number) 0 + (word) ppuDataFill::size#1 ← (number) $40 + call ppuDataFill + to:main::@11 +main::@11: scope:[main] from main::@10 + (byte) main::x#0 ← (byte) 0 to:main::@1 -main::@1: scope:[main] from main::@1 main::@3 - (byte) main::i#2 ← phi( main::@1/(byte) main::i#1 main::@3/(byte) main::i#0 ) - *((const nomodify byte*) MEMORY+(number) 0 + (byte) main::i#2) ← (number) 0 - *((const nomodify byte*) MEMORY+(number) $100 + (byte) main::i#2) ← (number) 0 - *((const nomodify byte*) MEMORY+(number) $200 + (byte) main::i#2) ← (number) 0 - *((const nomodify byte*) MEMORY+(number) $300 + (byte) main::i#2) ← (number) 0 - *((const nomodify byte*) MEMORY+(number) $400 + (byte) main::i#2) ← (number) 0 - *((const nomodify byte*) MEMORY+(number) $500 + (byte) main::i#2) ← (number) 0 - *((const nomodify byte*) MEMORY+(number) $600 + (byte) main::i#2) ← (number) 0 - *((const nomodify byte*) MEMORY+(number) $700 + (byte) main::i#2) ← (number) 0 - (byte) main::i#1 ← ++ (byte) main::i#2 - (bool~) main::$8 ← (number) 0 != (byte) main::i#1 - if((bool~) main::$8) goto main::@1 - to:main::waitForVBlank2 -main::waitForVBlank2: scope:[main] from main::@1 - to:main::waitForVBlank2_@1 -main::waitForVBlank2_@1: scope:[main] from main::waitForVBlank2 main::waitForVBlank2_@1 - (byte*~) main::waitForVBlank2_$3 ← (byte*)(const struct RICOH_2C02*) PPU - (byte*~) main::waitForVBlank2_$2 ← (byte*~) main::waitForVBlank2_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS - (number~) main::waitForVBlank2_$0 ← *((byte*~) main::waitForVBlank2_$2) & (number) $80 - (bool~) main::waitForVBlank2_$4 ← (number) 0 != (number~) main::waitForVBlank2_$0 - (bool~) main::waitForVBlank2_$1 ← ! (bool~) main::waitForVBlank2_$4 - if((bool~) main::waitForVBlank2_$1) goto main::waitForVBlank2_@1 +main::@1: scope:[main] from main::@11 main::@12 + (byte) main::x#2 ← phi( main::@11/(byte) main::x#0 main::@12/(byte) main::x#1 ) + (bool~) main::$7 ← (byte) main::x#2 < (number) $20 + if((bool~) main::$7) goto main::@2 + to:main::@3 +main::@2: scope:[main] from main::@1 + (byte) main::x#3 ← phi( main::@1/(byte) main::x#2 ) + (byte*~) main::$8 ← (const nomodify byte*) PPU_NAME_TABLE_0+(number) $14*(number) $20 + (byte) main::x#3 + (nomodify void*) ppuDataPutTile::ppuData#0 ← (void*)(byte*~) main::$8 + (byte*) ppuDataPutTile::tile#0 ← (const byte*) FLOOR + call ppuDataPutTile + to:main::@12 +main::@12: scope:[main] from main::@2 + (byte) main::x#4 ← phi( main::@2/(byte) main::x#3 ) + (byte) main::x#1 ← (byte) main::x#4 + (number) 2 + to:main::@1 +main::@3: scope:[main] from main::@1 + (nomodify void*) ppuDataPutTile::ppuData#1 ← (void*)(const nomodify byte*) PPU_NAME_TABLE_0+(number) $12*(number) $20+(number) $1c + (byte*) ppuDataPutTile::tile#1 ← (const byte*) FLAG + call ppuDataPutTile + to:main::@13 +main::@13: scope:[main] from main::@3 + (byte) main::i#0 ← (byte) 0 to:main::@4 -main::@4: scope:[main] from main::waitForVBlank2_@1 - call initPalette - to:main::@5 -main::@5: scope:[main] from main::@4 - call initSpriteBuffer +main::@4: scope:[main] from main::@13 main::@5 + (byte) main::i#2 ← phi( main::@13/(byte) main::i#0 main::@5/(byte) main::i#1 ) + (byte~) main::$10 ← sizeof (const struct SpriteData*) SPRITES + (bool~) main::$11 ← (byte) main::i#2 < (byte~) main::$10 + if((bool~) main::$11) goto main::@5 to:main::@6 -main::@6: scope:[main] from main::@5 +main::@5: scope:[main] from main::@4 + (byte) main::i#3 ← phi( main::@4/(byte) main::i#2 ) + (byte*~) main::$14 ← (byte*)(const struct SpriteData*) SPRITES + *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER + (byte) main::i#3) ← *((byte*~) main::$14 + (byte) main::i#3) + (byte) main::i#1 ← ++ (byte) main::i#3 + to:main::@4 +main::@6: scope:[main] from main::@4 + (byte*~) main::$15 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) main::$12 ← (byte*~) main::$15 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL + *((byte*~) main::$12) ← (number) 0 + (byte*~) main::$16 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) main::$13 ← (byte*~) main::$16 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL + *((byte*~) main::$13) ← (number) -8 to:main::enableVideoOutput1 main::enableVideoOutput1: scope:[main] from main::@6 (byte*~) main::enableVideoOutput1_$2 ← (byte*)(const struct RICOH_2C02*) PPU @@ -86,135 +369,73 @@ main::enableVideoOutput1: scope:[main] from main::@6 *((byte*~) main::enableVideoOutput1_$0) ← (number) $80 (byte*~) main::enableVideoOutput1_$3 ← (byte*)(const struct RICOH_2C02*) PPU (byte*~) main::enableVideoOutput1_$1 ← (byte*~) main::enableVideoOutput1_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK - *((byte*~) main::enableVideoOutput1_$1) ← (number) $10 - to:main::@2 -main::@2: scope:[main] from main::@2 main::enableVideoOutput1 - (bool~) main::$9 ← (number) 0 != (number) 1 - if((bool~) main::$9) goto main::@2 + *((byte*~) main::enableVideoOutput1_$1) ← (number) $18 + to:main::@7 +main::@7: scope:[main] from main::@7 main::enableVideoOutput1 + (bool~) main::$17 ← (number) 0 != (number) 1 + if((bool~) main::$17) goto main::@7 to:main::@return -main::@return: scope:[main] from main::@2 +main::@return: scope:[main] from main::@7 return to:@return interrupt(HARDWARE_STACK)(void()) vblank() vblank: scope:[vblank] from - to:vblank::transferSpriteBufferToPpu1 -vblank::transferSpriteBufferToPpu1: scope:[vblank] from vblank - (byte*~) vblank::transferSpriteBufferToPpu1_$2 ← (byte*)(const struct RICOH_2C02*) PPU - (byte*~) vblank::transferSpriteBufferToPpu1_$0 ← (byte*~) vblank::transferSpriteBufferToPpu1_$2 + (const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR - *((byte*~) vblank::transferSpriteBufferToPpu1_$0) ← (number) 0 - (byte*~) vblank::transferSpriteBufferToPpu1_$3 ← (byte*)(const struct RICOH_2A03*) APU - (byte*~) vblank::transferSpriteBufferToPpu1_$1 ← (byte*~) vblank::transferSpriteBufferToPpu1_$3 + (const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA - *((byte*~) vblank::transferSpriteBufferToPpu1_$1) ← >(const nomodify struct ObjectAttribute*) OAM_BUFFER + (struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0 ← (const nomodify struct SpriteData*) OAM_BUFFER + to:vblank::ppuSpriteBufferDmaTransfer1 +vblank::ppuSpriteBufferDmaTransfer1: scope:[vblank] from vblank + (struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#1 ← phi( vblank/(struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0 ) + (byte*~) vblank::ppuSpriteBufferDmaTransfer1_$3 ← (byte*)(const struct RICOH_2C02*) PPU + (byte*~) vblank::ppuSpriteBufferDmaTransfer1_$1 ← (byte*~) vblank::ppuSpriteBufferDmaTransfer1_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR + *((byte*~) vblank::ppuSpriteBufferDmaTransfer1_$1) ← (number) 0 + (byte~) vblank::ppuSpriteBufferDmaTransfer1_$0 ← > (struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#1 + (byte*~) vblank::ppuSpriteBufferDmaTransfer1_$4 ← (byte*)(const struct RICOH_2A03*) APU + (byte*~) vblank::ppuSpriteBufferDmaTransfer1_$2 ← (byte*~) vblank::ppuSpriteBufferDmaTransfer1_$4 + (const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA + *((byte*~) vblank::ppuSpriteBufferDmaTransfer1_$2) ← (byte~) vblank::ppuSpriteBufferDmaTransfer1_$0 to:vblank::@4 -vblank::@4: scope:[vblank] from vblank::transferSpriteBufferToPpu1 - (byte*~) vblank::$11 ← (byte*)(const struct RICOH_2A03*) APU - (byte*~) vblank::$7 ← (byte*~) vblank::$11 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 - *((byte*~) vblank::$7) ← (number) 1 - (byte*~) vblank::$12 ← (byte*)(const struct RICOH_2A03*) APU - (byte*~) vblank::$8 ← (byte*~) vblank::$12 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 - *((byte*~) vblank::$8) ← (number) 0 - (byte*~) vblank::$13 ← (byte*)(const struct RICOH_2A03*) APU - (byte*~) vblank::$9 ← (byte*~) vblank::$13 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 - (number~) vblank::$1 ← *((byte*~) vblank::$9) & (number) 1 - (bool~) vblank::$15 ← (number) 0 != (number~) vblank::$1 - (bool~) vblank::$2 ← ! (bool~) vblank::$15 +vblank::@4: scope:[vblank] from vblank::ppuSpriteBufferDmaTransfer1 + (byte*~) vblank::$33 ← (byte*)(const struct RICOH_2A03*) APU + (byte*~) vblank::$29 ← (byte*~) vblank::$33 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 + *((byte*~) vblank::$29) ← (number) 1 + (byte*~) vblank::$34 ← (byte*)(const struct RICOH_2A03*) APU + (byte*~) vblank::$30 ← (byte*~) vblank::$34 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 + *((byte*~) vblank::$30) ← (number) 0 + (byte*~) vblank::$35 ← (byte*)(const struct RICOH_2A03*) APU + (byte*~) vblank::$31 ← (byte*~) vblank::$35 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 + (number~) vblank::$1 ← *((byte*~) vblank::$31) & (number) 1 + (bool~) vblank::$37 ← (number) 0 != (number~) vblank::$1 + (bool~) vblank::$2 ← ! (bool~) vblank::$37 if((bool~) vblank::$2) goto vblank::@1 to:vblank::@2 -vblank::@1: scope:[vblank] from vblank::@4 vblank::@5 - (byte*~) vblank::$14 ← (byte*)(const struct RICOH_2A03*) APU - (byte*~) vblank::$10 ← (byte*~) vblank::$14 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 - (number~) vblank::$3 ← *((byte*~) vblank::$10) & (number) 1 - (bool~) vblank::$16 ← (number) 0 != (number~) vblank::$3 - (bool~) vblank::$4 ← ! (bool~) vblank::$16 +vblank::@1: scope:[vblank] from vblank::@2 vblank::@4 + (byte*~) vblank::$36 ← (byte*)(const struct RICOH_2A03*) APU + (byte*~) vblank::$32 ← (byte*~) vblank::$36 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 + (number~) vblank::$3 ← *((byte*~) vblank::$32) & (number) 1 + (bool~) vblank::$38 ← (number) 0 != (number~) vblank::$3 + (bool~) vblank::$4 ← ! (bool~) vblank::$38 if((bool~) vblank::$4) goto vblank::@return to:vblank::@3 vblank::@2: scope:[vblank] from vblank::@4 - call moveLuigiRight - to:vblank::@5 -vblank::@5: scope:[vblank] from vblank::@2 + (number~) vblank::$14 ← (number) 0 * (const byte) SIZEOF_STRUCT_SPRITEDATA + *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$14) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$14) + (number~) vblank::$16 ← (number) 1 * (const byte) SIZEOF_STRUCT_SPRITEDATA + *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$16) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$16) + (number~) vblank::$18 ← (number) 2 * (const byte) SIZEOF_STRUCT_SPRITEDATA + *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$18) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$18) + (number~) vblank::$20 ← (number) 3 * (const byte) SIZEOF_STRUCT_SPRITEDATA + *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$20) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$20) to:vblank::@1 vblank::@3: scope:[vblank] from vblank::@1 - call moveLuigiLeft - to:vblank::@6 -vblank::@6: scope:[vblank] from vblank::@3 + (number~) vblank::$22 ← (number) 0 * (const byte) SIZEOF_STRUCT_SPRITEDATA + *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$22) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$22) + (number~) vblank::$24 ← (number) 1 * (const byte) SIZEOF_STRUCT_SPRITEDATA + *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$24) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$24) + (number~) vblank::$26 ← (number) 2 * (const byte) SIZEOF_STRUCT_SPRITEDATA + *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$26) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$26) + (number~) vblank::$28 ← (number) 3 * (const byte) SIZEOF_STRUCT_SPRITEDATA + *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$28) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (number~) vblank::$28) to:vblank::@return -vblank::@return: scope:[vblank] from vblank::@1 vblank::@6 - return - to:@return - -(void()) moveLuigiRight() -moveLuigiRight: scope:[moveLuigiRight] from vblank::@2 - (number~) moveLuigiRight::$5 ← (number) 0 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE - *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiRight::$5) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiRight::$5) - (number~) moveLuigiRight::$7 ← (number) 1 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE - *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiRight::$7) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiRight::$7) - (number~) moveLuigiRight::$9 ← (number) 2 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE - *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiRight::$9) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiRight::$9) - (number~) moveLuigiRight::$11 ← (number) 3 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE - *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiRight::$11) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiRight::$11) - to:moveLuigiRight::@return -moveLuigiRight::@return: scope:[moveLuigiRight] from moveLuigiRight - return - to:@return - -(void()) moveLuigiLeft() -moveLuigiLeft: scope:[moveLuigiLeft] from vblank::@3 - (number~) moveLuigiLeft::$5 ← (number) 0 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE - *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiLeft::$5) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiLeft::$5) - (number~) moveLuigiLeft::$7 ← (number) 1 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE - *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiLeft::$7) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiLeft::$7) - (number~) moveLuigiLeft::$9 ← (number) 2 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE - *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiLeft::$9) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiLeft::$9) - (number~) moveLuigiLeft::$11 ← (number) 3 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE - *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiLeft::$11) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (number~) moveLuigiLeft::$11) - to:moveLuigiLeft::@return -moveLuigiLeft::@return: scope:[moveLuigiLeft] from moveLuigiLeft - return - to:@return - -(void()) initSpriteBuffer() -initSpriteBuffer: scope:[initSpriteBuffer] from main::@5 - (byte) initSpriteBuffer::i#0 ← (byte) 0 - to:initSpriteBuffer::@1 -initSpriteBuffer::@1: scope:[initSpriteBuffer] from initSpriteBuffer initSpriteBuffer::@1 - (byte) initSpriteBuffer::i#2 ← phi( initSpriteBuffer/(byte) initSpriteBuffer::i#0 initSpriteBuffer::@1/(byte) initSpriteBuffer::i#1 ) - (byte*~) initSpriteBuffer::$2 ← (byte*)(const struct ObjectAttribute*) SPRITES - *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER + (byte) initSpriteBuffer::i#2) ← *((byte*~) initSpriteBuffer::$2 + (byte) initSpriteBuffer::i#2) - (byte) initSpriteBuffer::i#1 ← ++ (byte) initSpriteBuffer::i#2 - (byte~) initSpriteBuffer::$0 ← sizeof (const struct ObjectAttribute*) SPRITES - (bool~) initSpriteBuffer::$1 ← (byte) initSpriteBuffer::i#1 != (byte~) initSpriteBuffer::$0 - if((bool~) initSpriteBuffer::$1) goto initSpriteBuffer::@1 - to:initSpriteBuffer::@return -initSpriteBuffer::@return: scope:[initSpriteBuffer] from initSpriteBuffer::@1 - return - to:@return - -(void()) initPalette() -initPalette: scope:[initPalette] from main::@4 - asm { ldaPPU_PPUSTATUS } - (byte*~) initPalette::$5 ← (byte*)(const struct RICOH_2C02*) PPU - (byte*~) initPalette::$2 ← (byte*~) initPalette::$5 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR - *((byte*~) initPalette::$2) ← >(const nomodify byte*) PPU_PALETTE - (byte*~) initPalette::$6 ← (byte*)(const struct RICOH_2C02*) PPU - (byte*~) initPalette::$3 ← (byte*~) initPalette::$6 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR - *((byte*~) initPalette::$3) ← <(const nomodify byte*) PPU_PALETTE - (byte) initPalette::i#0 ← (byte) 0 - to:initPalette::@1 -initPalette::@1: scope:[initPalette] from initPalette initPalette::@2 - (byte) initPalette::i#2 ← phi( initPalette/(byte) initPalette::i#0 initPalette::@2/(byte) initPalette::i#1 ) - (byte~) initPalette::$0 ← sizeof (const byte*) PALETTE - (bool~) initPalette::$1 ← (byte) initPalette::i#2 < (byte~) initPalette::$0 - if((bool~) initPalette::$1) goto initPalette::@2 - to:initPalette::@return -initPalette::@2: scope:[initPalette] from initPalette::@1 - (byte) initPalette::i#3 ← phi( initPalette::@1/(byte) initPalette::i#2 ) - (byte*~) initPalette::$7 ← (byte*)(const struct RICOH_2C02*) PPU - (byte*~) initPalette::$4 ← (byte*~) initPalette::$7 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA - *((byte*~) initPalette::$4) ← *((const byte*) PALETTE + (byte) initPalette::i#3) - (byte) initPalette::i#1 ← ++ (byte) initPalette::i#3 - to:initPalette::@1 -initPalette::@return: scope:[initPalette] from initPalette::@1 +vblank::@return: scope:[vblank] from vblank::@1 vblank::@3 return to:@return @1: scope:[] from @begin @@ -230,10 +451,11 @@ SYMBOL TABLE SSA (label) @begin (label) @end (const struct RICOH_2A03*) APU = (struct RICOH_2A03*)(number) $4000 +(const byte*) FLAG[] = { (byte) $54, (byte) $55, (byte) $56, (byte) $57 } +(const byte*) FLOOR[] = { (byte) $85, (byte) $85, (byte) $86, (byte) $86 } (const nomodify byte*) FR_COUNTER = (byte*)(number) $4017 (const nomodify byte*) MEMORY = (byte*)(number) 0 -(const nomodify struct ObjectAttribute*) OAM_BUFFER = (struct ObjectAttribute*)(number) $200 -(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X = (byte) 3 +(const nomodify struct SpriteData*) OAM_BUFFER = (struct SpriteData*)(number) $200 (const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ = (byte) $10 (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 = (byte) $16 (const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA = (byte) $14 @@ -242,13 +464,13 @@ SYMBOL TABLE SSA (const byte) OFFSET_STRUCT_RICOH_2C02_PPUCTRL = (byte) 0 (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA = (byte) 7 (const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK = (byte) 1 +(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL = (byte) 5 (const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS = (byte) 2 -(byte) ObjectAttribute::attributes -(byte) ObjectAttribute::tile -(byte) ObjectAttribute::x -(byte) ObjectAttribute::y -(const byte*) PALETTE[(number) $20] = { (byte) $f, (byte) $31, (byte) $32, (byte) $33, (byte) $f, (byte) $35, (byte) $36, (byte) $37, (byte) $f, (byte) $39, (byte) $3a, (byte) $3b, (byte) $f, (byte) $3d, (byte) $3e, (byte) $f, (byte) $f, (byte) $1c, (byte) $15, (byte) $14, (byte) $f, (byte) 2, (byte) $38, (byte) $3c, (byte) $f, (byte) $30, (byte) $37, (byte) $1a, (byte) $f, (byte) $f, (byte) $f, (byte) $f } +(const byte) OFFSET_STRUCT_SPRITEDATA_Y = (byte) 0 +(const byte*) PALETTE[(number) $20] = { (byte) $f, (byte) $13, (byte) $23, (byte) $33, (byte) $f, (byte) 6, (byte) $15, (byte) $36, (byte) $f, (byte) $39, (byte) $4a, (byte) $5b, (byte) $f, (byte) $3d, (byte) $4e, (byte) $5f, (byte) $f, (byte) $1c, (byte) $15, (byte) $14, (byte) $f, (byte) 2, (byte) $38, (byte) $3c, (byte) $f, (byte) $30, (byte) $37, (byte) $1a, (byte) $f, (byte) $f, (byte) $f, (byte) $f } (const struct RICOH_2C02*) PPU = (struct RICOH_2C02*)(number) $2000 +(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 = (byte*)(number) $23c0 +(const nomodify byte*) PPU_NAME_TABLE_0 = (byte*)(number) $2000 (const nomodify byte*) PPU_PALETTE = (byte*)(number) $3f00 (const to_volatile byte*) PPU_PPUSTATUS = (byte*)(number) $2002 (byte) RICOH_2A03::DMC_FREQ @@ -283,57 +505,41 @@ SYMBOL TABLE SSA (byte) RICOH_2C02::PPUMASK (byte) RICOH_2C02::PPUSCROLL (volatile byte) RICOH_2C02::PPUSTATUS loadstore -(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE = (byte) 4 -(const struct ObjectAttribute*) SPRITES[] = { { y: (byte) $80, tile: (byte) $36, attributes: (byte) 2, x: (byte) $80 }, { y: (byte) $80, tile: (byte) $37, attributes: (byte) 2, x: (byte) $88 }, { y: (byte) $88, tile: (byte) $38, attributes: (byte) 2, x: (byte) $80 }, { y: (byte) $88, tile: (byte) $39, attributes: (byte) 2, x: (byte) $88 } } +(const byte) SIZEOF_STRUCT_SPRITEDATA = (byte) 4 +(const struct SpriteData*) SPRITES[] = { { y: (byte) $80, tile: (byte) $36, attributes: (byte) 2, x: (byte) $80 }, { y: (byte) $80, tile: (byte) $37, attributes: (byte) 2, x: (byte) $88 }, { y: (byte) $88, tile: (byte) $38, attributes: (byte) 2, x: (byte) $80 }, { y: (byte) $88, tile: (byte) $39, attributes: (byte) 2, x: (byte) $88 } } +(byte) SpriteData::attributes +(byte) SpriteData::tile +(byte) SpriteData::x +(byte) SpriteData::y (const byte*) TILES[] = kickasm {{ .import binary "smb1_chr.bin" }} (const to_nomodify void()**) VECTORS[] = { &interrupt(HARDWARE_STACK)(void()) vblank(), &(void()) main(), (void()*)(number) 0 } -(void()) initPalette() -(byte~) initPalette::$0 -(bool~) initPalette::$1 -(byte*~) initPalette::$2 -(byte*~) initPalette::$3 -(byte*~) initPalette::$4 -(byte*~) initPalette::$5 -(byte*~) initPalette::$6 -(byte*~) initPalette::$7 -(label) initPalette::@1 -(label) initPalette::@2 -(label) initPalette::@return -(byte) initPalette::i -(byte) initPalette::i#0 -(byte) initPalette::i#1 -(byte) initPalette::i#2 -(byte) initPalette::i#3 -(void()) initSpriteBuffer() -(byte~) initSpriteBuffer::$0 -(bool~) initSpriteBuffer::$1 -(byte*~) initSpriteBuffer::$2 -(label) initSpriteBuffer::@1 -(label) initSpriteBuffer::@return -(byte) initSpriteBuffer::i -(byte) initSpriteBuffer::i#0 -(byte) initSpriteBuffer::i#1 -(byte) initSpriteBuffer::i#2 (void()) main() -(bool~) main::$8 -(bool~) main::$9 +(byte~) main::$1 +(byte~) main::$10 +(bool~) main::$11 +(byte*~) main::$12 +(byte*~) main::$13 +(byte*~) main::$14 +(byte*~) main::$15 +(byte*~) main::$16 +(bool~) main::$17 +(bool~) main::$7 +(byte*~) main::$8 (label) main::@1 +(label) main::@10 +(label) main::@11 +(label) main::@12 +(label) main::@13 (label) main::@2 (label) main::@3 (label) main::@4 (label) main::@5 (label) main::@6 +(label) main::@7 +(label) main::@8 +(label) main::@9 (label) main::@return -(label) main::clearVBlankFlag1 -(label) main::disableAudioOutput1 -(byte*~) main::disableAudioOutput1_$0 -(byte*~) main::disableAudioOutput1_$1 -(label) main::disableVideoOutput1 -(byte*~) main::disableVideoOutput1_$0 -(byte*~) main::disableVideoOutput1_$1 -(byte*~) main::disableVideoOutput1_$2 -(byte*~) main::disableVideoOutput1_$3 (label) main::enableVideoOutput1 (byte*~) main::enableVideoOutput1_$0 (byte*~) main::enableVideoOutput1_$1 @@ -343,142 +549,379 @@ SYMBOL TABLE SSA (byte) main::i#0 (byte) main::i#1 (byte) main::i#2 -(label) main::waitForVBlank1 -(number~) main::waitForVBlank1_$0 -(bool~) main::waitForVBlank1_$1 -(byte*~) main::waitForVBlank1_$2 -(byte*~) main::waitForVBlank1_$3 -(bool~) main::waitForVBlank1_$4 -(label) main::waitForVBlank1_@1 -(label) main::waitForVBlank2 -(number~) main::waitForVBlank2_$0 -(bool~) main::waitForVBlank2_$1 -(byte*~) main::waitForVBlank2_$2 -(byte*~) main::waitForVBlank2_$3 -(bool~) main::waitForVBlank2_$4 -(label) main::waitForVBlank2_@1 -(void()) moveLuigiLeft() -(number~) moveLuigiLeft::$11 -(number~) moveLuigiLeft::$5 -(number~) moveLuigiLeft::$7 -(number~) moveLuigiLeft::$9 -(label) moveLuigiLeft::@return -(void()) moveLuigiRight() -(number~) moveLuigiRight::$11 -(number~) moveLuigiRight::$5 -(number~) moveLuigiRight::$7 -(number~) moveLuigiRight::$9 -(label) moveLuigiRight::@return +(byte) main::i#3 +(label) main::initNES1 +(bool~) main::initNES1_$5 +(label) main::initNES1_@1 +(label) main::initNES1_@6 +(label) main::initNES1_@7 +(label) main::initNES1_clearVBlankFlag1 +(label) main::initNES1_disableAudioOutput1 +(byte*~) main::initNES1_disableAudioOutput1_$0 +(byte*~) main::initNES1_disableAudioOutput1_$1 +(label) main::initNES1_disableVideoOutput1 +(byte*~) main::initNES1_disableVideoOutput1_$0 +(byte*~) main::initNES1_disableVideoOutput1_$1 +(byte*~) main::initNES1_disableVideoOutput1_$2 +(byte*~) main::initNES1_disableVideoOutput1_$3 +(byte) main::initNES1_i +(byte) main::initNES1_i#0 +(byte) main::initNES1_i#1 +(byte) main::initNES1_i#2 +(label) main::initNES1_waitForVBlank1 +(number~) main::initNES1_waitForVBlank1_$0 +(bool~) main::initNES1_waitForVBlank1_$1 +(byte*~) main::initNES1_waitForVBlank1_$2 +(byte*~) main::initNES1_waitForVBlank1_$3 +(bool~) main::initNES1_waitForVBlank1_$4 +(label) main::initNES1_waitForVBlank1_@1 +(label) main::initNES1_waitForVBlank2 +(number~) main::initNES1_waitForVBlank2_$0 +(bool~) main::initNES1_waitForVBlank2_$1 +(byte*~) main::initNES1_waitForVBlank2_$2 +(byte*~) main::initNES1_waitForVBlank2_$3 +(bool~) main::initNES1_waitForVBlank2_$4 +(label) main::initNES1_waitForVBlank2_@1 +(byte) main::x +(byte) main::x#0 +(byte) main::x#1 +(byte) main::x#2 +(byte) main::x#3 +(byte) main::x#4 +(void()) ppuDataFill((nomodify void*) ppuDataFill::ppuData , (byte) ppuDataFill::val , (word) ppuDataFill::size) +(bool~) ppuDataFill::$1 +(label) ppuDataFill::@1 +(label) ppuDataFill::@2 +(label) ppuDataFill::@3 +(label) ppuDataFill::@4 +(label) ppuDataFill::@return +(word) ppuDataFill::i +(word) ppuDataFill::i#0 +(word) ppuDataFill::i#1 +(word) ppuDataFill::i#2 +(word) ppuDataFill::i#3 +(word) ppuDataFill::i#4 +(word) ppuDataFill::i#5 +(nomodify void*) ppuDataFill::ppuData +(nomodify void*) ppuDataFill::ppuData#0 +(nomodify void*) ppuDataFill::ppuData#1 +(nomodify void*) ppuDataFill::ppuData#2 +(label) ppuDataFill::ppuDataPrepare1 +(byte~) ppuDataFill::ppuDataPrepare1_$0 +(byte~) ppuDataFill::ppuDataPrepare1_$1 +(byte*~) ppuDataFill::ppuDataPrepare1_$2 +(byte*~) ppuDataFill::ppuDataPrepare1_$3 +(byte*~) ppuDataFill::ppuDataPrepare1_$4 +(byte*~) ppuDataFill::ppuDataPrepare1_$5 +(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData +(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 +(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#1 +(label) ppuDataFill::ppuDataPut1 +(byte*~) ppuDataFill::ppuDataPut1_$0 +(byte*~) ppuDataFill::ppuDataPut1_$1 +(byte) ppuDataFill::ppuDataPut1_val +(byte) ppuDataFill::ppuDataPut1_val#0 +(byte) ppuDataFill::ppuDataPut1_val#1 +(word) ppuDataFill::size +(word) ppuDataFill::size#0 +(word) ppuDataFill::size#1 +(word) ppuDataFill::size#2 +(word) ppuDataFill::size#3 +(word) ppuDataFill::size#4 +(word) ppuDataFill::size#5 +(word) ppuDataFill::size#6 +(word) ppuDataFill::size#7 +(word) ppuDataFill::size#8 +(byte) ppuDataFill::val +(byte) ppuDataFill::val#0 +(byte) ppuDataFill::val#1 +(byte) ppuDataFill::val#2 +(byte) ppuDataFill::val#3 +(byte) ppuDataFill::val#4 +(byte) ppuDataFill::val#5 +(byte) ppuDataFill::val#6 +(byte) ppuDataFill::val#7 +(byte) ppuDataFill::val#8 +(void()) ppuDataPutTile((nomodify void*) ppuDataPutTile::ppuData , (byte*) ppuDataPutTile::tile) +(byte*~) ppuDataPutTile::$3 +(byte*~) ppuDataPutTile::$7 +(label) ppuDataPutTile::@1 +(label) ppuDataPutTile::@2 +(label) ppuDataPutTile::@3 +(label) ppuDataPutTile::@4 +(label) ppuDataPutTile::@5 +(label) ppuDataPutTile::@return +(nomodify void*) ppuDataPutTile::ppuData +(nomodify void*) ppuDataPutTile::ppuData#0 +(nomodify void*) ppuDataPutTile::ppuData#1 +(nomodify void*) ppuDataPutTile::ppuData#2 +(nomodify void*) ppuDataPutTile::ppuData#3 +(nomodify void*) ppuDataPutTile::ppuData#4 +(nomodify void*) ppuDataPutTile::ppuData#5 +(nomodify void*) ppuDataPutTile::ppuData#6 +(nomodify void*) ppuDataPutTile::ppuData#7 +(nomodify void*) ppuDataPutTile::ppuData#8 +(label) ppuDataPutTile::ppuDataPrepare1 +(byte~) ppuDataPutTile::ppuDataPrepare1_$0 +(byte~) ppuDataPutTile::ppuDataPrepare1_$1 +(byte*~) ppuDataPutTile::ppuDataPrepare1_$2 +(byte*~) ppuDataPutTile::ppuDataPrepare1_$3 +(byte*~) ppuDataPutTile::ppuDataPrepare1_$4 +(byte*~) ppuDataPutTile::ppuDataPrepare1_$5 +(nomodify void*) ppuDataPutTile::ppuDataPrepare1_ppuData +(nomodify void*) ppuDataPutTile::ppuDataPrepare1_ppuData#0 +(nomodify void*) ppuDataPutTile::ppuDataPrepare1_ppuData#1 +(label) ppuDataPutTile::ppuDataPrepare2 +(byte~) ppuDataPutTile::ppuDataPrepare2_$0 +(byte~) ppuDataPutTile::ppuDataPrepare2_$1 +(byte*~) ppuDataPutTile::ppuDataPrepare2_$2 +(byte*~) ppuDataPutTile::ppuDataPrepare2_$3 +(byte*~) ppuDataPutTile::ppuDataPrepare2_$4 +(byte*~) ppuDataPutTile::ppuDataPrepare2_$5 +(nomodify void*) ppuDataPutTile::ppuDataPrepare2_ppuData +(nomodify void*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 +(nomodify void*) ppuDataPutTile::ppuDataPrepare2_ppuData#1 +(label) ppuDataPutTile::ppuDataPut1 +(byte*~) ppuDataPutTile::ppuDataPut1_$0 +(byte*~) ppuDataPutTile::ppuDataPut1_$1 +(byte) ppuDataPutTile::ppuDataPut1_val +(byte) ppuDataPutTile::ppuDataPut1_val#0 +(byte) ppuDataPutTile::ppuDataPut1_val#1 +(label) ppuDataPutTile::ppuDataPut2 +(byte*~) ppuDataPutTile::ppuDataPut2_$0 +(byte*~) ppuDataPutTile::ppuDataPut2_$1 +(byte) ppuDataPutTile::ppuDataPut2_val +(byte) ppuDataPutTile::ppuDataPut2_val#0 +(byte) ppuDataPutTile::ppuDataPut2_val#1 +(label) ppuDataPutTile::ppuDataPut3 +(byte*~) ppuDataPutTile::ppuDataPut3_$0 +(byte*~) ppuDataPutTile::ppuDataPut3_$1 +(byte) ppuDataPutTile::ppuDataPut3_val +(byte) ppuDataPutTile::ppuDataPut3_val#0 +(byte) ppuDataPutTile::ppuDataPut3_val#1 +(label) ppuDataPutTile::ppuDataPut4 +(byte*~) ppuDataPutTile::ppuDataPut4_$0 +(byte*~) ppuDataPutTile::ppuDataPut4_$1 +(byte) ppuDataPutTile::ppuDataPut4_val +(byte) ppuDataPutTile::ppuDataPut4_val#0 +(byte) ppuDataPutTile::ppuDataPut4_val#1 +(byte*) ppuDataPutTile::tile +(byte*) ppuDataPutTile::tile#0 +(byte*) ppuDataPutTile::tile#1 +(byte*) ppuDataPutTile::tile#10 +(byte*) ppuDataPutTile::tile#11 +(byte*) ppuDataPutTile::tile#12 +(byte*) ppuDataPutTile::tile#2 +(byte*) ppuDataPutTile::tile#3 +(byte*) ppuDataPutTile::tile#4 +(byte*) ppuDataPutTile::tile#5 +(byte*) ppuDataPutTile::tile#6 +(byte*) ppuDataPutTile::tile#7 +(byte*) ppuDataPutTile::tile#8 +(byte*) ppuDataPutTile::tile#9 +(void()) ppuDataTransfer((nomodify void*) ppuDataTransfer::ppuData , (nomodify void*) ppuDataTransfer::cpuData , (word) ppuDataTransfer::size) +(bool~) ppuDataTransfer::$1 +(label) ppuDataTransfer::@1 +(label) ppuDataTransfer::@2 +(label) ppuDataTransfer::@3 +(label) ppuDataTransfer::@4 +(label) ppuDataTransfer::@return +(nomodify void*) ppuDataTransfer::cpuData +(nomodify void*) ppuDataTransfer::cpuData#0 +(nomodify void*) ppuDataTransfer::cpuData#1 +(nomodify void*) ppuDataTransfer::cpuData#2 +(nomodify void*) ppuDataTransfer::cpuData#3 +(byte*) ppuDataTransfer::cpuSrc +(byte*) ppuDataTransfer::cpuSrc#0 +(byte*) ppuDataTransfer::cpuSrc#1 +(byte*) ppuDataTransfer::cpuSrc#2 +(byte*) ppuDataTransfer::cpuSrc#3 +(byte*) ppuDataTransfer::cpuSrc#4 +(byte*) ppuDataTransfer::cpuSrc#5 +(word) ppuDataTransfer::i +(word) ppuDataTransfer::i#0 +(word) ppuDataTransfer::i#1 +(word) ppuDataTransfer::i#2 +(word) ppuDataTransfer::i#3 +(word) ppuDataTransfer::i#4 +(word) ppuDataTransfer::i#5 +(nomodify void*) ppuDataTransfer::ppuData +(nomodify void*) ppuDataTransfer::ppuData#0 +(nomodify void*) ppuDataTransfer::ppuData#1 +(label) ppuDataTransfer::ppuDataPrepare1 +(byte~) ppuDataTransfer::ppuDataPrepare1_$0 +(byte~) ppuDataTransfer::ppuDataPrepare1_$1 +(byte*~) ppuDataTransfer::ppuDataPrepare1_$2 +(byte*~) ppuDataTransfer::ppuDataPrepare1_$3 +(byte*~) ppuDataTransfer::ppuDataPrepare1_$4 +(byte*~) ppuDataTransfer::ppuDataPrepare1_$5 +(nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData +(nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0 +(nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#1 +(label) ppuDataTransfer::ppuDataPut1 +(byte*~) ppuDataTransfer::ppuDataPut1_$0 +(byte*~) ppuDataTransfer::ppuDataPut1_$1 +(byte) ppuDataTransfer::ppuDataPut1_val +(byte) ppuDataTransfer::ppuDataPut1_val#0 +(byte) ppuDataTransfer::ppuDataPut1_val#1 +(word) ppuDataTransfer::size +(word) ppuDataTransfer::size#0 +(word) ppuDataTransfer::size#1 +(word) ppuDataTransfer::size#2 +(word) ppuDataTransfer::size#3 +(word) ppuDataTransfer::size#4 +(word) ppuDataTransfer::size#5 +(word) ppuDataTransfer::size#6 +(word) ppuDataTransfer::size#7 interrupt(HARDWARE_STACK)(void()) vblank() (number~) vblank::$1 -(byte*~) vblank::$10 -(byte*~) vblank::$11 -(byte*~) vblank::$12 -(byte*~) vblank::$13 -(byte*~) vblank::$14 -(bool~) vblank::$15 -(bool~) vblank::$16 +(number~) vblank::$14 +(number~) vblank::$16 +(number~) vblank::$18 (bool~) vblank::$2 +(number~) vblank::$20 +(number~) vblank::$22 +(number~) vblank::$24 +(number~) vblank::$26 +(number~) vblank::$28 +(byte*~) vblank::$29 (number~) vblank::$3 +(byte*~) vblank::$30 +(byte*~) vblank::$31 +(byte*~) vblank::$32 +(byte*~) vblank::$33 +(byte*~) vblank::$34 +(byte*~) vblank::$35 +(byte*~) vblank::$36 +(bool~) vblank::$37 +(bool~) vblank::$38 (bool~) vblank::$4 -(byte*~) vblank::$7 -(byte*~) vblank::$8 -(byte*~) vblank::$9 (label) vblank::@1 (label) vblank::@2 (label) vblank::@3 (label) vblank::@4 -(label) vblank::@5 -(label) vblank::@6 (label) vblank::@return -(label) vblank::transferSpriteBufferToPpu1 -(byte*~) vblank::transferSpriteBufferToPpu1_$0 -(byte*~) vblank::transferSpriteBufferToPpu1_$1 -(byte*~) vblank::transferSpriteBufferToPpu1_$2 -(byte*~) vblank::transferSpriteBufferToPpu1_$3 +(label) vblank::ppuSpriteBufferDmaTransfer1 +(byte~) vblank::ppuSpriteBufferDmaTransfer1_$0 +(byte*~) vblank::ppuSpriteBufferDmaTransfer1_$1 +(byte*~) vblank::ppuSpriteBufferDmaTransfer1_$2 +(byte*~) vblank::ppuSpriteBufferDmaTransfer1_$3 +(byte*~) vblank::ppuSpriteBufferDmaTransfer1_$4 +(struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer +(struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0 +(struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#1 -Adding number conversion cast (unumber) 0 in *((byte*~) main::disableVideoOutput1_$0) ← (number) 0 -Adding number conversion cast (unumber) 0 in *((byte*~) main::disableVideoOutput1_$1) ← (number) 0 +Adding number conversion cast (unumber) 0 in (byte) ppuDataPutTile::ppuDataPut1_val#0 ← *((byte*) ppuDataPutTile::tile#2 + (number) 0) +Adding number conversion cast (unumber) 1 in (byte) ppuDataPutTile::ppuDataPut2_val#0 ← *((byte*) ppuDataPutTile::tile#3 + (number) 1) +Adding number conversion cast (unumber) $20 in (byte*~) ppuDataPutTile::$3 ← (byte*~) ppuDataPutTile::$7 + (number) $20 +Adding number conversion cast (unumber) 2 in (byte) ppuDataPutTile::ppuDataPut3_val#0 ← *((byte*) ppuDataPutTile::tile#4 + (number) 2) +Adding number conversion cast (unumber) 3 in (byte) ppuDataPutTile::ppuDataPut4_val#0 ← *((byte*) ppuDataPutTile::tile#5 + (number) 3) +Adding number conversion cast (unumber) 0 in *((byte*~) main::initNES1_disableVideoOutput1_$0) ← (number) 0 +Adding number conversion cast (unumber) 0 in *((byte*~) main::initNES1_disableVideoOutput1_$1) ← (number) 0 Adding number conversion cast (unumber) $40 in *((const nomodify byte*) FR_COUNTER) ← (number) $40 -Adding number conversion cast (unumber) $40 in *((byte*~) main::disableAudioOutput1_$0) ← (number) $40 -Adding number conversion cast (unumber) $80 in (number~) main::waitForVBlank1_$0 ← *((byte*~) main::waitForVBlank1_$2) & (number) $80 -Adding number conversion cast (unumber) main::waitForVBlank1_$0 in (number~) main::waitForVBlank1_$0 ← *((byte*~) main::waitForVBlank1_$2) & (unumber)(number) $80 -Adding number conversion cast (unumber) 0 in (bool~) main::waitForVBlank1_$4 ← (number) 0 != (unumber~) main::waitForVBlank1_$0 -Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) 0 + (byte) main::i#2) ← (number) 0 -Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) 0 + (byte) main::i#2) ← ((unumber)) (number) 0 -Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) $100 + (byte) main::i#2) ← (number) 0 -Adding number conversion cast (unumber) $100 in *((const nomodify byte*) MEMORY+(number) $100 + (byte) main::i#2) ← ((unumber)) (number) 0 -Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) $200 + (byte) main::i#2) ← (number) 0 -Adding number conversion cast (unumber) $200 in *((const nomodify byte*) MEMORY+(number) $200 + (byte) main::i#2) ← ((unumber)) (number) 0 -Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) $300 + (byte) main::i#2) ← (number) 0 -Adding number conversion cast (unumber) $300 in *((const nomodify byte*) MEMORY+(number) $300 + (byte) main::i#2) ← ((unumber)) (number) 0 -Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) $400 + (byte) main::i#2) ← (number) 0 -Adding number conversion cast (unumber) $400 in *((const nomodify byte*) MEMORY+(number) $400 + (byte) main::i#2) ← ((unumber)) (number) 0 -Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) $500 + (byte) main::i#2) ← (number) 0 -Adding number conversion cast (unumber) $500 in *((const nomodify byte*) MEMORY+(number) $500 + (byte) main::i#2) ← ((unumber)) (number) 0 -Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) $600 + (byte) main::i#2) ← (number) 0 -Adding number conversion cast (unumber) $600 in *((const nomodify byte*) MEMORY+(number) $600 + (byte) main::i#2) ← ((unumber)) (number) 0 -Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) $700 + (byte) main::i#2) ← (number) 0 -Adding number conversion cast (unumber) $700 in *((const nomodify byte*) MEMORY+(number) $700 + (byte) main::i#2) ← ((unumber)) (number) 0 -Adding number conversion cast (unumber) 0 in (bool~) main::$8 ← (number) 0 != (byte) main::i#1 -Adding number conversion cast (unumber) $80 in (number~) main::waitForVBlank2_$0 ← *((byte*~) main::waitForVBlank2_$2) & (number) $80 -Adding number conversion cast (unumber) main::waitForVBlank2_$0 in (number~) main::waitForVBlank2_$0 ← *((byte*~) main::waitForVBlank2_$2) & (unumber)(number) $80 -Adding number conversion cast (unumber) 0 in (bool~) main::waitForVBlank2_$4 ← (number) 0 != (unumber~) main::waitForVBlank2_$0 +Adding number conversion cast (unumber) $40 in *((byte*~) main::initNES1_disableAudioOutput1_$0) ← (number) $40 +Adding number conversion cast (unumber) $80 in (number~) main::initNES1_waitForVBlank1_$0 ← *((byte*~) main::initNES1_waitForVBlank1_$2) & (number) $80 +Adding number conversion cast (unumber) main::initNES1_waitForVBlank1_$0 in (number~) main::initNES1_waitForVBlank1_$0 ← *((byte*~) main::initNES1_waitForVBlank1_$2) & (unumber)(number) $80 +Adding number conversion cast (unumber) 0 in (bool~) main::initNES1_waitForVBlank1_$4 ← (number) 0 != (unumber~) main::initNES1_waitForVBlank1_$0 +Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) 0 + (byte) main::initNES1_i#2) ← (number) 0 +Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) 0 + (byte) main::initNES1_i#2) ← ((unumber)) (number) 0 +Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) $100 + (byte) main::initNES1_i#2) ← (number) 0 +Adding number conversion cast (unumber) $100 in *((const nomodify byte*) MEMORY+(number) $100 + (byte) main::initNES1_i#2) ← ((unumber)) (number) 0 +Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) $200 + (byte) main::initNES1_i#2) ← (number) 0 +Adding number conversion cast (unumber) $200 in *((const nomodify byte*) MEMORY+(number) $200 + (byte) main::initNES1_i#2) ← ((unumber)) (number) 0 +Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) $300 + (byte) main::initNES1_i#2) ← (number) 0 +Adding number conversion cast (unumber) $300 in *((const nomodify byte*) MEMORY+(number) $300 + (byte) main::initNES1_i#2) ← ((unumber)) (number) 0 +Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) $400 + (byte) main::initNES1_i#2) ← (number) 0 +Adding number conversion cast (unumber) $400 in *((const nomodify byte*) MEMORY+(number) $400 + (byte) main::initNES1_i#2) ← ((unumber)) (number) 0 +Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) $500 + (byte) main::initNES1_i#2) ← (number) 0 +Adding number conversion cast (unumber) $500 in *((const nomodify byte*) MEMORY+(number) $500 + (byte) main::initNES1_i#2) ← ((unumber)) (number) 0 +Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) $600 + (byte) main::initNES1_i#2) ← (number) 0 +Adding number conversion cast (unumber) $600 in *((const nomodify byte*) MEMORY+(number) $600 + (byte) main::initNES1_i#2) ← ((unumber)) (number) 0 +Adding number conversion cast (unumber) 0 in *((const nomodify byte*) MEMORY+(number) $700 + (byte) main::initNES1_i#2) ← (number) 0 +Adding number conversion cast (unumber) $700 in *((const nomodify byte*) MEMORY+(number) $700 + (byte) main::initNES1_i#2) ← ((unumber)) (number) 0 +Adding number conversion cast (unumber) 0 in (bool~) main::initNES1_$5 ← (number) 0 != (byte) main::initNES1_i#1 +Adding number conversion cast (unumber) $80 in (number~) main::initNES1_waitForVBlank2_$0 ← *((byte*~) main::initNES1_waitForVBlank2_$2) & (number) $80 +Adding number conversion cast (unumber) main::initNES1_waitForVBlank2_$0 in (number~) main::initNES1_waitForVBlank2_$0 ← *((byte*~) main::initNES1_waitForVBlank2_$2) & (unumber)(number) $80 +Adding number conversion cast (unumber) 0 in (bool~) main::initNES1_waitForVBlank2_$4 ← (number) 0 != (unumber~) main::initNES1_waitForVBlank2_$0 +Adding number conversion cast (unumber) $fc in (byte) ppuDataFill::val#0 ← (number) $fc +Adding number conversion cast (unumber) $3c0 in (word) ppuDataFill::size#0 ← (number) $3c0 +Adding number conversion cast (unumber) 0 in (byte) ppuDataFill::val#1 ← (number) 0 +Adding number conversion cast (unumber) $40 in (word) ppuDataFill::size#1 ← (number) $40 +Adding number conversion cast (unumber) $20 in (bool~) main::$7 ← (byte) main::x#2 < (number) $20 +Adding number conversion cast (unumber) $14*$20 in (byte*~) main::$8 ← (const nomodify byte*) PPU_NAME_TABLE_0+(number) $14*(number) $20 + (byte) main::x#3 +Adding number conversion cast (unumber) 2 in (byte) main::x#1 ← (byte) main::x#4 + (number) 2 +Adding number conversion cast (unumber) $1c in (nomodify void*) ppuDataPutTile::ppuData#1 ← (void*)(const nomodify byte*) PPU_NAME_TABLE_0+(number) $12*(number) $20+(number) $1c +Adding number conversion cast (unumber) $12*$20 in (nomodify void*) ppuDataPutTile::ppuData#1 ← (void*)(const nomodify byte*) PPU_NAME_TABLE_0+(number) $12*(number) $20+(unumber)(number) $1c +Adding number conversion cast (unumber) 0 in *((byte*~) main::$12) ← (number) 0 +Adding number conversion cast (unumber) -8 in *((byte*~) main::$13) ← (number) -8 Adding number conversion cast (unumber) $80 in *((byte*~) main::enableVideoOutput1_$0) ← (number) $80 -Adding number conversion cast (unumber) $10 in *((byte*~) main::enableVideoOutput1_$1) ← (number) $10 -Adding number conversion cast (unumber) 0 in *((byte*~) vblank::transferSpriteBufferToPpu1_$0) ← (number) 0 -Adding number conversion cast (unumber) 1 in *((byte*~) vblank::$7) ← (number) 1 -Adding number conversion cast (unumber) 0 in *((byte*~) vblank::$8) ← (number) 0 -Adding number conversion cast (unumber) 1 in (number~) vblank::$1 ← *((byte*~) vblank::$9) & (number) 1 -Adding number conversion cast (unumber) vblank::$1 in (number~) vblank::$1 ← *((byte*~) vblank::$9) & (unumber)(number) 1 -Adding number conversion cast (unumber) 0 in (bool~) vblank::$15 ← (number) 0 != (unumber~) vblank::$1 -Adding number conversion cast (unumber) 1 in (number~) vblank::$3 ← *((byte*~) vblank::$10) & (number) 1 -Adding number conversion cast (unumber) vblank::$3 in (number~) vblank::$3 ← *((byte*~) vblank::$10) & (unumber)(number) 1 -Adding number conversion cast (unumber) 0 in (bool~) vblank::$16 ← (number) 0 != (unumber~) vblank::$3 -Adding number conversion cast (unumber) 0 in (number~) moveLuigiRight::$5 ← (number) 0 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Adding number conversion cast (unumber) moveLuigiRight::$5 in (number~) moveLuigiRight::$5 ← (unumber)(number) 0 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Adding number conversion cast (unumber) 1 in (number~) moveLuigiRight::$7 ← (number) 1 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Adding number conversion cast (unumber) moveLuigiRight::$7 in (number~) moveLuigiRight::$7 ← (unumber)(number) 1 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Adding number conversion cast (unumber) 2 in (number~) moveLuigiRight::$9 ← (number) 2 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Adding number conversion cast (unumber) moveLuigiRight::$9 in (number~) moveLuigiRight::$9 ← (unumber)(number) 2 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Adding number conversion cast (unumber) 3 in (number~) moveLuigiRight::$11 ← (number) 3 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Adding number conversion cast (unumber) moveLuigiRight::$11 in (number~) moveLuigiRight::$11 ← (unumber)(number) 3 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Adding number conversion cast (unumber) 0 in (number~) moveLuigiLeft::$5 ← (number) 0 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Adding number conversion cast (unumber) moveLuigiLeft::$5 in (number~) moveLuigiLeft::$5 ← (unumber)(number) 0 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Adding number conversion cast (unumber) 1 in (number~) moveLuigiLeft::$7 ← (number) 1 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Adding number conversion cast (unumber) moveLuigiLeft::$7 in (number~) moveLuigiLeft::$7 ← (unumber)(number) 1 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Adding number conversion cast (unumber) 2 in (number~) moveLuigiLeft::$9 ← (number) 2 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Adding number conversion cast (unumber) moveLuigiLeft::$9 in (number~) moveLuigiLeft::$9 ← (unumber)(number) 2 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Adding number conversion cast (unumber) 3 in (number~) moveLuigiLeft::$11 ← (number) 3 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Adding number conversion cast (unumber) moveLuigiLeft::$11 in (number~) moveLuigiLeft::$11 ← (unumber)(number) 3 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE +Adding number conversion cast (unumber) $18 in *((byte*~) main::enableVideoOutput1_$1) ← (number) $18 +Adding number conversion cast (unumber) 0 in *((byte*~) vblank::ppuSpriteBufferDmaTransfer1_$1) ← (number) 0 +Adding number conversion cast (unumber) 1 in *((byte*~) vblank::$29) ← (number) 1 +Adding number conversion cast (unumber) 0 in *((byte*~) vblank::$30) ← (number) 0 +Adding number conversion cast (unumber) 1 in (number~) vblank::$1 ← *((byte*~) vblank::$31) & (number) 1 +Adding number conversion cast (unumber) vblank::$1 in (number~) vblank::$1 ← *((byte*~) vblank::$31) & (unumber)(number) 1 +Adding number conversion cast (unumber) 0 in (bool~) vblank::$37 ← (number) 0 != (unumber~) vblank::$1 +Adding number conversion cast (unumber) 1 in (number~) vblank::$3 ← *((byte*~) vblank::$32) & (number) 1 +Adding number conversion cast (unumber) vblank::$3 in (number~) vblank::$3 ← *((byte*~) vblank::$32) & (unumber)(number) 1 +Adding number conversion cast (unumber) 0 in (bool~) vblank::$38 ← (number) 0 != (unumber~) vblank::$3 +Adding number conversion cast (unumber) 0 in (number~) vblank::$14 ← (number) 0 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Adding number conversion cast (unumber) vblank::$14 in (number~) vblank::$14 ← (unumber)(number) 0 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Adding number conversion cast (unumber) 1 in (number~) vblank::$16 ← (number) 1 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Adding number conversion cast (unumber) vblank::$16 in (number~) vblank::$16 ← (unumber)(number) 1 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Adding number conversion cast (unumber) 2 in (number~) vblank::$18 ← (number) 2 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Adding number conversion cast (unumber) vblank::$18 in (number~) vblank::$18 ← (unumber)(number) 2 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Adding number conversion cast (unumber) 3 in (number~) vblank::$20 ← (number) 3 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Adding number conversion cast (unumber) vblank::$20 in (number~) vblank::$20 ← (unumber)(number) 3 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Adding number conversion cast (unumber) 0 in (number~) vblank::$22 ← (number) 0 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Adding number conversion cast (unumber) vblank::$22 in (number~) vblank::$22 ← (unumber)(number) 0 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Adding number conversion cast (unumber) 1 in (number~) vblank::$24 ← (number) 1 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Adding number conversion cast (unumber) vblank::$24 in (number~) vblank::$24 ← (unumber)(number) 1 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Adding number conversion cast (unumber) 2 in (number~) vblank::$26 ← (number) 2 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Adding number conversion cast (unumber) vblank::$26 in (number~) vblank::$26 ← (unumber)(number) 2 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Adding number conversion cast (unumber) 3 in (number~) vblank::$28 ← (number) 3 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Adding number conversion cast (unumber) vblank::$28 in (number~) vblank::$28 ← (unumber)(number) 3 * (const byte) SIZEOF_STRUCT_SPRITEDATA Successful SSA optimization PassNAddNumberTypeConversions -Inlining cast *((byte*~) main::disableVideoOutput1_$0) ← (unumber)(number) 0 -Inlining cast *((byte*~) main::disableVideoOutput1_$1) ← (unumber)(number) 0 +Inlining cast *((byte*~) main::initNES1_disableVideoOutput1_$0) ← (unumber)(number) 0 +Inlining cast *((byte*~) main::initNES1_disableVideoOutput1_$1) ← (unumber)(number) 0 Inlining cast *((const nomodify byte*) FR_COUNTER) ← (unumber)(number) $40 -Inlining cast *((byte*~) main::disableAudioOutput1_$0) ← (unumber)(number) $40 -Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) 0 + (byte) main::i#2) ← (unumber)(number) 0 -Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) $100 + (byte) main::i#2) ← (unumber)(number) 0 -Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) $200 + (byte) main::i#2) ← (unumber)(number) 0 -Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) $300 + (byte) main::i#2) ← (unumber)(number) 0 -Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) $400 + (byte) main::i#2) ← (unumber)(number) 0 -Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) $500 + (byte) main::i#2) ← (unumber)(number) 0 -Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) $600 + (byte) main::i#2) ← (unumber)(number) 0 -Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) $700 + (byte) main::i#2) ← (unumber)(number) 0 +Inlining cast *((byte*~) main::initNES1_disableAudioOutput1_$0) ← (unumber)(number) $40 +Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) 0 + (byte) main::initNES1_i#2) ← (unumber)(number) 0 +Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) $100 + (byte) main::initNES1_i#2) ← (unumber)(number) 0 +Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) $200 + (byte) main::initNES1_i#2) ← (unumber)(number) 0 +Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) $300 + (byte) main::initNES1_i#2) ← (unumber)(number) 0 +Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) $400 + (byte) main::initNES1_i#2) ← (unumber)(number) 0 +Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) $500 + (byte) main::initNES1_i#2) ← (unumber)(number) 0 +Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) $600 + (byte) main::initNES1_i#2) ← (unumber)(number) 0 +Inlining cast *((const nomodify byte*) MEMORY+(unumber)(number) $700 + (byte) main::initNES1_i#2) ← (unumber)(number) 0 +Inlining cast (byte) ppuDataFill::val#0 ← (unumber)(number) $fc +Inlining cast (word) ppuDataFill::size#0 ← (unumber)(number) $3c0 +Inlining cast (byte) ppuDataFill::val#1 ← (unumber)(number) 0 +Inlining cast (word) ppuDataFill::size#1 ← (unumber)(number) $40 +Inlining cast *((byte*~) main::$12) ← (unumber)(number) 0 +Inlining cast *((byte*~) main::$13) ← (unumber)(number) -8 Inlining cast *((byte*~) main::enableVideoOutput1_$0) ← (unumber)(number) $80 -Inlining cast *((byte*~) main::enableVideoOutput1_$1) ← (unumber)(number) $10 -Inlining cast *((byte*~) vblank::transferSpriteBufferToPpu1_$0) ← (unumber)(number) 0 -Inlining cast *((byte*~) vblank::$7) ← (unumber)(number) 1 -Inlining cast *((byte*~) vblank::$8) ← (unumber)(number) 0 +Inlining cast *((byte*~) main::enableVideoOutput1_$1) ← (unumber)(number) $18 +Inlining cast *((byte*~) vblank::ppuSpriteBufferDmaTransfer1_$1) ← (unumber)(number) 0 +Inlining cast *((byte*~) vblank::$29) ← (unumber)(number) 1 +Inlining cast *((byte*~) vblank::$30) ← (unumber)(number) 0 Successful SSA optimization Pass2InlineCast +Simplifying constant pointer cast (byte*) 8192 +Simplifying constant pointer cast (byte*) 9152 Simplifying constant pointer cast (byte*) 16128 Simplifying constant pointer cast (byte*) 16407 Simplifying constant pointer cast (byte*) 0 -Simplifying constant pointer cast (struct ObjectAttribute*) 512 +Simplifying constant pointer cast (struct SpriteData*) 512 Simplifying constant pointer cast (void()*) 0 Simplifying constant pointer cast (byte*) 8194 Simplifying constant pointer cast (struct RICOH_2C02*) 8192 Simplifying constant pointer cast (struct RICOH_2A03*) 16384 Simplifying constant integer cast 0 +Simplifying constant integer cast 1 +Simplifying constant integer cast $20 +Simplifying constant integer cast 2 +Simplifying constant integer cast 3 +Simplifying constant integer cast 0 Simplifying constant integer cast 0 Simplifying constant integer cast $40 Simplifying constant integer cast $40 @@ -503,8 +946,17 @@ Simplifying constant integer cast $700 Simplifying constant integer cast 0 Simplifying constant integer cast $80 Simplifying constant integer cast 0 +Simplifying constant integer cast $fc +Simplifying constant integer cast $3c0 +Simplifying constant integer cast 0 +Simplifying constant integer cast $40 +Simplifying constant integer cast $20 +Simplifying constant integer cast 2 +Simplifying constant integer cast $1c +Simplifying constant integer cast 0 +Simplifying constant integer cast -8 Simplifying constant integer cast $80 -Simplifying constant integer cast $10 +Simplifying constant integer cast $18 Simplifying constant integer cast 0 Simplifying constant integer cast 1 Simplifying constant integer cast 0 @@ -522,6 +974,11 @@ Simplifying constant integer cast 2 Simplifying constant integer cast 3 Successful SSA optimization PassNCastSimplification Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 1 +Finalized unsigned number type (byte) $20 +Finalized unsigned number type (byte) 2 +Finalized unsigned number type (byte) 3 +Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) $40 Finalized unsigned number type (byte) $40 @@ -546,8 +1003,17 @@ Finalized unsigned number type (word) $700 Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) $80 Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) $fc +Finalized unsigned number type (word) $3c0 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) $40 +Finalized unsigned number type (byte) $20 +Finalized unsigned number type (byte) 2 +Finalized unsigned number type (byte) $1c +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) -8 Finalized unsigned number type (byte) $80 -Finalized unsigned number type (byte) $10 +Finalized unsigned number type (byte) $18 Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 1 Finalized unsigned number type (byte) 0 @@ -564,196 +1030,384 @@ Finalized unsigned number type (byte) 1 Finalized unsigned number type (byte) 2 Finalized unsigned number type (byte) 3 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to byte in (unumber~) main::waitForVBlank1_$0 ← *((byte*~) main::waitForVBlank1_$2) & (byte) $80 -Inferred type updated to byte in (unumber~) main::waitForVBlank2_$0 ← *((byte*~) main::waitForVBlank2_$2) & (byte) $80 -Inferred type updated to byte in (unumber~) vblank::$1 ← *((byte*~) vblank::$9) & (byte) 1 -Inferred type updated to byte in (unumber~) vblank::$3 ← *((byte*~) vblank::$10) & (byte) 1 -Inferred type updated to byte in (unumber~) moveLuigiRight::$5 ← (byte) 0 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Inferred type updated to byte in (unumber~) moveLuigiRight::$7 ← (byte) 1 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Inferred type updated to byte in (unumber~) moveLuigiRight::$9 ← (byte) 2 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Inferred type updated to byte in (unumber~) moveLuigiRight::$11 ← (byte) 3 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Inferred type updated to byte in (unumber~) moveLuigiLeft::$5 ← (byte) 0 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Inferred type updated to byte in (unumber~) moveLuigiLeft::$7 ← (byte) 1 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Inferred type updated to byte in (unumber~) moveLuigiLeft::$9 ← (byte) 2 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Inferred type updated to byte in (unumber~) moveLuigiLeft::$11 ← (byte) 3 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Inversing boolean not [16] (bool~) main::waitForVBlank1_$1 ← (byte) 0 == (byte~) main::waitForVBlank1_$0 from [15] (bool~) main::waitForVBlank1_$4 ← (byte) 0 != (byte~) main::waitForVBlank1_$0 -Inversing boolean not [35] (bool~) main::waitForVBlank2_$1 ← (byte) 0 == (byte~) main::waitForVBlank2_$0 from [34] (bool~) main::waitForVBlank2_$4 ← (byte) 0 != (byte~) main::waitForVBlank2_$0 -Inversing boolean not [64] (bool~) vblank::$2 ← (byte) 0 == (byte~) vblank::$1 from [63] (bool~) vblank::$15 ← (byte) 0 != (byte~) vblank::$1 -Inversing boolean not [70] (bool~) vblank::$4 ← (byte) 0 == (byte~) vblank::$3 from [69] (bool~) vblank::$16 ← (byte) 0 != (byte~) vblank::$3 +Inferred type updated to byte in (unumber~) main::initNES1_waitForVBlank1_$0 ← *((byte*~) main::initNES1_waitForVBlank1_$2) & (byte) $80 +Inferred type updated to byte in (unumber~) main::initNES1_waitForVBlank2_$0 ← *((byte*~) main::initNES1_waitForVBlank2_$2) & (byte) $80 +Inferred type updated to byte in (unumber~) vblank::$1 ← *((byte*~) vblank::$31) & (byte) 1 +Inferred type updated to byte in (unumber~) vblank::$3 ← *((byte*~) vblank::$32) & (byte) 1 +Inferred type updated to byte in (unumber~) vblank::$14 ← (byte) 0 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Inferred type updated to byte in (unumber~) vblank::$16 ← (byte) 1 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Inferred type updated to byte in (unumber~) vblank::$18 ← (byte) 2 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Inferred type updated to byte in (unumber~) vblank::$20 ← (byte) 3 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Inferred type updated to byte in (unumber~) vblank::$22 ← (byte) 0 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Inferred type updated to byte in (unumber~) vblank::$24 ← (byte) 1 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Inferred type updated to byte in (unumber~) vblank::$26 ← (byte) 2 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Inferred type updated to byte in (unumber~) vblank::$28 ← (byte) 3 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Inversing boolean not [117] (bool~) main::initNES1_waitForVBlank1_$1 ← (byte) 0 == (byte~) main::initNES1_waitForVBlank1_$0 from [116] (bool~) main::initNES1_waitForVBlank1_$4 ← (byte) 0 != (byte~) main::initNES1_waitForVBlank1_$0 +Inversing boolean not [136] (bool~) main::initNES1_waitForVBlank2_$1 ← (byte) 0 == (byte~) main::initNES1_waitForVBlank2_$0 from [135] (bool~) main::initNES1_waitForVBlank2_$4 ← (byte) 0 != (byte~) main::initNES1_waitForVBlank2_$0 +Inversing boolean not [209] (bool~) vblank::$2 ← (byte) 0 == (byte~) vblank::$1 from [208] (bool~) vblank::$37 ← (byte) 0 != (byte~) vblank::$1 +Inversing boolean not [215] (bool~) vblank::$4 ← (byte) 0 == (byte~) vblank::$3 from [214] (bool~) vblank::$38 ← (byte) 0 != (byte~) vblank::$3 Successful SSA optimization Pass2UnaryNotSimplification -Alias initPalette::i#2 = initPalette::i#3 +Alias ppuDataFill::ppuDataPrepare1_ppuData#0 = ppuDataFill::ppuData#2 ppuDataFill::ppuDataPrepare1_ppuData#1 +Alias ppuDataFill::size#3 = ppuDataFill::size#5 ppuDataFill::size#7 +Alias ppuDataFill::val#4 = ppuDataFill::val#6 ppuDataFill::val#8 +Alias ppuDataFill::val#2 = ppuDataFill::val#3 ppuDataFill::ppuDataPut1_val#0 ppuDataFill::ppuDataPut1_val#1 ppuDataFill::val#7 ppuDataFill::val#5 +Alias ppuDataFill::i#2 = ppuDataFill::i#5 ppuDataFill::i#4 ppuDataFill::i#3 +Alias ppuDataFill::size#2 = ppuDataFill::size#8 ppuDataFill::size#6 ppuDataFill::size#4 +Alias ppuDataTransfer::ppuDataPrepare1_ppuData#0 = ppuDataTransfer::ppuData#1 ppuDataTransfer::ppuDataPrepare1_ppuData#1 +Alias ppuDataTransfer::cpuData#1 = ppuDataTransfer::cpuData#2 ppuDataTransfer::cpuData#3 +Alias ppuDataTransfer::size#2 = ppuDataTransfer::size#4 ppuDataTransfer::size#6 +Alias ppuDataTransfer::cpuSrc#2 = ppuDataTransfer::cpuSrc#4 ppuDataTransfer::cpuSrc#5 ppuDataTransfer::cpuSrc#3 +Alias ppuDataTransfer::i#2 = ppuDataTransfer::i#5 ppuDataTransfer::i#4 ppuDataTransfer::i#3 +Alias ppuDataTransfer::size#1 = ppuDataTransfer::size#7 ppuDataTransfer::size#5 ppuDataTransfer::size#3 +Alias ppuDataTransfer::ppuDataPut1_val#0 = ppuDataTransfer::ppuDataPut1_val#1 +Alias ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuDataPrepare1_ppuData#0 ppuDataPutTile::ppuDataPrepare1_ppuData#1 ppuDataPutTile::ppuData#8 ppuDataPutTile::ppuData#7 ppuDataPutTile::ppuData#6 ppuDataPutTile::ppuData#5 ppuDataPutTile::ppuData#4 ppuDataPutTile::ppuData#3 +Alias ppuDataPutTile::tile#10 = ppuDataPutTile::tile#6 ppuDataPutTile::tile#2 ppuDataPutTile::tile#7 ppuDataPutTile::tile#3 ppuDataPutTile::tile#12 ppuDataPutTile::tile#11 ppuDataPutTile::tile#8 ppuDataPutTile::tile#4 ppuDataPutTile::tile#9 ppuDataPutTile::tile#5 +Alias ppuDataPutTile::ppuDataPut1_val#0 = ppuDataPutTile::ppuDataPut1_val#1 +Alias ppuDataPutTile::ppuDataPut2_val#0 = ppuDataPutTile::ppuDataPut2_val#1 +Alias ppuDataPutTile::ppuDataPrepare2_ppuData#0 = ppuDataPutTile::ppuDataPrepare2_ppuData#1 +Alias ppuDataPutTile::ppuDataPut3_val#0 = ppuDataPutTile::ppuDataPut3_val#1 +Alias ppuDataPutTile::ppuDataPut4_val#0 = ppuDataPutTile::ppuDataPut4_val#1 +Alias ppuDataTransfer::size#0 = main::$1 +Alias main::x#2 = main::x#3 main::x#4 +Alias main::i#2 = main::i#3 +Alias vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0 = vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#1 Successful SSA optimization Pass2AliasElimination -Simple Condition (bool~) main::waitForVBlank1_$1 [16] if((byte) 0==(byte~) main::waitForVBlank1_$0) goto main::waitForVBlank1_@1 -Simple Condition (bool~) main::$8 [29] if((byte) 0!=(byte) main::i#1) goto main::@1 -Simple Condition (bool~) main::waitForVBlank2_$1 [34] if((byte) 0==(byte~) main::waitForVBlank2_$0) goto main::waitForVBlank2_@1 -Simple Condition (bool~) main::$9 [44] if((number) 0!=(number) 1) goto main::@2 -Simple Condition (bool~) vblank::$2 [62] if((byte) 0==(byte~) vblank::$1) goto vblank::@1 -Simple Condition (bool~) vblank::$4 [67] if((byte) 0==(byte~) vblank::$3) goto vblank::@return -Simple Condition (bool~) initSpriteBuffer::$1 [96] if((byte) initSpriteBuffer::i#1!=(byte~) initSpriteBuffer::$0) goto initSpriteBuffer::@1 -Simple Condition (bool~) initPalette::$1 [109] if((byte) initPalette::i#2<(byte~) initPalette::$0) goto initPalette::@2 +Identical Phi Values (word) ppuDataFill::size#2 (word) ppuDataFill::size#3 +Identical Phi Values (byte) ppuDataFill::val#2 (byte) ppuDataFill::val#4 +Identical Phi Values (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0 (nomodify void*) ppuDataTransfer::ppuData#0 +Identical Phi Values (nomodify void*) ppuDataTransfer::cpuData#1 (nomodify void*) ppuDataTransfer::cpuData#0 +Identical Phi Values (word) ppuDataTransfer::size#2 (word) ppuDataTransfer::size#0 +Identical Phi Values (word) ppuDataTransfer::size#1 (word) ppuDataTransfer::size#2 +Successful SSA optimization Pass2IdenticalPhiElimination +Simple Condition (bool~) ppuDataFill::$1 [12] if((word) ppuDataFill::i#2<(word) ppuDataFill::size#3) goto ppuDataFill::@2 +Simple Condition (bool~) ppuDataTransfer::$1 [31] if((word) ppuDataTransfer::i#2<(word) ppuDataTransfer::size#0) goto ppuDataTransfer::@2 +Simple Condition (bool~) main::initNES1_waitForVBlank1_$1 [92] if((byte) 0==(byte~) main::initNES1_waitForVBlank1_$0) goto main::initNES1_waitForVBlank1_@1 +Simple Condition (bool~) main::initNES1_$5 [105] if((byte) 0!=(byte) main::initNES1_i#1) goto main::initNES1_@1 +Simple Condition (bool~) main::initNES1_waitForVBlank2_$1 [110] if((byte) 0==(byte~) main::initNES1_waitForVBlank2_$0) goto main::initNES1_waitForVBlank2_@1 +Simple Condition (bool~) main::$7 [127] if((byte) main::x#2<(byte) $20) goto main::@2 +Simple Condition (bool~) main::$11 [140] if((byte) main::i#2<(byte~) main::$10) goto main::@5 +Simple Condition (bool~) main::$17 [157] if((number) 0!=(number) 1) goto main::@7 +Simple Condition (bool~) vblank::$2 [177] if((byte) 0==(byte~) vblank::$1) goto vblank::@1 +Simple Condition (bool~) vblank::$4 [182] if((byte) 0==(byte~) vblank::$3) goto vblank::@return Successful SSA optimization Pass2ConditionalJumpSimplification -Constant right-side identified [1] (byte*~) main::disableVideoOutput1_$2 ← (byte*)(const struct RICOH_2C02*) PPU -Constant right-side identified [4] (byte*~) main::disableVideoOutput1_$3 ← (byte*)(const struct RICOH_2C02*) PPU -Constant right-side identified [8] (byte*~) main::disableAudioOutput1_$1 ← (byte*)(const struct RICOH_2A03*) APU -Constant right-side identified [12] (byte*~) main::waitForVBlank1_$3 ← (byte*)(const struct RICOH_2C02*) PPU -Constant right-side identified [30] (byte*~) main::waitForVBlank2_$3 ← (byte*)(const struct RICOH_2C02*) PPU -Constant right-side identified [37] (byte*~) main::enableVideoOutput1_$2 ← (byte*)(const struct RICOH_2C02*) PPU -Constant right-side identified [40] (byte*~) main::enableVideoOutput1_$3 ← (byte*)(const struct RICOH_2C02*) PPU -Constant right-side identified [46] (byte*~) vblank::transferSpriteBufferToPpu1_$2 ← (byte*)(const struct RICOH_2C02*) PPU -Constant right-side identified [49] (byte*~) vblank::transferSpriteBufferToPpu1_$3 ← (byte*)(const struct RICOH_2A03*) APU -Constant right-side identified [52] (byte*~) vblank::$11 ← (byte*)(const struct RICOH_2A03*) APU -Constant right-side identified [55] (byte*~) vblank::$12 ← (byte*)(const struct RICOH_2A03*) APU -Constant right-side identified [58] (byte*~) vblank::$13 ← (byte*)(const struct RICOH_2A03*) APU -Constant right-side identified [63] (byte*~) vblank::$14 ← (byte*)(const struct RICOH_2A03*) APU -Constant right-side identified [71] (byte~) moveLuigiRight::$5 ← (byte) 0 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant right-side identified [73] (byte~) moveLuigiRight::$7 ← (byte) 1 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant right-side identified [75] (byte~) moveLuigiRight::$9 ← (byte) 2 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant right-side identified [77] (byte~) moveLuigiRight::$11 ← (byte) 3 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant right-side identified [80] (byte~) moveLuigiLeft::$5 ← (byte) 0 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant right-side identified [82] (byte~) moveLuigiLeft::$7 ← (byte) 1 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant right-side identified [84] (byte~) moveLuigiLeft::$9 ← (byte) 2 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant right-side identified [86] (byte~) moveLuigiLeft::$11 ← (byte) 3 * (const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant right-side identified [91] (byte*~) initSpriteBuffer::$2 ← (byte*)(const struct ObjectAttribute*) SPRITES -Constant right-side identified [94] (byte~) initSpriteBuffer::$0 ← sizeof (const struct ObjectAttribute*) SPRITES -Constant right-side identified [99] (byte*~) initPalette::$5 ← (byte*)(const struct RICOH_2C02*) PPU -Constant right-side identified [102] (byte*~) initPalette::$6 ← (byte*)(const struct RICOH_2C02*) PPU -Constant right-side identified [107] (byte~) initPalette::$0 ← sizeof (const byte*) PALETTE -Constant right-side identified [110] (byte*~) initPalette::$7 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [2] (byte*~) ppuDataFill::ppuDataPrepare1_$4 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [6] (byte*~) ppuDataFill::ppuDataPrepare1_$5 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [13] (byte*~) ppuDataFill::ppuDataPut1_$1 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [20] (byte*~) ppuDataTransfer::ppuDataPrepare1_$4 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [24] (byte*~) ppuDataTransfer::ppuDataPrepare1_$5 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [33] (byte*~) ppuDataTransfer::ppuDataPut1_$1 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [41] (byte*~) ppuDataPutTile::ppuDataPrepare1_$4 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [45] (byte*~) ppuDataPutTile::ppuDataPrepare1_$5 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [49] (byte*~) ppuDataPutTile::ppuDataPut1_$1 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [53] (byte*~) ppuDataPutTile::ppuDataPut2_$1 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [60] (byte*~) ppuDataPutTile::ppuDataPrepare2_$4 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [64] (byte*~) ppuDataPutTile::ppuDataPrepare2_$5 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [68] (byte*~) ppuDataPutTile::ppuDataPut3_$1 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [72] (byte*~) ppuDataPutTile::ppuDataPut4_$1 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [77] (byte*~) main::initNES1_disableVideoOutput1_$2 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [80] (byte*~) main::initNES1_disableVideoOutput1_$3 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [84] (byte*~) main::initNES1_disableAudioOutput1_$1 ← (byte*)(const struct RICOH_2A03*) APU +Constant right-side identified [88] (byte*~) main::initNES1_waitForVBlank1_$3 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [106] (byte*~) main::initNES1_waitForVBlank2_$3 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [112] (word) ppuDataTransfer::size#0 ← sizeof (const byte*) PALETTE +Constant right-side identified [138] (byte~) main::$10 ← sizeof (const struct SpriteData*) SPRITES +Constant right-side identified [141] (byte*~) main::$14 ← (byte*)(const struct SpriteData*) SPRITES +Constant right-side identified [144] (byte*~) main::$15 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [147] (byte*~) main::$16 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [150] (byte*~) main::enableVideoOutput1_$2 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [153] (byte*~) main::enableVideoOutput1_$3 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [160] (byte*~) vblank::ppuSpriteBufferDmaTransfer1_$3 ← (byte*)(const struct RICOH_2C02*) PPU +Constant right-side identified [164] (byte*~) vblank::ppuSpriteBufferDmaTransfer1_$4 ← (byte*)(const struct RICOH_2A03*) APU +Constant right-side identified [167] (byte*~) vblank::$33 ← (byte*)(const struct RICOH_2A03*) APU +Constant right-side identified [170] (byte*~) vblank::$34 ← (byte*)(const struct RICOH_2A03*) APU +Constant right-side identified [173] (byte*~) vblank::$35 ← (byte*)(const struct RICOH_2A03*) APU +Constant right-side identified [178] (byte*~) vblank::$36 ← (byte*)(const struct RICOH_2A03*) APU +Constant right-side identified [183] (byte~) vblank::$14 ← (byte) 0 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Constant right-side identified [185] (byte~) vblank::$16 ← (byte) 1 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Constant right-side identified [187] (byte~) vblank::$18 ← (byte) 2 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Constant right-side identified [189] (byte~) vblank::$20 ← (byte) 3 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Constant right-side identified [191] (byte~) vblank::$22 ← (byte) 0 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Constant right-side identified [193] (byte~) vblank::$24 ← (byte) 1 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Constant right-side identified [195] (byte~) vblank::$26 ← (byte) 2 * (const byte) SIZEOF_STRUCT_SPRITEDATA +Constant right-side identified [197] (byte~) vblank::$28 ← (byte) 3 * (const byte) SIZEOF_STRUCT_SPRITEDATA Successful SSA optimization Pass2ConstantRValueConsolidation -Constant (const byte*) main::disableVideoOutput1_$2 = (byte*)PPU -Constant (const byte*) main::disableVideoOutput1_$3 = (byte*)PPU -Constant (const byte*) main::disableAudioOutput1_$1 = (byte*)APU -Constant (const byte*) main::waitForVBlank1_$3 = (byte*)PPU +Constant (const byte*) ppuDataFill::ppuDataPrepare1_$4 = (byte*)PPU +Constant (const byte*) ppuDataFill::ppuDataPrepare1_$5 = (byte*)PPU +Constant (const word) ppuDataFill::i#0 = 0 +Constant (const byte*) ppuDataFill::ppuDataPut1_$1 = (byte*)PPU +Constant (const byte*) ppuDataTransfer::ppuDataPrepare1_$4 = (byte*)PPU +Constant (const byte*) ppuDataTransfer::ppuDataPrepare1_$5 = (byte*)PPU +Constant (const word) ppuDataTransfer::i#0 = 0 +Constant (const byte*) ppuDataTransfer::ppuDataPut1_$1 = (byte*)PPU +Constant (const byte*) ppuDataPutTile::ppuDataPrepare1_$4 = (byte*)PPU +Constant (const byte*) ppuDataPutTile::ppuDataPrepare1_$5 = (byte*)PPU +Constant (const byte*) ppuDataPutTile::ppuDataPut1_$1 = (byte*)PPU +Constant (const byte*) ppuDataPutTile::ppuDataPut2_$1 = (byte*)PPU +Constant (const byte*) ppuDataPutTile::ppuDataPrepare2_$4 = (byte*)PPU +Constant (const byte*) ppuDataPutTile::ppuDataPrepare2_$5 = (byte*)PPU +Constant (const byte*) ppuDataPutTile::ppuDataPut3_$1 = (byte*)PPU +Constant (const byte*) ppuDataPutTile::ppuDataPut4_$1 = (byte*)PPU +Constant (const byte*) main::initNES1_disableVideoOutput1_$2 = (byte*)PPU +Constant (const byte*) main::initNES1_disableVideoOutput1_$3 = (byte*)PPU +Constant (const byte*) main::initNES1_disableAudioOutput1_$1 = (byte*)APU +Constant (const byte*) main::initNES1_waitForVBlank1_$3 = (byte*)PPU +Constant (const byte) main::initNES1_i#0 = 0 +Constant (const byte*) main::initNES1_waitForVBlank2_$3 = (byte*)PPU +Constant (const word) ppuDataTransfer::size#0 = sizeof PALETTE +Constant (const nomodify void*) ppuDataTransfer::ppuData#0 = (void*)PPU_PALETTE +Constant (const nomodify void*) ppuDataTransfer::cpuData#0 = (void*)PALETTE +Constant (const nomodify void*) ppuDataFill::ppuData#0 = (void*)PPU_NAME_TABLE_0 +Constant (const byte) ppuDataFill::val#0 = $fc +Constant (const word) ppuDataFill::size#0 = $3c0 +Constant (const nomodify void*) ppuDataFill::ppuData#1 = (void*)PPU_ATTRIBUTE_TABLE_0 +Constant (const byte) ppuDataFill::val#1 = 0 +Constant (const word) ppuDataFill::size#1 = $40 +Constant (const byte) main::x#0 = 0 +Constant (const byte*) ppuDataPutTile::tile#0 = FLOOR +Constant (const nomodify void*) ppuDataPutTile::ppuData#1 = (void*)PPU_NAME_TABLE_0+(word)$12*$20+$1c +Constant (const byte*) ppuDataPutTile::tile#1 = FLAG Constant (const byte) main::i#0 = 0 -Constant (const byte*) main::waitForVBlank2_$3 = (byte*)PPU +Constant (const byte) main::$10 = sizeof SPRITES +Constant (const byte*) main::$14 = (byte*)SPRITES +Constant (const byte*) main::$15 = (byte*)PPU +Constant (const byte*) main::$16 = (byte*)PPU Constant (const byte*) main::enableVideoOutput1_$2 = (byte*)PPU Constant (const byte*) main::enableVideoOutput1_$3 = (byte*)PPU -Constant (const byte*) vblank::transferSpriteBufferToPpu1_$2 = (byte*)PPU -Constant (const byte*) vblank::transferSpriteBufferToPpu1_$3 = (byte*)APU -Constant (const byte*) vblank::$11 = (byte*)APU -Constant (const byte*) vblank::$12 = (byte*)APU -Constant (const byte*) vblank::$13 = (byte*)APU -Constant (const byte*) vblank::$14 = (byte*)APU -Constant (const byte) moveLuigiRight::$5 = 0*SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant (const byte) moveLuigiRight::$7 = 1*SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant (const byte) moveLuigiRight::$9 = 2*SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant (const byte) moveLuigiRight::$11 = 3*SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant (const byte) moveLuigiLeft::$5 = 0*SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant (const byte) moveLuigiLeft::$7 = 1*SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant (const byte) moveLuigiLeft::$9 = 2*SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant (const byte) moveLuigiLeft::$11 = 3*SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant (const byte) initSpriteBuffer::i#0 = 0 -Constant (const byte*) initSpriteBuffer::$2 = (byte*)SPRITES -Constant (const byte) initSpriteBuffer::$0 = sizeof SPRITES -Constant (const byte*) initPalette::$5 = (byte*)PPU -Constant (const byte*) initPalette::$6 = (byte*)PPU -Constant (const byte) initPalette::i#0 = 0 -Constant (const byte) initPalette::$0 = sizeof PALETTE -Constant (const byte*) initPalette::$7 = (byte*)PPU +Constant (const struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0 = OAM_BUFFER +Constant (const byte*) vblank::ppuSpriteBufferDmaTransfer1_$3 = (byte*)PPU +Constant (const byte*) vblank::ppuSpriteBufferDmaTransfer1_$4 = (byte*)APU +Constant (const byte*) vblank::$33 = (byte*)APU +Constant (const byte*) vblank::$34 = (byte*)APU +Constant (const byte*) vblank::$35 = (byte*)APU +Constant (const byte*) vblank::$36 = (byte*)APU +Constant (const byte) vblank::$14 = 0*SIZEOF_STRUCT_SPRITEDATA +Constant (const byte) vblank::$16 = 1*SIZEOF_STRUCT_SPRITEDATA +Constant (const byte) vblank::$18 = 2*SIZEOF_STRUCT_SPRITEDATA +Constant (const byte) vblank::$20 = 3*SIZEOF_STRUCT_SPRITEDATA +Constant (const byte) vblank::$22 = 0*SIZEOF_STRUCT_SPRITEDATA +Constant (const byte) vblank::$24 = 1*SIZEOF_STRUCT_SPRITEDATA +Constant (const byte) vblank::$26 = 2*SIZEOF_STRUCT_SPRITEDATA +Constant (const byte) vblank::$28 = 3*SIZEOF_STRUCT_SPRITEDATA Successful SSA optimization Pass2ConstantIdentification -if() condition always true - replacing block destination [44] if((number) 0!=(number) 1) goto main::@2 +Constant (const byte*) ppuDataTransfer::cpuSrc#0 = (byte*)ppuDataTransfer::cpuData#0 +Successful SSA optimization Pass2ConstantIdentification +if() condition always true - replacing block destination [157] if((number) 0!=(number) 1) goto main::@7 Successful SSA optimization Pass2ConstantIfs -Converting *(pointer+n) to pointer[n] [3] *((byte*~) main::disableVideoOutput1_$0) ← (byte) 0 -- *(main::disableVideoOutput1_$2 + OFFSET_STRUCT_RICOH_2C02_PPUCTRL) -Converting *(pointer+n) to pointer[n] [6] *((byte*~) main::disableVideoOutput1_$1) ← (byte) 0 -- *(main::disableVideoOutput1_$3 + OFFSET_STRUCT_RICOH_2C02_PPUMASK) -Converting *(pointer+n) to pointer[n] [10] *((byte*~) main::disableAudioOutput1_$0) ← (byte) $40 -- *(main::disableAudioOutput1_$1 + OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) -Converting *(pointer+n) to pointer[n] [14] (byte~) main::waitForVBlank1_$0 ← *((byte*~) main::waitForVBlank1_$2) & (byte) $80 -- *(main::waitForVBlank1_$3 + OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) -Converting *(pointer+n) to pointer[n] [32] (byte~) main::waitForVBlank2_$0 ← *((byte*~) main::waitForVBlank2_$2) & (byte) $80 -- *(main::waitForVBlank2_$3 + OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) -Converting *(pointer+n) to pointer[n] [39] *((byte*~) main::enableVideoOutput1_$0) ← (byte) $80 -- *(main::enableVideoOutput1_$2 + OFFSET_STRUCT_RICOH_2C02_PPUCTRL) -Converting *(pointer+n) to pointer[n] [42] *((byte*~) main::enableVideoOutput1_$1) ← (byte) $10 -- *(main::enableVideoOutput1_$3 + OFFSET_STRUCT_RICOH_2C02_PPUMASK) -Converting *(pointer+n) to pointer[n] [48] *((byte*~) vblank::transferSpriteBufferToPpu1_$0) ← (byte) 0 -- *(vblank::transferSpriteBufferToPpu1_$2 + OFFSET_STRUCT_RICOH_2C02_OAMADDR) -Converting *(pointer+n) to pointer[n] [51] *((byte*~) vblank::transferSpriteBufferToPpu1_$1) ← >(const nomodify struct ObjectAttribute*) OAM_BUFFER -- *(vblank::transferSpriteBufferToPpu1_$3 + OFFSET_STRUCT_RICOH_2A03_OAMDMA) -Converting *(pointer+n) to pointer[n] [54] *((byte*~) vblank::$7) ← (byte) 1 -- *(vblank::$11 + OFFSET_STRUCT_RICOH_2A03_JOY1) -Converting *(pointer+n) to pointer[n] [57] *((byte*~) vblank::$8) ← (byte) 0 -- *(vblank::$12 + OFFSET_STRUCT_RICOH_2A03_JOY1) -Converting *(pointer+n) to pointer[n] [60] (byte~) vblank::$1 ← *((byte*~) vblank::$9) & (byte) 1 -- *(vblank::$13 + OFFSET_STRUCT_RICOH_2A03_JOY1) -Converting *(pointer+n) to pointer[n] [65] (byte~) vblank::$3 ← *((byte*~) vblank::$10) & (byte) 1 -- *(vblank::$14 + OFFSET_STRUCT_RICOH_2A03_JOY1) -Converting *(pointer+n) to pointer[n] [101] *((byte*~) initPalette::$2) ← >(const nomodify byte*) PPU_PALETTE -- *(initPalette::$5 + OFFSET_STRUCT_RICOH_2C02_PPUADDR) -Converting *(pointer+n) to pointer[n] [104] *((byte*~) initPalette::$3) ← <(const nomodify byte*) PPU_PALETTE -- *(initPalette::$6 + OFFSET_STRUCT_RICOH_2C02_PPUADDR) -Converting *(pointer+n) to pointer[n] [112] *((byte*~) initPalette::$4) ← *((const byte*) PALETTE + (byte) initPalette::i#2) -- *(initPalette::$7 + OFFSET_STRUCT_RICOH_2C02_PPUDATA) +Converting *(pointer+n) to pointer[n] [4] *((byte*~) ppuDataFill::ppuDataPrepare1_$2) ← (byte~) ppuDataFill::ppuDataPrepare1_$0 -- *(ppuDataFill::ppuDataPrepare1_$4 + OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Converting *(pointer+n) to pointer[n] [8] *((byte*~) ppuDataFill::ppuDataPrepare1_$3) ← (byte~) ppuDataFill::ppuDataPrepare1_$1 -- *(ppuDataFill::ppuDataPrepare1_$5 + OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Converting *(pointer+n) to pointer[n] [15] *((byte*~) ppuDataFill::ppuDataPut1_$0) ← (byte) ppuDataFill::val#4 -- *(ppuDataFill::ppuDataPut1_$1 + OFFSET_STRUCT_RICOH_2C02_PPUDATA) +Converting *(pointer+n) to pointer[n] [22] *((byte*~) ppuDataTransfer::ppuDataPrepare1_$2) ← (byte~) ppuDataTransfer::ppuDataPrepare1_$0 -- *(ppuDataTransfer::ppuDataPrepare1_$4 + OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Converting *(pointer+n) to pointer[n] [26] *((byte*~) ppuDataTransfer::ppuDataPrepare1_$3) ← (byte~) ppuDataTransfer::ppuDataPrepare1_$1 -- *(ppuDataTransfer::ppuDataPrepare1_$5 + OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Converting *(pointer+n) to pointer[n] [35] *((byte*~) ppuDataTransfer::ppuDataPut1_$0) ← (byte) ppuDataTransfer::ppuDataPut1_val#0 -- *(ppuDataTransfer::ppuDataPut1_$1 + OFFSET_STRUCT_RICOH_2C02_PPUDATA) +Converting *(pointer+n) to pointer[n] [43] *((byte*~) ppuDataPutTile::ppuDataPrepare1_$2) ← (byte~) ppuDataPutTile::ppuDataPrepare1_$0 -- *(ppuDataPutTile::ppuDataPrepare1_$4 + OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Converting *(pointer+n) to pointer[n] [47] *((byte*~) ppuDataPutTile::ppuDataPrepare1_$3) ← (byte~) ppuDataPutTile::ppuDataPrepare1_$1 -- *(ppuDataPutTile::ppuDataPrepare1_$5 + OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Converting *(pointer+n) to pointer[n] [51] *((byte*~) ppuDataPutTile::ppuDataPut1_$0) ← (byte) ppuDataPutTile::ppuDataPut1_val#0 -- *(ppuDataPutTile::ppuDataPut1_$1 + OFFSET_STRUCT_RICOH_2C02_PPUDATA) +Converting *(pointer+n) to pointer[n] [55] *((byte*~) ppuDataPutTile::ppuDataPut2_$0) ← (byte) ppuDataPutTile::ppuDataPut2_val#0 -- *(ppuDataPutTile::ppuDataPut2_$1 + OFFSET_STRUCT_RICOH_2C02_PPUDATA) +Converting *(pointer+n) to pointer[n] [62] *((byte*~) ppuDataPutTile::ppuDataPrepare2_$2) ← (byte~) ppuDataPutTile::ppuDataPrepare2_$0 -- *(ppuDataPutTile::ppuDataPrepare2_$4 + OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Converting *(pointer+n) to pointer[n] [66] *((byte*~) ppuDataPutTile::ppuDataPrepare2_$3) ← (byte~) ppuDataPutTile::ppuDataPrepare2_$1 -- *(ppuDataPutTile::ppuDataPrepare2_$5 + OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Converting *(pointer+n) to pointer[n] [70] *((byte*~) ppuDataPutTile::ppuDataPut3_$0) ← (byte) ppuDataPutTile::ppuDataPut3_val#0 -- *(ppuDataPutTile::ppuDataPut3_$1 + OFFSET_STRUCT_RICOH_2C02_PPUDATA) +Converting *(pointer+n) to pointer[n] [74] *((byte*~) ppuDataPutTile::ppuDataPut4_$0) ← (byte) ppuDataPutTile::ppuDataPut4_val#0 -- *(ppuDataPutTile::ppuDataPut4_$1 + OFFSET_STRUCT_RICOH_2C02_PPUDATA) +Converting *(pointer+n) to pointer[n] [79] *((byte*~) main::initNES1_disableVideoOutput1_$0) ← (byte) 0 -- *(main::initNES1_disableVideoOutput1_$2 + OFFSET_STRUCT_RICOH_2C02_PPUCTRL) +Converting *(pointer+n) to pointer[n] [82] *((byte*~) main::initNES1_disableVideoOutput1_$1) ← (byte) 0 -- *(main::initNES1_disableVideoOutput1_$3 + OFFSET_STRUCT_RICOH_2C02_PPUMASK) +Converting *(pointer+n) to pointer[n] [86] *((byte*~) main::initNES1_disableAudioOutput1_$0) ← (byte) $40 -- *(main::initNES1_disableAudioOutput1_$1 + OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) +Converting *(pointer+n) to pointer[n] [90] (byte~) main::initNES1_waitForVBlank1_$0 ← *((byte*~) main::initNES1_waitForVBlank1_$2) & (byte) $80 -- *(main::initNES1_waitForVBlank1_$3 + OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) +Converting *(pointer+n) to pointer[n] [108] (byte~) main::initNES1_waitForVBlank2_$0 ← *((byte*~) main::initNES1_waitForVBlank2_$2) & (byte) $80 -- *(main::initNES1_waitForVBlank2_$3 + OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) +Converting *(pointer+n) to pointer[n] [146] *((byte*~) main::$12) ← (byte) 0 -- *(main::$15 + OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) +Converting *(pointer+n) to pointer[n] [149] *((byte*~) main::$13) ← (byte) -8 -- *(main::$16 + OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) +Converting *(pointer+n) to pointer[n] [152] *((byte*~) main::enableVideoOutput1_$0) ← (byte) $80 -- *(main::enableVideoOutput1_$2 + OFFSET_STRUCT_RICOH_2C02_PPUCTRL) +Converting *(pointer+n) to pointer[n] [155] *((byte*~) main::enableVideoOutput1_$1) ← (byte) $18 -- *(main::enableVideoOutput1_$3 + OFFSET_STRUCT_RICOH_2C02_PPUMASK) +Converting *(pointer+n) to pointer[n] [162] *((byte*~) vblank::ppuSpriteBufferDmaTransfer1_$1) ← (byte) 0 -- *(vblank::ppuSpriteBufferDmaTransfer1_$3 + OFFSET_STRUCT_RICOH_2C02_OAMADDR) +Converting *(pointer+n) to pointer[n] [166] *((byte*~) vblank::ppuSpriteBufferDmaTransfer1_$2) ← (byte~) vblank::ppuSpriteBufferDmaTransfer1_$0 -- *(vblank::ppuSpriteBufferDmaTransfer1_$4 + OFFSET_STRUCT_RICOH_2A03_OAMDMA) +Converting *(pointer+n) to pointer[n] [169] *((byte*~) vblank::$29) ← (byte) 1 -- *(vblank::$33 + OFFSET_STRUCT_RICOH_2A03_JOY1) +Converting *(pointer+n) to pointer[n] [172] *((byte*~) vblank::$30) ← (byte) 0 -- *(vblank::$34 + OFFSET_STRUCT_RICOH_2A03_JOY1) +Converting *(pointer+n) to pointer[n] [175] (byte~) vblank::$1 ← *((byte*~) vblank::$31) & (byte) 1 -- *(vblank::$35 + OFFSET_STRUCT_RICOH_2A03_JOY1) +Converting *(pointer+n) to pointer[n] [180] (byte~) vblank::$3 ← *((byte*~) vblank::$32) & (byte) 1 -- *(vblank::$36 + OFFSET_STRUCT_RICOH_2A03_JOY1) Successful SSA optimization Pass2InlineDerefIdx -Simplifying constant evaluating to zero (byte) 0*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE in -Simplifying constant evaluating to zero (byte) 0*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE in -Simplifying constant evaluating to zero <(const nomodify byte*) PPU_PALETTE in [104] *((const byte*) initPalette::$6 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← <(const nomodify byte*) PPU_PALETTE +Simplifying constant evaluating to zero (byte) 0*(const byte) SIZEOF_STRUCT_SPRITEDATA in +Simplifying constant evaluating to zero (byte) 0*(const byte) SIZEOF_STRUCT_SPRITEDATA in Successful SSA optimization PassNSimplifyConstantZero -Simplifying expression containing zero main::disableVideoOutput1_$2 in [2] (byte*~) main::disableVideoOutput1_$0 ← (const byte*) main::disableVideoOutput1_$2 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUCTRL -Simplifying expression containing zero main::disableVideoOutput1_$2 in [3] *((const byte*) main::disableVideoOutput1_$2 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUCTRL) ← (byte) 0 -Simplifying expression containing zero MEMORY in [19] *((const nomodify byte*) MEMORY+(byte) 0 + (byte) main::i#2) ← (byte) 0 -Simplifying expression containing zero main::enableVideoOutput1_$2 in [38] (byte*~) main::enableVideoOutput1_$0 ← (const byte*) main::enableVideoOutput1_$2 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUCTRL -Simplifying expression containing zero main::enableVideoOutput1_$2 in [39] *((const byte*) main::enableVideoOutput1_$2 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUCTRL) ← (byte) $80 -Simplifying expression containing zero (byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X in [72] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (const byte) moveLuigiRight::$5) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (const byte) moveLuigiRight::$5) -Simplifying expression containing zero (byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X in [72] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (const byte) moveLuigiRight::$5) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) -Simplifying expression containing zero (byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X in [81] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (const byte) moveLuigiLeft::$5) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (const byte) moveLuigiLeft::$5) -Simplifying expression containing zero (byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X in [81] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X + (const byte) moveLuigiLeft::$5) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) +Simplifying expression containing zero ppuDataPutTile::tile#10 in [48] (byte) ppuDataPutTile::ppuDataPut1_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 0) +Simplifying expression containing zero main::initNES1_disableVideoOutput1_$2 in [78] (byte*~) main::initNES1_disableVideoOutput1_$0 ← (const byte*) main::initNES1_disableVideoOutput1_$2 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUCTRL +Simplifying expression containing zero main::initNES1_disableVideoOutput1_$2 in [79] *((const byte*) main::initNES1_disableVideoOutput1_$2 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUCTRL) ← (byte) 0 +Simplifying expression containing zero MEMORY in [95] *((const nomodify byte*) MEMORY+(byte) 0 + (byte) main::initNES1_i#2) ← (byte) 0 +Simplifying expression containing zero main::enableVideoOutput1_$2 in [151] (byte*~) main::enableVideoOutput1_$0 ← (const byte*) main::enableVideoOutput1_$2 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUCTRL +Simplifying expression containing zero main::enableVideoOutput1_$2 in [152] *((const byte*) main::enableVideoOutput1_$2 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUCTRL) ← (byte) $80 +Simplifying expression containing zero (byte*)OAM_BUFFER+OFFSET_STRUCT_SPRITEDATA_Y in [184] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$14) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$14) +Simplifying expression containing zero (byte*)OAM_BUFFER in [184] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$14) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y) +Simplifying expression containing zero (byte*)OAM_BUFFER+OFFSET_STRUCT_SPRITEDATA_Y in [184] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$14) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) +Simplifying expression containing zero (byte*)OAM_BUFFER in [184] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) +Simplifying expression containing zero (byte*)OAM_BUFFER in [186] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$16) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$16) +Simplifying expression containing zero (byte*)OAM_BUFFER in [186] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$16) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER + (const byte) vblank::$16) +Simplifying expression containing zero (byte*)OAM_BUFFER in [188] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$18) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$18) +Simplifying expression containing zero (byte*)OAM_BUFFER in [188] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$18) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER + (const byte) vblank::$18) +Simplifying expression containing zero (byte*)OAM_BUFFER in [190] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$20) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$20) +Simplifying expression containing zero (byte*)OAM_BUFFER in [190] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$20) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER + (const byte) vblank::$20) +Simplifying expression containing zero (byte*)OAM_BUFFER+OFFSET_STRUCT_SPRITEDATA_Y in [192] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$22) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$22) +Simplifying expression containing zero (byte*)OAM_BUFFER in [192] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$22) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y) +Simplifying expression containing zero (byte*)OAM_BUFFER+OFFSET_STRUCT_SPRITEDATA_Y in [192] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$22) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) +Simplifying expression containing zero (byte*)OAM_BUFFER in [192] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) +Simplifying expression containing zero (byte*)OAM_BUFFER in [194] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$24) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$24) +Simplifying expression containing zero (byte*)OAM_BUFFER in [194] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$24) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER + (const byte) vblank::$24) +Simplifying expression containing zero (byte*)OAM_BUFFER in [196] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$26) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$26) +Simplifying expression containing zero (byte*)OAM_BUFFER in [196] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$26) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER + (const byte) vblank::$26) +Simplifying expression containing zero (byte*)OAM_BUFFER in [198] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$28) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$28) +Simplifying expression containing zero (byte*)OAM_BUFFER in [198] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_Y + (const byte) vblank::$28) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER + (const byte) vblank::$28) Successful SSA optimization PassNSimplifyExpressionWithZero -Eliminating unused variable (byte*~) main::disableVideoOutput1_$0 and assignment [1] (byte*~) main::disableVideoOutput1_$0 ← (const byte*) main::disableVideoOutput1_$2 -Eliminating unused variable (byte*~) main::disableVideoOutput1_$1 and assignment [3] (byte*~) main::disableVideoOutput1_$1 ← (const byte*) main::disableVideoOutput1_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK -Eliminating unused variable (byte*~) main::disableAudioOutput1_$0 and assignment [6] (byte*~) main::disableAudioOutput1_$0 ← (const byte*) main::disableAudioOutput1_$1 + (const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ -Eliminating unused variable (byte*~) main::waitForVBlank1_$2 and assignment [9] (byte*~) main::waitForVBlank1_$2 ← (const byte*) main::waitForVBlank1_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS -Eliminating unused variable (byte*~) main::waitForVBlank2_$2 and assignment [23] (byte*~) main::waitForVBlank2_$2 ← (const byte*) main::waitForVBlank2_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS -Eliminating unused variable (byte*~) main::enableVideoOutput1_$0 and assignment [28] (byte*~) main::enableVideoOutput1_$0 ← (const byte*) main::enableVideoOutput1_$2 -Eliminating unused variable (byte*~) main::enableVideoOutput1_$1 and assignment [30] (byte*~) main::enableVideoOutput1_$1 ← (const byte*) main::enableVideoOutput1_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK -Eliminating unused variable (byte*~) vblank::transferSpriteBufferToPpu1_$0 and assignment [33] (byte*~) vblank::transferSpriteBufferToPpu1_$0 ← (const byte*) vblank::transferSpriteBufferToPpu1_$2 + (const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR -Eliminating unused variable (byte*~) vblank::transferSpriteBufferToPpu1_$1 and assignment [35] (byte*~) vblank::transferSpriteBufferToPpu1_$1 ← (const byte*) vblank::transferSpriteBufferToPpu1_$3 + (const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA -Eliminating unused variable (byte*~) vblank::$7 and assignment [37] (byte*~) vblank::$7 ← (const byte*) vblank::$11 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 -Eliminating unused variable (byte*~) vblank::$8 and assignment [39] (byte*~) vblank::$8 ← (const byte*) vblank::$12 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 -Eliminating unused variable (byte*~) vblank::$9 and assignment [41] (byte*~) vblank::$9 ← (const byte*) vblank::$13 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 -Eliminating unused variable (byte*~) vblank::$10 and assignment [44] (byte*~) vblank::$10 ← (const byte*) vblank::$14 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 -Eliminating unused variable (byte*~) initPalette::$2 and assignment [66] (byte*~) initPalette::$2 ← (const byte*) initPalette::$5 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR -Eliminating unused variable (byte*~) initPalette::$3 and assignment [68] (byte*~) initPalette::$3 ← (const byte*) initPalette::$6 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR -Eliminating unused variable (byte*~) initPalette::$4 and assignment [72] (byte*~) initPalette::$4 ← (const byte*) initPalette::$7 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA -Eliminating unused constant (const byte) moveLuigiRight::$5 -Eliminating unused constant (const byte) moveLuigiLeft::$5 +Eliminating unused variable (byte*~) ppuDataFill::ppuDataPrepare1_$2 and assignment [2] (byte*~) ppuDataFill::ppuDataPrepare1_$2 ← (const byte*) ppuDataFill::ppuDataPrepare1_$4 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR +Eliminating unused variable (byte*~) ppuDataFill::ppuDataPrepare1_$3 and assignment [5] (byte*~) ppuDataFill::ppuDataPrepare1_$3 ← (const byte*) ppuDataFill::ppuDataPrepare1_$5 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR +Eliminating unused variable (byte*~) ppuDataFill::ppuDataPut1_$0 and assignment [9] (byte*~) ppuDataFill::ppuDataPut1_$0 ← (const byte*) ppuDataFill::ppuDataPut1_$1 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA +Eliminating unused variable (byte*~) ppuDataTransfer::ppuDataPrepare1_$2 and assignment [14] (byte*~) ppuDataTransfer::ppuDataPrepare1_$2 ← (const byte*) ppuDataTransfer::ppuDataPrepare1_$4 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR +Eliminating unused variable (byte*~) ppuDataTransfer::ppuDataPrepare1_$3 and assignment [17] (byte*~) ppuDataTransfer::ppuDataPrepare1_$3 ← (const byte*) ppuDataTransfer::ppuDataPrepare1_$5 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR +Eliminating unused variable (byte*~) ppuDataTransfer::ppuDataPut1_$0 and assignment [22] (byte*~) ppuDataTransfer::ppuDataPut1_$0 ← (const byte*) ppuDataTransfer::ppuDataPut1_$1 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA +Eliminating unused variable (byte*~) ppuDataPutTile::ppuDataPrepare1_$2 and assignment [29] (byte*~) ppuDataPutTile::ppuDataPrepare1_$2 ← (const byte*) ppuDataPutTile::ppuDataPrepare1_$4 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR +Eliminating unused variable (byte*~) ppuDataPutTile::ppuDataPrepare1_$3 and assignment [32] (byte*~) ppuDataPutTile::ppuDataPrepare1_$3 ← (const byte*) ppuDataPutTile::ppuDataPrepare1_$5 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR +Eliminating unused variable (byte*~) ppuDataPutTile::ppuDataPut1_$0 and assignment [35] (byte*~) ppuDataPutTile::ppuDataPut1_$0 ← (const byte*) ppuDataPutTile::ppuDataPut1_$1 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA +Eliminating unused variable (byte*~) ppuDataPutTile::ppuDataPut2_$0 and assignment [38] (byte*~) ppuDataPutTile::ppuDataPut2_$0 ← (const byte*) ppuDataPutTile::ppuDataPut2_$1 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA +Eliminating unused variable (byte*~) ppuDataPutTile::ppuDataPrepare2_$2 and assignment [44] (byte*~) ppuDataPutTile::ppuDataPrepare2_$2 ← (const byte*) ppuDataPutTile::ppuDataPrepare2_$4 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR +Eliminating unused variable (byte*~) ppuDataPutTile::ppuDataPrepare2_$3 and assignment [47] (byte*~) ppuDataPutTile::ppuDataPrepare2_$3 ← (const byte*) ppuDataPutTile::ppuDataPrepare2_$5 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR +Eliminating unused variable (byte*~) ppuDataPutTile::ppuDataPut3_$0 and assignment [50] (byte*~) ppuDataPutTile::ppuDataPut3_$0 ← (const byte*) ppuDataPutTile::ppuDataPut3_$1 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA +Eliminating unused variable (byte*~) ppuDataPutTile::ppuDataPut4_$0 and assignment [53] (byte*~) ppuDataPutTile::ppuDataPut4_$0 ← (const byte*) ppuDataPutTile::ppuDataPut4_$1 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA +Eliminating unused variable (byte*~) main::initNES1_disableVideoOutput1_$0 and assignment [57] (byte*~) main::initNES1_disableVideoOutput1_$0 ← (const byte*) main::initNES1_disableVideoOutput1_$2 +Eliminating unused variable (byte*~) main::initNES1_disableVideoOutput1_$1 and assignment [59] (byte*~) main::initNES1_disableVideoOutput1_$1 ← (const byte*) main::initNES1_disableVideoOutput1_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK +Eliminating unused variable (byte*~) main::initNES1_disableAudioOutput1_$0 and assignment [62] (byte*~) main::initNES1_disableAudioOutput1_$0 ← (const byte*) main::initNES1_disableAudioOutput1_$1 + (const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ +Eliminating unused variable (byte*~) main::initNES1_waitForVBlank1_$2 and assignment [65] (byte*~) main::initNES1_waitForVBlank1_$2 ← (const byte*) main::initNES1_waitForVBlank1_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS +Eliminating unused variable (byte*~) main::initNES1_waitForVBlank2_$2 and assignment [79] (byte*~) main::initNES1_waitForVBlank2_$2 ← (const byte*) main::initNES1_waitForVBlank2_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS +Eliminating unused variable (byte*~) main::$12 and assignment [97] (byte*~) main::$12 ← (const byte*) main::$15 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL +Eliminating unused variable (byte*~) main::$13 and assignment [99] (byte*~) main::$13 ← (const byte*) main::$16 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL +Eliminating unused variable (byte*~) main::enableVideoOutput1_$0 and assignment [101] (byte*~) main::enableVideoOutput1_$0 ← (const byte*) main::enableVideoOutput1_$2 +Eliminating unused variable (byte*~) main::enableVideoOutput1_$1 and assignment [103] (byte*~) main::enableVideoOutput1_$1 ← (const byte*) main::enableVideoOutput1_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK +Eliminating unused variable (byte*~) vblank::ppuSpriteBufferDmaTransfer1_$1 and assignment [106] (byte*~) vblank::ppuSpriteBufferDmaTransfer1_$1 ← (const byte*) vblank::ppuSpriteBufferDmaTransfer1_$3 + (const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR +Eliminating unused variable (byte*~) vblank::ppuSpriteBufferDmaTransfer1_$2 and assignment [109] (byte*~) vblank::ppuSpriteBufferDmaTransfer1_$2 ← (const byte*) vblank::ppuSpriteBufferDmaTransfer1_$4 + (const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA +Eliminating unused variable (byte*~) vblank::$29 and assignment [111] (byte*~) vblank::$29 ← (const byte*) vblank::$33 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 +Eliminating unused variable (byte*~) vblank::$30 and assignment [113] (byte*~) vblank::$30 ← (const byte*) vblank::$34 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 +Eliminating unused variable (byte*~) vblank::$31 and assignment [115] (byte*~) vblank::$31 ← (const byte*) vblank::$35 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 +Eliminating unused variable (byte*~) vblank::$32 and assignment [118] (byte*~) vblank::$32 ← (const byte*) vblank::$36 + (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 +Eliminating unused constant (const byte) vblank::$14 +Eliminating unused constant (const byte) vblank::$22 Eliminating unused constant (const byte) OFFSET_STRUCT_RICOH_2C02_PPUCTRL +Eliminating unused constant (const byte) OFFSET_STRUCT_SPRITEDATA_Y Successful SSA optimization PassNEliminateUnusedVars Removing unused block main::@return Successful SSA optimization Pass2EliminateUnusedBlocks -Resolving array sizeof() sizeof (const struct ObjectAttribute*) SPRITES Resolving array sizeof() sizeof (const byte*) PALETTE +Resolving array sizeof() sizeof (const struct SpriteData*) SPRITES Successful SSA optimization PassNSizeOfSimplification -Adding number conversion cast (unumber) 4 in +Constant right-side identified [10] (byte~) ppuDataTransfer::ppuDataPrepare1_$0 ← > (const nomodify void*) ppuDataTransfer::ppuData#0 +Constant right-side identified [12] (byte~) ppuDataTransfer::ppuDataPrepare1_$1 ← < (const nomodify void*) ppuDataTransfer::ppuData#0 +Constant right-side identified [83] (byte~) vblank::ppuSpriteBufferDmaTransfer1_$0 ← > (const struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) ppuDataTransfer::ppuDataPrepare1_$0 = >ppuDataTransfer::ppuData#0 +Constant (const byte) ppuDataTransfer::ppuDataPrepare1_$1 = vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0 +Successful SSA optimization Pass2ConstantIdentification +Simplifying constant evaluating to zero <(const nomodify void*) ppuDataTransfer::ppuData#0 in +Successful SSA optimization PassNSimplifyConstantZero Adding number conversion cast (unumber) $20 in +Adding number conversion cast (unumber) 4 in Successful SSA optimization PassNAddNumberTypeConversions -Simplifying constant integer cast 4 Simplifying constant integer cast $20 +Simplifying constant integer cast 4 Successful SSA optimization PassNCastSimplification -Finalized unsigned number type (byte) 4 Finalized unsigned number type (byte) $20 +Finalized unsigned number type (byte) 4 Successful SSA optimization PassNFinalizeNumberTypeConversions +Inlining Noop Cast [28] (byte*~) ppuDataPutTile::$7 ← (byte*)(nomodify void*) ppuDataPutTile::ppuData#2 keeping ppuDataPutTile::ppuData#2 +Successful SSA optimization Pass2NopCastInlining +Inlining Noop Cast [30] (nomodify void*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 ← (void*)(byte*~) ppuDataPutTile::$3 keeping ppuDataPutTile::ppuDataPrepare2_ppuData#0 +Inlining Noop Cast [68] (nomodify void*) ppuDataPutTile::ppuData#0 ← (void*)(byte*~) main::$8 keeping ppuDataPutTile::ppuData#0 +Successful SSA optimization Pass2NopCastInlining +Inlining constant with var siblings (const word) ppuDataFill::i#0 +Inlining constant with different constant siblings (const nomodify void*) ppuDataFill::ppuData#0 +Inlining constant with var siblings (const byte) ppuDataFill::val#0 +Inlining constant with var siblings (const word) ppuDataFill::size#0 +Inlining constant with different constant siblings (const nomodify void*) ppuDataFill::ppuData#1 +Inlining constant with var siblings (const byte) ppuDataFill::val#1 +Inlining constant with var siblings (const word) ppuDataFill::size#1 +Inlining constant with var siblings (const word) ppuDataTransfer::i#0 +Inlining constant with var siblings (const byte*) ppuDataTransfer::cpuSrc#0 +Inlining constant with var siblings (const byte*) ppuDataPutTile::tile#0 +Inlining constant with var siblings (const nomodify void*) ppuDataPutTile::ppuData#1 +Inlining constant with var siblings (const byte*) ppuDataPutTile::tile#1 +Inlining constant with var siblings (const byte) main::initNES1_i#0 +Inlining constant with var siblings (const byte) main::x#0 Inlining constant with var siblings (const byte) main::i#0 -Inlining constant with var siblings (const byte) initSpriteBuffer::i#0 -Inlining constant with var siblings (const byte) initPalette::i#0 -Constant inlined main::disableVideoOutput1_$2 = (byte*)(const struct RICOH_2C02*) PPU -Constant inlined main::disableVideoOutput1_$3 = (byte*)(const struct RICOH_2C02*) PPU -Constant inlined moveLuigiRight::$9 = (byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE +Constant inlined ppuDataPutTile::ppuDataPut4_$1 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined ppuDataTransfer::i#0 = (word) 0 +Constant inlined ppuDataTransfer::ppuDataPrepare1_$1 = (byte) 0 +Constant inlined ppuDataTransfer::ppuDataPrepare1_$0 = >(const nomodify void*) ppuDataTransfer::ppuData#0 +Constant inlined main::$14 = (byte*)(const struct SpriteData*) SPRITES +Constant inlined main::$15 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined main::$10 = (byte) 4*(const byte) SIZEOF_STRUCT_SPRITEDATA +Constant inlined main::initNES1_waitForVBlank2_$3 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined main::$16 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined ppuDataFill::ppuDataPrepare1_$4 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined ppuDataTransfer::ppuDataPrepare1_$5 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined ppuDataFill::ppuDataPrepare1_$5 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined ppuDataTransfer::ppuDataPrepare1_$4 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined ppuDataFill::ppuData#1 = (void*)(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 +Constant inlined ppuDataFill::ppuData#0 = (void*)(const nomodify byte*) PPU_NAME_TABLE_0 +Constant inlined ppuDataTransfer::cpuSrc#0 = (byte*)(const nomodify void*) ppuDataTransfer::cpuData#0 +Constant inlined vblank::$16 = (byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA +Constant inlined vblank::$18 = (byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA +Constant inlined main::initNES1_i#0 = (byte) 0 +Constant inlined ppuDataPutTile::ppuDataPut1_$1 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined ppuDataPutTile::ppuDataPrepare2_$5 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined ppuDataPutTile::ppuDataPrepare2_$4 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined ppuDataFill::i#0 = (word) 0 +Constant inlined vblank::$24 = (byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA +Constant inlined vblank::$26 = (byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA +Constant inlined vblank::$28 = (byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA Constant inlined main::enableVideoOutput1_$3 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined vblank::$20 = (byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA Constant inlined main::enableVideoOutput1_$2 = (byte*)(const struct RICOH_2C02*) PPU -Constant inlined main::waitForVBlank1_$3 = (byte*)(const struct RICOH_2C02*) PPU -Constant inlined vblank::transferSpriteBufferToPpu1_$3 = (byte*)(const struct RICOH_2A03*) APU -Constant inlined initSpriteBuffer::i#0 = (byte) 0 -Constant inlined vblank::transferSpriteBufferToPpu1_$2 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined ppuDataTransfer::ppuDataPut1_$1 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined ppuDataPutTile::ppuDataPut2_$1 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined ppuDataFill::val#1 = (byte) 0 +Constant inlined ppuDataFill::ppuDataPut1_$1 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined ppuDataFill::val#0 = (byte) $fc +Constant inlined ppuDataPutTile::ppuDataPrepare1_$5 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined ppuDataPutTile::ppuDataPrepare1_$4 = (byte*)(const struct RICOH_2C02*) PPU Constant inlined main::i#0 = (byte) 0 -Constant inlined main::disableAudioOutput1_$1 = (byte*)(const struct RICOH_2A03*) APU -Constant inlined vblank::$13 = (byte*)(const struct RICOH_2A03*) APU -Constant inlined vblank::$14 = (byte*)(const struct RICOH_2A03*) APU -Constant inlined moveLuigiLeft::$11 = (byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant inlined initPalette::$5 = (byte*)(const struct RICOH_2C02*) PPU -Constant inlined initPalette::$6 = (byte*)(const struct RICOH_2C02*) PPU -Constant inlined initPalette::$7 = (byte*)(const struct RICOH_2C02*) PPU -Constant inlined initSpriteBuffer::$2 = (byte*)(const struct ObjectAttribute*) SPRITES -Constant inlined vblank::$11 = (byte*)(const struct RICOH_2A03*) APU -Constant inlined vblank::$12 = (byte*)(const struct RICOH_2A03*) APU -Constant inlined initSpriteBuffer::$0 = (byte) 4*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant inlined initPalette::$0 = (byte) $20*(const byte) SIZEOF_BYTE -Constant inlined initPalette::i#0 = (byte) 0 -Constant inlined moveLuigiRight::$7 = (byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant inlined main::waitForVBlank2_$3 = (byte*)(const struct RICOH_2C02*) PPU -Constant inlined moveLuigiLeft::$7 = (byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant inlined moveLuigiRight::$11 = (byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE -Constant inlined moveLuigiLeft::$9 = (byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE +Constant inlined main::initNES1_disableVideoOutput1_$3 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined main::initNES1_disableVideoOutput1_$2 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined main::initNES1_disableAudioOutput1_$1 = (byte*)(const struct RICOH_2A03*) APU +Constant inlined ppuDataPutTile::tile#0 = (const byte*) FLOOR +Constant inlined ppuDataPutTile::tile#1 = (const byte*) FLAG +Constant inlined vblank::$35 = (byte*)(const struct RICOH_2A03*) APU +Constant inlined ppuDataPutTile::ppuDataPut3_$1 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined vblank::$36 = (byte*)(const struct RICOH_2A03*) APU +Constant inlined main::x#0 = (byte) 0 +Constant inlined vblank::$33 = (byte*)(const struct RICOH_2A03*) APU +Constant inlined vblank::$34 = (byte*)(const struct RICOH_2A03*) APU +Constant inlined vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0 = (const nomodify struct SpriteData*) OAM_BUFFER +Constant inlined main::initNES1_waitForVBlank1_$3 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined ppuDataPutTile::ppuData#1 = (void*)(const nomodify byte*) PPU_NAME_TABLE_0+(word)(number) $12*(number) $20+(byte) $1c +Constant inlined vblank::ppuSpriteBufferDmaTransfer1_$0 = >(const nomodify struct SpriteData*) OAM_BUFFER +Constant inlined ppuDataFill::size#1 = (byte) $40 +Constant inlined ppuDataFill::size#0 = (word) $3c0 +Constant inlined vblank::ppuSpriteBufferDmaTransfer1_$3 = (byte*)(const struct RICOH_2C02*) PPU +Constant inlined vblank::ppuSpriteBufferDmaTransfer1_$4 = (byte*)(const struct RICOH_2A03*) APU Successful SSA optimization Pass2ConstantInlining +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA) +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA) +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA) +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA) +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA) +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA) Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK) Consolidated array index constant in *((byte*)APU+OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) +Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK) Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR) Consolidated array index constant in *((byte*)APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA) @@ -761,72 +1415,76 @@ Consolidated array index constant in *((byte*)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) Consolidated array index constant in *((byte*)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) Consolidated array index constant in *((byte*)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) Consolidated array index constant in *((byte*)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) -Consolidated array index constant in *((byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+1*SIZEOF_STRUCT_OBJECTATTRIBUTE) -Consolidated array index constant in *((byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+1*SIZEOF_STRUCT_OBJECTATTRIBUTE) -Consolidated array index constant in *((byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+2*SIZEOF_STRUCT_OBJECTATTRIBUTE) -Consolidated array index constant in *((byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+2*SIZEOF_STRUCT_OBJECTATTRIBUTE) -Consolidated array index constant in *((byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+3*SIZEOF_STRUCT_OBJECTATTRIBUTE) -Consolidated array index constant in *((byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+3*SIZEOF_STRUCT_OBJECTATTRIBUTE) -Consolidated array index constant in *((byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+1*SIZEOF_STRUCT_OBJECTATTRIBUTE) -Consolidated array index constant in *((byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+1*SIZEOF_STRUCT_OBJECTATTRIBUTE) -Consolidated array index constant in *((byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+2*SIZEOF_STRUCT_OBJECTATTRIBUTE) -Consolidated array index constant in *((byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+2*SIZEOF_STRUCT_OBJECTATTRIBUTE) -Consolidated array index constant in *((byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+3*SIZEOF_STRUCT_OBJECTATTRIBUTE) -Consolidated array index constant in *((byte*)OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+3*SIZEOF_STRUCT_OBJECTATTRIBUTE) -Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) -Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) -Consolidated array index constant in *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA) +Consolidated array index constant in *((byte*)OAM_BUFFER+1*SIZEOF_STRUCT_SPRITEDATA) +Consolidated array index constant in *((byte*)OAM_BUFFER+1*SIZEOF_STRUCT_SPRITEDATA) +Consolidated array index constant in *((byte*)OAM_BUFFER+2*SIZEOF_STRUCT_SPRITEDATA) +Consolidated array index constant in *((byte*)OAM_BUFFER+2*SIZEOF_STRUCT_SPRITEDATA) +Consolidated array index constant in *((byte*)OAM_BUFFER+3*SIZEOF_STRUCT_SPRITEDATA) +Consolidated array index constant in *((byte*)OAM_BUFFER+3*SIZEOF_STRUCT_SPRITEDATA) +Consolidated array index constant in *((byte*)OAM_BUFFER+1*SIZEOF_STRUCT_SPRITEDATA) +Consolidated array index constant in *((byte*)OAM_BUFFER+1*SIZEOF_STRUCT_SPRITEDATA) +Consolidated array index constant in *((byte*)OAM_BUFFER+2*SIZEOF_STRUCT_SPRITEDATA) +Consolidated array index constant in *((byte*)OAM_BUFFER+2*SIZEOF_STRUCT_SPRITEDATA) +Consolidated array index constant in *((byte*)OAM_BUFFER+3*SIZEOF_STRUCT_SPRITEDATA) +Consolidated array index constant in *((byte*)OAM_BUFFER+3*SIZEOF_STRUCT_SPRITEDATA) Successful SSA optimization Pass2ConstantAdditionElimination -Added new block during phi lifting main::@7(between main::@1 and main::@1) -Added new block during phi lifting initSpriteBuffer::@2(between initSpriteBuffer::@1 and initSpriteBuffer::@1) +Added new block during phi lifting main::@14(between main::initNES1_@1 and main::initNES1_@1) Adding NOP phi() at start of @begin Adding NOP phi() at start of @1 Adding NOP phi() at start of @2 Adding NOP phi() at start of @end -Adding NOP phi() at start of main::waitForVBlank1 +Adding NOP phi() at start of main +Adding NOP phi() at start of main::initNES1_waitForVBlank1 +Adding NOP phi() at start of main::initNES1_@6 +Adding NOP phi() at start of main::initNES1_waitForVBlank2 +Adding NOP phi() at start of main::@8 +Adding NOP phi() at start of main::@9 +Adding NOP phi() at start of main::@10 +Adding NOP phi() at start of main::@11 Adding NOP phi() at start of main::@3 -Adding NOP phi() at start of main::waitForVBlank2 -Adding NOP phi() at start of main::@4 -Adding NOP phi() at start of main::@5 -Adding NOP phi() at start of main::@6 -Adding NOP phi() at start of main::@2 -Adding NOP phi() at start of initSpriteBuffer +Adding NOP phi() at start of main::@13 +Adding NOP phi() at start of main::@7 +Adding NOP phi() at start of ppuDataFill::@3 +Adding NOP phi() at start of ppuDataFill::@2 +Adding NOP phi() at start of ppuDataTransfer +Adding NOP phi() at start of ppuDataTransfer::@3 Adding NOP phi() at start of vblank -Adding NOP phi() at start of vblank::@2 -Adding NOP phi() at start of vblank::@5 -Adding NOP phi() at start of vblank::@3 -Adding NOP phi() at start of vblank::@6 CALL GRAPH Calls in [] to main:2 -Calls in [main] to initPalette:30 initSpriteBuffer:32 -Calls in [vblank] to moveLuigiRight:62 moveLuigiLeft:67 +Calls in [main] to ppuDataTransfer:32 ppuDataFill:34 ppuDataFill:36 ppuDataPutTile:41 ppuDataPutTile:55 -Created 3 initial phi equivalence classes -Coalesced [37] main::i#3 ← main::i#1 -Coalesced [44] initSpriteBuffer::i#3 ← initSpriteBuffer::i#1 -Coalesced [53] initPalette::i#4 ← initPalette::i#1 -Coalesced down to 3 phi equivalence classes +Created 11 initial phi equivalence classes +Coalesced [52] main::i#4 ← main::i#1 +Coalesced [57] main::x#5 ← main::x#1 +Coalesced [58] main::initNES1_i#3 ← main::initNES1_i#1 +Coalesced [90] ppuDataFill::i#6 ← ppuDataFill::i#1 +Coalesced [102] ppuDataTransfer::i#6 ← ppuDataTransfer::i#1 +Coalesced [103] ppuDataTransfer::cpuSrc#6 ← ppuDataTransfer::cpuSrc#1 +Coalesced down to 11 phi equivalence classes Culled Empty Block (label) @2 -Culled Empty Block (label) main::@3 -Culled Empty Block (label) main::@6 -Culled Empty Block (label) main::@7 -Culled Empty Block (label) initSpriteBuffer::@2 -Culled Empty Block (label) vblank::@5 -Culled Empty Block (label) vblank::@6 -Renumbering block main::@4 to main::@3 -Renumbering block main::@5 to main::@4 +Culled Empty Block (label) main::initNES1_@6 +Culled Empty Block (label) main::@11 +Culled Empty Block (label) main::@13 +Culled Empty Block (label) main::@14 +Culled Empty Block (label) ppuDataFill::@3 +Culled Empty Block (label) ppuDataFill::@2 +Culled Empty Block (label) ppuDataTransfer::@3 +Renumbering block ppuDataFill::@4 to ppuDataFill::@2 +Renumbering block ppuDataTransfer::@4 to ppuDataTransfer::@3 +Renumbering block main::@12 to main::@11 Adding NOP phi() at start of @begin Adding NOP phi() at start of @1 Adding NOP phi() at start of @end -Adding NOP phi() at start of main::waitForVBlank1 -Adding NOP phi() at start of main::waitForVBlank2 +Adding NOP phi() at start of main +Adding NOP phi() at start of main::initNES1_waitForVBlank1 +Adding NOP phi() at start of main::initNES1_waitForVBlank2 +Adding NOP phi() at start of main::@8 +Adding NOP phi() at start of main::@9 +Adding NOP phi() at start of main::@10 Adding NOP phi() at start of main::@3 -Adding NOP phi() at start of main::@4 -Adding NOP phi() at start of main::@2 -Adding NOP phi() at start of initSpriteBuffer +Adding NOP phi() at start of main::@7 +Adding NOP phi() at start of ppuDataTransfer Adding NOP phi() at start of vblank -Adding NOP phi() at start of vblank::@2 -Adding NOP phi() at start of vblank::@3 FINAL CONTROL FLOW GRAPH @begin: scope:[] from @@ -841,152 +1499,237 @@ FINAL CONTROL FLOW GRAPH (void()) main() main: scope:[main] from @1 + [4] phi() + to:main::initNES1 +main::initNES1: scope:[main] from main asm { cld ldx#$ff txs } - to:main::disableVideoOutput1 -main::disableVideoOutput1: scope:[main] from main - [5] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0 - [6] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) 0 - to:main::disableAudioOutput1 -main::disableAudioOutput1: scope:[main] from main::disableVideoOutput1 - [7] *((const nomodify byte*) FR_COUNTER) ← (byte) $40 - [8] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) ← (byte) $40 - to:main::clearVBlankFlag1 -main::clearVBlankFlag1: scope:[main] from main::disableAudioOutput1 + to:main::initNES1_disableVideoOutput1 +main::initNES1_disableVideoOutput1: scope:[main] from main::initNES1 + [6] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0 + [7] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) 0 + to:main::initNES1_disableAudioOutput1 +main::initNES1_disableAudioOutput1: scope:[main] from main::initNES1_disableVideoOutput1 + [8] *((const nomodify byte*) FR_COUNTER) ← (byte) $40 + [9] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) ← (byte) $40 + to:main::initNES1_clearVBlankFlag1 +main::initNES1_clearVBlankFlag1: scope:[main] from main::initNES1_disableAudioOutput1 asm { ldaPPU_PPUSTATUS } - to:main::waitForVBlank1 -main::waitForVBlank1: scope:[main] from main::clearVBlankFlag1 - [10] phi() - to:main::waitForVBlank1_@1 -main::waitForVBlank1_@1: scope:[main] from main::waitForVBlank1 main::waitForVBlank1_@1 - [11] (byte~) main::waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 - [12] if((byte) 0==(byte~) main::waitForVBlank1_$0) goto main::waitForVBlank1_@1 - to:main::@1 -main::@1: scope:[main] from main::@1 main::waitForVBlank1_@1 - [13] (byte) main::i#2 ← phi( main::@1/(byte) main::i#1 main::waitForVBlank1_@1/(byte) 0 ) - [14] *((const nomodify byte*) MEMORY + (byte) main::i#2) ← (byte) 0 - [15] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::i#2) ← (byte) 0 - [16] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::i#2) ← (byte) 0 - [17] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::i#2) ← (byte) 0 - [18] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::i#2) ← (byte) 0 - [19] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::i#2) ← (byte) 0 - [20] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::i#2) ← (byte) 0 - [21] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::i#2) ← (byte) 0 - [22] (byte) main::i#1 ← ++ (byte) main::i#2 - [23] if((byte) 0!=(byte) main::i#1) goto main::@1 - to:main::waitForVBlank2 -main::waitForVBlank2: scope:[main] from main::@1 - [24] phi() - to:main::waitForVBlank2_@1 -main::waitForVBlank2_@1: scope:[main] from main::waitForVBlank2 main::waitForVBlank2_@1 - [25] (byte~) main::waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 - [26] if((byte) 0==(byte~) main::waitForVBlank2_$0) goto main::waitForVBlank2_@1 - to:main::@3 -main::@3: scope:[main] from main::waitForVBlank2_@1 - [27] phi() - [28] call initPalette - to:main::@4 -main::@4: scope:[main] from main::@3 + to:main::initNES1_waitForVBlank1 +main::initNES1_waitForVBlank1: scope:[main] from main::initNES1_clearVBlankFlag1 + [11] phi() + to:main::initNES1_waitForVBlank1_@1 +main::initNES1_waitForVBlank1_@1: scope:[main] from main::initNES1_waitForVBlank1 main::initNES1_waitForVBlank1_@1 + [12] (byte~) main::initNES1_waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 + [13] if((byte) 0==(byte~) main::initNES1_waitForVBlank1_$0) goto main::initNES1_waitForVBlank1_@1 + to:main::initNES1_@1 +main::initNES1_@1: scope:[main] from main::initNES1_@1 main::initNES1_waitForVBlank1_@1 + [14] (byte) main::initNES1_i#2 ← phi( main::initNES1_@1/(byte) main::initNES1_i#1 main::initNES1_waitForVBlank1_@1/(byte) 0 ) + [15] *((const nomodify byte*) MEMORY + (byte) main::initNES1_i#2) ← (byte) 0 + [16] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::initNES1_i#2) ← (byte) 0 + [17] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::initNES1_i#2) ← (byte) 0 + [18] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::initNES1_i#2) ← (byte) 0 + [19] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::initNES1_i#2) ← (byte) 0 + [20] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::initNES1_i#2) ← (byte) 0 + [21] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::initNES1_i#2) ← (byte) 0 + [22] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::initNES1_i#2) ← (byte) 0 + [23] (byte) main::initNES1_i#1 ← ++ (byte) main::initNES1_i#2 + [24] if((byte) 0!=(byte) main::initNES1_i#1) goto main::initNES1_@1 + to:main::initNES1_waitForVBlank2 +main::initNES1_waitForVBlank2: scope:[main] from main::initNES1_@1 + [25] phi() + to:main::initNES1_waitForVBlank2_@1 +main::initNES1_waitForVBlank2_@1: scope:[main] from main::initNES1_waitForVBlank2 main::initNES1_waitForVBlank2_@1 + [26] (byte~) main::initNES1_waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 + [27] if((byte) 0==(byte~) main::initNES1_waitForVBlank2_$0) goto main::initNES1_waitForVBlank2_@1 + to:main::initNES1_@7 +main::initNES1_@7: scope:[main] from main::initNES1_waitForVBlank2_@1 + asm { ldaPPU_PPUSTATUS } + to:main::@8 +main::@8: scope:[main] from main::initNES1_@7 [29] phi() - [30] call initSpriteBuffer - to:main::enableVideoOutput1 -main::enableVideoOutput1: scope:[main] from main::@4 - [31] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80 - [32] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $10 - to:main::@2 -main::@2: scope:[main] from main::@2 main::enableVideoOutput1 + [30] call ppuDataTransfer + to:main::@9 +main::@9: scope:[main] from main::@8 + [31] phi() + [32] call ppuDataFill + to:main::@10 +main::@10: scope:[main] from main::@9 [33] phi() - to:main::@2 + [34] call ppuDataFill + to:main::@1 +main::@1: scope:[main] from main::@10 main::@11 + [35] (byte) main::x#2 ← phi( main::@10/(byte) 0 main::@11/(byte) main::x#1 ) + [36] if((byte) main::x#2<(byte) $20) goto main::@2 + to:main::@3 +main::@3: scope:[main] from main::@1 + [37] phi() + [38] call ppuDataPutTile + to:main::@4 +main::@4: scope:[main] from main::@3 main::@5 + [39] (byte) main::i#2 ← phi( main::@3/(byte) 0 main::@5/(byte) main::i#1 ) + [40] if((byte) main::i#2<(byte) 4*(const byte) SIZEOF_STRUCT_SPRITEDATA) goto main::@5 + to:main::@6 +main::@6: scope:[main] from main::@4 + [41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) 0 + [42] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) -8 + to:main::enableVideoOutput1 +main::enableVideoOutput1: scope:[main] from main::@6 + [43] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80 + [44] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $18 + to:main::@7 +main::@7: scope:[main] from main::@7 main::enableVideoOutput1 + [45] phi() + to:main::@7 +main::@5: scope:[main] from main::@4 + [46] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER + (byte) main::i#2) ← *((byte*)(const struct SpriteData*) SPRITES + (byte) main::i#2) + [47] (byte) main::i#1 ← ++ (byte) main::i#2 + to:main::@4 +main::@2: scope:[main] from main::@1 + [48] (nomodify byte*) ppuDataPutTile::ppuData#0 ← (const nomodify byte*) PPU_NAME_TABLE_0+(word)(number) $14*(number) $20 + (byte) main::x#2 + [49] (nomodify void*) ppuDataPutTile::ppuData#9 ← (void*)(nomodify byte*) ppuDataPutTile::ppuData#0 + [50] call ppuDataPutTile + to:main::@11 +main::@11: scope:[main] from main::@2 + [51] (byte) main::x#1 ← (byte) main::x#2 + (byte) 2 + to:main::@1 -(void()) initSpriteBuffer() -initSpriteBuffer: scope:[initSpriteBuffer] from main::@4 - [34] phi() - to:initSpriteBuffer::@1 -initSpriteBuffer::@1: scope:[initSpriteBuffer] from initSpriteBuffer initSpriteBuffer::@1 - [35] (byte) initSpriteBuffer::i#2 ← phi( initSpriteBuffer/(byte) 0 initSpriteBuffer::@1/(byte) initSpriteBuffer::i#1 ) - [36] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER + (byte) initSpriteBuffer::i#2) ← *((byte*)(const struct ObjectAttribute*) SPRITES + (byte) initSpriteBuffer::i#2) - [37] (byte) initSpriteBuffer::i#1 ← ++ (byte) initSpriteBuffer::i#2 - [38] if((byte) initSpriteBuffer::i#1!=(byte) 4*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) goto initSpriteBuffer::@1 - to:initSpriteBuffer::@return -initSpriteBuffer::@return: scope:[initSpriteBuffer] from initSpriteBuffer::@1 - [39] return +(void()) ppuDataPutTile((nomodify void*) ppuDataPutTile::ppuData , (byte*) ppuDataPutTile::tile) +ppuDataPutTile: scope:[ppuDataPutTile] from main::@2 main::@3 + [52] (byte*) ppuDataPutTile::tile#10 ← phi( main::@2/(const byte*) FLOOR main::@3/(const byte*) FLAG ) + [52] (nomodify void*) ppuDataPutTile::ppuData#2 ← phi( main::@2/(nomodify void*) ppuDataPutTile::ppuData#9 main::@3/(void*)(const nomodify byte*) PPU_NAME_TABLE_0+(word)(number) $12*(number) $20+(byte) $1c ) + to:ppuDataPutTile::ppuDataPrepare1 +ppuDataPutTile::ppuDataPrepare1: scope:[ppuDataPutTile] from ppuDataPutTile + [53] (byte~) ppuDataPutTile::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataPutTile::ppuData#2 + [54] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare1_$0 + [55] (byte~) ppuDataPutTile::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataPutTile::ppuData#2 + [56] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare1_$1 + to:ppuDataPutTile::@1 +ppuDataPutTile::@1: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPrepare1 + [57] (byte) ppuDataPutTile::ppuDataPut1_val#0 ← *((byte*) ppuDataPutTile::tile#10) + to:ppuDataPutTile::ppuDataPut1 +ppuDataPutTile::ppuDataPut1: scope:[ppuDataPutTile] from ppuDataPutTile::@1 + [58] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut1_val#0 + to:ppuDataPutTile::@2 +ppuDataPutTile::@2: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPut1 + [59] (byte) ppuDataPutTile::ppuDataPut2_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 1) + to:ppuDataPutTile::ppuDataPut2 +ppuDataPutTile::ppuDataPut2: scope:[ppuDataPutTile] from ppuDataPutTile::@2 + [60] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut2_val#0 + to:ppuDataPutTile::@3 +ppuDataPutTile::@3: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPut2 + [61] (nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 ← (byte*)(nomodify void*) ppuDataPutTile::ppuData#2 + (byte) $20 + to:ppuDataPutTile::ppuDataPrepare2 +ppuDataPutTile::ppuDataPrepare2: scope:[ppuDataPutTile] from ppuDataPutTile::@3 + [62] (byte~) ppuDataPutTile::ppuDataPrepare2_$0 ← > (void*)(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 + [63] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare2_$0 + [64] (byte~) ppuDataPutTile::ppuDataPrepare2_$1 ← < (void*)(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 + [65] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare2_$1 + to:ppuDataPutTile::@4 +ppuDataPutTile::@4: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPrepare2 + [66] (byte) ppuDataPutTile::ppuDataPut3_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 2) + to:ppuDataPutTile::ppuDataPut3 +ppuDataPutTile::ppuDataPut3: scope:[ppuDataPutTile] from ppuDataPutTile::@4 + [67] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut3_val#0 + to:ppuDataPutTile::@5 +ppuDataPutTile::@5: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPut3 + [68] (byte) ppuDataPutTile::ppuDataPut4_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 3) + to:ppuDataPutTile::ppuDataPut4 +ppuDataPutTile::ppuDataPut4: scope:[ppuDataPutTile] from ppuDataPutTile::@5 + [69] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut4_val#0 + to:ppuDataPutTile::@return +ppuDataPutTile::@return: scope:[ppuDataPutTile] from ppuDataPutTile::ppuDataPut4 + [70] return to:@return -(void()) initPalette() -initPalette: scope:[initPalette] from main::@3 - asm { ldaPPU_PPUSTATUS } - [41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify byte*) PPU_PALETTE - [42] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0 - to:initPalette::@1 -initPalette::@1: scope:[initPalette] from initPalette initPalette::@2 - [43] (byte) initPalette::i#2 ← phi( initPalette/(byte) 0 initPalette::@2/(byte) initPalette::i#1 ) - [44] if((byte) initPalette::i#2<(byte) $20*(const byte) SIZEOF_BYTE) goto initPalette::@2 - to:initPalette::@return -initPalette::@return: scope:[initPalette] from initPalette::@1 - [45] return +(void()) ppuDataFill((nomodify void*) ppuDataFill::ppuData , (byte) ppuDataFill::val , (word) ppuDataFill::size) +ppuDataFill: scope:[ppuDataFill] from main::@10 main::@9 + [71] (byte) ppuDataFill::val#4 ← phi( main::@10/(byte) 0 main::@9/(byte) $fc ) + [71] (word) ppuDataFill::size#3 ← phi( main::@10/(byte) $40 main::@9/(word) $3c0 ) + [71] (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ← phi( main::@10/(void*)(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 main::@9/(void*)(const nomodify byte*) PPU_NAME_TABLE_0 ) + to:ppuDataFill::ppuDataPrepare1 +ppuDataFill::ppuDataPrepare1: scope:[ppuDataFill] from ppuDataFill + [72] (byte~) ppuDataFill::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 + [73] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$0 + [74] (byte~) ppuDataFill::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 + [75] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$1 + to:ppuDataFill::@1 +ppuDataFill::@1: scope:[ppuDataFill] from ppuDataFill::@2 ppuDataFill::ppuDataPrepare1 + [76] (word) ppuDataFill::i#2 ← phi( ppuDataFill::ppuDataPrepare1/(word) 0 ppuDataFill::@2/(word) ppuDataFill::i#1 ) + [77] if((word) ppuDataFill::i#2<(word) ppuDataFill::size#3) goto ppuDataFill::ppuDataPut1 + to:ppuDataFill::@return +ppuDataFill::@return: scope:[ppuDataFill] from ppuDataFill::@1 + [78] return to:@return -initPalette::@2: scope:[initPalette] from initPalette::@1 - [46] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← *((const byte*) PALETTE + (byte) initPalette::i#2) - [47] (byte) initPalette::i#1 ← ++ (byte) initPalette::i#2 - to:initPalette::@1 +ppuDataFill::ppuDataPut1: scope:[ppuDataFill] from ppuDataFill::@1 + [79] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataFill::val#4 + to:ppuDataFill::@2 +ppuDataFill::@2: scope:[ppuDataFill] from ppuDataFill::ppuDataPut1 + [80] (word) ppuDataFill::i#1 ← ++ (word) ppuDataFill::i#2 + to:ppuDataFill::@1 + +(void()) ppuDataTransfer((nomodify void*) ppuDataTransfer::ppuData , (nomodify void*) ppuDataTransfer::cpuData , (word) ppuDataTransfer::size) +ppuDataTransfer: scope:[ppuDataTransfer] from main::@8 + [81] phi() + to:ppuDataTransfer::ppuDataPrepare1 +ppuDataTransfer::ppuDataPrepare1: scope:[ppuDataTransfer] from ppuDataTransfer + [82] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify void*) ppuDataTransfer::ppuData#0 + [83] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0 + to:ppuDataTransfer::@1 +ppuDataTransfer::@1: scope:[ppuDataTransfer] from ppuDataTransfer::@3 ppuDataTransfer::ppuDataPrepare1 + [84] (byte*) ppuDataTransfer::cpuSrc#2 ← phi( ppuDataTransfer::ppuDataPrepare1/(byte*)(const nomodify void*) ppuDataTransfer::cpuData#0 ppuDataTransfer::@3/(byte*) ppuDataTransfer::cpuSrc#1 ) + [84] (word) ppuDataTransfer::i#2 ← phi( ppuDataTransfer::ppuDataPrepare1/(word) 0 ppuDataTransfer::@3/(word) ppuDataTransfer::i#1 ) + [85] if((word) ppuDataTransfer::i#2<(const word) ppuDataTransfer::size#0) goto ppuDataTransfer::@2 + to:ppuDataTransfer::@return +ppuDataTransfer::@return: scope:[ppuDataTransfer] from ppuDataTransfer::@1 + [86] return + to:@return +ppuDataTransfer::@2: scope:[ppuDataTransfer] from ppuDataTransfer::@1 + [87] (byte) ppuDataTransfer::ppuDataPut1_val#0 ← *((byte*) ppuDataTransfer::cpuSrc#2) + to:ppuDataTransfer::ppuDataPut1 +ppuDataTransfer::ppuDataPut1: scope:[ppuDataTransfer] from ppuDataTransfer::@2 + [88] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataTransfer::ppuDataPut1_val#0 + to:ppuDataTransfer::@3 +ppuDataTransfer::@3: scope:[ppuDataTransfer] from ppuDataTransfer::ppuDataPut1 + [89] (byte*) ppuDataTransfer::cpuSrc#1 ← ++ (byte*) ppuDataTransfer::cpuSrc#2 + [90] (word) ppuDataTransfer::i#1 ← ++ (word) ppuDataTransfer::i#2 + to:ppuDataTransfer::@1 interrupt(HARDWARE_STACK)(void()) vblank() vblank: scope:[vblank] from - [48] phi() - to:vblank::transferSpriteBufferToPpu1 -vblank::transferSpriteBufferToPpu1: scope:[vblank] from vblank - [49] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 - [50] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct ObjectAttribute*) OAM_BUFFER + [91] phi() + to:vblank::ppuSpriteBufferDmaTransfer1 +vblank::ppuSpriteBufferDmaTransfer1: scope:[vblank] from vblank + [92] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 + [93] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct SpriteData*) OAM_BUFFER to:vblank::@4 -vblank::@4: scope:[vblank] from vblank::transferSpriteBufferToPpu1 - [51] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1 - [52] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0 - [53] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 - [54] if((byte) 0==(byte~) vblank::$1) goto vblank::@1 +vblank::@4: scope:[vblank] from vblank::ppuSpriteBufferDmaTransfer1 + [94] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1 + [95] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0 + [96] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 + [97] if((byte) 0==(byte~) vblank::$1) goto vblank::@1 to:vblank::@2 vblank::@2: scope:[vblank] from vblank::@4 - [55] phi() - [56] call moveLuigiRight + [98] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) + [99] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) + [100] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) + [101] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) to:vblank::@1 vblank::@1: scope:[vblank] from vblank::@2 vblank::@4 - [57] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 - [58] if((byte) 0==(byte~) vblank::$3) goto vblank::@return + [102] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 + [103] if((byte) 0==(byte~) vblank::$3) goto vblank::@return to:vblank::@3 vblank::@3: scope:[vblank] from vblank::@1 - [59] phi() - [60] call moveLuigiLeft + [104] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) + [105] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) + [106] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) + [107] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) to:vblank::@return vblank::@return: scope:[vblank] from vblank::@1 vblank::@3 - [61] return - to:@return - -(void()) moveLuigiLeft() -moveLuigiLeft: scope:[moveLuigiLeft] from vblank::@3 - [62] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) - [63] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) - [64] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) - [65] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) - to:moveLuigiLeft::@return -moveLuigiLeft::@return: scope:[moveLuigiLeft] from moveLuigiLeft - [66] return - to:@return - -(void()) moveLuigiRight() -moveLuigiRight: scope:[moveLuigiRight] from vblank::@2 - [67] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) - [68] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) - [69] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) - [70] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) - to:moveLuigiRight::@return -moveLuigiRight::@return: scope:[moveLuigiRight] from moveLuigiRight - [71] return + [108] return to:@return VARIABLE REGISTER WEIGHTS -(byte) ObjectAttribute::attributes -(byte) ObjectAttribute::tile -(byte) ObjectAttribute::x -(byte) ObjectAttribute::y (byte) RICOH_2A03::DMC_FREQ (byte) RICOH_2A03::DMC_LEN (byte) RICOH_2A03::DMC_RAW @@ -1019,49 +1762,162 @@ VARIABLE REGISTER WEIGHTS (byte) RICOH_2C02::PPUMASK (byte) RICOH_2C02::PPUSCROLL (volatile byte) RICOH_2C02::PPUSTATUS loadstore -(void()) initPalette() -(byte) initPalette::i -(byte) initPalette::i#1 2002.0 -(byte) initPalette::i#2 1334.6666666666667 -(void()) initSpriteBuffer() -(byte) initSpriteBuffer::i -(byte) initSpriteBuffer::i#1 1501.5 -(byte) initSpriteBuffer::i#2 2002.0 +(byte) SpriteData::attributes +(byte) SpriteData::tile +(byte) SpriteData::x +(byte) SpriteData::y (void()) main() (byte) main::i -(byte) main::i#1 151.5 -(byte) main::i#2 112.22222222222223 -(byte~) main::waitForVBlank1_$0 202.0 -(byte~) main::waitForVBlank2_$0 202.0 -(void()) moveLuigiLeft() -(void()) moveLuigiRight() +(byte) main::i#1 202.0 +(byte) main::i#2 168.33333333333331 +(byte) main::initNES1_i +(byte) main::initNES1_i#1 151.5 +(byte) main::initNES1_i#2 112.22222222222223 +(byte~) main::initNES1_waitForVBlank1_$0 202.0 +(byte~) main::initNES1_waitForVBlank2_$0 202.0 +(byte) main::x +(byte) main::x#1 202.0 +(byte) main::x#2 80.8 +(void()) ppuDataFill((nomodify void*) ppuDataFill::ppuData , (byte) ppuDataFill::val , (word) ppuDataFill::size) +(word) ppuDataFill::i +(word) ppuDataFill::i#1 2002.0 +(word) ppuDataFill::i#2 1001.0 +(nomodify void*) ppuDataFill::ppuData +(byte~) ppuDataFill::ppuDataPrepare1_$0 202.0 +(byte~) ppuDataFill::ppuDataPrepare1_$1 202.0 +(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData +(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 67.33333333333333 +(byte) ppuDataFill::ppuDataPut1_val +(word) ppuDataFill::size +(word) ppuDataFill::size#3 111.22222222222223 +(byte) ppuDataFill::val +(byte) ppuDataFill::val#4 111.22222222222223 +(void()) ppuDataPutTile((nomodify void*) ppuDataPutTile::ppuData , (byte*) ppuDataPutTile::tile) +(nomodify void*) ppuDataPutTile::ppuData +(nomodify byte*) ppuDataPutTile::ppuData#0 101.0 +(nomodify void*) ppuDataPutTile::ppuData#2 233.66666666666669 +(nomodify void*) ppuDataPutTile::ppuData#9 202.0 +(byte~) ppuDataPutTile::ppuDataPrepare1_$0 2002.0 +(byte~) ppuDataPutTile::ppuDataPrepare1_$1 2002.0 +(nomodify void*) ppuDataPutTile::ppuDataPrepare1_ppuData +(byte~) ppuDataPutTile::ppuDataPrepare2_$0 2002.0 +(byte~) ppuDataPutTile::ppuDataPrepare2_$1 2002.0 +(nomodify void*) ppuDataPutTile::ppuDataPrepare2_ppuData +(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 333.6666666666667 +(byte) ppuDataPutTile::ppuDataPut1_val +(byte) ppuDataPutTile::ppuDataPut1_val#0 2002.0 +(byte) ppuDataPutTile::ppuDataPut2_val +(byte) ppuDataPutTile::ppuDataPut2_val#0 2002.0 +(byte) ppuDataPutTile::ppuDataPut3_val +(byte) ppuDataPutTile::ppuDataPut3_val#0 2002.0 +(byte) ppuDataPutTile::ppuDataPut4_val +(byte) ppuDataPutTile::ppuDataPut4_val#0 2002.0 +(byte*) ppuDataPutTile::tile +(byte*) ppuDataPutTile::tile#10 250.25 +(void()) ppuDataTransfer((nomodify void*) ppuDataTransfer::ppuData , (nomodify void*) ppuDataTransfer::cpuData , (word) ppuDataTransfer::size) +(nomodify void*) ppuDataTransfer::cpuData +(byte*) ppuDataTransfer::cpuSrc +(byte*) ppuDataTransfer::cpuSrc#1 1001.0 +(byte*) ppuDataTransfer::cpuSrc#2 750.75 +(word) ppuDataTransfer::i +(word) ppuDataTransfer::i#1 2002.0 +(word) ppuDataTransfer::i#2 600.5999999999999 +(nomodify void*) ppuDataTransfer::ppuData +(nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData +(byte) ppuDataTransfer::ppuDataPut1_val +(byte) ppuDataTransfer::ppuDataPut1_val#0 2002.0 +(word) ppuDataTransfer::size interrupt(HARDWARE_STACK)(void()) vblank() (byte~) vblank::$1 4.0 (byte~) vblank::$3 4.0 +(struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer Initial phi equivalence classes +[ main::initNES1_i#2 main::initNES1_i#1 ] +[ main::x#2 main::x#1 ] [ main::i#2 main::i#1 ] -[ initSpriteBuffer::i#2 initSpriteBuffer::i#1 ] -[ initPalette::i#2 initPalette::i#1 ] -Added variable main::waitForVBlank1_$0 to live range equivalence class [ main::waitForVBlank1_$0 ] -Added variable main::waitForVBlank2_$0 to live range equivalence class [ main::waitForVBlank2_$0 ] +[ ppuDataPutTile::ppuData#2 ppuDataPutTile::ppuData#9 ] +[ ppuDataPutTile::tile#10 ] +[ ppuDataFill::ppuDataPrepare1_ppuData#0 ] +[ ppuDataFill::size#3 ] +[ ppuDataFill::val#4 ] +[ ppuDataFill::i#2 ppuDataFill::i#1 ] +[ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] +[ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ] +Added variable main::initNES1_waitForVBlank1_$0 to live range equivalence class [ main::initNES1_waitForVBlank1_$0 ] +Added variable main::initNES1_waitForVBlank2_$0 to live range equivalence class [ main::initNES1_waitForVBlank2_$0 ] +Added variable ppuDataPutTile::ppuData#0 to live range equivalence class [ ppuDataPutTile::ppuData#0 ] +Added variable ppuDataPutTile::ppuDataPrepare1_$0 to live range equivalence class [ ppuDataPutTile::ppuDataPrepare1_$0 ] +Added variable ppuDataPutTile::ppuDataPrepare1_$1 to live range equivalence class [ ppuDataPutTile::ppuDataPrepare1_$1 ] +Added variable ppuDataPutTile::ppuDataPut1_val#0 to live range equivalence class [ ppuDataPutTile::ppuDataPut1_val#0 ] +Added variable ppuDataPutTile::ppuDataPut2_val#0 to live range equivalence class [ ppuDataPutTile::ppuDataPut2_val#0 ] +Added variable ppuDataPutTile::ppuDataPrepare2_ppuData#0 to live range equivalence class [ ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] +Added variable ppuDataPutTile::ppuDataPrepare2_$0 to live range equivalence class [ ppuDataPutTile::ppuDataPrepare2_$0 ] +Added variable ppuDataPutTile::ppuDataPrepare2_$1 to live range equivalence class [ ppuDataPutTile::ppuDataPrepare2_$1 ] +Added variable ppuDataPutTile::ppuDataPut3_val#0 to live range equivalence class [ ppuDataPutTile::ppuDataPut3_val#0 ] +Added variable ppuDataPutTile::ppuDataPut4_val#0 to live range equivalence class [ ppuDataPutTile::ppuDataPut4_val#0 ] +Added variable ppuDataFill::ppuDataPrepare1_$0 to live range equivalence class [ ppuDataFill::ppuDataPrepare1_$0 ] +Added variable ppuDataFill::ppuDataPrepare1_$1 to live range equivalence class [ ppuDataFill::ppuDataPrepare1_$1 ] +Added variable ppuDataTransfer::ppuDataPut1_val#0 to live range equivalence class [ ppuDataTransfer::ppuDataPut1_val#0 ] Added variable vblank::$1 to live range equivalence class [ vblank::$1 ] Added variable vblank::$3 to live range equivalence class [ vblank::$3 ] Complete equivalence classes +[ main::initNES1_i#2 main::initNES1_i#1 ] +[ main::x#2 main::x#1 ] [ main::i#2 main::i#1 ] -[ initSpriteBuffer::i#2 initSpriteBuffer::i#1 ] -[ initPalette::i#2 initPalette::i#1 ] -[ main::waitForVBlank1_$0 ] -[ main::waitForVBlank2_$0 ] +[ ppuDataPutTile::ppuData#2 ppuDataPutTile::ppuData#9 ] +[ ppuDataPutTile::tile#10 ] +[ ppuDataFill::ppuDataPrepare1_ppuData#0 ] +[ ppuDataFill::size#3 ] +[ ppuDataFill::val#4 ] +[ ppuDataFill::i#2 ppuDataFill::i#1 ] +[ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] +[ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ] +[ main::initNES1_waitForVBlank1_$0 ] +[ main::initNES1_waitForVBlank2_$0 ] +[ ppuDataPutTile::ppuData#0 ] +[ ppuDataPutTile::ppuDataPrepare1_$0 ] +[ ppuDataPutTile::ppuDataPrepare1_$1 ] +[ ppuDataPutTile::ppuDataPut1_val#0 ] +[ ppuDataPutTile::ppuDataPut2_val#0 ] +[ ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] +[ ppuDataPutTile::ppuDataPrepare2_$0 ] +[ ppuDataPutTile::ppuDataPrepare2_$1 ] +[ ppuDataPutTile::ppuDataPut3_val#0 ] +[ ppuDataPutTile::ppuDataPut4_val#0 ] +[ ppuDataFill::ppuDataPrepare1_$0 ] +[ ppuDataFill::ppuDataPrepare1_$1 ] +[ ppuDataTransfer::ppuDataPut1_val#0 ] [ vblank::$1 ] [ vblank::$3 ] -Allocated zp[1]:2 [ main::i#2 main::i#1 ] -Allocated zp[1]:3 [ initSpriteBuffer::i#2 initSpriteBuffer::i#1 ] -Allocated zp[1]:4 [ initPalette::i#2 initPalette::i#1 ] -Allocated zp[1]:5 [ main::waitForVBlank1_$0 ] -Allocated zp[1]:6 [ main::waitForVBlank2_$0 ] -Allocated zp[1]:7 [ vblank::$1 ] -Allocated zp[1]:8 [ vblank::$3 ] +Allocated zp[1]:2 [ main::initNES1_i#2 main::initNES1_i#1 ] +Allocated zp[1]:3 [ main::x#2 main::x#1 ] +Allocated zp[1]:4 [ main::i#2 main::i#1 ] +Allocated zp[2]:5 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::ppuData#9 ] +Allocated zp[2]:7 [ ppuDataPutTile::tile#10 ] +Allocated zp[2]:9 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ] +Allocated zp[2]:11 [ ppuDataFill::size#3 ] +Allocated zp[1]:13 [ ppuDataFill::val#4 ] +Allocated zp[2]:14 [ ppuDataFill::i#2 ppuDataFill::i#1 ] +Allocated zp[2]:16 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] +Allocated zp[2]:18 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ] +Allocated zp[1]:20 [ main::initNES1_waitForVBlank1_$0 ] +Allocated zp[1]:21 [ main::initNES1_waitForVBlank2_$0 ] +Allocated zp[2]:22 [ ppuDataPutTile::ppuData#0 ] +Allocated zp[1]:24 [ ppuDataPutTile::ppuDataPrepare1_$0 ] +Allocated zp[1]:25 [ ppuDataPutTile::ppuDataPrepare1_$1 ] +Allocated zp[1]:26 [ ppuDataPutTile::ppuDataPut1_val#0 ] +Allocated zp[1]:27 [ ppuDataPutTile::ppuDataPut2_val#0 ] +Allocated zp[2]:28 [ ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] +Allocated zp[1]:30 [ ppuDataPutTile::ppuDataPrepare2_$0 ] +Allocated zp[1]:31 [ ppuDataPutTile::ppuDataPrepare2_$1 ] +Allocated zp[1]:32 [ ppuDataPutTile::ppuDataPut3_val#0 ] +Allocated zp[1]:33 [ ppuDataPutTile::ppuDataPut4_val#0 ] +Allocated zp[1]:34 [ ppuDataFill::ppuDataPrepare1_$0 ] +Allocated zp[1]:35 [ ppuDataFill::ppuDataPrepare1_$1 ] +Allocated zp[1]:36 [ ppuDataTransfer::ppuDataPut1_val#0 ] +Allocated zp[1]:37 [ vblank::$1 ] +Allocated zp[1]:38 [ vblank::$3 ] INITIAL ASM Target platform is nes / MOS6502 @@ -1098,19 +1954,23 @@ Target platform is nes / MOS6502 .segment Code // Global Constants & labels - .const SIZEOF_STRUCT_OBJECTATTRIBUTE = 4 + .const SIZEOF_STRUCT_SPRITEDATA = 4 .const OFFSET_STRUCT_RICOH_2A03_DMC_FREQ = $10 .const OFFSET_STRUCT_RICOH_2C02_PPUMASK = 1 .const OFFSET_STRUCT_RICOH_2C02_PPUSTATUS = 2 - .const OFFSET_STRUCT_RICOH_2A03_JOY1 = $16 - .const OFFSET_STRUCT_OBJECTATTRIBUTE_X = 3 .const OFFSET_STRUCT_RICOH_2C02_OAMADDR = 3 .const OFFSET_STRUCT_RICOH_2A03_OAMDMA = $14 .const OFFSET_STRUCT_RICOH_2C02_PPUADDR = 6 .const OFFSET_STRUCT_RICOH_2C02_PPUDATA = 7 + .const OFFSET_STRUCT_RICOH_2C02_PPUSCROLL = 5 + .const OFFSET_STRUCT_RICOH_2A03_JOY1 = $16 .const SIZEOF_BYTE = 1 - // $3000-$3EFF $0F00 Mirrors of $2000-$2EFF - // $3F00-$3F1F $0020 Palette RAM indexes + // $2000-$23bf $03c0 Name table 0 + .label PPU_NAME_TABLE_0 = $2000 + // $23c0-$23ff $0040 Attribute table 0 + .label PPU_ATTRIBUTE_TABLE_0 = $23c0 + // $3000-$3eff $0f00 Mirrors of $2000-$2eff + // $3f00-$3f1f $0020 Palette RAM indexes .label PPU_PALETTE = $3f00 // APU Frame Counter // generates low-frequency clocks for the channels and an optional 60 Hz interrupt. @@ -1126,8 +1986,8 @@ Target platform is nes / MOS6502 .label FR_COUNTER = $4017 // Pointer to the start of RAM memory .label MEMORY = 0 - // OAM (Object Attribute Memory) Buffer - // Will be transfered to the PPU via DMA + // Sprite OAM Buffer + // Will be transfered to the PPU via DMA during vblank .label OAM_BUFFER = $200 // PPU Status Register for reading in ASM .label PPU_PPUSTATUS = $2002 @@ -1143,6 +2003,8 @@ __b1_from___bbegin: // @1 __b1: // [2] call main + // [4] phi from @1 to main [phi:@1->main] +main_from___b1: jsr main // [3] phi from @1 to @end [phi:@1->@end] __bend_from___b1: @@ -1153,346 +2015,675 @@ __bend: // main // RESET Called when the NES is reset, including when it is turned on. main: { - .label waitForVBlank1___0 = 5 - .label waitForVBlank2___0 = 6 - // Clear RAM - since it has all variables and the stack it is necesary to do it inline - .label i = 2 + .label initNES1_waitForVBlank1___0 = $14 + .label initNES1_waitForVBlank2___0 = $15 + .label initNES1_i = 2 + .label x = 3 + .label i = 4 + jmp initNES1 + // main::initNES1 + initNES1: // asm { cld ldx#$ff txs } - // Initialize decimal-mode and stack cld ldx #$ff txs - jmp disableVideoOutput1 - // main::disableVideoOutput1 - disableVideoOutput1: - // [5] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0 -- _deref_pbuc1=vbuc2 + jmp initNES1_disableVideoOutput1 + // main::initNES1_disableVideoOutput1 + initNES1_disableVideoOutput1: + // [6] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta PPU - // [6] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // [7] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK - jmp disableAudioOutput1 - // main::disableAudioOutput1 - disableAudioOutput1: - // [7] *((const nomodify byte*) FR_COUNTER) ← (byte) $40 -- _deref_pbuc1=vbuc2 + jmp initNES1_disableAudioOutput1 + // main::initNES1_disableAudioOutput1 + initNES1_disableAudioOutput1: + // [8] *((const nomodify byte*) FR_COUNTER) ← (byte) $40 -- _deref_pbuc1=vbuc2 lda #$40 sta FR_COUNTER - // [8] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) ← (byte) $40 -- _deref_pbuc1=vbuc2 + // [9] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) ← (byte) $40 -- _deref_pbuc1=vbuc2 lda #$40 sta APU+OFFSET_STRUCT_RICOH_2A03_DMC_FREQ - jmp clearVBlankFlag1 - // main::clearVBlankFlag1 - clearVBlankFlag1: + jmp initNES1_clearVBlankFlag1 + // main::initNES1_clearVBlankFlag1 + initNES1_clearVBlankFlag1: // asm { ldaPPU_PPUSTATUS } lda PPU_PPUSTATUS - // [10] phi from main::clearVBlankFlag1 to main::waitForVBlank1 [phi:main::clearVBlankFlag1->main::waitForVBlank1] - waitForVBlank1_from_clearVBlankFlag1: - jmp waitForVBlank1 - // main::waitForVBlank1 - waitForVBlank1: - jmp waitForVBlank1___b1 - // main::waitForVBlank1_@1 - waitForVBlank1___b1: - // [11] (byte~) main::waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 -- vbuz1=_deref_pbuc1_band_vbuc2 + // [11] phi from main::initNES1_clearVBlankFlag1 to main::initNES1_waitForVBlank1 [phi:main::initNES1_clearVBlankFlag1->main::initNES1_waitForVBlank1] + initNES1_waitForVBlank1_from_initNES1_clearVBlankFlag1: + jmp initNES1_waitForVBlank1 + // main::initNES1_waitForVBlank1 + initNES1_waitForVBlank1: + jmp initNES1_waitForVBlank1___b1 + // main::initNES1_waitForVBlank1_@1 + initNES1_waitForVBlank1___b1: + // [12] (byte~) main::initNES1_waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 -- vbuz1=_deref_pbuc1_band_vbuc2 lda #$80 and PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS - sta.z waitForVBlank1___0 - // [12] if((byte) 0==(byte~) main::waitForVBlank1_$0) goto main::waitForVBlank1_@1 -- vbuc1_eq_vbuz1_then_la1 + sta.z initNES1_waitForVBlank1___0 + // [13] if((byte) 0==(byte~) main::initNES1_waitForVBlank1_$0) goto main::initNES1_waitForVBlank1_@1 -- vbuc1_eq_vbuz1_then_la1 lda #0 - cmp.z waitForVBlank1___0 - beq waitForVBlank1___b1 - // [13] phi from main::waitForVBlank1_@1 to main::@1 [phi:main::waitForVBlank1_@1->main::@1] - __b1_from_waitForVBlank1___b1: - // [13] phi (byte) main::i#2 = (byte) 0 [phi:main::waitForVBlank1_@1->main::@1#0] -- vbuz1=vbuc1 + cmp.z initNES1_waitForVBlank1___0 + beq initNES1_waitForVBlank1___b1 + // [14] phi from main::initNES1_waitForVBlank1_@1 to main::initNES1_@1 [phi:main::initNES1_waitForVBlank1_@1->main::initNES1_@1] + initNES1___b1_from_initNES1_waitForVBlank1___b1: + // [14] phi (byte) main::initNES1_i#2 = (byte) 0 [phi:main::initNES1_waitForVBlank1_@1->main::initNES1_@1#0] -- vbuz1=vbuc1 lda #0 - sta.z i - jmp __b1 - // [13] phi from main::@1 to main::@1 [phi:main::@1->main::@1] - __b1_from___b1: - // [13] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy + sta.z initNES1_i + jmp initNES1___b1 + // [14] phi from main::initNES1_@1 to main::initNES1_@1 [phi:main::initNES1_@1->main::initNES1_@1] + initNES1___b1_from_initNES1___b1: + // [14] phi (byte) main::initNES1_i#2 = (byte) main::initNES1_i#1 [phi:main::initNES1_@1->main::initNES1_@1#0] -- register_copy + jmp initNES1___b1 + // main::initNES1_@1 + initNES1___b1: + // [15] *((const nomodify byte*) MEMORY + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #0 + ldy.z initNES1_i + sta MEMORY,y + // [16] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #0 + ldy.z initNES1_i + sta MEMORY+$100,y + // [17] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #0 + ldy.z initNES1_i + sta MEMORY+$200,y + // [18] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #0 + ldy.z initNES1_i + sta MEMORY+$300,y + // [19] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #0 + ldy.z initNES1_i + sta MEMORY+$400,y + // [20] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #0 + ldy.z initNES1_i + sta MEMORY+$500,y + // [21] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #0 + ldy.z initNES1_i + sta MEMORY+$600,y + // [22] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #0 + ldy.z initNES1_i + sta MEMORY+$700,y + // [23] (byte) main::initNES1_i#1 ← ++ (byte) main::initNES1_i#2 -- vbuz1=_inc_vbuz1 + inc.z initNES1_i + // [24] if((byte) 0!=(byte) main::initNES1_i#1) goto main::initNES1_@1 -- vbuc1_neq_vbuz1_then_la1 + lda #0 + cmp.z initNES1_i + bne initNES1___b1_from_initNES1___b1 + // [25] phi from main::initNES1_@1 to main::initNES1_waitForVBlank2 [phi:main::initNES1_@1->main::initNES1_waitForVBlank2] + initNES1_waitForVBlank2_from_initNES1___b1: + jmp initNES1_waitForVBlank2 + // main::initNES1_waitForVBlank2 + initNES1_waitForVBlank2: + jmp initNES1_waitForVBlank2___b1 + // main::initNES1_waitForVBlank2_@1 + initNES1_waitForVBlank2___b1: + // [26] (byte~) main::initNES1_waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 -- vbuz1=_deref_pbuc1_band_vbuc2 + lda #$80 + and PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS + sta.z initNES1_waitForVBlank2___0 + // [27] if((byte) 0==(byte~) main::initNES1_waitForVBlank2_$0) goto main::initNES1_waitForVBlank2_@1 -- vbuc1_eq_vbuz1_then_la1 + lda #0 + cmp.z initNES1_waitForVBlank2___0 + beq initNES1_waitForVBlank2___b1 + jmp initNES1___b7 + // main::initNES1_@7 + initNES1___b7: + // asm { ldaPPU_PPUSTATUS } + lda PPU_PPUSTATUS + // [29] phi from main::initNES1_@7 to main::@8 [phi:main::initNES1_@7->main::@8] + __b8_from_initNES1___b7: + jmp __b8 + // main::@8 + __b8: + // [30] call ppuDataTransfer + // Transfer the palette + // [81] phi from main::@8 to ppuDataTransfer [phi:main::@8->ppuDataTransfer] + ppuDataTransfer_from___b8: + jsr ppuDataTransfer + // [31] phi from main::@8 to main::@9 [phi:main::@8->main::@9] + __b9_from___b8: + jmp __b9 + // main::@9 + __b9: + // [32] call ppuDataFill + // Clear the name table + // [71] phi from main::@9 to ppuDataFill [phi:main::@9->ppuDataFill] + ppuDataFill_from___b9: + // [71] phi (byte) ppuDataFill::val#4 = (byte) $fc [phi:main::@9->ppuDataFill#0] -- vbuz1=vbuc1 + lda #$fc + sta.z ppuDataFill.val + // [71] phi (word) ppuDataFill::size#3 = (word) $3c0 [phi:main::@9->ppuDataFill#1] -- vwuz1=vwuc1 + lda #<$3c0 + sta.z ppuDataFill.size + lda #>$3c0 + sta.z ppuDataFill.size+1 + // [71] phi (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 = (void*)(const nomodify byte*) PPU_NAME_TABLE_0 [phi:main::@9->ppuDataFill#2] -- pvoz1=pvoc1 + lda #PPU_NAME_TABLE_0 + sta.z ppuDataFill.ppuDataPrepare1_ppuData+1 + jsr ppuDataFill + // [33] phi from main::@9 to main::@10 [phi:main::@9->main::@10] + __b10_from___b9: + jmp __b10 + // main::@10 + __b10: + // [34] call ppuDataFill + // Fill the PPU attribute table + // [71] phi from main::@10 to ppuDataFill [phi:main::@10->ppuDataFill] + ppuDataFill_from___b10: + // [71] phi (byte) ppuDataFill::val#4 = (byte) 0 [phi:main::@10->ppuDataFill#0] -- vbuz1=vbuc1 + lda #0 + sta.z ppuDataFill.val + // [71] phi (word) ppuDataFill::size#3 = (byte) $40 [phi:main::@10->ppuDataFill#1] -- vwuz1=vbuc1 + lda #<$40 + sta.z ppuDataFill.size + lda #>$40 + sta.z ppuDataFill.size+1 + // [71] phi (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 = (void*)(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 [phi:main::@10->ppuDataFill#2] -- pvoz1=pvoc1 + lda #PPU_ATTRIBUTE_TABLE_0 + sta.z ppuDataFill.ppuDataPrepare1_ppuData+1 + jsr ppuDataFill + // [35] phi from main::@10 to main::@1 [phi:main::@10->main::@1] + __b1_from___b10: + // [35] phi (byte) main::x#2 = (byte) 0 [phi:main::@10->main::@1#0] -- vbuz1=vbuc1 + lda #0 + sta.z x jmp __b1 + // Show the entire tile set + //char ch=0; + //for(char y=0;y!=16;y++) { + // ppuDataPrepare(PPU_NAME_TABLE_0+32*4+4+(unsigned int)y*32); + // for(char x=0;x!=16;x++) + // ppuDataPut(ch++); + //} + // Show floor // main::@1 __b1: - // [14] *((const nomodify byte*) MEMORY + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 - lda #0 - ldy.z i - sta MEMORY,y - // [15] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 - lda #0 - ldy.z i - sta MEMORY+$100,y - // [16] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 - lda #0 - ldy.z i - sta MEMORY+$200,y - // [17] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 - lda #0 - ldy.z i - sta MEMORY+$300,y - // [18] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 - lda #0 - ldy.z i - sta MEMORY+$400,y - // [19] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 - lda #0 - ldy.z i - sta MEMORY+$500,y - // [20] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 - lda #0 - ldy.z i - sta MEMORY+$600,y - // [21] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuz1=vbuc2 - lda #0 - ldy.z i - sta MEMORY+$700,y - // [22] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 - inc.z i - // [23] if((byte) 0!=(byte) main::i#1) goto main::@1 -- vbuc1_neq_vbuz1_then_la1 - lda #0 - cmp.z i - bne __b1_from___b1 - // [24] phi from main::@1 to main::waitForVBlank2 [phi:main::@1->main::waitForVBlank2] - waitForVBlank2_from___b1: - jmp waitForVBlank2 - // main::waitForVBlank2 - waitForVBlank2: - jmp waitForVBlank2___b1 - // main::waitForVBlank2_@1 - waitForVBlank2___b1: - // [25] (byte~) main::waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 -- vbuz1=_deref_pbuc1_band_vbuc2 - lda #$80 - and PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS - sta.z waitForVBlank2___0 - // [26] if((byte) 0==(byte~) main::waitForVBlank2_$0) goto main::waitForVBlank2_@1 -- vbuc1_eq_vbuz1_then_la1 - lda #0 - cmp.z waitForVBlank2___0 - beq waitForVBlank2___b1 - // [27] phi from main::waitForVBlank2_@1 to main::@3 [phi:main::waitForVBlank2_@1->main::@3] - __b3_from_waitForVBlank2___b1: + // [36] if((byte) main::x#2<(byte) $20) goto main::@2 -- vbuz1_lt_vbuc1_then_la1 + lda.z x + cmp #$20 + bcc __b2 + // [37] phi from main::@1 to main::@3 [phi:main::@1->main::@3] + __b3_from___b1: jmp __b3 // main::@3 __b3: - // [28] call initPalette - // Now the PPU is ready. - jsr initPalette - // [29] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + // [38] call ppuDataPutTile + // Show flag + // [52] phi from main::@3 to ppuDataPutTile [phi:main::@3->ppuDataPutTile] + ppuDataPutTile_from___b3: + // [52] phi (byte*) ppuDataPutTile::tile#10 = (const byte*) FLAG [phi:main::@3->ppuDataPutTile#0] -- pbuz1=pbuc1 + lda #FLAG + sta.z ppuDataPutTile.tile+1 + // [52] phi (nomodify void*) ppuDataPutTile::ppuData#2 = (void*)(const nomodify byte*) PPU_NAME_TABLE_0+(word)(number) $12*(number) $20+(byte) $1c [phi:main::@3->ppuDataPutTile#1] -- pvoz1=pvoc1 + lda #PPU_NAME_TABLE_0+$12*$20+$1c + sta.z ppuDataPutTile.ppuData_1+1 + jsr ppuDataPutTile + // [39] phi from main::@3 to main::@4 [phi:main::@3->main::@4] __b4_from___b3: + // [39] phi (byte) main::i#2 = (byte) 0 [phi:main::@3->main::@4#0] -- vbuz1=vbuc1 + lda #0 + sta.z i jmp __b4 + // Initialize Sprite OAM Buffer with the SPRITE data // main::@4 __b4: - // [30] call initSpriteBuffer - // [34] phi from main::@4 to initSpriteBuffer [phi:main::@4->initSpriteBuffer] - initSpriteBuffer_from___b4: - jsr initSpriteBuffer + // [40] if((byte) main::i#2<(byte) 4*(const byte) SIZEOF_STRUCT_SPRITEDATA) goto main::@5 -- vbuz1_lt_vbuc1_then_la1 + lda.z i + cmp #4*SIZEOF_STRUCT_SPRITEDATA + bcc __b5 + jmp __b6 + // main::@6 + __b6: + // [41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // Set initial scroll + lda #0 + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL + // [42] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) -8 -- _deref_pbuc1=vbuc2 + lda #-8 + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL jmp enableVideoOutput1 // main::enableVideoOutput1 enableVideoOutput1: - // [31] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80 -- _deref_pbuc1=vbuc2 + // [43] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80 -- _deref_pbuc1=vbuc2 lda #$80 sta PPU - // [32] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $10 -- _deref_pbuc1=vbuc2 - lda #$10 + // [44] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $18 -- _deref_pbuc1=vbuc2 + lda #$18 sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK - // [33] phi from main::@2 main::enableVideoOutput1 to main::@2 [phi:main::@2/main::enableVideoOutput1->main::@2] - __b2_from___b2: - __b2_from_enableVideoOutput1: - jmp __b2 + // [45] phi from main::@7 main::enableVideoOutput1 to main::@7 [phi:main::@7/main::enableVideoOutput1->main::@7] + __b7_from___b7: + __b7_from_enableVideoOutput1: + jmp __b7 // Infinite loop - // main::@2 - __b2: - jmp __b2_from___b2 -} - // initSpriteBuffer -// Initialize OAM (Object Attribute Memory) Buffer with the SPRITE data -initSpriteBuffer: { - .label i = 3 - // [35] phi from initSpriteBuffer to initSpriteBuffer::@1 [phi:initSpriteBuffer->initSpriteBuffer::@1] - __b1_from_initSpriteBuffer: - // [35] phi (byte) initSpriteBuffer::i#2 = (byte) 0 [phi:initSpriteBuffer->initSpriteBuffer::@1#0] -- vbuz1=vbuc1 - lda #0 - sta.z i - jmp __b1 - // [35] phi from initSpriteBuffer::@1 to initSpriteBuffer::@1 [phi:initSpriteBuffer::@1->initSpriteBuffer::@1] - __b1_from___b1: - // [35] phi (byte) initSpriteBuffer::i#2 = (byte) initSpriteBuffer::i#1 [phi:initSpriteBuffer::@1->initSpriteBuffer::@1#0] -- register_copy - jmp __b1 - // initSpriteBuffer::@1 - __b1: - // [36] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER + (byte) initSpriteBuffer::i#2) ← *((byte*)(const struct ObjectAttribute*) SPRITES + (byte) initSpriteBuffer::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1 + // main::@7 + __b7: + jmp __b7_from___b7 + // main::@5 + __b5: + // [46] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER + (byte) main::i#2) ← *((byte*)(const struct SpriteData*) SPRITES + (byte) main::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1 ldy.z i lda SPRITES,y sta OAM_BUFFER,y - // [37] (byte) initSpriteBuffer::i#1 ← ++ (byte) initSpriteBuffer::i#2 -- vbuz1=_inc_vbuz1 + // [47] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 inc.z i - // [38] if((byte) initSpriteBuffer::i#1!=(byte) 4*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) goto initSpriteBuffer::@1 -- vbuz1_neq_vbuc1_then_la1 - lda #4*SIZEOF_STRUCT_OBJECTATTRIBUTE - cmp.z i - bne __b1_from___b1 + // [39] phi from main::@5 to main::@4 [phi:main::@5->main::@4] + __b4_from___b5: + // [39] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@5->main::@4#0] -- register_copy + jmp __b4 + // main::@2 + __b2: + // [48] (nomodify byte*) ppuDataPutTile::ppuData#0 ← (const nomodify byte*) PPU_NAME_TABLE_0+(word)(number) $14*(number) $20 + (byte) main::x#2 -- pbuz1=pbuc1_plus_vbuz2 + lda.z x + clc + adc #PPU_NAME_TABLE_0+$14*$20 + adc #0 + sta.z ppuDataPutTile.ppuData+1 + // [49] (nomodify void*) ppuDataPutTile::ppuData#9 ← (void*)(nomodify byte*) ppuDataPutTile::ppuData#0 -- pvoz1=pvoz2 + lda.z ppuDataPutTile.ppuData + sta.z ppuDataPutTile.ppuData_1 + lda.z ppuDataPutTile.ppuData+1 + sta.z ppuDataPutTile.ppuData_1+1 + // [50] call ppuDataPutTile + // [52] phi from main::@2 to ppuDataPutTile [phi:main::@2->ppuDataPutTile] + ppuDataPutTile_from___b2: + // [52] phi (byte*) ppuDataPutTile::tile#10 = (const byte*) FLOOR [phi:main::@2->ppuDataPutTile#0] -- pbuz1=pbuc1 + lda #FLOOR + sta.z ppuDataPutTile.tile+1 + // [52] phi (nomodify void*) ppuDataPutTile::ppuData#2 = (nomodify void*) ppuDataPutTile::ppuData#9 [phi:main::@2->ppuDataPutTile#1] -- register_copy + jsr ppuDataPutTile + jmp __b11 + // main::@11 + __b11: + // [51] (byte) main::x#1 ← (byte) main::x#2 + (byte) 2 -- vbuz1=vbuz1_plus_2 + lda.z x + clc + adc #2 + sta.z x + // [35] phi from main::@11 to main::@1 [phi:main::@11->main::@1] + __b1_from___b11: + // [35] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@11->main::@1#0] -- register_copy + jmp __b1 +} + // ppuDataPutTile +// Transfer a 2x2 tile into the PPU memory +// - ppuData : Pointer in the PPU memory +// - tile : The tile to transfer +// ppuDataPutTile(byte* zp($16) ppuData, byte* zp(7) tile) +ppuDataPutTile: { + .label ppuDataPrepare1___0 = $18 + .label ppuDataPrepare1___1 = $19 + .label ppuDataPrepare2___0 = $1e + .label ppuDataPrepare2___1 = $1f + .label ppuDataPut1_val = $1a + .label ppuDataPut2_val = $1b + .label ppuDataPrepare2_ppuData = $1c + .label ppuDataPut3_val = $20 + .label ppuDataPut4_val = $21 + .label ppuData = $16 + .label ppuData_1 = 5 + .label tile = 7 + jmp ppuDataPrepare1 + // ppuDataPutTile::ppuDataPrepare1 + ppuDataPrepare1: + // [53] (byte~) ppuDataPutTile::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataPutTile::ppuData#2 -- vbuz1=_hi_pvoz2 + lda.z ppuData_1+1 + sta.z ppuDataPrepare1___0 + // [54] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare1_$0 -- _deref_pbuc1=vbuz1 + lda.z ppuDataPrepare1___0 + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + // [55] (byte~) ppuDataPutTile::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataPutTile::ppuData#2 -- vbuz1=_lo_pvoz2 + lda.z ppuData_1 + sta.z ppuDataPrepare1___1 + // [56] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare1_$1 -- _deref_pbuc1=vbuz1 + lda.z ppuDataPrepare1___1 + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + jmp __b1 + // ppuDataPutTile::@1 + __b1: + // [57] (byte) ppuDataPutTile::ppuDataPut1_val#0 ← *((byte*) ppuDataPutTile::tile#10) -- vbuz1=_deref_pbuz2 + ldy #0 + lda (tile),y + sta.z ppuDataPut1_val + jmp ppuDataPut1 + // ppuDataPutTile::ppuDataPut1 + ppuDataPut1: + // [58] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut1_val#0 -- _deref_pbuc1=vbuz1 + lda.z ppuDataPut1_val + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + jmp __b2 + // ppuDataPutTile::@2 + __b2: + // [59] (byte) ppuDataPutTile::ppuDataPut2_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 1) -- vbuz1=pbuz2_derefidx_vbuc1 + ldy #1 + lda (tile),y + sta.z ppuDataPut2_val + jmp ppuDataPut2 + // ppuDataPutTile::ppuDataPut2 + ppuDataPut2: + // [60] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut2_val#0 -- _deref_pbuc1=vbuz1 + lda.z ppuDataPut2_val + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + jmp __b3 + // ppuDataPutTile::@3 + __b3: + // [61] (nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 ← (byte*)(nomodify void*) ppuDataPutTile::ppuData#2 + (byte) $20 -- pbuz1=pbuz2_plus_vbuc1 + lda #$20 + clc + adc.z ppuData_1 + sta.z ppuDataPrepare2_ppuData + lda #0 + adc.z ppuData_1+1 + sta.z ppuDataPrepare2_ppuData+1 + jmp ppuDataPrepare2 + // ppuDataPutTile::ppuDataPrepare2 + ppuDataPrepare2: + // [62] (byte~) ppuDataPutTile::ppuDataPrepare2_$0 ← > (void*)(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 -- vbuz1=_hi_pvoz2 + lda.z ppuDataPrepare2_ppuData+1 + sta.z ppuDataPrepare2___0 + // [63] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare2_$0 -- _deref_pbuc1=vbuz1 + lda.z ppuDataPrepare2___0 + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + // [64] (byte~) ppuDataPutTile::ppuDataPrepare2_$1 ← < (void*)(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 -- vbuz1=_lo_pvoz2 + lda.z ppuDataPrepare2_ppuData + sta.z ppuDataPrepare2___1 + // [65] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare2_$1 -- _deref_pbuc1=vbuz1 + lda.z ppuDataPrepare2___1 + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + jmp __b4 + // ppuDataPutTile::@4 + __b4: + // [66] (byte) ppuDataPutTile::ppuDataPut3_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 2) -- vbuz1=pbuz2_derefidx_vbuc1 + ldy #2 + lda (tile),y + sta.z ppuDataPut3_val + jmp ppuDataPut3 + // ppuDataPutTile::ppuDataPut3 + ppuDataPut3: + // [67] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut3_val#0 -- _deref_pbuc1=vbuz1 + lda.z ppuDataPut3_val + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + jmp __b5 + // ppuDataPutTile::@5 + __b5: + // [68] (byte) ppuDataPutTile::ppuDataPut4_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 3) -- vbuz1=pbuz2_derefidx_vbuc1 + ldy #3 + lda (tile),y + sta.z ppuDataPut4_val + jmp ppuDataPut4 + // ppuDataPutTile::ppuDataPut4 + ppuDataPut4: + // [69] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut4_val#0 -- _deref_pbuc1=vbuz1 + lda.z ppuDataPut4_val + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA jmp __breturn - // initSpriteBuffer::@return + // ppuDataPutTile::@return __breturn: - // [39] return + // [70] return rts } - // initPalette -// Copy palette values to PPU -initPalette: { - .label i = 4 - // asm { ldaPPU_PPUSTATUS } - // Reset the high/low latch to "high" - lda PPU_PPUSTATUS - // [41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify byte*) PPU_PALETTE -- _deref_pbuc1=vbuc2 - // Write the high byte of PPU Palette address - lda #>PPU_PALETTE + // ppuDataFill +// Fill a number of bytes in the PPU memory +// - ppuData : Pointer in the PPU memory +// - size : The number of bytes to transfer +// ppuDataFill(byte zp($d) val, word zp($b) size) +ppuDataFill: { + .label ppuDataPrepare1___0 = $22 + .label ppuDataPrepare1___1 = $23 + .label ppuDataPrepare1_ppuData = 9 + .label i = $e + .label size = $b + .label val = $d + jmp ppuDataPrepare1 + // ppuDataFill::ppuDataPrepare1 + ppuDataPrepare1: + // [72] (byte~) ppuDataFill::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 -- vbuz1=_hi_pvoz2 + lda.z ppuDataPrepare1_ppuData+1 + sta.z ppuDataPrepare1___0 + // [73] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$0 -- _deref_pbuc1=vbuz1 + lda.z ppuDataPrepare1___0 sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR - // [42] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0 -- _deref_pbuc1=vbuc2 - // Write the low byte of PPU Palette address - lda #0 + // [74] (byte~) ppuDataFill::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 -- vbuz1=_lo_pvoz2 + lda.z ppuDataPrepare1_ppuData + sta.z ppuDataPrepare1___1 + // [75] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$1 -- _deref_pbuc1=vbuz1 + lda.z ppuDataPrepare1___1 sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR - // [43] phi from initPalette to initPalette::@1 [phi:initPalette->initPalette::@1] - __b1_from_initPalette: - // [43] phi (byte) initPalette::i#2 = (byte) 0 [phi:initPalette->initPalette::@1#0] -- vbuz1=vbuc1 - lda #0 + // [76] phi from ppuDataFill::ppuDataPrepare1 to ppuDataFill::@1 [phi:ppuDataFill::ppuDataPrepare1->ppuDataFill::@1] + __b1_from_ppuDataPrepare1: + // [76] phi (word) ppuDataFill::i#2 = (word) 0 [phi:ppuDataFill::ppuDataPrepare1->ppuDataFill::@1#0] -- vwuz1=vwuc1 + lda #<0 sta.z i + lda #>0 + sta.z i+1 jmp __b1 - // Write to PPU - // initPalette::@1 + // Transfer to PPU + // ppuDataFill::@1 __b1: - // [44] if((byte) initPalette::i#2<(byte) $20*(const byte) SIZEOF_BYTE) goto initPalette::@2 -- vbuz1_lt_vbuc1_then_la1 + // [77] if((word) ppuDataFill::i#2<(word) ppuDataFill::size#3) goto ppuDataFill::ppuDataPut1 -- vwuz1_lt_vwuz2_then_la1 + lda.z i+1 + cmp.z size+1 + bcc ppuDataPut1 + bne !+ lda.z i - cmp #$20*SIZEOF_BYTE - bcc __b2 + cmp.z size + bcc ppuDataPut1 + !: jmp __breturn - // initPalette::@return + // ppuDataFill::@return __breturn: - // [45] return + // [78] return rts - // initPalette::@2 - __b2: - // [46] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← *((const byte*) PALETTE + (byte) initPalette::i#2) -- _deref_pbuc1=pbuc2_derefidx_vbuz1 - ldy.z i - lda PALETTE,y + // ppuDataFill::ppuDataPut1 + ppuDataPut1: + // [79] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataFill::val#4 -- _deref_pbuc1=vbuz1 + lda.z val sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA - // [47] (byte) initPalette::i#1 ← ++ (byte) initPalette::i#2 -- vbuz1=_inc_vbuz1 + jmp __b2 + // ppuDataFill::@2 + __b2: + // [80] (word) ppuDataFill::i#1 ← ++ (word) ppuDataFill::i#2 -- vwuz1=_inc_vwuz1 inc.z i - // [43] phi from initPalette::@2 to initPalette::@1 [phi:initPalette::@2->initPalette::@1] + bne !+ + inc.z i+1 + !: + // [76] phi from ppuDataFill::@2 to ppuDataFill::@1 [phi:ppuDataFill::@2->ppuDataFill::@1] __b1_from___b2: - // [43] phi (byte) initPalette::i#2 = (byte) initPalette::i#1 [phi:initPalette::@2->initPalette::@1#0] -- register_copy + // [76] phi (word) ppuDataFill::i#2 = (word) ppuDataFill::i#1 [phi:ppuDataFill::@2->ppuDataFill::@1#0] -- register_copy + jmp __b1 +} + // ppuDataTransfer +// Transfer a number of bytes from the CPU memory to the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) +// - ppuData : Pointer in the PPU memory +// - size : The number of bytes to transfer +ppuDataTransfer: { + .const size = $20*SIZEOF_BYTE + .label ppuData = PPU_PALETTE + .label cpuData = PALETTE + .label ppuDataPut1_val = $24 + // Transfer to PPU + .label cpuSrc = $12 + .label i = $10 + jmp ppuDataPrepare1 + // ppuDataTransfer::ppuDataPrepare1 + ppuDataPrepare1: + // [82] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify void*) ppuDataTransfer::ppuData#0 -- _deref_pbuc1=vbuc2 + lda #>ppuData + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + // [83] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0 -- _deref_pbuc1=vbuc2 + lda #0 + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + // [84] phi from ppuDataTransfer::ppuDataPrepare1 to ppuDataTransfer::@1 [phi:ppuDataTransfer::ppuDataPrepare1->ppuDataTransfer::@1] + __b1_from_ppuDataPrepare1: + // [84] phi (byte*) ppuDataTransfer::cpuSrc#2 = (byte*)(const nomodify void*) ppuDataTransfer::cpuData#0 [phi:ppuDataTransfer::ppuDataPrepare1->ppuDataTransfer::@1#0] -- pbuz1=pbuc1 + lda #cpuData + sta.z cpuSrc+1 + // [84] phi (word) ppuDataTransfer::i#2 = (word) 0 [phi:ppuDataTransfer::ppuDataPrepare1->ppuDataTransfer::@1#1] -- vwuz1=vwuc1 + lda #<0 + sta.z i + lda #>0 + sta.z i+1 + jmp __b1 + // ppuDataTransfer::@1 + __b1: + // [85] if((word) ppuDataTransfer::i#2<(const word) ppuDataTransfer::size#0) goto ppuDataTransfer::@2 -- vwuz1_lt_vwuc1_then_la1 + lda.z i+1 + cmp #>size + bcc __b2 + bne !+ + lda.z i + cmp #ppuDataTransfer::@1] + __b1_from___b3: + // [84] phi (byte*) ppuDataTransfer::cpuSrc#2 = (byte*) ppuDataTransfer::cpuSrc#1 [phi:ppuDataTransfer::@3->ppuDataTransfer::@1#0] -- register_copy + // [84] phi (word) ppuDataTransfer::i#2 = (word) ppuDataTransfer::i#1 [phi:ppuDataTransfer::@3->ppuDataTransfer::@1#1] -- register_copy jmp __b1 } // vblank // NMI Called when the PPU refreshes the screen (also known as the V-Blank period) vblank: { - .label __1 = 7 - .label __3 = 8 + .label __1 = $25 + .label __3 = $26 // entry interrupt(HARDWARE_STACK) pha txa pha tya pha - jmp transferSpriteBufferToPpu1 - // vblank::transferSpriteBufferToPpu1 - transferSpriteBufferToPpu1: - // [49] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 -- _deref_pbuc1=vbuc2 + jmp ppuSpriteBufferDmaTransfer1 + // vblank::ppuSpriteBufferDmaTransfer1 + ppuSpriteBufferDmaTransfer1: + // [92] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR - // [50] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct ObjectAttribute*) OAM_BUFFER -- _deref_pbuc1=vbuc2 + // [93] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct SpriteData*) OAM_BUFFER -- _deref_pbuc1=vbuc2 lda #>OAM_BUFFER sta APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA jmp __b4 // vblank::@4 __b4: - // [51] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1 -- _deref_pbuc1=vbuc2 - // Freeze the button positions. + // [94] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1 -- _deref_pbuc1=vbuc2 + // Latch the controller buttons lda #1 sta APU+OFFSET_STRUCT_RICOH_2A03_JOY1 - // [52] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // [95] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta APU+OFFSET_STRUCT_RICOH_2A03_JOY1 - // [53] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 -- vbuz1=_deref_pbuc1_band_vbuc2 + // [96] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 -- vbuz1=_deref_pbuc1_band_vbuc2 lda #1 and APU+OFFSET_STRUCT_RICOH_2A03_JOY1 sta.z __1 - // [54] if((byte) 0==(byte~) vblank::$1) goto vblank::@1 -- vbuc1_eq_vbuz1_then_la1 + // [97] if((byte) 0==(byte~) vblank::$1) goto vblank::@1 -- vbuc1_eq_vbuz1_then_la1 lda #0 cmp.z __1 beq __b1 - // [55] phi from vblank::@4 to vblank::@2 [phi:vblank::@4->vblank::@2] - __b2_from___b4: jmp __b2 // vblank::@2 __b2: - // [56] call moveLuigiRight - jsr moveLuigiRight + // [98] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) -- _deref_pbuc1=_inc__deref_pbuc1 + inc OAM_BUFFER + // [99] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_inc__deref_pbuc1 + inc OAM_BUFFER+1*SIZEOF_STRUCT_SPRITEDATA + // [100] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_inc__deref_pbuc1 + inc OAM_BUFFER+2*SIZEOF_STRUCT_SPRITEDATA + // [101] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_inc__deref_pbuc1 + inc OAM_BUFFER+3*SIZEOF_STRUCT_SPRITEDATA jmp __b1 // vblank::@1 __b1: - // [57] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 -- vbuz1=_deref_pbuc1_band_vbuc2 + // [102] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 -- vbuz1=_deref_pbuc1_band_vbuc2 lda #1 and APU+OFFSET_STRUCT_RICOH_2A03_JOY1 sta.z __3 - // [58] if((byte) 0==(byte~) vblank::$3) goto vblank::@return -- vbuc1_eq_vbuz1_then_la1 + // [103] if((byte) 0==(byte~) vblank::$3) goto vblank::@return -- vbuc1_eq_vbuz1_then_la1 lda #0 cmp.z __3 beq __breturn - // [59] phi from vblank::@1 to vblank::@3 [phi:vblank::@1->vblank::@3] - __b3_from___b1: jmp __b3 // vblank::@3 __b3: - // [60] call moveLuigiLeft - jsr moveLuigiLeft + // [104] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) -- _deref_pbuc1=_dec__deref_pbuc1 + dec OAM_BUFFER + // [105] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_dec__deref_pbuc1 + dec OAM_BUFFER+1*SIZEOF_STRUCT_SPRITEDATA + // [106] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_dec__deref_pbuc1 + dec OAM_BUFFER+2*SIZEOF_STRUCT_SPRITEDATA + // [107] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_dec__deref_pbuc1 + dec OAM_BUFFER+3*SIZEOF_STRUCT_SPRITEDATA jmp __breturn // vblank::@return __breturn: - // [61] return - exit interrupt(HARDWARE_STACK) + // [108] return - exit interrupt(HARDWARE_STACK) pla tay pla tax pla rti -} - // moveLuigiLeft -// move the Luigi sprites left -moveLuigiLeft: { - // [62] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) -- _deref_pbuc1=_dec__deref_pbuc1 - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X - // [63] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_dec__deref_pbuc1 - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+1*SIZEOF_STRUCT_OBJECTATTRIBUTE - // [64] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_dec__deref_pbuc1 - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+2*SIZEOF_STRUCT_OBJECTATTRIBUTE - // [65] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_dec__deref_pbuc1 - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+3*SIZEOF_STRUCT_OBJECTATTRIBUTE - jmp __breturn - // moveLuigiLeft::@return - __breturn: - // [66] return - rts -} - // moveLuigiRight -// move the Luigi sprites right -moveLuigiRight: { - // [67] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) -- _deref_pbuc1=_inc__deref_pbuc1 - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X - // [68] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_inc__deref_pbuc1 - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+1*SIZEOF_STRUCT_OBJECTATTRIBUTE - // [69] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_inc__deref_pbuc1 - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+2*SIZEOF_STRUCT_OBJECTATTRIBUTE - // [70] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_inc__deref_pbuc1 - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+3*SIZEOF_STRUCT_OBJECTATTRIBUTE - jmp __breturn - // moveLuigiRight::@return - __breturn: - // [71] return - rts } // File Data .segment Data + // Flag tile + FLAG: .byte $54, $55, $56, $57 + // Floor tile + FLOOR: .byte $85, $85, $86, $86 // Small Luigi Sprite Data SPRITES: .byte $80, $36, 2, $80, $80, $37, 2, $88, $88, $38, 2, $80, $88, $39, 2, $88 - PALETTE: .byte $f, $31, $32, $33, $f, $35, $36, $37, $f, $39, $3a, $3b, $f, $3d, $3e, $f, $f, $1c, $15, $14, $f, 2, $38, $3c, $f, $30, $37, $1a, $f, $f, $f, $f + // Color Palette + PALETTE: .byte $f, $13, $23, $33, $f, 6, $15, $36, $f, $39, $4a, $5b, $f, $3d, $4e, $5f, $f, $1c, $15, $14, $f, 2, $38, $3c, $f, $30, $37, $1a, $f, $f, $f, $f .segment Tiles TILES: .import binary "smb1_chr.bin" @@ -1502,98 +2693,174 @@ TILES: REGISTER UPLIFT POTENTIAL REGISTERS Statement asm { cld ldx#$ff txs } always clobbers reg byte x -Statement [5] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a -Statement [6] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) 0 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a -Statement [7] *((const nomodify byte*) FR_COUNTER) ← (byte) $40 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a -Statement [8] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) ← (byte) $40 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [6] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [7] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) 0 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [8] *((const nomodify byte*) FR_COUNTER) ← (byte) $40 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [9] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) ← (byte) $40 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a Statement asm { ldaPPU_PPUSTATUS } always clobbers reg byte a -Statement [11] (byte~) main::waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 [ main::waitForVBlank1_$0 ] ( [ main::waitForVBlank1_$0 ] { } main:2 [ main::waitForVBlank1_$0 ] { } ) always clobbers reg byte a -Statement [14] *((const nomodify byte*) MEMORY + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::i#2 main::i#1 ] -Statement [15] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Statement [16] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Statement [17] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Statement [18] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Statement [19] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Statement [20] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Statement [21] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Statement [25] (byte~) main::waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 [ main::waitForVBlank2_$0 ] ( [ main::waitForVBlank2_$0 ] { } main:2 [ main::waitForVBlank2_$0 ] { } ) always clobbers reg byte a -Statement [31] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a -Statement [32] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $10 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a -Statement [36] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER + (byte) initSpriteBuffer::i#2) ← *((byte*)(const struct ObjectAttribute*) SPRITES + (byte) initSpriteBuffer::i#2) [ initSpriteBuffer::i#2 ] ( initSpriteBuffer:30 [ initSpriteBuffer::i#2 ] { } main:2::initSpriteBuffer:30 [ initSpriteBuffer::i#2 ] { } ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp[1]:3 [ initSpriteBuffer::i#2 initSpriteBuffer::i#1 ] +Statement [12] (byte~) main::initNES1_waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 [ main::initNES1_waitForVBlank1_$0 ] ( [ main::initNES1_waitForVBlank1_$0 ] { } main:2 [ main::initNES1_waitForVBlank1_$0 ] { } ) always clobbers reg byte a +Statement [15] *((const nomodify byte*) MEMORY + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::initNES1_i#2 main::initNES1_i#1 ] +Statement [16] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Statement [17] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Statement [18] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Statement [19] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Statement [20] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Statement [21] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Statement [22] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Statement [26] (byte~) main::initNES1_waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 [ main::initNES1_waitForVBlank2_$0 ] ( [ main::initNES1_waitForVBlank2_$0 ] { } main:2 [ main::initNES1_waitForVBlank2_$0 ] { } ) always clobbers reg byte a Statement asm { ldaPPU_PPUSTATUS } always clobbers reg byte a -Statement [41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify byte*) PPU_PALETTE [ ] ( initPalette:28 [ ] { } main:2::initPalette:28 [ ] { } ) always clobbers reg byte a -Statement [42] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0 [ ] ( initPalette:28 [ ] { } main:2::initPalette:28 [ ] { } ) always clobbers reg byte a -Statement [46] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← *((const byte*) PALETTE + (byte) initPalette::i#2) [ initPalette::i#2 ] ( initPalette:28 [ initPalette::i#2 ] { } main:2::initPalette:28 [ initPalette::i#2 ] { } ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp[1]:4 [ initPalette::i#2 initPalette::i#1 ] -Statement [49] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 [ ] ( [ ] { } ) always clobbers reg byte a -Statement [50] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct ObjectAttribute*) OAM_BUFFER [ ] ( [ ] { } ) always clobbers reg byte a -Statement [51] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1 [ ] ( [ ] { } ) always clobbers reg byte a -Statement [52] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0 [ ] ( [ ] { } ) always clobbers reg byte a -Statement [53] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 [ vblank::$1 ] ( [ vblank::$1 ] { } ) always clobbers reg byte a -Statement [57] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 [ vblank::$3 ] ( [ vblank::$3 ] { } ) always clobbers reg byte a -Statement [61] return [ ] ( [ ] { } ) always clobbers reg byte a reg byte x reg byte y +Statement [41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) 0 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [42] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) -8 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [43] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [44] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $18 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [46] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER + (byte) main::i#2) ← *((byte*)(const struct SpriteData*) SPRITES + (byte) main::i#2) [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:4 [ main::i#2 main::i#1 ] +Statement [48] (nomodify byte*) ppuDataPutTile::ppuData#0 ← (const nomodify byte*) PPU_NAME_TABLE_0+(word)(number) $14*(number) $20 + (byte) main::x#2 [ main::x#2 ppuDataPutTile::ppuData#0 ] ( [ main::x#2 ppuDataPutTile::ppuData#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2 [ main::x#2 ppuDataPutTile::ppuData#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:3 [ main::x#2 main::x#1 ] +Statement [49] (nomodify void*) ppuDataPutTile::ppuData#9 ← (void*)(nomodify byte*) ppuDataPutTile::ppuData#0 [ main::x#2 ppuDataPutTile::ppuData#9 ] ( [ main::x#2 ppuDataPutTile::ppuData#9 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2 [ main::x#2 ppuDataPutTile::ppuData#9 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a +Statement [53] (byte~) ppuDataPutTile::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataPutTile::ppuData#2 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$0 ] ( ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$0 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$0 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a +Statement [55] (byte~) ppuDataPutTile::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataPutTile::ppuData#2 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$1 ] ( ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$1 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$1 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$1 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$1 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a +Statement [57] (byte) ppuDataPutTile::ppuDataPut1_val#0 ← *((byte*) ppuDataPutTile::tile#10) [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut1_val#0 ] ( ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut1_val#0 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut1_val#0 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut1_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut1_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp[1]:3 [ main::x#2 main::x#1 ] +Statement [59] (byte) ppuDataPutTile::ppuDataPut2_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 1) [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut2_val#0 ] ( ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut2_val#0 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut2_val#0 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut2_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut2_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a reg byte y +Statement [61] (nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 ← (byte*)(nomodify void*) ppuDataPutTile::ppuData#2 + (byte) $20 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] ( ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a +Statement [62] (byte~) ppuDataPutTile::ppuDataPrepare2_$0 ← > (void*)(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ppuDataPutTile::ppuDataPrepare2_$0 ] ( ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ppuDataPutTile::ppuDataPrepare2_$0 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ppuDataPutTile::ppuDataPrepare2_$0 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ppuDataPutTile::ppuDataPrepare2_$0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ppuDataPutTile::ppuDataPrepare2_$0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a +Statement [64] (byte~) ppuDataPutTile::ppuDataPrepare2_$1 ← < (void*)(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_$1 ] ( ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_$1 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_$1 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_$1 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_$1 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a +Statement [66] (byte) ppuDataPutTile::ppuDataPut3_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 2) [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut3_val#0 ] ( ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut3_val#0 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut3_val#0 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut3_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut3_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a reg byte y +Statement [68] (byte) ppuDataPutTile::ppuDataPut4_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 3) [ ppuDataPutTile::ppuDataPut4_val#0 ] ( ppuDataPutTile:38 [ ppuDataPutTile::ppuDataPut4_val#0 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::ppuDataPut4_val#0 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuDataPut4_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuDataPut4_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a reg byte y +Statement [72] (byte~) ppuDataFill::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$0 ] ( ppuDataFill:32 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$0 ] { } main:2::ppuDataFill:32 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$0 ] { } ppuDataFill:34 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$0 ] { } main:2::ppuDataFill:34 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$0 ] { } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:13 [ ppuDataFill::val#4 ] +Statement [74] (byte~) ppuDataFill::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$1 ] ( ppuDataFill:32 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$1 ] { } main:2::ppuDataFill:32 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$1 ] { } ppuDataFill:34 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$1 ] { } main:2::ppuDataFill:34 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$1 ] { } ) always clobbers reg byte a +Statement [77] if((word) ppuDataFill::i#2<(word) ppuDataFill::size#3) goto ppuDataFill::ppuDataPut1 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] ( ppuDataFill:32 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { } main:2::ppuDataFill:32 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { } ppuDataFill:34 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { } main:2::ppuDataFill:34 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { } ) always clobbers reg byte a +Statement [82] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify void*) ppuDataTransfer::ppuData#0 [ ] ( ppuDataTransfer:30 [ ] { } main:2::ppuDataTransfer:30 [ ] { } ) always clobbers reg byte a +Statement [83] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0 [ ] ( ppuDataTransfer:30 [ ] { } main:2::ppuDataTransfer:30 [ ] { } ) always clobbers reg byte a +Statement [85] if((word) ppuDataTransfer::i#2<(const word) ppuDataTransfer::size#0) goto ppuDataTransfer::@2 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ] ( ppuDataTransfer:30 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ] { } main:2::ppuDataTransfer:30 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ] { } ) always clobbers reg byte a +Statement [87] (byte) ppuDataTransfer::ppuDataPut1_val#0 ← *((byte*) ppuDataTransfer::cpuSrc#2) [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::ppuDataPut1_val#0 ] ( ppuDataTransfer:30 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::ppuDataPut1_val#0 ] { } main:2::ppuDataTransfer:30 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::ppuDataPut1_val#0 ] { } ) always clobbers reg byte a reg byte y +Statement [92] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 [ ] ( [ ] { } ) always clobbers reg byte a +Statement [93] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct SpriteData*) OAM_BUFFER [ ] ( [ ] { } ) always clobbers reg byte a +Statement [94] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1 [ ] ( [ ] { } ) always clobbers reg byte a +Statement [95] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0 [ ] ( [ ] { } ) always clobbers reg byte a +Statement [96] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 [ vblank::$1 ] ( [ vblank::$1 ] { } ) always clobbers reg byte a +Statement [102] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 [ vblank::$3 ] ( [ vblank::$3 ] { } ) always clobbers reg byte a +Statement [108] return [ ] ( [ ] { } ) always clobbers reg byte a reg byte x reg byte y Statement asm { cld ldx#$ff txs } always clobbers reg byte x -Statement [5] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a -Statement [6] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) 0 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a -Statement [7] *((const nomodify byte*) FR_COUNTER) ← (byte) $40 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a -Statement [8] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) ← (byte) $40 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [6] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [7] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) 0 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [8] *((const nomodify byte*) FR_COUNTER) ← (byte) $40 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [9] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) ← (byte) $40 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a Statement asm { ldaPPU_PPUSTATUS } always clobbers reg byte a -Statement [11] (byte~) main::waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 [ main::waitForVBlank1_$0 ] ( [ main::waitForVBlank1_$0 ] { } main:2 [ main::waitForVBlank1_$0 ] { } ) always clobbers reg byte a -Statement [14] *((const nomodify byte*) MEMORY + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Statement [15] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Statement [16] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Statement [17] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Statement [18] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Statement [19] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Statement [20] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Statement [21] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::i#2) ← (byte) 0 [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a -Statement [25] (byte~) main::waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 [ main::waitForVBlank2_$0 ] ( [ main::waitForVBlank2_$0 ] { } main:2 [ main::waitForVBlank2_$0 ] { } ) always clobbers reg byte a -Statement [31] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a -Statement [32] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $10 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a -Statement [36] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER + (byte) initSpriteBuffer::i#2) ← *((byte*)(const struct ObjectAttribute*) SPRITES + (byte) initSpriteBuffer::i#2) [ initSpriteBuffer::i#2 ] ( initSpriteBuffer:30 [ initSpriteBuffer::i#2 ] { } main:2::initSpriteBuffer:30 [ initSpriteBuffer::i#2 ] { } ) always clobbers reg byte a +Statement [12] (byte~) main::initNES1_waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 [ main::initNES1_waitForVBlank1_$0 ] ( [ main::initNES1_waitForVBlank1_$0 ] { } main:2 [ main::initNES1_waitForVBlank1_$0 ] { } ) always clobbers reg byte a +Statement [15] *((const nomodify byte*) MEMORY + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Statement [16] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Statement [17] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Statement [18] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Statement [19] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Statement [20] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Statement [21] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Statement [22] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::initNES1_i#2) ← (byte) 0 [ main::initNES1_i#2 ] ( [ main::initNES1_i#2 ] { } main:2 [ main::initNES1_i#2 ] { } ) always clobbers reg byte a +Statement [26] (byte~) main::initNES1_waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 [ main::initNES1_waitForVBlank2_$0 ] ( [ main::initNES1_waitForVBlank2_$0 ] { } main:2 [ main::initNES1_waitForVBlank2_$0 ] { } ) always clobbers reg byte a Statement asm { ldaPPU_PPUSTATUS } always clobbers reg byte a -Statement [41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify byte*) PPU_PALETTE [ ] ( initPalette:28 [ ] { } main:2::initPalette:28 [ ] { } ) always clobbers reg byte a -Statement [42] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0 [ ] ( initPalette:28 [ ] { } main:2::initPalette:28 [ ] { } ) always clobbers reg byte a -Statement [46] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← *((const byte*) PALETTE + (byte) initPalette::i#2) [ initPalette::i#2 ] ( initPalette:28 [ initPalette::i#2 ] { } main:2::initPalette:28 [ initPalette::i#2 ] { } ) always clobbers reg byte a -Statement [49] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 [ ] ( [ ] { } ) always clobbers reg byte a -Statement [50] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct ObjectAttribute*) OAM_BUFFER [ ] ( [ ] { } ) always clobbers reg byte a -Statement [51] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1 [ ] ( [ ] { } ) always clobbers reg byte a -Statement [52] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0 [ ] ( [ ] { } ) always clobbers reg byte a -Statement [53] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 [ vblank::$1 ] ( [ vblank::$1 ] { } ) always clobbers reg byte a -Statement [57] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 [ vblank::$3 ] ( [ vblank::$3 ] { } ) always clobbers reg byte a -Statement [61] return [ ] ( [ ] { } ) always clobbers reg byte a reg byte x reg byte y -Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , reg byte y , -Potential registers zp[1]:3 [ initSpriteBuffer::i#2 initSpriteBuffer::i#1 ] : zp[1]:3 , reg byte x , reg byte y , -Potential registers zp[1]:4 [ initPalette::i#2 initPalette::i#1 ] : zp[1]:4 , reg byte x , reg byte y , -Potential registers zp[1]:5 [ main::waitForVBlank1_$0 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y , -Potential registers zp[1]:6 [ main::waitForVBlank2_$0 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y , -Potential registers zp[1]:7 [ vblank::$1 ] : zp[1]:7 , reg byte a , reg byte x , reg byte y , -Potential registers zp[1]:8 [ vblank::$3 ] : zp[1]:8 , reg byte a , reg byte x , reg byte y , +Statement [41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) 0 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [42] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) -8 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [43] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [44] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $18 [ ] ( [ ] { } main:2 [ ] { } ) always clobbers reg byte a +Statement [46] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER + (byte) main::i#2) ← *((byte*)(const struct SpriteData*) SPRITES + (byte) main::i#2) [ main::i#2 ] ( [ main::i#2 ] { } main:2 [ main::i#2 ] { } ) always clobbers reg byte a +Statement [48] (nomodify byte*) ppuDataPutTile::ppuData#0 ← (const nomodify byte*) PPU_NAME_TABLE_0+(word)(number) $14*(number) $20 + (byte) main::x#2 [ main::x#2 ppuDataPutTile::ppuData#0 ] ( [ main::x#2 ppuDataPutTile::ppuData#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2 [ main::x#2 ppuDataPutTile::ppuData#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a +Statement [49] (nomodify void*) ppuDataPutTile::ppuData#9 ← (void*)(nomodify byte*) ppuDataPutTile::ppuData#0 [ main::x#2 ppuDataPutTile::ppuData#9 ] ( [ main::x#2 ppuDataPutTile::ppuData#9 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2 [ main::x#2 ppuDataPutTile::ppuData#9 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a +Statement [53] (byte~) ppuDataPutTile::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataPutTile::ppuData#2 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$0 ] ( ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$0 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$0 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a +Statement [55] (byte~) ppuDataPutTile::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataPutTile::ppuData#2 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$1 ] ( ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$1 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$1 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$1 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare1_$1 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a +Statement [57] (byte) ppuDataPutTile::ppuDataPut1_val#0 ← *((byte*) ppuDataPutTile::tile#10) [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut1_val#0 ] ( ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut1_val#0 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut1_val#0 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut1_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut1_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a reg byte y +Statement [59] (byte) ppuDataPutTile::ppuDataPut2_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 1) [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut2_val#0 ] ( ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut2_val#0 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut2_val#0 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut2_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuData#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut2_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a reg byte y +Statement [61] (nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 ← (byte*)(nomodify void*) ppuDataPutTile::ppuData#2 + (byte) $20 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] ( ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a +Statement [62] (byte~) ppuDataPutTile::ppuDataPrepare2_$0 ← > (void*)(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ppuDataPutTile::ppuDataPrepare2_$0 ] ( ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ppuDataPutTile::ppuDataPrepare2_$0 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ppuDataPutTile::ppuDataPrepare2_$0 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ppuDataPutTile::ppuDataPrepare2_$0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ppuDataPutTile::ppuDataPrepare2_$0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a +Statement [64] (byte~) ppuDataPutTile::ppuDataPrepare2_$1 ← < (void*)(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_$1 ] ( ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_$1 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_$1 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_$1 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPrepare2_$1 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a +Statement [66] (byte) ppuDataPutTile::ppuDataPut3_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 2) [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut3_val#0 ] ( ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut3_val#0 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut3_val#0 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut3_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::tile#10 ppuDataPutTile::ppuDataPut3_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a reg byte y +Statement [68] (byte) ppuDataPutTile::ppuDataPut4_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 3) [ ppuDataPutTile::ppuDataPut4_val#0 ] ( ppuDataPutTile:38 [ ppuDataPutTile::ppuDataPut4_val#0 ] { } main:2::ppuDataPutTile:38 [ ppuDataPutTile::ppuDataPut4_val#0 ] { } ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuDataPut4_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } main:2::ppuDataPutTile:50 [ main::x#2 ppuDataPutTile::ppuDataPut4_val#0 ] { { ppuDataPutTile::ppuData#2 = ppuDataPutTile::ppuData#9 } } ) always clobbers reg byte a reg byte y +Statement [72] (byte~) ppuDataFill::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$0 ] ( ppuDataFill:32 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$0 ] { } main:2::ppuDataFill:32 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$0 ] { } ppuDataFill:34 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$0 ] { } main:2::ppuDataFill:34 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$0 ] { } ) always clobbers reg byte a +Statement [74] (byte~) ppuDataFill::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$1 ] ( ppuDataFill:32 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$1 ] { } main:2::ppuDataFill:32 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$1 ] { } ppuDataFill:34 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$1 ] { } main:2::ppuDataFill:34 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::ppuDataPrepare1_$1 ] { } ) always clobbers reg byte a +Statement [77] if((word) ppuDataFill::i#2<(word) ppuDataFill::size#3) goto ppuDataFill::ppuDataPut1 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] ( ppuDataFill:32 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { } main:2::ppuDataFill:32 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { } ppuDataFill:34 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { } main:2::ppuDataFill:34 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { } ) always clobbers reg byte a +Statement [82] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify void*) ppuDataTransfer::ppuData#0 [ ] ( ppuDataTransfer:30 [ ] { } main:2::ppuDataTransfer:30 [ ] { } ) always clobbers reg byte a +Statement [83] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0 [ ] ( ppuDataTransfer:30 [ ] { } main:2::ppuDataTransfer:30 [ ] { } ) always clobbers reg byte a +Statement [85] if((word) ppuDataTransfer::i#2<(const word) ppuDataTransfer::size#0) goto ppuDataTransfer::@2 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ] ( ppuDataTransfer:30 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ] { } main:2::ppuDataTransfer:30 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ] { } ) always clobbers reg byte a +Statement [87] (byte) ppuDataTransfer::ppuDataPut1_val#0 ← *((byte*) ppuDataTransfer::cpuSrc#2) [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::ppuDataPut1_val#0 ] ( ppuDataTransfer:30 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::ppuDataPut1_val#0 ] { } main:2::ppuDataTransfer:30 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::ppuDataPut1_val#0 ] { } ) always clobbers reg byte a reg byte y +Statement [92] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 [ ] ( [ ] { } ) always clobbers reg byte a +Statement [93] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct SpriteData*) OAM_BUFFER [ ] ( [ ] { } ) always clobbers reg byte a +Statement [94] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1 [ ] ( [ ] { } ) always clobbers reg byte a +Statement [95] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0 [ ] ( [ ] { } ) always clobbers reg byte a +Statement [96] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 [ vblank::$1 ] ( [ vblank::$1 ] { } ) always clobbers reg byte a +Statement [102] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 [ vblank::$3 ] ( [ vblank::$3 ] { } ) always clobbers reg byte a +Statement [108] return [ ] ( [ ] { } ) always clobbers reg byte a reg byte x reg byte y +Potential registers zp[1]:2 [ main::initNES1_i#2 main::initNES1_i#1 ] : zp[1]:2 , reg byte x , reg byte y , +Potential registers zp[1]:3 [ main::x#2 main::x#1 ] : zp[1]:3 , reg byte x , +Potential registers zp[1]:4 [ main::i#2 main::i#1 ] : zp[1]:4 , reg byte x , reg byte y , +Potential registers zp[2]:5 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::ppuData#9 ] : zp[2]:5 , +Potential registers zp[2]:7 [ ppuDataPutTile::tile#10 ] : zp[2]:7 , +Potential registers zp[2]:9 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ] : zp[2]:9 , +Potential registers zp[2]:11 [ ppuDataFill::size#3 ] : zp[2]:11 , +Potential registers zp[1]:13 [ ppuDataFill::val#4 ] : zp[1]:13 , reg byte x , reg byte y , +Potential registers zp[2]:14 [ ppuDataFill::i#2 ppuDataFill::i#1 ] : zp[2]:14 , +Potential registers zp[2]:16 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] : zp[2]:16 , +Potential registers zp[2]:18 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ] : zp[2]:18 , +Potential registers zp[1]:20 [ main::initNES1_waitForVBlank1_$0 ] : zp[1]:20 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:21 [ main::initNES1_waitForVBlank2_$0 ] : zp[1]:21 , reg byte a , reg byte x , reg byte y , +Potential registers zp[2]:22 [ ppuDataPutTile::ppuData#0 ] : zp[2]:22 , +Potential registers zp[1]:24 [ ppuDataPutTile::ppuDataPrepare1_$0 ] : zp[1]:24 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:25 [ ppuDataPutTile::ppuDataPrepare1_$1 ] : zp[1]:25 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:26 [ ppuDataPutTile::ppuDataPut1_val#0 ] : zp[1]:26 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:27 [ ppuDataPutTile::ppuDataPut2_val#0 ] : zp[1]:27 , reg byte a , reg byte x , reg byte y , +Potential registers zp[2]:28 [ ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] : zp[2]:28 , +Potential registers zp[1]:30 [ ppuDataPutTile::ppuDataPrepare2_$0 ] : zp[1]:30 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:31 [ ppuDataPutTile::ppuDataPrepare2_$1 ] : zp[1]:31 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:32 [ ppuDataPutTile::ppuDataPut3_val#0 ] : zp[1]:32 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:33 [ ppuDataPutTile::ppuDataPut4_val#0 ] : zp[1]:33 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:34 [ ppuDataFill::ppuDataPrepare1_$0 ] : zp[1]:34 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:35 [ ppuDataFill::ppuDataPrepare1_$1 ] : zp[1]:35 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:36 [ ppuDataTransfer::ppuDataPut1_val#0 ] : zp[1]:36 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:37 [ vblank::$1 ] : zp[1]:37 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:38 [ vblank::$3 ] : zp[1]:38 , reg byte a , reg byte x , reg byte y , REGISTER UPLIFT SCOPES -Uplift Scope [initSpriteBuffer] 3,503.5: zp[1]:3 [ initSpriteBuffer::i#2 initSpriteBuffer::i#1 ] -Uplift Scope [initPalette] 3,336.67: zp[1]:4 [ initPalette::i#2 initPalette::i#1 ] -Uplift Scope [main] 263.72: zp[1]:2 [ main::i#2 main::i#1 ] 202: zp[1]:5 [ main::waitForVBlank1_$0 ] 202: zp[1]:6 [ main::waitForVBlank2_$0 ] -Uplift Scope [vblank] 4: zp[1]:7 [ vblank::$1 ] 4: zp[1]:8 [ vblank::$3 ] +Uplift Scope [ppuDataPutTile] 2,002: zp[1]:24 [ ppuDataPutTile::ppuDataPrepare1_$0 ] 2,002: zp[1]:25 [ ppuDataPutTile::ppuDataPrepare1_$1 ] 2,002: zp[1]:26 [ ppuDataPutTile::ppuDataPut1_val#0 ] 2,002: zp[1]:27 [ ppuDataPutTile::ppuDataPut2_val#0 ] 2,002: zp[1]:30 [ ppuDataPutTile::ppuDataPrepare2_$0 ] 2,002: zp[1]:31 [ ppuDataPutTile::ppuDataPrepare2_$1 ] 2,002: zp[1]:32 [ ppuDataPutTile::ppuDataPut3_val#0 ] 2,002: zp[1]:33 [ ppuDataPutTile::ppuDataPut4_val#0 ] 435.67: zp[2]:5 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::ppuData#9 ] 333.67: zp[2]:28 [ ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] 250.25: zp[2]:7 [ ppuDataPutTile::tile#10 ] 101: zp[2]:22 [ ppuDataPutTile::ppuData#0 ] +Uplift Scope [ppuDataTransfer] 2,602.6: zp[2]:16 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] 2,002: zp[1]:36 [ ppuDataTransfer::ppuDataPut1_val#0 ] 1,751.75: zp[2]:18 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ] +Uplift Scope [ppuDataFill] 3,003: zp[2]:14 [ ppuDataFill::i#2 ppuDataFill::i#1 ] 202: zp[1]:34 [ ppuDataFill::ppuDataPrepare1_$0 ] 202: zp[1]:35 [ ppuDataFill::ppuDataPrepare1_$1 ] 111.22: zp[2]:11 [ ppuDataFill::size#3 ] 111.22: zp[1]:13 [ ppuDataFill::val#4 ] 67.33: zp[2]:9 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ] +Uplift Scope [main] 370.33: zp[1]:4 [ main::i#2 main::i#1 ] 282.8: zp[1]:3 [ main::x#2 main::x#1 ] 263.72: zp[1]:2 [ main::initNES1_i#2 main::initNES1_i#1 ] 202: zp[1]:20 [ main::initNES1_waitForVBlank1_$0 ] 202: zp[1]:21 [ main::initNES1_waitForVBlank2_$0 ] +Uplift Scope [vblank] 4: zp[1]:37 [ vblank::$1 ] 4: zp[1]:38 [ vblank::$3 ] Uplift Scope [RICOH_2C02] Uplift Scope [RICOH_2A03] -Uplift Scope [ObjectAttribute] -Uplift Scope [moveLuigiRight] -Uplift Scope [moveLuigiLeft] +Uplift Scope [SpriteData] Uplift Scope [] -Uplifting [initSpriteBuffer] best 2588 combination reg byte x [ initSpriteBuffer::i#2 initSpriteBuffer::i#1 ] -Uplifting [initPalette] best 2468 combination reg byte x [ initPalette::i#2 initPalette::i#1 ] -Uplifting [main] best 2018 combination reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::waitForVBlank1_$0 ] reg byte a [ main::waitForVBlank2_$0 ] -Uplifting [vblank] best 2006 combination reg byte a [ vblank::$1 ] reg byte a [ vblank::$3 ] -Uplifting [RICOH_2C02] best 2006 combination -Uplifting [RICOH_2A03] best 2006 combination -Uplifting [ObjectAttribute] best 2006 combination -Uplifting [moveLuigiRight] best 2006 combination -Uplifting [moveLuigiLeft] best 2006 combination -Uplifting [] best 2006 combination +Uplifting [ppuDataPutTile] best 4881 combination reg byte a [ ppuDataPutTile::ppuDataPrepare1_$0 ] reg byte a [ ppuDataPutTile::ppuDataPrepare1_$1 ] reg byte a [ ppuDataPutTile::ppuDataPut1_val#0 ] reg byte a [ ppuDataPutTile::ppuDataPut2_val#0 ] zp[1]:30 [ ppuDataPutTile::ppuDataPrepare2_$0 ] zp[1]:31 [ ppuDataPutTile::ppuDataPrepare2_$1 ] zp[1]:32 [ ppuDataPutTile::ppuDataPut3_val#0 ] zp[1]:33 [ ppuDataPutTile::ppuDataPut4_val#0 ] zp[2]:5 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::ppuData#9 ] zp[2]:28 [ ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] zp[2]:7 [ ppuDataPutTile::tile#10 ] zp[2]:22 [ ppuDataPutTile::ppuData#0 ] +Limited combination testing to 100 combinations of 65536 possible. +Uplifting [ppuDataTransfer] best 4821 combination zp[2]:16 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] reg byte a [ ppuDataTransfer::ppuDataPut1_val#0 ] zp[2]:18 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ] +Uplifting [ppuDataFill] best 4773 combination zp[2]:14 [ ppuDataFill::i#2 ppuDataFill::i#1 ] reg byte a [ ppuDataFill::ppuDataPrepare1_$0 ] reg byte a [ ppuDataFill::ppuDataPrepare1_$1 ] zp[2]:11 [ ppuDataFill::size#3 ] reg byte x [ ppuDataFill::val#4 ] zp[2]:9 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ] +Uplifting [main] best 4133 combination reg byte x [ main::i#2 main::i#1 ] reg byte x [ main::x#2 main::x#1 ] reg byte x [ main::initNES1_i#2 main::initNES1_i#1 ] reg byte a [ main::initNES1_waitForVBlank1_$0 ] zp[1]:21 [ main::initNES1_waitForVBlank2_$0 ] +Limited combination testing to 100 combinations of 288 possible. +Uplifting [vblank] best 4121 combination reg byte a [ vblank::$1 ] reg byte a [ vblank::$3 ] +Uplifting [RICOH_2C02] best 4121 combination +Uplifting [RICOH_2A03] best 4121 combination +Uplifting [SpriteData] best 4121 combination +Uplifting [] best 4121 combination +Attempting to uplift remaining variables inzp[1]:30 [ ppuDataPutTile::ppuDataPrepare2_$0 ] +Uplifting [ppuDataPutTile] best 4115 combination reg byte a [ ppuDataPutTile::ppuDataPrepare2_$0 ] +Attempting to uplift remaining variables inzp[1]:31 [ ppuDataPutTile::ppuDataPrepare2_$1 ] +Uplifting [ppuDataPutTile] best 4109 combination reg byte a [ ppuDataPutTile::ppuDataPrepare2_$1 ] +Attempting to uplift remaining variables inzp[1]:32 [ ppuDataPutTile::ppuDataPut3_val#0 ] +Uplifting [ppuDataPutTile] best 4103 combination reg byte a [ ppuDataPutTile::ppuDataPut3_val#0 ] +Attempting to uplift remaining variables inzp[1]:33 [ ppuDataPutTile::ppuDataPut4_val#0 ] +Uplifting [ppuDataPutTile] best 4097 combination reg byte a [ ppuDataPutTile::ppuDataPut4_val#0 ] +Attempting to uplift remaining variables inzp[1]:21 [ main::initNES1_waitForVBlank2_$0 ] +Uplifting [main] best 4037 combination reg byte a [ main::initNES1_waitForVBlank2_$0 ] +Coalescing zero page register [ zp[2]:5 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::ppuData#9 ] ] with [ zp[2]:22 [ ppuDataPutTile::ppuData#0 ] ] - score: 1 +Coalescing zero page register [ zp[2]:5 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::ppuData#9 ppuDataPutTile::ppuData#0 ] ] with [ zp[2]:28 [ ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] ] - score: 1 +Coalescing zero page register [ zp[2]:9 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ] ] with [ zp[2]:5 [ ppuDataPutTile::ppuData#2 ppuDataPutTile::ppuData#9 ppuDataPutTile::ppuData#0 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] ] +Coalescing zero page register [ zp[2]:11 [ ppuDataFill::size#3 ] ] with [ zp[2]:7 [ ppuDataPutTile::tile#10 ] ] +Coalescing zero page register [ zp[2]:16 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] ] with [ zp[2]:14 [ ppuDataFill::i#2 ppuDataFill::i#1 ] ] +Coalescing zero page register [ zp[2]:18 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ] ] with [ zp[2]:9 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataPutTile::ppuData#2 ppuDataPutTile::ppuData#9 ppuDataPutTile::ppuData#0 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] ] +Allocated (was zp[2]:11) zp[2]:2 [ ppuDataFill::size#3 ppuDataPutTile::tile#10 ] +Allocated (was zp[2]:16) zp[2]:4 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ppuDataFill::i#2 ppuDataFill::i#1 ] +Allocated (was zp[2]:18) zp[2]:6 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataPutTile::ppuData#2 ppuDataPutTile::ppuData#9 ppuDataPutTile::ppuData#0 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] ASSEMBLER BEFORE OPTIMIZATION // File Comments @@ -1629,19 +2896,23 @@ ASSEMBLER BEFORE OPTIMIZATION .segment Code // Global Constants & labels - .const SIZEOF_STRUCT_OBJECTATTRIBUTE = 4 + .const SIZEOF_STRUCT_SPRITEDATA = 4 .const OFFSET_STRUCT_RICOH_2A03_DMC_FREQ = $10 .const OFFSET_STRUCT_RICOH_2C02_PPUMASK = 1 .const OFFSET_STRUCT_RICOH_2C02_PPUSTATUS = 2 - .const OFFSET_STRUCT_RICOH_2A03_JOY1 = $16 - .const OFFSET_STRUCT_OBJECTATTRIBUTE_X = 3 .const OFFSET_STRUCT_RICOH_2C02_OAMADDR = 3 .const OFFSET_STRUCT_RICOH_2A03_OAMDMA = $14 .const OFFSET_STRUCT_RICOH_2C02_PPUADDR = 6 .const OFFSET_STRUCT_RICOH_2C02_PPUDATA = 7 + .const OFFSET_STRUCT_RICOH_2C02_PPUSCROLL = 5 + .const OFFSET_STRUCT_RICOH_2A03_JOY1 = $16 .const SIZEOF_BYTE = 1 - // $3000-$3EFF $0F00 Mirrors of $2000-$2EFF - // $3F00-$3F1F $0020 Palette RAM indexes + // $2000-$23bf $03c0 Name table 0 + .label PPU_NAME_TABLE_0 = $2000 + // $23c0-$23ff $0040 Attribute table 0 + .label PPU_ATTRIBUTE_TABLE_0 = $23c0 + // $3000-$3eff $0f00 Mirrors of $2000-$2eff + // $3f00-$3f1f $0020 Palette RAM indexes .label PPU_PALETTE = $3f00 // APU Frame Counter // generates low-frequency clocks for the channels and an optional 60 Hz interrupt. @@ -1657,8 +2928,8 @@ ASSEMBLER BEFORE OPTIMIZATION .label FR_COUNTER = $4017 // Pointer to the start of RAM memory .label MEMORY = 0 - // OAM (Object Attribute Memory) Buffer - // Will be transfered to the PPU via DMA + // Sprite OAM Buffer + // Will be transfered to the PPU via DMA during vblank .label OAM_BUFFER = $200 // PPU Status Register for reading in ASM .label PPU_PPUSTATUS = $2002 @@ -1674,6 +2945,8 @@ __b1_from___bbegin: // @1 __b1: // [2] call main + // [4] phi from @1 to main [phi:@1->main] +main_from___b1: jsr main // [3] phi from @1 to @end [phi:@1->@end] __bend_from___b1: @@ -1684,205 +2957,513 @@ __bend: // main // RESET Called when the NES is reset, including when it is turned on. main: { + jmp initNES1 + // main::initNES1 + initNES1: // asm { cld ldx#$ff txs } - // Initialize decimal-mode and stack cld ldx #$ff txs - jmp disableVideoOutput1 - // main::disableVideoOutput1 - disableVideoOutput1: - // [5] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0 -- _deref_pbuc1=vbuc2 + jmp initNES1_disableVideoOutput1 + // main::initNES1_disableVideoOutput1 + initNES1_disableVideoOutput1: + // [6] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta PPU - // [6] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // [7] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK - jmp disableAudioOutput1 - // main::disableAudioOutput1 - disableAudioOutput1: - // [7] *((const nomodify byte*) FR_COUNTER) ← (byte) $40 -- _deref_pbuc1=vbuc2 + jmp initNES1_disableAudioOutput1 + // main::initNES1_disableAudioOutput1 + initNES1_disableAudioOutput1: + // [8] *((const nomodify byte*) FR_COUNTER) ← (byte) $40 -- _deref_pbuc1=vbuc2 lda #$40 sta FR_COUNTER - // [8] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) ← (byte) $40 -- _deref_pbuc1=vbuc2 + // [9] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) ← (byte) $40 -- _deref_pbuc1=vbuc2 lda #$40 sta APU+OFFSET_STRUCT_RICOH_2A03_DMC_FREQ - jmp clearVBlankFlag1 - // main::clearVBlankFlag1 - clearVBlankFlag1: + jmp initNES1_clearVBlankFlag1 + // main::initNES1_clearVBlankFlag1 + initNES1_clearVBlankFlag1: // asm { ldaPPU_PPUSTATUS } lda PPU_PPUSTATUS - // [10] phi from main::clearVBlankFlag1 to main::waitForVBlank1 [phi:main::clearVBlankFlag1->main::waitForVBlank1] - waitForVBlank1_from_clearVBlankFlag1: - jmp waitForVBlank1 - // main::waitForVBlank1 - waitForVBlank1: - jmp waitForVBlank1___b1 - // main::waitForVBlank1_@1 - waitForVBlank1___b1: - // [11] (byte~) main::waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 -- vbuaa=_deref_pbuc1_band_vbuc2 + // [11] phi from main::initNES1_clearVBlankFlag1 to main::initNES1_waitForVBlank1 [phi:main::initNES1_clearVBlankFlag1->main::initNES1_waitForVBlank1] + initNES1_waitForVBlank1_from_initNES1_clearVBlankFlag1: + jmp initNES1_waitForVBlank1 + // main::initNES1_waitForVBlank1 + initNES1_waitForVBlank1: + jmp initNES1_waitForVBlank1___b1 + // main::initNES1_waitForVBlank1_@1 + initNES1_waitForVBlank1___b1: + // [12] (byte~) main::initNES1_waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 -- vbuaa=_deref_pbuc1_band_vbuc2 lda #$80 and PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS - // [12] if((byte) 0==(byte~) main::waitForVBlank1_$0) goto main::waitForVBlank1_@1 -- vbuc1_eq_vbuaa_then_la1 + // [13] if((byte) 0==(byte~) main::initNES1_waitForVBlank1_$0) goto main::initNES1_waitForVBlank1_@1 -- vbuc1_eq_vbuaa_then_la1 cmp #0 - beq waitForVBlank1___b1 - // [13] phi from main::waitForVBlank1_@1 to main::@1 [phi:main::waitForVBlank1_@1->main::@1] - __b1_from_waitForVBlank1___b1: - // [13] phi (byte) main::i#2 = (byte) 0 [phi:main::waitForVBlank1_@1->main::@1#0] -- vbuxx=vbuc1 + beq initNES1_waitForVBlank1___b1 + // [14] phi from main::initNES1_waitForVBlank1_@1 to main::initNES1_@1 [phi:main::initNES1_waitForVBlank1_@1->main::initNES1_@1] + initNES1___b1_from_initNES1_waitForVBlank1___b1: + // [14] phi (byte) main::initNES1_i#2 = (byte) 0 [phi:main::initNES1_waitForVBlank1_@1->main::initNES1_@1#0] -- vbuxx=vbuc1 ldx #0 - jmp __b1 - // [13] phi from main::@1 to main::@1 [phi:main::@1->main::@1] - __b1_from___b1: - // [13] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy - jmp __b1 - // main::@1 - __b1: - // [14] *((const nomodify byte*) MEMORY + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + jmp initNES1___b1 + // [14] phi from main::initNES1_@1 to main::initNES1_@1 [phi:main::initNES1_@1->main::initNES1_@1] + initNES1___b1_from_initNES1___b1: + // [14] phi (byte) main::initNES1_i#2 = (byte) main::initNES1_i#1 [phi:main::initNES1_@1->main::initNES1_@1#0] -- register_copy + jmp initNES1___b1 + // main::initNES1_@1 + initNES1___b1: + // [15] *((const nomodify byte*) MEMORY + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 lda #0 sta MEMORY,x - // [15] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + // [16] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 lda #0 sta MEMORY+$100,x - // [16] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + // [17] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 lda #0 sta MEMORY+$200,x - // [17] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + // [18] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 lda #0 sta MEMORY+$300,x - // [18] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + // [19] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 lda #0 sta MEMORY+$400,x - // [19] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + // [20] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 lda #0 sta MEMORY+$500,x - // [20] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + // [21] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 lda #0 sta MEMORY+$600,x - // [21] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + // [22] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 lda #0 sta MEMORY+$700,x - // [22] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx + // [23] (byte) main::initNES1_i#1 ← ++ (byte) main::initNES1_i#2 -- vbuxx=_inc_vbuxx inx - // [23] if((byte) 0!=(byte) main::i#1) goto main::@1 -- vbuc1_neq_vbuxx_then_la1 + // [24] if((byte) 0!=(byte) main::initNES1_i#1) goto main::initNES1_@1 -- vbuc1_neq_vbuxx_then_la1 cpx #0 - bne __b1_from___b1 - // [24] phi from main::@1 to main::waitForVBlank2 [phi:main::@1->main::waitForVBlank2] - waitForVBlank2_from___b1: - jmp waitForVBlank2 - // main::waitForVBlank2 - waitForVBlank2: - jmp waitForVBlank2___b1 - // main::waitForVBlank2_@1 - waitForVBlank2___b1: - // [25] (byte~) main::waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 -- vbuaa=_deref_pbuc1_band_vbuc2 + bne initNES1___b1_from_initNES1___b1 + // [25] phi from main::initNES1_@1 to main::initNES1_waitForVBlank2 [phi:main::initNES1_@1->main::initNES1_waitForVBlank2] + initNES1_waitForVBlank2_from_initNES1___b1: + jmp initNES1_waitForVBlank2 + // main::initNES1_waitForVBlank2 + initNES1_waitForVBlank2: + jmp initNES1_waitForVBlank2___b1 + // main::initNES1_waitForVBlank2_@1 + initNES1_waitForVBlank2___b1: + // [26] (byte~) main::initNES1_waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 -- vbuaa=_deref_pbuc1_band_vbuc2 lda #$80 and PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS - // [26] if((byte) 0==(byte~) main::waitForVBlank2_$0) goto main::waitForVBlank2_@1 -- vbuc1_eq_vbuaa_then_la1 + // [27] if((byte) 0==(byte~) main::initNES1_waitForVBlank2_$0) goto main::initNES1_waitForVBlank2_@1 -- vbuc1_eq_vbuaa_then_la1 cmp #0 - beq waitForVBlank2___b1 - // [27] phi from main::waitForVBlank2_@1 to main::@3 [phi:main::waitForVBlank2_@1->main::@3] - __b3_from_waitForVBlank2___b1: + beq initNES1_waitForVBlank2___b1 + jmp initNES1___b7 + // main::initNES1_@7 + initNES1___b7: + // asm { ldaPPU_PPUSTATUS } + lda PPU_PPUSTATUS + // [29] phi from main::initNES1_@7 to main::@8 [phi:main::initNES1_@7->main::@8] + __b8_from_initNES1___b7: + jmp __b8 + // main::@8 + __b8: + // [30] call ppuDataTransfer + // Transfer the palette + // [81] phi from main::@8 to ppuDataTransfer [phi:main::@8->ppuDataTransfer] + ppuDataTransfer_from___b8: + jsr ppuDataTransfer + // [31] phi from main::@8 to main::@9 [phi:main::@8->main::@9] + __b9_from___b8: + jmp __b9 + // main::@9 + __b9: + // [32] call ppuDataFill + // Clear the name table + // [71] phi from main::@9 to ppuDataFill [phi:main::@9->ppuDataFill] + ppuDataFill_from___b9: + // [71] phi (byte) ppuDataFill::val#4 = (byte) $fc [phi:main::@9->ppuDataFill#0] -- vbuxx=vbuc1 + ldx #$fc + // [71] phi (word) ppuDataFill::size#3 = (word) $3c0 [phi:main::@9->ppuDataFill#1] -- vwuz1=vwuc1 + lda #<$3c0 + sta.z ppuDataFill.size + lda #>$3c0 + sta.z ppuDataFill.size+1 + // [71] phi (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 = (void*)(const nomodify byte*) PPU_NAME_TABLE_0 [phi:main::@9->ppuDataFill#2] -- pvoz1=pvoc1 + lda #PPU_NAME_TABLE_0 + sta.z ppuDataFill.ppuDataPrepare1_ppuData+1 + jsr ppuDataFill + // [33] phi from main::@9 to main::@10 [phi:main::@9->main::@10] + __b10_from___b9: + jmp __b10 + // main::@10 + __b10: + // [34] call ppuDataFill + // Fill the PPU attribute table + // [71] phi from main::@10 to ppuDataFill [phi:main::@10->ppuDataFill] + ppuDataFill_from___b10: + // [71] phi (byte) ppuDataFill::val#4 = (byte) 0 [phi:main::@10->ppuDataFill#0] -- vbuxx=vbuc1 + ldx #0 + // [71] phi (word) ppuDataFill::size#3 = (byte) $40 [phi:main::@10->ppuDataFill#1] -- vwuz1=vbuc1 + lda #<$40 + sta.z ppuDataFill.size + lda #>$40 + sta.z ppuDataFill.size+1 + // [71] phi (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 = (void*)(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 [phi:main::@10->ppuDataFill#2] -- pvoz1=pvoc1 + lda #PPU_ATTRIBUTE_TABLE_0 + sta.z ppuDataFill.ppuDataPrepare1_ppuData+1 + jsr ppuDataFill + // [35] phi from main::@10 to main::@1 [phi:main::@10->main::@1] + __b1_from___b10: + // [35] phi (byte) main::x#2 = (byte) 0 [phi:main::@10->main::@1#0] -- vbuxx=vbuc1 + ldx #0 + jmp __b1 + // Show the entire tile set + //char ch=0; + //for(char y=0;y!=16;y++) { + // ppuDataPrepare(PPU_NAME_TABLE_0+32*4+4+(unsigned int)y*32); + // for(char x=0;x!=16;x++) + // ppuDataPut(ch++); + //} + // Show floor + // main::@1 + __b1: + // [36] if((byte) main::x#2<(byte) $20) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 + cpx #$20 + bcc __b2 + // [37] phi from main::@1 to main::@3 [phi:main::@1->main::@3] + __b3_from___b1: jmp __b3 // main::@3 __b3: - // [28] call initPalette - // Now the PPU is ready. - jsr initPalette - // [29] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + // [38] call ppuDataPutTile + // Show flag + // [52] phi from main::@3 to ppuDataPutTile [phi:main::@3->ppuDataPutTile] + ppuDataPutTile_from___b3: + // [52] phi (byte*) ppuDataPutTile::tile#10 = (const byte*) FLAG [phi:main::@3->ppuDataPutTile#0] -- pbuz1=pbuc1 + lda #FLAG + sta.z ppuDataPutTile.tile+1 + // [52] phi (nomodify void*) ppuDataPutTile::ppuData#2 = (void*)(const nomodify byte*) PPU_NAME_TABLE_0+(word)(number) $12*(number) $20+(byte) $1c [phi:main::@3->ppuDataPutTile#1] -- pvoz1=pvoc1 + lda #PPU_NAME_TABLE_0+$12*$20+$1c + sta.z ppuDataPutTile.ppuData+1 + jsr ppuDataPutTile + // [39] phi from main::@3 to main::@4 [phi:main::@3->main::@4] __b4_from___b3: + // [39] phi (byte) main::i#2 = (byte) 0 [phi:main::@3->main::@4#0] -- vbuxx=vbuc1 + ldx #0 jmp __b4 + // Initialize Sprite OAM Buffer with the SPRITE data // main::@4 __b4: - // [30] call initSpriteBuffer - // [34] phi from main::@4 to initSpriteBuffer [phi:main::@4->initSpriteBuffer] - initSpriteBuffer_from___b4: - jsr initSpriteBuffer + // [40] if((byte) main::i#2<(byte) 4*(const byte) SIZEOF_STRUCT_SPRITEDATA) goto main::@5 -- vbuxx_lt_vbuc1_then_la1 + cpx #4*SIZEOF_STRUCT_SPRITEDATA + bcc __b5 + jmp __b6 + // main::@6 + __b6: + // [41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // Set initial scroll + lda #0 + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL + // [42] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) -8 -- _deref_pbuc1=vbuc2 + lda #-8 + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL jmp enableVideoOutput1 // main::enableVideoOutput1 enableVideoOutput1: - // [31] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80 -- _deref_pbuc1=vbuc2 + // [43] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80 -- _deref_pbuc1=vbuc2 lda #$80 sta PPU - // [32] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $10 -- _deref_pbuc1=vbuc2 - lda #$10 + // [44] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $18 -- _deref_pbuc1=vbuc2 + lda #$18 sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK - // [33] phi from main::@2 main::enableVideoOutput1 to main::@2 [phi:main::@2/main::enableVideoOutput1->main::@2] - __b2_from___b2: - __b2_from_enableVideoOutput1: - jmp __b2 + // [45] phi from main::@7 main::enableVideoOutput1 to main::@7 [phi:main::@7/main::enableVideoOutput1->main::@7] + __b7_from___b7: + __b7_from_enableVideoOutput1: + jmp __b7 // Infinite loop - // main::@2 - __b2: - jmp __b2_from___b2 -} - // initSpriteBuffer -// Initialize OAM (Object Attribute Memory) Buffer with the SPRITE data -initSpriteBuffer: { - // [35] phi from initSpriteBuffer to initSpriteBuffer::@1 [phi:initSpriteBuffer->initSpriteBuffer::@1] - __b1_from_initSpriteBuffer: - // [35] phi (byte) initSpriteBuffer::i#2 = (byte) 0 [phi:initSpriteBuffer->initSpriteBuffer::@1#0] -- vbuxx=vbuc1 - ldx #0 - jmp __b1 - // [35] phi from initSpriteBuffer::@1 to initSpriteBuffer::@1 [phi:initSpriteBuffer::@1->initSpriteBuffer::@1] - __b1_from___b1: - // [35] phi (byte) initSpriteBuffer::i#2 = (byte) initSpriteBuffer::i#1 [phi:initSpriteBuffer::@1->initSpriteBuffer::@1#0] -- register_copy - jmp __b1 - // initSpriteBuffer::@1 - __b1: - // [36] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER + (byte) initSpriteBuffer::i#2) ← *((byte*)(const struct ObjectAttribute*) SPRITES + (byte) initSpriteBuffer::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx + // main::@7 + __b7: + jmp __b7_from___b7 + // main::@5 + __b5: + // [46] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER + (byte) main::i#2) ← *((byte*)(const struct SpriteData*) SPRITES + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx lda SPRITES,x sta OAM_BUFFER,x - // [37] (byte) initSpriteBuffer::i#1 ← ++ (byte) initSpriteBuffer::i#2 -- vbuxx=_inc_vbuxx + // [47] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx inx - // [38] if((byte) initSpriteBuffer::i#1!=(byte) 4*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) goto initSpriteBuffer::@1 -- vbuxx_neq_vbuc1_then_la1 - cpx #4*SIZEOF_STRUCT_OBJECTATTRIBUTE - bne __b1_from___b1 + // [39] phi from main::@5 to main::@4 [phi:main::@5->main::@4] + __b4_from___b5: + // [39] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@5->main::@4#0] -- register_copy + jmp __b4 + // main::@2 + __b2: + // [48] (nomodify byte*) ppuDataPutTile::ppuData#0 ← (const nomodify byte*) PPU_NAME_TABLE_0+(word)(number) $14*(number) $20 + (byte) main::x#2 -- pbuz1=pbuc1_plus_vbuxx + txa + clc + adc #PPU_NAME_TABLE_0+$14*$20 + adc #0 + sta.z ppuDataPutTile.ppuData+1 + // [49] (nomodify void*) ppuDataPutTile::ppuData#9 ← (void*)(nomodify byte*) ppuDataPutTile::ppuData#0 + // [50] call ppuDataPutTile + // [52] phi from main::@2 to ppuDataPutTile [phi:main::@2->ppuDataPutTile] + ppuDataPutTile_from___b2: + // [52] phi (byte*) ppuDataPutTile::tile#10 = (const byte*) FLOOR [phi:main::@2->ppuDataPutTile#0] -- pbuz1=pbuc1 + lda #FLOOR + sta.z ppuDataPutTile.tile+1 + // [52] phi (nomodify void*) ppuDataPutTile::ppuData#2 = (nomodify void*) ppuDataPutTile::ppuData#9 [phi:main::@2->ppuDataPutTile#1] -- register_copy + jsr ppuDataPutTile + jmp __b11 + // main::@11 + __b11: + // [51] (byte) main::x#1 ← (byte) main::x#2 + (byte) 2 -- vbuxx=vbuxx_plus_2 + inx + inx + // [35] phi from main::@11 to main::@1 [phi:main::@11->main::@1] + __b1_from___b11: + // [35] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@11->main::@1#0] -- register_copy + jmp __b1 +} + // ppuDataPutTile +// Transfer a 2x2 tile into the PPU memory +// - ppuData : Pointer in the PPU memory +// - tile : The tile to transfer +// ppuDataPutTile(byte* zp(6) ppuData, byte* zp(2) tile) +ppuDataPutTile: { + .label ppuDataPrepare2_ppuData = 6 + .label ppuData = 6 + .label tile = 2 + jmp ppuDataPrepare1 + // ppuDataPutTile::ppuDataPrepare1 + ppuDataPrepare1: + // [53] (byte~) ppuDataPutTile::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataPutTile::ppuData#2 -- vbuaa=_hi_pvoz1 + lda.z ppuData+1 + // [54] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare1_$0 -- _deref_pbuc1=vbuaa + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + // [55] (byte~) ppuDataPutTile::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataPutTile::ppuData#2 -- vbuaa=_lo_pvoz1 + lda.z ppuData + // [56] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare1_$1 -- _deref_pbuc1=vbuaa + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + jmp __b1 + // ppuDataPutTile::@1 + __b1: + // [57] (byte) ppuDataPutTile::ppuDataPut1_val#0 ← *((byte*) ppuDataPutTile::tile#10) -- vbuaa=_deref_pbuz1 + ldy #0 + lda (tile),y + jmp ppuDataPut1 + // ppuDataPutTile::ppuDataPut1 + ppuDataPut1: + // [58] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut1_val#0 -- _deref_pbuc1=vbuaa + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + jmp __b2 + // ppuDataPutTile::@2 + __b2: + // [59] (byte) ppuDataPutTile::ppuDataPut2_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 1) -- vbuaa=pbuz1_derefidx_vbuc1 + ldy #1 + lda (tile),y + jmp ppuDataPut2 + // ppuDataPutTile::ppuDataPut2 + ppuDataPut2: + // [60] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut2_val#0 -- _deref_pbuc1=vbuaa + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + jmp __b3 + // ppuDataPutTile::@3 + __b3: + // [61] (nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 ← (byte*)(nomodify void*) ppuDataPutTile::ppuData#2 + (byte) $20 -- pbuz1=pbuz1_plus_vbuc1 + lda #$20 + clc + adc.z ppuDataPrepare2_ppuData + sta.z ppuDataPrepare2_ppuData + bcc !+ + inc.z ppuDataPrepare2_ppuData+1 + !: + jmp ppuDataPrepare2 + // ppuDataPutTile::ppuDataPrepare2 + ppuDataPrepare2: + // [62] (byte~) ppuDataPutTile::ppuDataPrepare2_$0 ← > (void*)(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 -- vbuaa=_hi_pvoz1 + lda.z ppuDataPrepare2_ppuData+1 + // [63] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare2_$0 -- _deref_pbuc1=vbuaa + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + // [64] (byte~) ppuDataPutTile::ppuDataPrepare2_$1 ← < (void*)(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 -- vbuaa=_lo_pvoz1 + lda.z ppuDataPrepare2_ppuData + // [65] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare2_$1 -- _deref_pbuc1=vbuaa + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + jmp __b4 + // ppuDataPutTile::@4 + __b4: + // [66] (byte) ppuDataPutTile::ppuDataPut3_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 2) -- vbuaa=pbuz1_derefidx_vbuc1 + ldy #2 + lda (tile),y + jmp ppuDataPut3 + // ppuDataPutTile::ppuDataPut3 + ppuDataPut3: + // [67] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut3_val#0 -- _deref_pbuc1=vbuaa + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + jmp __b5 + // ppuDataPutTile::@5 + __b5: + // [68] (byte) ppuDataPutTile::ppuDataPut4_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 3) -- vbuaa=pbuz1_derefidx_vbuc1 + ldy #3 + lda (tile),y + jmp ppuDataPut4 + // ppuDataPutTile::ppuDataPut4 + ppuDataPut4: + // [69] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut4_val#0 -- _deref_pbuc1=vbuaa + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA jmp __breturn - // initSpriteBuffer::@return + // ppuDataPutTile::@return __breturn: - // [39] return + // [70] return rts } - // initPalette -// Copy palette values to PPU -initPalette: { - // asm { ldaPPU_PPUSTATUS } - // Reset the high/low latch to "high" - lda PPU_PPUSTATUS - // [41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify byte*) PPU_PALETTE -- _deref_pbuc1=vbuc2 - // Write the high byte of PPU Palette address - lda #>PPU_PALETTE + // ppuDataFill +// Fill a number of bytes in the PPU memory +// - ppuData : Pointer in the PPU memory +// - size : The number of bytes to transfer +// ppuDataFill(byte register(X) val, word zp(2) size) +ppuDataFill: { + .label ppuDataPrepare1_ppuData = 6 + .label i = 4 + .label size = 2 + jmp ppuDataPrepare1 + // ppuDataFill::ppuDataPrepare1 + ppuDataPrepare1: + // [72] (byte~) ppuDataFill::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 -- vbuaa=_hi_pvoz1 + lda.z ppuDataPrepare1_ppuData+1 + // [73] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$0 -- _deref_pbuc1=vbuaa sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR - // [42] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0 -- _deref_pbuc1=vbuc2 - // Write the low byte of PPU Palette address + // [74] (byte~) ppuDataFill::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 -- vbuaa=_lo_pvoz1 + lda.z ppuDataPrepare1_ppuData + // [75] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$1 -- _deref_pbuc1=vbuaa + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + // [76] phi from ppuDataFill::ppuDataPrepare1 to ppuDataFill::@1 [phi:ppuDataFill::ppuDataPrepare1->ppuDataFill::@1] + __b1_from_ppuDataPrepare1: + // [76] phi (word) ppuDataFill::i#2 = (word) 0 [phi:ppuDataFill::ppuDataPrepare1->ppuDataFill::@1#0] -- vwuz1=vwuc1 + lda #<0 + sta.z i + lda #>0 + sta.z i+1 + jmp __b1 + // Transfer to PPU + // ppuDataFill::@1 + __b1: + // [77] if((word) ppuDataFill::i#2<(word) ppuDataFill::size#3) goto ppuDataFill::ppuDataPut1 -- vwuz1_lt_vwuz2_then_la1 + lda.z i+1 + cmp.z size+1 + bcc ppuDataPut1 + bne !+ + lda.z i + cmp.z size + bcc ppuDataPut1 + !: + jmp __breturn + // ppuDataFill::@return + __breturn: + // [78] return + rts + // ppuDataFill::ppuDataPut1 + ppuDataPut1: + // [79] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataFill::val#4 -- _deref_pbuc1=vbuxx + stx PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + jmp __b2 + // ppuDataFill::@2 + __b2: + // [80] (word) ppuDataFill::i#1 ← ++ (word) ppuDataFill::i#2 -- vwuz1=_inc_vwuz1 + inc.z i + bne !+ + inc.z i+1 + !: + // [76] phi from ppuDataFill::@2 to ppuDataFill::@1 [phi:ppuDataFill::@2->ppuDataFill::@1] + __b1_from___b2: + // [76] phi (word) ppuDataFill::i#2 = (word) ppuDataFill::i#1 [phi:ppuDataFill::@2->ppuDataFill::@1#0] -- register_copy + jmp __b1 +} + // ppuDataTransfer +// Transfer a number of bytes from the CPU memory to the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) +// - ppuData : Pointer in the PPU memory +// - size : The number of bytes to transfer +ppuDataTransfer: { + .const size = $20*SIZEOF_BYTE + .label ppuData = PPU_PALETTE + .label cpuData = PALETTE + // Transfer to PPU + .label cpuSrc = 6 + .label i = 4 + jmp ppuDataPrepare1 + // ppuDataTransfer::ppuDataPrepare1 + ppuDataPrepare1: + // [82] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify void*) ppuDataTransfer::ppuData#0 -- _deref_pbuc1=vbuc2 + lda #>ppuData + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + // [83] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR - // [43] phi from initPalette to initPalette::@1 [phi:initPalette->initPalette::@1] - __b1_from_initPalette: - // [43] phi (byte) initPalette::i#2 = (byte) 0 [phi:initPalette->initPalette::@1#0] -- vbuxx=vbuc1 - ldx #0 + // [84] phi from ppuDataTransfer::ppuDataPrepare1 to ppuDataTransfer::@1 [phi:ppuDataTransfer::ppuDataPrepare1->ppuDataTransfer::@1] + __b1_from_ppuDataPrepare1: + // [84] phi (byte*) ppuDataTransfer::cpuSrc#2 = (byte*)(const nomodify void*) ppuDataTransfer::cpuData#0 [phi:ppuDataTransfer::ppuDataPrepare1->ppuDataTransfer::@1#0] -- pbuz1=pbuc1 + lda #cpuData + sta.z cpuSrc+1 + // [84] phi (word) ppuDataTransfer::i#2 = (word) 0 [phi:ppuDataTransfer::ppuDataPrepare1->ppuDataTransfer::@1#1] -- vwuz1=vwuc1 + lda #<0 + sta.z i + lda #>0 + sta.z i+1 jmp __b1 - // Write to PPU - // initPalette::@1 + // ppuDataTransfer::@1 __b1: - // [44] if((byte) initPalette::i#2<(byte) $20*(const byte) SIZEOF_BYTE) goto initPalette::@2 -- vbuxx_lt_vbuc1_then_la1 - cpx #$20*SIZEOF_BYTE + // [85] if((word) ppuDataTransfer::i#2<(const word) ppuDataTransfer::size#0) goto ppuDataTransfer::@2 -- vwuz1_lt_vwuc1_then_la1 + lda.z i+1 + cmp #>size bcc __b2 + bne !+ + lda.z i + cmp #initPalette::@1] - __b1_from___b2: - // [43] phi (byte) initPalette::i#2 = (byte) initPalette::i#1 [phi:initPalette::@2->initPalette::@1#0] -- register_copy + jmp __b3 + // ppuDataTransfer::@3 + __b3: + // [89] (byte*) ppuDataTransfer::cpuSrc#1 ← ++ (byte*) ppuDataTransfer::cpuSrc#2 -- pbuz1=_inc_pbuz1 + inc.z cpuSrc + bne !+ + inc.z cpuSrc+1 + !: + // [90] (word) ppuDataTransfer::i#1 ← ++ (word) ppuDataTransfer::i#2 -- vwuz1=_inc_vwuz1 + inc.z i + bne !+ + inc.z i+1 + !: + // [84] phi from ppuDataTransfer::@3 to ppuDataTransfer::@1 [phi:ppuDataTransfer::@3->ppuDataTransfer::@1] + __b1_from___b3: + // [84] phi (byte*) ppuDataTransfer::cpuSrc#2 = (byte*) ppuDataTransfer::cpuSrc#1 [phi:ppuDataTransfer::@3->ppuDataTransfer::@1#0] -- register_copy + // [84] phi (word) ppuDataTransfer::i#2 = (word) ppuDataTransfer::i#1 [phi:ppuDataTransfer::@3->ppuDataTransfer::@1#1] -- register_copy jmp __b1 } // vblank @@ -1894,104 +3475,83 @@ vblank: { pha tya pha - jmp transferSpriteBufferToPpu1 - // vblank::transferSpriteBufferToPpu1 - transferSpriteBufferToPpu1: - // [49] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 -- _deref_pbuc1=vbuc2 + jmp ppuSpriteBufferDmaTransfer1 + // vblank::ppuSpriteBufferDmaTransfer1 + ppuSpriteBufferDmaTransfer1: + // [92] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR - // [50] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct ObjectAttribute*) OAM_BUFFER -- _deref_pbuc1=vbuc2 + // [93] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct SpriteData*) OAM_BUFFER -- _deref_pbuc1=vbuc2 lda #>OAM_BUFFER sta APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA jmp __b4 // vblank::@4 __b4: - // [51] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1 -- _deref_pbuc1=vbuc2 - // Freeze the button positions. + // [94] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1 -- _deref_pbuc1=vbuc2 + // Latch the controller buttons lda #1 sta APU+OFFSET_STRUCT_RICOH_2A03_JOY1 - // [52] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // [95] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta APU+OFFSET_STRUCT_RICOH_2A03_JOY1 - // [53] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 -- vbuaa=_deref_pbuc1_band_vbuc2 + // [96] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 -- vbuaa=_deref_pbuc1_band_vbuc2 lda #1 and APU+OFFSET_STRUCT_RICOH_2A03_JOY1 - // [54] if((byte) 0==(byte~) vblank::$1) goto vblank::@1 -- vbuc1_eq_vbuaa_then_la1 + // [97] if((byte) 0==(byte~) vblank::$1) goto vblank::@1 -- vbuc1_eq_vbuaa_then_la1 cmp #0 beq __b1 - // [55] phi from vblank::@4 to vblank::@2 [phi:vblank::@4->vblank::@2] - __b2_from___b4: jmp __b2 // vblank::@2 __b2: - // [56] call moveLuigiRight - jsr moveLuigiRight + // [98] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) -- _deref_pbuc1=_inc__deref_pbuc1 + inc OAM_BUFFER + // [99] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_inc__deref_pbuc1 + inc OAM_BUFFER+1*SIZEOF_STRUCT_SPRITEDATA + // [100] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_inc__deref_pbuc1 + inc OAM_BUFFER+2*SIZEOF_STRUCT_SPRITEDATA + // [101] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_inc__deref_pbuc1 + inc OAM_BUFFER+3*SIZEOF_STRUCT_SPRITEDATA jmp __b1 // vblank::@1 __b1: - // [57] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 -- vbuaa=_deref_pbuc1_band_vbuc2 + // [102] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 -- vbuaa=_deref_pbuc1_band_vbuc2 lda #1 and APU+OFFSET_STRUCT_RICOH_2A03_JOY1 - // [58] if((byte) 0==(byte~) vblank::$3) goto vblank::@return -- vbuc1_eq_vbuaa_then_la1 + // [103] if((byte) 0==(byte~) vblank::$3) goto vblank::@return -- vbuc1_eq_vbuaa_then_la1 cmp #0 beq __breturn - // [59] phi from vblank::@1 to vblank::@3 [phi:vblank::@1->vblank::@3] - __b3_from___b1: jmp __b3 // vblank::@3 __b3: - // [60] call moveLuigiLeft - jsr moveLuigiLeft + // [104] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) -- _deref_pbuc1=_dec__deref_pbuc1 + dec OAM_BUFFER + // [105] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_dec__deref_pbuc1 + dec OAM_BUFFER+1*SIZEOF_STRUCT_SPRITEDATA + // [106] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_dec__deref_pbuc1 + dec OAM_BUFFER+2*SIZEOF_STRUCT_SPRITEDATA + // [107] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_dec__deref_pbuc1 + dec OAM_BUFFER+3*SIZEOF_STRUCT_SPRITEDATA jmp __breturn // vblank::@return __breturn: - // [61] return - exit interrupt(HARDWARE_STACK) + // [108] return - exit interrupt(HARDWARE_STACK) pla tay pla tax pla rti -} - // moveLuigiLeft -// move the Luigi sprites left -moveLuigiLeft: { - // [62] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) -- _deref_pbuc1=_dec__deref_pbuc1 - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X - // [63] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_dec__deref_pbuc1 - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+1*SIZEOF_STRUCT_OBJECTATTRIBUTE - // [64] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_dec__deref_pbuc1 - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+2*SIZEOF_STRUCT_OBJECTATTRIBUTE - // [65] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_dec__deref_pbuc1 - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+3*SIZEOF_STRUCT_OBJECTATTRIBUTE - jmp __breturn - // moveLuigiLeft::@return - __breturn: - // [66] return - rts -} - // moveLuigiRight -// move the Luigi sprites right -moveLuigiRight: { - // [67] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) -- _deref_pbuc1=_inc__deref_pbuc1 - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X - // [68] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_inc__deref_pbuc1 - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+1*SIZEOF_STRUCT_OBJECTATTRIBUTE - // [69] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_inc__deref_pbuc1 - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+2*SIZEOF_STRUCT_OBJECTATTRIBUTE - // [70] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_inc__deref_pbuc1 - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+3*SIZEOF_STRUCT_OBJECTATTRIBUTE - jmp __breturn - // moveLuigiRight::@return - __breturn: - // [71] return - rts } // File Data .segment Data + // Flag tile + FLAG: .byte $54, $55, $56, $57 + // Floor tile + FLOOR: .byte $85, $85, $86, $86 // Small Luigi Sprite Data SPRITES: .byte $80, $36, 2, $80, $80, $37, 2, $88, $88, $38, 2, $80, $88, $39, 2, $88 - PALETTE: .byte $f, $31, $32, $33, $f, $35, $36, $37, $f, $39, $3a, $3b, $f, $3d, $3e, $f, $f, $1c, $15, $14, $f, 2, $38, $3c, $f, $30, $37, $1a, $f, $f, $f, $f + // Color Palette + PALETTE: .byte $f, $13, $23, $33, $f, 6, $15, $36, $f, $39, $4a, $5b, $f, $3d, $4e, $5f, $f, $1c, $15, $14, $f, 2, $38, $3c, $f, $30, $37, $1a, $f, $f, $f, $f .segment Tiles TILES: .import binary "smb1_chr.bin" @@ -2002,30 +3562,53 @@ TILES: ASSEMBLER OPTIMIZATIONS Removing instruction jmp __b1 Removing instruction jmp __bend -Removing instruction jmp disableVideoOutput1 -Removing instruction jmp disableAudioOutput1 -Removing instruction jmp clearVBlankFlag1 -Removing instruction jmp waitForVBlank1 -Removing instruction jmp waitForVBlank1___b1 +Removing instruction jmp initNES1 +Removing instruction jmp initNES1_disableVideoOutput1 +Removing instruction jmp initNES1_disableAudioOutput1 +Removing instruction jmp initNES1_clearVBlankFlag1 +Removing instruction jmp initNES1_waitForVBlank1 +Removing instruction jmp initNES1_waitForVBlank1___b1 +Removing instruction jmp initNES1___b1 +Removing instruction jmp initNES1_waitForVBlank2 +Removing instruction jmp initNES1_waitForVBlank2___b1 +Removing instruction jmp initNES1___b7 +Removing instruction jmp __b8 +Removing instruction jmp __b9 +Removing instruction jmp __b10 Removing instruction jmp __b1 -Removing instruction jmp waitForVBlank2 -Removing instruction jmp waitForVBlank2___b1 Removing instruction jmp __b3 Removing instruction jmp __b4 +Removing instruction jmp __b6 Removing instruction jmp enableVideoOutput1 +Removing instruction jmp __b7 +Removing instruction jmp __b11 +Removing instruction jmp ppuDataPrepare1 +Removing instruction jmp __b1 +Removing instruction jmp ppuDataPut1 Removing instruction jmp __b2 +Removing instruction jmp ppuDataPut2 +Removing instruction jmp __b3 +Removing instruction jmp ppuDataPrepare2 +Removing instruction jmp __b4 +Removing instruction jmp ppuDataPut3 +Removing instruction jmp __b5 +Removing instruction jmp ppuDataPut4 +Removing instruction jmp __breturn +Removing instruction jmp ppuDataPrepare1 Removing instruction jmp __b1 Removing instruction jmp __breturn +Removing instruction jmp __b2 +Removing instruction jmp ppuDataPrepare1 Removing instruction jmp __b1 Removing instruction jmp __breturn -Removing instruction jmp transferSpriteBufferToPpu1 +Removing instruction jmp ppuDataPut1 +Removing instruction jmp __b3 +Removing instruction jmp ppuSpriteBufferDmaTransfer1 Removing instruction jmp __b4 Removing instruction jmp __b2 Removing instruction jmp __b1 Removing instruction jmp __b3 Removing instruction jmp __breturn -Removing instruction jmp __breturn -Removing instruction jmp __breturn Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #0 Removing instruction lda #$40 @@ -2036,67 +3619,97 @@ Removing instruction lda #0 Removing instruction lda #0 Removing instruction lda #0 Removing instruction lda #0 +Removing instruction lda #>0 +Removing instruction lda #>0 Succesful ASM optimization Pass5UnnecesaryLoadElimination -Replacing label waitForVBlank1___b1 with waitForVBlank1 -Replacing label __b1_from___b1 with __b1 -Replacing label waitForVBlank2___b1 with waitForVBlank2 -Replacing label __b1_from___b1 with __b1 +Replacing label initNES1_waitForVBlank1___b1 with initNES1_waitForVBlank1 +Replacing label initNES1___b1_from_initNES1___b1 with initNES1___b1 +Replacing label initNES1_waitForVBlank2___b1 with initNES1_waitForVBlank2 Removing instruction __b1_from___bbegin: Removing instruction __b1: +Removing instruction main_from___b1: Removing instruction __bend_from___b1: -Removing instruction waitForVBlank1_from_clearVBlankFlag1: -Removing instruction waitForVBlank1___b1: -Removing instruction __b1_from___b1: -Removing instruction waitForVBlank2_from___b1: -Removing instruction waitForVBlank2___b1: -Removing instruction __b3_from_waitForVBlank2___b1: -Removing instruction __b4_from___b3: -Removing instruction initSpriteBuffer_from___b4: -Removing instruction __b2_from_enableVideoOutput1: -Removing instruction __b1_from___b1: -Removing instruction __b2_from___b4: +Removing instruction initNES1_waitForVBlank1_from_initNES1_clearVBlankFlag1: +Removing instruction initNES1_waitForVBlank1___b1: +Removing instruction initNES1___b1_from_initNES1___b1: +Removing instruction initNES1_waitForVBlank2_from_initNES1___b1: +Removing instruction initNES1_waitForVBlank2___b1: +Removing instruction __b8_from_initNES1___b7: +Removing instruction __b9_from___b8: +Removing instruction __b10_from___b9: Removing instruction __b3_from___b1: +Removing instruction __b7_from_enableVideoOutput1: Succesful ASM optimization Pass5RedundantLabelElimination Removing instruction __bbegin: Removing instruction __bend: -Removing instruction disableVideoOutput1: -Removing instruction disableAudioOutput1: -Removing instruction clearVBlankFlag1: -Removing instruction __b1_from_waitForVBlank1___b1: +Removing instruction initNES1: +Removing instruction initNES1_disableVideoOutput1: +Removing instruction initNES1_disableAudioOutput1: +Removing instruction initNES1_clearVBlankFlag1: +Removing instruction initNES1___b1_from_initNES1_waitForVBlank1___b1: +Removing instruction initNES1___b7: +Removing instruction __b8: +Removing instruction ppuDataTransfer_from___b8: +Removing instruction __b9: +Removing instruction ppuDataFill_from___b9: +Removing instruction __b10: +Removing instruction ppuDataFill_from___b10: +Removing instruction __b1_from___b10: Removing instruction __b3: -Removing instruction __b4: +Removing instruction ppuDataPutTile_from___b3: +Removing instruction __b4_from___b3: +Removing instruction __b6: Removing instruction enableVideoOutput1: +Removing instruction __b7: +Removing instruction __b4_from___b5: +Removing instruction ppuDataPutTile_from___b2: +Removing instruction __b11: +Removing instruction __b1_from___b11: +Removing instruction ppuDataPrepare1: +Removing instruction __b1: +Removing instruction ppuDataPut1: Removing instruction __b2: -Removing instruction __b1_from_initSpriteBuffer: +Removing instruction ppuDataPut2: +Removing instruction __b3: +Removing instruction ppuDataPrepare2: +Removing instruction __b4: +Removing instruction ppuDataPut3: +Removing instruction __b5: +Removing instruction ppuDataPut4: Removing instruction __breturn: -Removing instruction __b1_from_initPalette: +Removing instruction ppuDataPrepare1: +Removing instruction __b1_from_ppuDataPrepare1: Removing instruction __breturn: +Removing instruction __b2: Removing instruction __b1_from___b2: -Removing instruction transferSpriteBufferToPpu1: +Removing instruction ppuDataPrepare1: +Removing instruction __b1_from_ppuDataPrepare1: +Removing instruction __breturn: +Removing instruction ppuDataPut1: +Removing instruction __b3: +Removing instruction __b1_from___b3: +Removing instruction ppuSpriteBufferDmaTransfer1: Removing instruction __b4: Removing instruction __b2: Removing instruction __b3: -Removing instruction __breturn: -Removing instruction __breturn: Succesful ASM optimization Pass5UnusedLabelElimination Removing instruction jsr main Succesful ASM optimization Pass5SkipBegin -Relabelling long label __b2_from___b2 to __b2 +Relabelling long label __b7_from___b7 to __b3 Succesful ASM optimization Pass5RelabelLongLabels -Removing instruction jmp __b1 -Removing instruction jmp __b1 +Removing instruction jmp initNES1___b1 Succesful ASM optimization Pass5NextJumpElimination -Replacing instruction ldx #0 with TAX FINAL SYMBOL TABLE (label) @1 (label) @begin (label) @end (const struct RICOH_2A03*) APU = (struct RICOH_2A03*) 16384 +(const byte*) FLAG[] = { (byte) $54, (byte) $55, (byte) $56, (byte) $57 } +(const byte*) FLOOR[] = { (byte) $85, (byte) $85, (byte) $86, (byte) $86 } (const nomodify byte*) FR_COUNTER = (byte*) 16407 (const nomodify byte*) MEMORY = (byte*) 0 -(const nomodify struct ObjectAttribute*) OAM_BUFFER = (struct ObjectAttribute*) 512 -(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X = (byte) 3 +(const nomodify struct SpriteData*) OAM_BUFFER = (struct SpriteData*) 512 (const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ = (byte) $10 (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 = (byte) $16 (const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA = (byte) $14 @@ -2104,13 +3717,12 @@ FINAL SYMBOL TABLE (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR = (byte) 6 (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA = (byte) 7 (const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK = (byte) 1 +(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL = (byte) 5 (const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS = (byte) 2 -(byte) ObjectAttribute::attributes -(byte) ObjectAttribute::tile -(byte) ObjectAttribute::x -(byte) ObjectAttribute::y -(const byte*) PALETTE[(number) $20] = { (byte) $f, (byte) $31, (byte) $32, (byte) $33, (byte) $f, (byte) $35, (byte) $36, (byte) $37, (byte) $f, (byte) $39, (byte) $3a, (byte) $3b, (byte) $f, (byte) $3d, (byte) $3e, (byte) $f, (byte) $f, (byte) $1c, (byte) $15, (byte) $14, (byte) $f, (byte) 2, (byte) $38, (byte) $3c, (byte) $f, (byte) $30, (byte) $37, (byte) $1a, (byte) $f, (byte) $f, (byte) $f, (byte) $f } +(const byte*) PALETTE[(number) $20] = { (byte) $f, (byte) $13, (byte) $23, (byte) $33, (byte) $f, (byte) 6, (byte) $15, (byte) $36, (byte) $f, (byte) $39, (byte) $4a, (byte) $5b, (byte) $f, (byte) $3d, (byte) $4e, (byte) $5f, (byte) $f, (byte) $1c, (byte) $15, (byte) $14, (byte) $f, (byte) 2, (byte) $38, (byte) $3c, (byte) $f, (byte) $30, (byte) $37, (byte) $1a, (byte) $f, (byte) $f, (byte) $f, (byte) $f } (const struct RICOH_2C02*) PPU = (struct RICOH_2C02*) 8192 +(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 = (byte*) 9152 +(const nomodify byte*) PPU_NAME_TABLE_0 = (byte*) 8192 (const nomodify byte*) PPU_PALETTE = (byte*) 16128 (const to_volatile byte*) PPU_PPUSTATUS = (byte*) 8194 (byte) RICOH_2A03::DMC_FREQ @@ -2146,46 +3758,124 @@ FINAL SYMBOL TABLE (byte) RICOH_2C02::PPUSCROLL (volatile byte) RICOH_2C02::PPUSTATUS loadstore (const byte) SIZEOF_BYTE = (byte) 1 -(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE = (byte) 4 -(const struct ObjectAttribute*) SPRITES[] = { { y: (byte) $80, tile: (byte) $36, attributes: (byte) 2, x: (byte) $80 }, { y: (byte) $80, tile: (byte) $37, attributes: (byte) 2, x: (byte) $88 }, { y: (byte) $88, tile: (byte) $38, attributes: (byte) 2, x: (byte) $80 }, { y: (byte) $88, tile: (byte) $39, attributes: (byte) 2, x: (byte) $88 } } +(const byte) SIZEOF_STRUCT_SPRITEDATA = (byte) 4 +(const struct SpriteData*) SPRITES[] = { { y: (byte) $80, tile: (byte) $36, attributes: (byte) 2, x: (byte) $80 }, { y: (byte) $80, tile: (byte) $37, attributes: (byte) 2, x: (byte) $88 }, { y: (byte) $88, tile: (byte) $38, attributes: (byte) 2, x: (byte) $80 }, { y: (byte) $88, tile: (byte) $39, attributes: (byte) 2, x: (byte) $88 } } +(byte) SpriteData::attributes +(byte) SpriteData::tile +(byte) SpriteData::x +(byte) SpriteData::y (const byte*) TILES[] = kickasm {{ .import binary "smb1_chr.bin" }} (const to_nomodify void()**) VECTORS[] = { &interrupt(HARDWARE_STACK)(void()) vblank(), &(void()) main(), (void()*) 0 } -(void()) initPalette() -(label) initPalette::@1 -(label) initPalette::@2 -(label) initPalette::@return -(byte) initPalette::i -(byte) initPalette::i#1 reg byte x 2002.0 -(byte) initPalette::i#2 reg byte x 1334.6666666666667 -(void()) initSpriteBuffer() -(label) initSpriteBuffer::@1 -(label) initSpriteBuffer::@return -(byte) initSpriteBuffer::i -(byte) initSpriteBuffer::i#1 reg byte x 1501.5 -(byte) initSpriteBuffer::i#2 reg byte x 2002.0 (void()) main() (label) main::@1 +(label) main::@10 +(label) main::@11 (label) main::@2 (label) main::@3 (label) main::@4 -(label) main::clearVBlankFlag1 -(label) main::disableAudioOutput1 -(label) main::disableVideoOutput1 +(label) main::@5 +(label) main::@6 +(label) main::@7 +(label) main::@8 +(label) main::@9 (label) main::enableVideoOutput1 (byte) main::i -(byte) main::i#1 reg byte x 151.5 -(byte) main::i#2 reg byte x 112.22222222222223 -(label) main::waitForVBlank1 -(byte~) main::waitForVBlank1_$0 reg byte a 202.0 -(label) main::waitForVBlank1_@1 -(label) main::waitForVBlank2 -(byte~) main::waitForVBlank2_$0 reg byte a 202.0 -(label) main::waitForVBlank2_@1 -(void()) moveLuigiLeft() -(label) moveLuigiLeft::@return -(void()) moveLuigiRight() -(label) moveLuigiRight::@return +(byte) main::i#1 reg byte x 202.0 +(byte) main::i#2 reg byte x 168.33333333333331 +(label) main::initNES1 +(label) main::initNES1_@1 +(label) main::initNES1_@7 +(label) main::initNES1_clearVBlankFlag1 +(label) main::initNES1_disableAudioOutput1 +(label) main::initNES1_disableVideoOutput1 +(byte) main::initNES1_i +(byte) main::initNES1_i#1 reg byte x 151.5 +(byte) main::initNES1_i#2 reg byte x 112.22222222222223 +(label) main::initNES1_waitForVBlank1 +(byte~) main::initNES1_waitForVBlank1_$0 reg byte a 202.0 +(label) main::initNES1_waitForVBlank1_@1 +(label) main::initNES1_waitForVBlank2 +(byte~) main::initNES1_waitForVBlank2_$0 reg byte a 202.0 +(label) main::initNES1_waitForVBlank2_@1 +(byte) main::x +(byte) main::x#1 reg byte x 202.0 +(byte) main::x#2 reg byte x 80.8 +(void()) ppuDataFill((nomodify void*) ppuDataFill::ppuData , (byte) ppuDataFill::val , (word) ppuDataFill::size) +(label) ppuDataFill::@1 +(label) ppuDataFill::@2 +(label) ppuDataFill::@return +(word) ppuDataFill::i +(word) ppuDataFill::i#1 i zp[2]:4 2002.0 +(word) ppuDataFill::i#2 i zp[2]:4 1001.0 +(nomodify void*) ppuDataFill::ppuData +(label) ppuDataFill::ppuDataPrepare1 +(byte~) ppuDataFill::ppuDataPrepare1_$0 reg byte a 202.0 +(byte~) ppuDataFill::ppuDataPrepare1_$1 reg byte a 202.0 +(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData +(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataPrepare1_ppuData zp[2]:6 67.33333333333333 +(label) ppuDataFill::ppuDataPut1 +(byte) ppuDataFill::ppuDataPut1_val +(word) ppuDataFill::size +(word) ppuDataFill::size#3 size zp[2]:2 111.22222222222223 +(byte) ppuDataFill::val +(byte) ppuDataFill::val#4 reg byte x 111.22222222222223 +(void()) ppuDataPutTile((nomodify void*) ppuDataPutTile::ppuData , (byte*) ppuDataPutTile::tile) +(label) ppuDataPutTile::@1 +(label) ppuDataPutTile::@2 +(label) ppuDataPutTile::@3 +(label) ppuDataPutTile::@4 +(label) ppuDataPutTile::@5 +(label) ppuDataPutTile::@return +(nomodify void*) ppuDataPutTile::ppuData +(nomodify byte*) ppuDataPutTile::ppuData#0 ppuData zp[2]:6 101.0 +(nomodify void*) ppuDataPutTile::ppuData#2 ppuData zp[2]:6 233.66666666666669 +(nomodify void*) ppuDataPutTile::ppuData#9 ppuData zp[2]:6 202.0 +(label) ppuDataPutTile::ppuDataPrepare1 +(byte~) ppuDataPutTile::ppuDataPrepare1_$0 reg byte a 2002.0 +(byte~) ppuDataPutTile::ppuDataPrepare1_$1 reg byte a 2002.0 +(nomodify void*) ppuDataPutTile::ppuDataPrepare1_ppuData +(label) ppuDataPutTile::ppuDataPrepare2 +(byte~) ppuDataPutTile::ppuDataPrepare2_$0 reg byte a 2002.0 +(byte~) ppuDataPutTile::ppuDataPrepare2_$1 reg byte a 2002.0 +(nomodify void*) ppuDataPutTile::ppuDataPrepare2_ppuData +(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 ppuDataPrepare2_ppuData zp[2]:6 333.6666666666667 +(label) ppuDataPutTile::ppuDataPut1 +(byte) ppuDataPutTile::ppuDataPut1_val +(byte) ppuDataPutTile::ppuDataPut1_val#0 reg byte a 2002.0 +(label) ppuDataPutTile::ppuDataPut2 +(byte) ppuDataPutTile::ppuDataPut2_val +(byte) ppuDataPutTile::ppuDataPut2_val#0 reg byte a 2002.0 +(label) ppuDataPutTile::ppuDataPut3 +(byte) ppuDataPutTile::ppuDataPut3_val +(byte) ppuDataPutTile::ppuDataPut3_val#0 reg byte a 2002.0 +(label) ppuDataPutTile::ppuDataPut4 +(byte) ppuDataPutTile::ppuDataPut4_val +(byte) ppuDataPutTile::ppuDataPut4_val#0 reg byte a 2002.0 +(byte*) ppuDataPutTile::tile +(byte*) ppuDataPutTile::tile#10 tile zp[2]:2 250.25 +(void()) ppuDataTransfer((nomodify void*) ppuDataTransfer::ppuData , (nomodify void*) ppuDataTransfer::cpuData , (word) ppuDataTransfer::size) +(label) ppuDataTransfer::@1 +(label) ppuDataTransfer::@2 +(label) ppuDataTransfer::@3 +(label) ppuDataTransfer::@return +(nomodify void*) ppuDataTransfer::cpuData +(const nomodify void*) ppuDataTransfer::cpuData#0 cpuData = (void*)(const byte*) PALETTE +(byte*) ppuDataTransfer::cpuSrc +(byte*) ppuDataTransfer::cpuSrc#1 cpuSrc zp[2]:6 1001.0 +(byte*) ppuDataTransfer::cpuSrc#2 cpuSrc zp[2]:6 750.75 +(word) ppuDataTransfer::i +(word) ppuDataTransfer::i#1 i zp[2]:4 2002.0 +(word) ppuDataTransfer::i#2 i zp[2]:4 600.5999999999999 +(nomodify void*) ppuDataTransfer::ppuData +(const nomodify void*) ppuDataTransfer::ppuData#0 ppuData = (void*)(const nomodify byte*) PPU_PALETTE +(label) ppuDataTransfer::ppuDataPrepare1 +(nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData +(label) ppuDataTransfer::ppuDataPut1 +(byte) ppuDataTransfer::ppuDataPut1_val +(byte) ppuDataTransfer::ppuDataPut1_val#0 reg byte a 2002.0 +(word) ppuDataTransfer::size +(const word) ppuDataTransfer::size#0 size = (byte) $20*(const byte) SIZEOF_BYTE interrupt(HARDWARE_STACK)(void()) vblank() (byte~) vblank::$1 reg byte a 4.0 (byte~) vblank::$3 reg byte a 4.0 @@ -2194,19 +3884,35 @@ interrupt(HARDWARE_STACK)(void()) vblank() (label) vblank::@3 (label) vblank::@4 (label) vblank::@return -(label) vblank::transferSpriteBufferToPpu1 +(label) vblank::ppuSpriteBufferDmaTransfer1 +(struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer +reg byte x [ main::initNES1_i#2 main::initNES1_i#1 ] +reg byte x [ main::x#2 main::x#1 ] reg byte x [ main::i#2 main::i#1 ] -reg byte x [ initSpriteBuffer::i#2 initSpriteBuffer::i#1 ] -reg byte x [ initPalette::i#2 initPalette::i#1 ] -reg byte a [ main::waitForVBlank1_$0 ] -reg byte a [ main::waitForVBlank2_$0 ] +zp[2]:2 [ ppuDataFill::size#3 ppuDataPutTile::tile#10 ] +reg byte x [ ppuDataFill::val#4 ] +zp[2]:4 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ppuDataFill::i#2 ppuDataFill::i#1 ] +zp[2]:6 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataPutTile::ppuData#2 ppuDataPutTile::ppuData#9 ppuDataPutTile::ppuData#0 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] +reg byte a [ main::initNES1_waitForVBlank1_$0 ] +reg byte a [ main::initNES1_waitForVBlank2_$0 ] +reg byte a [ ppuDataPutTile::ppuDataPrepare1_$0 ] +reg byte a [ ppuDataPutTile::ppuDataPrepare1_$1 ] +reg byte a [ ppuDataPutTile::ppuDataPut1_val#0 ] +reg byte a [ ppuDataPutTile::ppuDataPut2_val#0 ] +reg byte a [ ppuDataPutTile::ppuDataPrepare2_$0 ] +reg byte a [ ppuDataPutTile::ppuDataPrepare2_$1 ] +reg byte a [ ppuDataPutTile::ppuDataPut3_val#0 ] +reg byte a [ ppuDataPutTile::ppuDataPut4_val#0 ] +reg byte a [ ppuDataFill::ppuDataPrepare1_$0 ] +reg byte a [ ppuDataFill::ppuDataPrepare1_$1 ] +reg byte a [ ppuDataTransfer::ppuDataPut1_val#0 ] reg byte a [ vblank::$1 ] reg byte a [ vblank::$3 ] FINAL ASSEMBLER -Score: 1475 +Score: 3009 // File Comments // A minimal NES demo @@ -2241,19 +3947,23 @@ Score: 1475 .segment Code // Global Constants & labels - .const SIZEOF_STRUCT_OBJECTATTRIBUTE = 4 + .const SIZEOF_STRUCT_SPRITEDATA = 4 .const OFFSET_STRUCT_RICOH_2A03_DMC_FREQ = $10 .const OFFSET_STRUCT_RICOH_2C02_PPUMASK = 1 .const OFFSET_STRUCT_RICOH_2C02_PPUSTATUS = 2 - .const OFFSET_STRUCT_RICOH_2A03_JOY1 = $16 - .const OFFSET_STRUCT_OBJECTATTRIBUTE_X = 3 .const OFFSET_STRUCT_RICOH_2C02_OAMADDR = 3 .const OFFSET_STRUCT_RICOH_2A03_OAMDMA = $14 .const OFFSET_STRUCT_RICOH_2C02_PPUADDR = 6 .const OFFSET_STRUCT_RICOH_2C02_PPUDATA = 7 + .const OFFSET_STRUCT_RICOH_2C02_PPUSCROLL = 5 + .const OFFSET_STRUCT_RICOH_2A03_JOY1 = $16 .const SIZEOF_BYTE = 1 - // $3000-$3EFF $0F00 Mirrors of $2000-$2EFF - // $3F00-$3F1F $0020 Palette RAM indexes + // $2000-$23bf $03c0 Name table 0 + .label PPU_NAME_TABLE_0 = $2000 + // $23c0-$23ff $0040 Attribute table 0 + .label PPU_ATTRIBUTE_TABLE_0 = $23c0 + // $3000-$3eff $0f00 Mirrors of $2000-$2eff + // $3f00-$3f1f $0020 Palette RAM indexes .label PPU_PALETTE = $3f00 // APU Frame Counter // generates low-frequency clocks for the channels and an optional 60 Hz interrupt. @@ -2269,8 +3979,8 @@ Score: 1475 .label FR_COUNTER = $4017 // Pointer to the start of RAM memory .label MEMORY = 0 - // OAM (Object Attribute Memory) Buffer - // Will be transfered to the PPU via DMA + // Sprite OAM Buffer + // Will be transfered to the PPU via DMA during vblank .label OAM_BUFFER = $200 // PPU Status Register for reading in ASM .label PPU_PPUSTATUS = $2002 @@ -2282,194 +3992,480 @@ Score: 1475 // [1] phi from @begin to @1 [phi:@begin->@1] // @1 // [2] call main + // [4] phi from @1 to main [phi:@1->main] // [3] phi from @1 to @end [phi:@1->@end] // @end .segment Code // main // RESET Called when the NES is reset, including when it is turned on. main: { + // main::initNES1 // asm // asm { cld ldx#$ff txs } - // Initialize decimal-mode and stack cld ldx #$ff txs - // main::disableVideoOutput1 + // main::initNES1_disableVideoOutput1 // PPU->PPUCTRL = 0 - // [5] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // [6] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta PPU // PPU->PPUMASK = 0 - // [6] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // [7] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) 0 -- _deref_pbuc1=vbuc2 sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK - // main::disableAudioOutput1 + // main::initNES1_disableAudioOutput1 // *FR_COUNTER = 0b01000000 - // [7] *((const nomodify byte*) FR_COUNTER) ← (byte) $40 -- _deref_pbuc1=vbuc2 + // [8] *((const nomodify byte*) FR_COUNTER) ← (byte) $40 -- _deref_pbuc1=vbuc2 lda #$40 sta FR_COUNTER // APU->DMC_FREQ = 0b01000000 - // [8] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) ← (byte) $40 -- _deref_pbuc1=vbuc2 + // [9] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) ← (byte) $40 -- _deref_pbuc1=vbuc2 sta APU+OFFSET_STRUCT_RICOH_2A03_DMC_FREQ - // main::clearVBlankFlag1 + // main::initNES1_clearVBlankFlag1 // asm // asm { ldaPPU_PPUSTATUS } lda PPU_PPUSTATUS - // [10] phi from main::clearVBlankFlag1 to main::waitForVBlank1 [phi:main::clearVBlankFlag1->main::waitForVBlank1] - // main::waitForVBlank1 - waitForVBlank1: - // main::waitForVBlank1_@1 + // [11] phi from main::initNES1_clearVBlankFlag1 to main::initNES1_waitForVBlank1 [phi:main::initNES1_clearVBlankFlag1->main::initNES1_waitForVBlank1] + // main::initNES1_waitForVBlank1 + initNES1_waitForVBlank1: + // main::initNES1_waitForVBlank1_@1 // PPU->PPUSTATUS&0x80 - // [11] (byte~) main::waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 -- vbuaa=_deref_pbuc1_band_vbuc2 + // [12] (byte~) main::initNES1_waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 -- vbuaa=_deref_pbuc1_band_vbuc2 lda #$80 and PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS // while(!(PPU->PPUSTATUS&0x80)) - // [12] if((byte) 0==(byte~) main::waitForVBlank1_$0) goto main::waitForVBlank1_@1 -- vbuc1_eq_vbuaa_then_la1 + // [13] if((byte) 0==(byte~) main::initNES1_waitForVBlank1_$0) goto main::initNES1_waitForVBlank1_@1 -- vbuc1_eq_vbuaa_then_la1 cmp #0 - beq waitForVBlank1 - // [13] phi from main::waitForVBlank1_@1 to main::@1 [phi:main::waitForVBlank1_@1->main::@1] - // [13] phi (byte) main::i#2 = (byte) 0 [phi:main::waitForVBlank1_@1->main::@1#0] -- vbuxx=vbuc1 + beq initNES1_waitForVBlank1 + // [14] phi from main::initNES1_waitForVBlank1_@1 to main::initNES1_@1 [phi:main::initNES1_waitForVBlank1_@1->main::initNES1_@1] + // [14] phi (byte) main::initNES1_i#2 = (byte) 0 [phi:main::initNES1_waitForVBlank1_@1->main::initNES1_@1#0] -- vbuxx=vbuc1 ldx #0 - // [13] phi from main::@1 to main::@1 [phi:main::@1->main::@1] - // [13] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy - // main::@1 - __b1: + // [14] phi from main::initNES1_@1 to main::initNES1_@1 [phi:main::initNES1_@1->main::initNES1_@1] + // [14] phi (byte) main::initNES1_i#2 = (byte) main::initNES1_i#1 [phi:main::initNES1_@1->main::initNES1_@1#0] -- register_copy + // main::initNES1_@1 + initNES1___b1: // (MEMORY+0x000)[i] = 0 - // [14] *((const nomodify byte*) MEMORY + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + // [15] *((const nomodify byte*) MEMORY + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 lda #0 sta MEMORY,x // (MEMORY+0x100)[i] = 0 - // [15] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + // [16] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 sta MEMORY+$100,x // (MEMORY+0x200)[i] = 0 - // [16] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + // [17] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 sta MEMORY+$200,x // (MEMORY+0x300)[i] = 0 - // [17] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + // [18] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 sta MEMORY+$300,x // (MEMORY+0x400)[i] = 0 - // [18] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + // [19] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 sta MEMORY+$400,x // (MEMORY+0x500)[i] = 0 - // [19] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + // [20] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 sta MEMORY+$500,x // (MEMORY+0x600)[i] = 0 - // [20] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + // [21] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 sta MEMORY+$600,x // (MEMORY+0x700)[i] = 0 - // [21] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 + // [22] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::initNES1_i#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2 sta MEMORY+$700,x // while (++i) - // [22] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx + // [23] (byte) main::initNES1_i#1 ← ++ (byte) main::initNES1_i#2 -- vbuxx=_inc_vbuxx inx - // [23] if((byte) 0!=(byte) main::i#1) goto main::@1 -- vbuc1_neq_vbuxx_then_la1 + // [24] if((byte) 0!=(byte) main::initNES1_i#1) goto main::initNES1_@1 -- vbuc1_neq_vbuxx_then_la1 cpx #0 - bne __b1 - // [24] phi from main::@1 to main::waitForVBlank2 [phi:main::@1->main::waitForVBlank2] - // main::waitForVBlank2 - waitForVBlank2: - // main::waitForVBlank2_@1 + bne initNES1___b1 + // [25] phi from main::initNES1_@1 to main::initNES1_waitForVBlank2 [phi:main::initNES1_@1->main::initNES1_waitForVBlank2] + // main::initNES1_waitForVBlank2 + initNES1_waitForVBlank2: + // main::initNES1_waitForVBlank2_@1 // PPU->PPUSTATUS&0x80 - // [25] (byte~) main::waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 -- vbuaa=_deref_pbuc1_band_vbuc2 + // [26] (byte~) main::initNES1_waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80 -- vbuaa=_deref_pbuc1_band_vbuc2 lda #$80 and PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS // while(!(PPU->PPUSTATUS&0x80)) - // [26] if((byte) 0==(byte~) main::waitForVBlank2_$0) goto main::waitForVBlank2_@1 -- vbuc1_eq_vbuaa_then_la1 + // [27] if((byte) 0==(byte~) main::initNES1_waitForVBlank2_$0) goto main::initNES1_waitForVBlank2_@1 -- vbuc1_eq_vbuaa_then_la1 cmp #0 - beq waitForVBlank2 - // [27] phi from main::waitForVBlank2_@1 to main::@3 [phi:main::waitForVBlank2_@1->main::@3] - // main::@3 - // initPalette() - // [28] call initPalette - // Now the PPU is ready. - jsr initPalette - // [29] phi from main::@3 to main::@4 [phi:main::@3->main::@4] - // main::@4 - // initSpriteBuffer() - // [30] call initSpriteBuffer - // [34] phi from main::@4 to initSpriteBuffer [phi:main::@4->initSpriteBuffer] - jsr initSpriteBuffer - // main::enableVideoOutput1 - // PPU->PPUCTRL = 0b10000000 - // [31] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80 -- _deref_pbuc1=vbuc2 - lda #$80 - sta PPU - // PPU->PPUMASK = 0b00010000 - // [32] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $10 -- _deref_pbuc1=vbuc2 - lda #$10 - sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK - // [33] phi from main::@2 main::enableVideoOutput1 to main::@2 [phi:main::@2/main::enableVideoOutput1->main::@2] - __b2: - // Infinite loop - // main::@2 - jmp __b2 -} - // initSpriteBuffer -// Initialize OAM (Object Attribute Memory) Buffer with the SPRITE data -initSpriteBuffer: { - // [35] phi from initSpriteBuffer to initSpriteBuffer::@1 [phi:initSpriteBuffer->initSpriteBuffer::@1] - // [35] phi (byte) initSpriteBuffer::i#2 = (byte) 0 [phi:initSpriteBuffer->initSpriteBuffer::@1#0] -- vbuxx=vbuc1 - ldx #0 - // [35] phi from initSpriteBuffer::@1 to initSpriteBuffer::@1 [phi:initSpriteBuffer::@1->initSpriteBuffer::@1] - // [35] phi (byte) initSpriteBuffer::i#2 = (byte) initSpriteBuffer::i#1 [phi:initSpriteBuffer::@1->initSpriteBuffer::@1#0] -- register_copy - // initSpriteBuffer::@1 - __b1: - // ((char*)OAM_BUFFER)[i] = ((char*)SPRITES)[i] - // [36] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER + (byte) initSpriteBuffer::i#2) ← *((byte*)(const struct ObjectAttribute*) SPRITES + (byte) initSpriteBuffer::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx - lda SPRITES,x - sta OAM_BUFFER,x - // while (++i!=sizeof(SPRITES)) - // [37] (byte) initSpriteBuffer::i#1 ← ++ (byte) initSpriteBuffer::i#2 -- vbuxx=_inc_vbuxx - inx - // [38] if((byte) initSpriteBuffer::i#1!=(byte) 4*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) goto initSpriteBuffer::@1 -- vbuxx_neq_vbuc1_then_la1 - cpx #4*SIZEOF_STRUCT_OBJECTATTRIBUTE - bne __b1 - // initSpriteBuffer::@return - // } - // [39] return - rts -} - // initPalette -// Copy palette values to PPU -initPalette: { + beq initNES1_waitForVBlank2 + // main::initNES1_@7 // asm // asm { ldaPPU_PPUSTATUS } - // Reset the high/low latch to "high" lda PPU_PPUSTATUS - // PPU->PPUADDR = >PPU_PALETTE - // [41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify byte*) PPU_PALETTE -- _deref_pbuc1=vbuc2 - // Write the high byte of PPU Palette address - lda #>PPU_PALETTE + // [29] phi from main::initNES1_@7 to main::@8 [phi:main::initNES1_@7->main::@8] + // main::@8 + // ppuDataTransfer(PPU_PALETTE, PALETTE, sizeof(PALETTE)) + // [30] call ppuDataTransfer + // Transfer the palette + // [81] phi from main::@8 to ppuDataTransfer [phi:main::@8->ppuDataTransfer] + jsr ppuDataTransfer + // [31] phi from main::@8 to main::@9 [phi:main::@8->main::@9] + // main::@9 + // ppuDataFill(PPU_NAME_TABLE_0, 0xfc, 0x3c0) + // [32] call ppuDataFill + // Clear the name table + // [71] phi from main::@9 to ppuDataFill [phi:main::@9->ppuDataFill] + // [71] phi (byte) ppuDataFill::val#4 = (byte) $fc [phi:main::@9->ppuDataFill#0] -- vbuxx=vbuc1 + ldx #$fc + // [71] phi (word) ppuDataFill::size#3 = (word) $3c0 [phi:main::@9->ppuDataFill#1] -- vwuz1=vwuc1 + lda #<$3c0 + sta.z ppuDataFill.size + lda #>$3c0 + sta.z ppuDataFill.size+1 + // [71] phi (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 = (void*)(const nomodify byte*) PPU_NAME_TABLE_0 [phi:main::@9->ppuDataFill#2] -- pvoz1=pvoc1 + lda #PPU_NAME_TABLE_0 + sta.z ppuDataFill.ppuDataPrepare1_ppuData+1 + jsr ppuDataFill + // [33] phi from main::@9 to main::@10 [phi:main::@9->main::@10] + // main::@10 + // ppuDataFill(PPU_ATTRIBUTE_TABLE_0, 0, 0x40) + // [34] call ppuDataFill + // Fill the PPU attribute table + // [71] phi from main::@10 to ppuDataFill [phi:main::@10->ppuDataFill] + // [71] phi (byte) ppuDataFill::val#4 = (byte) 0 [phi:main::@10->ppuDataFill#0] -- vbuxx=vbuc1 + ldx #0 + // [71] phi (word) ppuDataFill::size#3 = (byte) $40 [phi:main::@10->ppuDataFill#1] -- vwuz1=vbuc1 + lda #<$40 + sta.z ppuDataFill.size + lda #>$40 + sta.z ppuDataFill.size+1 + // [71] phi (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 = (void*)(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 [phi:main::@10->ppuDataFill#2] -- pvoz1=pvoc1 + lda #PPU_ATTRIBUTE_TABLE_0 + sta.z ppuDataFill.ppuDataPrepare1_ppuData+1 + jsr ppuDataFill + // [35] phi from main::@10 to main::@1 [phi:main::@10->main::@1] + // [35] phi (byte) main::x#2 = (byte) 0 [phi:main::@10->main::@1#0] -- vbuxx=vbuc1 + ldx #0 + // Show the entire tile set + //char ch=0; + //for(char y=0;y!=16;y++) { + // ppuDataPrepare(PPU_NAME_TABLE_0+32*4+4+(unsigned int)y*32); + // for(char x=0;x!=16;x++) + // ppuDataPut(ch++); + //} + // Show floor + // main::@1 + __b1: + // for(char x=0;x<32;x+=2) + // [36] if((byte) main::x#2<(byte) $20) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 + cpx #$20 + bcc __b2 + // [37] phi from main::@1 to main::@3 [phi:main::@1->main::@3] + // main::@3 + // ppuDataPutTile(PPU_NAME_TABLE_0+18*32+28, FLAG) + // [38] call ppuDataPutTile + // Show flag + // [52] phi from main::@3 to ppuDataPutTile [phi:main::@3->ppuDataPutTile] + // [52] phi (byte*) ppuDataPutTile::tile#10 = (const byte*) FLAG [phi:main::@3->ppuDataPutTile#0] -- pbuz1=pbuc1 + lda #FLAG + sta.z ppuDataPutTile.tile+1 + // [52] phi (nomodify void*) ppuDataPutTile::ppuData#2 = (void*)(const nomodify byte*) PPU_NAME_TABLE_0+(word)(number) $12*(number) $20+(byte) $1c [phi:main::@3->ppuDataPutTile#1] -- pvoz1=pvoc1 + lda #PPU_NAME_TABLE_0+$12*$20+$1c + sta.z ppuDataPutTile.ppuData+1 + jsr ppuDataPutTile + // [39] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + // [39] phi (byte) main::i#2 = (byte) 0 [phi:main::@3->main::@4#0] -- vbuxx=vbuc1 + ldx #0 + // Initialize Sprite OAM Buffer with the SPRITE data + // main::@4 + __b4: + // for(char i=0;iPPUSCROLL = 0 + // [41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // Set initial scroll + lda #0 + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL + // PPU->PPUSCROLL = -8 + // [42] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) -8 -- _deref_pbuc1=vbuc2 + lda #-8 + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL + // main::enableVideoOutput1 + // PPU->PPUCTRL = 0b10000000 + // [43] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80 -- _deref_pbuc1=vbuc2 + lda #$80 + sta PPU + // PPU->PPUMASK = 0b00011000 + // [44] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $18 -- _deref_pbuc1=vbuc2 + lda #$18 + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK + // [45] phi from main::@7 main::enableVideoOutput1 to main::@7 [phi:main::@7/main::enableVideoOutput1->main::@7] + __b3: + // Infinite loop + // main::@7 + jmp __b3 + // main::@5 + __b5: + // ((char*)OAM_BUFFER)[i] = ((char*)SPRITES)[i] + // [46] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER + (byte) main::i#2) ← *((byte*)(const struct SpriteData*) SPRITES + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx + lda SPRITES,x + sta OAM_BUFFER,x + // for(char i=0;imain::@4] + // [39] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@5->main::@4#0] -- register_copy + jmp __b4 + // main::@2 + __b2: + // PPU_NAME_TABLE_0+20*32+x + // [48] (nomodify byte*) ppuDataPutTile::ppuData#0 ← (const nomodify byte*) PPU_NAME_TABLE_0+(word)(number) $14*(number) $20 + (byte) main::x#2 -- pbuz1=pbuc1_plus_vbuxx + txa + clc + adc #PPU_NAME_TABLE_0+$14*$20 + adc #0 + sta.z ppuDataPutTile.ppuData+1 + // [49] (nomodify void*) ppuDataPutTile::ppuData#9 ← (void*)(nomodify byte*) ppuDataPutTile::ppuData#0 + // ppuDataPutTile(PPU_NAME_TABLE_0+20*32+x, FLOOR) + // [50] call ppuDataPutTile + // [52] phi from main::@2 to ppuDataPutTile [phi:main::@2->ppuDataPutTile] + // [52] phi (byte*) ppuDataPutTile::tile#10 = (const byte*) FLOOR [phi:main::@2->ppuDataPutTile#0] -- pbuz1=pbuc1 + lda #FLOOR + sta.z ppuDataPutTile.tile+1 + // [52] phi (nomodify void*) ppuDataPutTile::ppuData#2 = (nomodify void*) ppuDataPutTile::ppuData#9 [phi:main::@2->ppuDataPutTile#1] -- register_copy + jsr ppuDataPutTile + // main::@11 + // x+=2 + // [51] (byte) main::x#1 ← (byte) main::x#2 + (byte) 2 -- vbuxx=vbuxx_plus_2 + inx + inx + // [35] phi from main::@11 to main::@1 [phi:main::@11->main::@1] + // [35] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@11->main::@1#0] -- register_copy + jmp __b1 +} + // ppuDataPutTile +// Transfer a 2x2 tile into the PPU memory +// - ppuData : Pointer in the PPU memory +// - tile : The tile to transfer +// ppuDataPutTile(byte* zp(6) ppuData, byte* zp(2) tile) +ppuDataPutTile: { + .label ppuDataPrepare2_ppuData = 6 + .label ppuData = 6 + .label tile = 2 + // ppuDataPutTile::ppuDataPrepare1 + // >ppuData + // [53] (byte~) ppuDataPutTile::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataPutTile::ppuData#2 -- vbuaa=_hi_pvoz1 + lda.z ppuData+1 + // PPU->PPUADDR = >ppuData + // [54] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare1_$0 -- _deref_pbuc1=vbuaa sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR - // PPU->PPUADDR = PPUADDR = PPUDATA = val + // [58] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut1_val#0 -- _deref_pbuc1=vbuaa + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + // ppuDataPutTile::@2 + // ppuDataPut(tile[1]) + // [59] (byte) ppuDataPutTile::ppuDataPut2_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 1) -- vbuaa=pbuz1_derefidx_vbuc1 + ldy #1 + lda (tile),y + // ppuDataPutTile::ppuDataPut2 + // PPU->PPUDATA = val + // [60] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut2_val#0 -- _deref_pbuc1=vbuaa + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + // ppuDataPutTile::@3 + // (char*)ppuData+32 + // [61] (nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 ← (byte*)(nomodify void*) ppuDataPutTile::ppuData#2 + (byte) $20 -- pbuz1=pbuz1_plus_vbuc1 + lda #$20 + clc + adc.z ppuDataPrepare2_ppuData + sta.z ppuDataPrepare2_ppuData + bcc !+ + inc.z ppuDataPrepare2_ppuData+1 + !: + // ppuDataPutTile::ppuDataPrepare2 + // >ppuData + // [62] (byte~) ppuDataPutTile::ppuDataPrepare2_$0 ← > (void*)(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 -- vbuaa=_hi_pvoz1 + lda.z ppuDataPrepare2_ppuData+1 + // PPU->PPUADDR = >ppuData + // [63] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataPutTile::ppuDataPrepare2_$0 -- _deref_pbuc1=vbuaa + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + // PPUADDR = PPUDATA = val + // [67] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut3_val#0 -- _deref_pbuc1=vbuaa + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + // ppuDataPutTile::@5 + // ppuDataPut(tile[3]) + // [68] (byte) ppuDataPutTile::ppuDataPut4_val#0 ← *((byte*) ppuDataPutTile::tile#10 + (byte) 3) -- vbuaa=pbuz1_derefidx_vbuc1 + ldy #3 + lda (tile),y + // ppuDataPutTile::ppuDataPut4 + // PPU->PPUDATA = val + // [69] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataPutTile::ppuDataPut4_val#0 -- _deref_pbuc1=vbuaa + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + // ppuDataPutTile::@return + // } + // [70] return + rts +} + // ppuDataFill +// Fill a number of bytes in the PPU memory +// - ppuData : Pointer in the PPU memory +// - size : The number of bytes to transfer +// ppuDataFill(byte register(X) val, word zp(2) size) +ppuDataFill: { + .label ppuDataPrepare1_ppuData = 6 + .label i = 4 + .label size = 2 + // ppuDataFill::ppuDataPrepare1 + // >ppuData + // [72] (byte~) ppuDataFill::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 -- vbuaa=_hi_pvoz1 + lda.z ppuDataPrepare1_ppuData+1 + // PPU->PPUADDR = >ppuData + // [73] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$0 -- _deref_pbuc1=vbuaa + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + // PPUADDR = ppuDataFill::@1] + // [76] phi (word) ppuDataFill::i#2 = (word) 0 [phi:ppuDataFill::ppuDataPrepare1->ppuDataFill::@1#0] -- vwuz1=vwuc1 + lda #<0 + sta.z i + sta.z i+1 + // Transfer to PPU + // ppuDataFill::@1 + __b1: + // for(unsigned int i=0;iPPUDATA = val + // [79] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataFill::val#4 -- _deref_pbuc1=vbuxx + stx PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA + // ppuDataFill::@2 + // for(unsigned int i=0;ippuDataFill::@1] + // [76] phi (word) ppuDataFill::i#2 = (word) ppuDataFill::i#1 [phi:ppuDataFill::@2->ppuDataFill::@1#0] -- register_copy + jmp __b1 +} + // ppuDataTransfer +// Transfer a number of bytes from the CPU memory to the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) +// - ppuData : Pointer in the PPU memory +// - size : The number of bytes to transfer +ppuDataTransfer: { + .const size = $20*SIZEOF_BYTE + .label ppuData = PPU_PALETTE + .label cpuData = PALETTE + // Transfer to PPU + .label cpuSrc = 6 + .label i = 4 + // ppuDataTransfer::ppuDataPrepare1 + // PPU->PPUADDR = >ppuData + // [82] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify void*) ppuDataTransfer::ppuData#0 -- _deref_pbuc1=vbuc2 + lda #>ppuData + sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR + // PPU->PPUADDR = initPalette::@1] - // [43] phi (byte) initPalette::i#2 = (byte) 0 [phi:initPalette->initPalette::@1#0] -- vbuxx=vbuc1 - tax - // Write to PPU - // initPalette::@1 + // [84] phi from ppuDataTransfer::ppuDataPrepare1 to ppuDataTransfer::@1 [phi:ppuDataTransfer::ppuDataPrepare1->ppuDataTransfer::@1] + // [84] phi (byte*) ppuDataTransfer::cpuSrc#2 = (byte*)(const nomodify void*) ppuDataTransfer::cpuData#0 [phi:ppuDataTransfer::ppuDataPrepare1->ppuDataTransfer::@1#0] -- pbuz1=pbuc1 + lda #cpuData + sta.z cpuSrc+1 + // [84] phi (word) ppuDataTransfer::i#2 = (word) 0 [phi:ppuDataTransfer::ppuDataPrepare1->ppuDataTransfer::@1#1] -- vwuz1=vwuc1 + lda #<0 + sta.z i + sta.z i+1 + // ppuDataTransfer::@1 __b1: - // for(char i=0;isize bcc __b2 - // initPalette::@return + bne !+ + lda.z i + cmp #PPUDATA = PALETTE[i] - // [46] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← *((const byte*) PALETTE + (byte) initPalette::i#2) -- _deref_pbuc1=pbuc2_derefidx_vbuxx - lda PALETTE,x + // ppuDataPut(*cpuSrc++) + // [87] (byte) ppuDataTransfer::ppuDataPut1_val#0 ← *((byte*) ppuDataTransfer::cpuSrc#2) -- vbuaa=_deref_pbuz1 + ldy #0 + lda (cpuSrc),y + // ppuDataTransfer::ppuDataPut1 + // PPU->PPUDATA = val + // [88] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataTransfer::ppuDataPut1_val#0 -- _deref_pbuc1=vbuaa sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA - // for(char i=0;iinitPalette::@1] - // [43] phi (byte) initPalette::i#2 = (byte) initPalette::i#1 [phi:initPalette::@2->initPalette::@1#0] -- register_copy + // ppuDataTransfer::@3 + // ppuDataPut(*cpuSrc++); + // [89] (byte*) ppuDataTransfer::cpuSrc#1 ← ++ (byte*) ppuDataTransfer::cpuSrc#2 -- pbuz1=_inc_pbuz1 + inc.z cpuSrc + bne !+ + inc.z cpuSrc+1 + !: + // for(unsigned int i=0;ippuDataTransfer::@1] + // [84] phi (byte*) ppuDataTransfer::cpuSrc#2 = (byte*) ppuDataTransfer::cpuSrc#1 [phi:ppuDataTransfer::@3->ppuDataTransfer::@1#0] -- register_copy + // [84] phi (word) ppuDataTransfer::i#2 = (word) ppuDataTransfer::i#1 [phi:ppuDataTransfer::@3->ppuDataTransfer::@1#1] -- register_copy jmp __b1 } // vblank @@ -2481,109 +4477,90 @@ vblank: { pha tya pha - // vblank::transferSpriteBufferToPpu1 + // vblank::ppuSpriteBufferDmaTransfer1 // PPU->OAMADDR = 0 - // [49] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // [92] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR - // APU->OAMDMA = >OAM_BUFFER - // [50] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct ObjectAttribute*) OAM_BUFFER -- _deref_pbuc1=vbuc2 + // APU->OAMDMA = >spriteBuffer + // [93] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const nomodify struct SpriteData*) OAM_BUFFER -- _deref_pbuc1=vbuc2 lda #>OAM_BUFFER sta APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA // vblank::@4 // APU->JOY1 = 1 - // [51] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1 -- _deref_pbuc1=vbuc2 - // Freeze the button positions. + // [94] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1 -- _deref_pbuc1=vbuc2 + // Latch the controller buttons lda #1 sta APU+OFFSET_STRUCT_RICOH_2A03_JOY1 // APU->JOY1 = 0 - // [52] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0 -- _deref_pbuc1=vbuc2 + // [95] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0 -- _deref_pbuc1=vbuc2 lda #0 sta APU+OFFSET_STRUCT_RICOH_2A03_JOY1 // APU->JOY1&0b00000001 - // [53] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 -- vbuaa=_deref_pbuc1_band_vbuc2 + // [96] (byte~) vblank::$1 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 -- vbuaa=_deref_pbuc1_band_vbuc2 lda #1 and APU+OFFSET_STRUCT_RICOH_2A03_JOY1 // if(APU->JOY1&0b00000001) - // [54] if((byte) 0==(byte~) vblank::$1) goto vblank::@1 -- vbuc1_eq_vbuaa_then_la1 + // [97] if((byte) 0==(byte~) vblank::$1) goto vblank::@1 -- vbuc1_eq_vbuaa_then_la1 cmp #0 beq __b1 - // [55] phi from vblank::@4 to vblank::@2 [phi:vblank::@4->vblank::@2] // vblank::@2 - // moveLuigiRight() - // [56] call moveLuigiRight - jsr moveLuigiRight + // OAM_BUFFER[0].y++; + // [98] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) -- _deref_pbuc1=_inc__deref_pbuc1 + inc OAM_BUFFER + // OAM_BUFFER[1].y++; + // [99] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_inc__deref_pbuc1 + inc OAM_BUFFER+1*SIZEOF_STRUCT_SPRITEDATA + // OAM_BUFFER[2].y++; + // [100] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_inc__deref_pbuc1 + inc OAM_BUFFER+2*SIZEOF_STRUCT_SPRITEDATA + // OAM_BUFFER[3].y++; + // [101] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← ++ *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_inc__deref_pbuc1 + inc OAM_BUFFER+3*SIZEOF_STRUCT_SPRITEDATA // vblank::@1 __b1: // APU->JOY1&0b00000001 - // [57] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 -- vbuaa=_deref_pbuc1_band_vbuc2 + // [102] (byte~) vblank::$3 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1 -- vbuaa=_deref_pbuc1_band_vbuc2 lda #1 and APU+OFFSET_STRUCT_RICOH_2A03_JOY1 // if(APU->JOY1&0b00000001) - // [58] if((byte) 0==(byte~) vblank::$3) goto vblank::@return -- vbuc1_eq_vbuaa_then_la1 + // [103] if((byte) 0==(byte~) vblank::$3) goto vblank::@return -- vbuc1_eq_vbuaa_then_la1 cmp #0 beq __breturn - // [59] phi from vblank::@1 to vblank::@3 [phi:vblank::@1->vblank::@3] // vblank::@3 - // moveLuigiLeft() - // [60] call moveLuigiLeft - jsr moveLuigiLeft + // OAM_BUFFER[0].y--; + // [104] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER) -- _deref_pbuc1=_dec__deref_pbuc1 + dec OAM_BUFFER + // OAM_BUFFER[1].y--; + // [105] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 1*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_dec__deref_pbuc1 + dec OAM_BUFFER+1*SIZEOF_STRUCT_SPRITEDATA + // OAM_BUFFER[2].y--; + // [106] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 2*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_dec__deref_pbuc1 + dec OAM_BUFFER+2*SIZEOF_STRUCT_SPRITEDATA + // OAM_BUFFER[3].y--; + // [107] *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) ← -- *((byte*)(const nomodify struct SpriteData*) OAM_BUFFER+(byte) 3*(const byte) SIZEOF_STRUCT_SPRITEDATA) -- _deref_pbuc1=_dec__deref_pbuc1 + dec OAM_BUFFER+3*SIZEOF_STRUCT_SPRITEDATA // vblank::@return __breturn: // } - // [61] return - exit interrupt(HARDWARE_STACK) + // [108] return - exit interrupt(HARDWARE_STACK) pla tay pla tax pla rti -} - // moveLuigiLeft -// move the Luigi sprites left -moveLuigiLeft: { - // OAM_BUFFER[0].x--; - // [62] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) -- _deref_pbuc1=_dec__deref_pbuc1 - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X - // OAM_BUFFER[1].x--; - // [63] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_dec__deref_pbuc1 - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+1*SIZEOF_STRUCT_OBJECTATTRIBUTE - // OAM_BUFFER[2].x--; - // [64] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_dec__deref_pbuc1 - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+2*SIZEOF_STRUCT_OBJECTATTRIBUTE - // OAM_BUFFER[3].x--; - // [65] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← -- *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_dec__deref_pbuc1 - dec OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+3*SIZEOF_STRUCT_OBJECTATTRIBUTE - // moveLuigiLeft::@return - // } - // [66] return - rts -} - // moveLuigiRight -// move the Luigi sprites right -moveLuigiRight: { - // OAM_BUFFER[0].x++; - // [67] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X) -- _deref_pbuc1=_inc__deref_pbuc1 - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X - // OAM_BUFFER[1].x++; - // [68] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 1*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_inc__deref_pbuc1 - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+1*SIZEOF_STRUCT_OBJECTATTRIBUTE - // OAM_BUFFER[2].x++; - // [69] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 2*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_inc__deref_pbuc1 - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+2*SIZEOF_STRUCT_OBJECTATTRIBUTE - // OAM_BUFFER[3].x++; - // [70] *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) ← ++ *((byte*)(const nomodify struct ObjectAttribute*) OAM_BUFFER+(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X+(byte) 3*(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE) -- _deref_pbuc1=_inc__deref_pbuc1 - inc OAM_BUFFER+OFFSET_STRUCT_OBJECTATTRIBUTE_X+3*SIZEOF_STRUCT_OBJECTATTRIBUTE - // moveLuigiRight::@return - // } - // [71] return - rts } // File Data .segment Data + // Flag tile + FLAG: .byte $54, $55, $56, $57 + // Floor tile + FLOOR: .byte $85, $85, $86, $86 // Small Luigi Sprite Data SPRITES: .byte $80, $36, 2, $80, $80, $37, 2, $88, $88, $38, 2, $80, $88, $39, 2, $88 - PALETTE: .byte $f, $31, $32, $33, $f, $35, $36, $37, $f, $39, $3a, $3b, $f, $3d, $3e, $f, $f, $1c, $15, $14, $f, 2, $38, $3c, $f, $30, $37, $1a, $f, $f, $f, $f + // Color Palette + PALETTE: .byte $f, $13, $23, $33, $f, 6, $15, $36, $f, $39, $4a, $5b, $f, $3d, $4e, $5f, $f, $1c, $15, $14, $f, 2, $38, $3c, $f, $30, $37, $1a, $f, $f, $f, $f .segment Tiles TILES: .import binary "smb1_chr.bin" diff --git a/src/test/ref/examples/nes/nes-demo.sym b/src/test/ref/examples/nes/nes-demo.sym index cce9449aa..b7a13bed1 100644 --- a/src/test/ref/examples/nes/nes-demo.sym +++ b/src/test/ref/examples/nes/nes-demo.sym @@ -2,10 +2,11 @@ (label) @begin (label) @end (const struct RICOH_2A03*) APU = (struct RICOH_2A03*) 16384 +(const byte*) FLAG[] = { (byte) $54, (byte) $55, (byte) $56, (byte) $57 } +(const byte*) FLOOR[] = { (byte) $85, (byte) $85, (byte) $86, (byte) $86 } (const nomodify byte*) FR_COUNTER = (byte*) 16407 (const nomodify byte*) MEMORY = (byte*) 0 -(const nomodify struct ObjectAttribute*) OAM_BUFFER = (struct ObjectAttribute*) 512 -(const byte) OFFSET_STRUCT_OBJECTATTRIBUTE_X = (byte) 3 +(const nomodify struct SpriteData*) OAM_BUFFER = (struct SpriteData*) 512 (const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ = (byte) $10 (const byte) OFFSET_STRUCT_RICOH_2A03_JOY1 = (byte) $16 (const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA = (byte) $14 @@ -13,13 +14,12 @@ (const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR = (byte) 6 (const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA = (byte) 7 (const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK = (byte) 1 +(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL = (byte) 5 (const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS = (byte) 2 -(byte) ObjectAttribute::attributes -(byte) ObjectAttribute::tile -(byte) ObjectAttribute::x -(byte) ObjectAttribute::y -(const byte*) PALETTE[(number) $20] = { (byte) $f, (byte) $31, (byte) $32, (byte) $33, (byte) $f, (byte) $35, (byte) $36, (byte) $37, (byte) $f, (byte) $39, (byte) $3a, (byte) $3b, (byte) $f, (byte) $3d, (byte) $3e, (byte) $f, (byte) $f, (byte) $1c, (byte) $15, (byte) $14, (byte) $f, (byte) 2, (byte) $38, (byte) $3c, (byte) $f, (byte) $30, (byte) $37, (byte) $1a, (byte) $f, (byte) $f, (byte) $f, (byte) $f } +(const byte*) PALETTE[(number) $20] = { (byte) $f, (byte) $13, (byte) $23, (byte) $33, (byte) $f, (byte) 6, (byte) $15, (byte) $36, (byte) $f, (byte) $39, (byte) $4a, (byte) $5b, (byte) $f, (byte) $3d, (byte) $4e, (byte) $5f, (byte) $f, (byte) $1c, (byte) $15, (byte) $14, (byte) $f, (byte) 2, (byte) $38, (byte) $3c, (byte) $f, (byte) $30, (byte) $37, (byte) $1a, (byte) $f, (byte) $f, (byte) $f, (byte) $f } (const struct RICOH_2C02*) PPU = (struct RICOH_2C02*) 8192 +(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 = (byte*) 9152 +(const nomodify byte*) PPU_NAME_TABLE_0 = (byte*) 8192 (const nomodify byte*) PPU_PALETTE = (byte*) 16128 (const to_volatile byte*) PPU_PPUSTATUS = (byte*) 8194 (byte) RICOH_2A03::DMC_FREQ @@ -55,46 +55,124 @@ (byte) RICOH_2C02::PPUSCROLL (volatile byte) RICOH_2C02::PPUSTATUS loadstore (const byte) SIZEOF_BYTE = (byte) 1 -(const byte) SIZEOF_STRUCT_OBJECTATTRIBUTE = (byte) 4 -(const struct ObjectAttribute*) SPRITES[] = { { y: (byte) $80, tile: (byte) $36, attributes: (byte) 2, x: (byte) $80 }, { y: (byte) $80, tile: (byte) $37, attributes: (byte) 2, x: (byte) $88 }, { y: (byte) $88, tile: (byte) $38, attributes: (byte) 2, x: (byte) $80 }, { y: (byte) $88, tile: (byte) $39, attributes: (byte) 2, x: (byte) $88 } } +(const byte) SIZEOF_STRUCT_SPRITEDATA = (byte) 4 +(const struct SpriteData*) SPRITES[] = { { y: (byte) $80, tile: (byte) $36, attributes: (byte) 2, x: (byte) $80 }, { y: (byte) $80, tile: (byte) $37, attributes: (byte) 2, x: (byte) $88 }, { y: (byte) $88, tile: (byte) $38, attributes: (byte) 2, x: (byte) $80 }, { y: (byte) $88, tile: (byte) $39, attributes: (byte) 2, x: (byte) $88 } } +(byte) SpriteData::attributes +(byte) SpriteData::tile +(byte) SpriteData::x +(byte) SpriteData::y (const byte*) TILES[] = kickasm {{ .import binary "smb1_chr.bin" }} (const to_nomodify void()**) VECTORS[] = { &interrupt(HARDWARE_STACK)(void()) vblank(), &(void()) main(), (void()*) 0 } -(void()) initPalette() -(label) initPalette::@1 -(label) initPalette::@2 -(label) initPalette::@return -(byte) initPalette::i -(byte) initPalette::i#1 reg byte x 2002.0 -(byte) initPalette::i#2 reg byte x 1334.6666666666667 -(void()) initSpriteBuffer() -(label) initSpriteBuffer::@1 -(label) initSpriteBuffer::@return -(byte) initSpriteBuffer::i -(byte) initSpriteBuffer::i#1 reg byte x 1501.5 -(byte) initSpriteBuffer::i#2 reg byte x 2002.0 (void()) main() (label) main::@1 +(label) main::@10 +(label) main::@11 (label) main::@2 (label) main::@3 (label) main::@4 -(label) main::clearVBlankFlag1 -(label) main::disableAudioOutput1 -(label) main::disableVideoOutput1 +(label) main::@5 +(label) main::@6 +(label) main::@7 +(label) main::@8 +(label) main::@9 (label) main::enableVideoOutput1 (byte) main::i -(byte) main::i#1 reg byte x 151.5 -(byte) main::i#2 reg byte x 112.22222222222223 -(label) main::waitForVBlank1 -(byte~) main::waitForVBlank1_$0 reg byte a 202.0 -(label) main::waitForVBlank1_@1 -(label) main::waitForVBlank2 -(byte~) main::waitForVBlank2_$0 reg byte a 202.0 -(label) main::waitForVBlank2_@1 -(void()) moveLuigiLeft() -(label) moveLuigiLeft::@return -(void()) moveLuigiRight() -(label) moveLuigiRight::@return +(byte) main::i#1 reg byte x 202.0 +(byte) main::i#2 reg byte x 168.33333333333331 +(label) main::initNES1 +(label) main::initNES1_@1 +(label) main::initNES1_@7 +(label) main::initNES1_clearVBlankFlag1 +(label) main::initNES1_disableAudioOutput1 +(label) main::initNES1_disableVideoOutput1 +(byte) main::initNES1_i +(byte) main::initNES1_i#1 reg byte x 151.5 +(byte) main::initNES1_i#2 reg byte x 112.22222222222223 +(label) main::initNES1_waitForVBlank1 +(byte~) main::initNES1_waitForVBlank1_$0 reg byte a 202.0 +(label) main::initNES1_waitForVBlank1_@1 +(label) main::initNES1_waitForVBlank2 +(byte~) main::initNES1_waitForVBlank2_$0 reg byte a 202.0 +(label) main::initNES1_waitForVBlank2_@1 +(byte) main::x +(byte) main::x#1 reg byte x 202.0 +(byte) main::x#2 reg byte x 80.8 +(void()) ppuDataFill((nomodify void*) ppuDataFill::ppuData , (byte) ppuDataFill::val , (word) ppuDataFill::size) +(label) ppuDataFill::@1 +(label) ppuDataFill::@2 +(label) ppuDataFill::@return +(word) ppuDataFill::i +(word) ppuDataFill::i#1 i zp[2]:4 2002.0 +(word) ppuDataFill::i#2 i zp[2]:4 1001.0 +(nomodify void*) ppuDataFill::ppuData +(label) ppuDataFill::ppuDataPrepare1 +(byte~) ppuDataFill::ppuDataPrepare1_$0 reg byte a 202.0 +(byte~) ppuDataFill::ppuDataPrepare1_$1 reg byte a 202.0 +(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData +(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataPrepare1_ppuData zp[2]:6 67.33333333333333 +(label) ppuDataFill::ppuDataPut1 +(byte) ppuDataFill::ppuDataPut1_val +(word) ppuDataFill::size +(word) ppuDataFill::size#3 size zp[2]:2 111.22222222222223 +(byte) ppuDataFill::val +(byte) ppuDataFill::val#4 reg byte x 111.22222222222223 +(void()) ppuDataPutTile((nomodify void*) ppuDataPutTile::ppuData , (byte*) ppuDataPutTile::tile) +(label) ppuDataPutTile::@1 +(label) ppuDataPutTile::@2 +(label) ppuDataPutTile::@3 +(label) ppuDataPutTile::@4 +(label) ppuDataPutTile::@5 +(label) ppuDataPutTile::@return +(nomodify void*) ppuDataPutTile::ppuData +(nomodify byte*) ppuDataPutTile::ppuData#0 ppuData zp[2]:6 101.0 +(nomodify void*) ppuDataPutTile::ppuData#2 ppuData zp[2]:6 233.66666666666669 +(nomodify void*) ppuDataPutTile::ppuData#9 ppuData zp[2]:6 202.0 +(label) ppuDataPutTile::ppuDataPrepare1 +(byte~) ppuDataPutTile::ppuDataPrepare1_$0 reg byte a 2002.0 +(byte~) ppuDataPutTile::ppuDataPrepare1_$1 reg byte a 2002.0 +(nomodify void*) ppuDataPutTile::ppuDataPrepare1_ppuData +(label) ppuDataPutTile::ppuDataPrepare2 +(byte~) ppuDataPutTile::ppuDataPrepare2_$0 reg byte a 2002.0 +(byte~) ppuDataPutTile::ppuDataPrepare2_$1 reg byte a 2002.0 +(nomodify void*) ppuDataPutTile::ppuDataPrepare2_ppuData +(nomodify byte*) ppuDataPutTile::ppuDataPrepare2_ppuData#0 ppuDataPrepare2_ppuData zp[2]:6 333.6666666666667 +(label) ppuDataPutTile::ppuDataPut1 +(byte) ppuDataPutTile::ppuDataPut1_val +(byte) ppuDataPutTile::ppuDataPut1_val#0 reg byte a 2002.0 +(label) ppuDataPutTile::ppuDataPut2 +(byte) ppuDataPutTile::ppuDataPut2_val +(byte) ppuDataPutTile::ppuDataPut2_val#0 reg byte a 2002.0 +(label) ppuDataPutTile::ppuDataPut3 +(byte) ppuDataPutTile::ppuDataPut3_val +(byte) ppuDataPutTile::ppuDataPut3_val#0 reg byte a 2002.0 +(label) ppuDataPutTile::ppuDataPut4 +(byte) ppuDataPutTile::ppuDataPut4_val +(byte) ppuDataPutTile::ppuDataPut4_val#0 reg byte a 2002.0 +(byte*) ppuDataPutTile::tile +(byte*) ppuDataPutTile::tile#10 tile zp[2]:2 250.25 +(void()) ppuDataTransfer((nomodify void*) ppuDataTransfer::ppuData , (nomodify void*) ppuDataTransfer::cpuData , (word) ppuDataTransfer::size) +(label) ppuDataTransfer::@1 +(label) ppuDataTransfer::@2 +(label) ppuDataTransfer::@3 +(label) ppuDataTransfer::@return +(nomodify void*) ppuDataTransfer::cpuData +(const nomodify void*) ppuDataTransfer::cpuData#0 cpuData = (void*)(const byte*) PALETTE +(byte*) ppuDataTransfer::cpuSrc +(byte*) ppuDataTransfer::cpuSrc#1 cpuSrc zp[2]:6 1001.0 +(byte*) ppuDataTransfer::cpuSrc#2 cpuSrc zp[2]:6 750.75 +(word) ppuDataTransfer::i +(word) ppuDataTransfer::i#1 i zp[2]:4 2002.0 +(word) ppuDataTransfer::i#2 i zp[2]:4 600.5999999999999 +(nomodify void*) ppuDataTransfer::ppuData +(const nomodify void*) ppuDataTransfer::ppuData#0 ppuData = (void*)(const nomodify byte*) PPU_PALETTE +(label) ppuDataTransfer::ppuDataPrepare1 +(nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData +(label) ppuDataTransfer::ppuDataPut1 +(byte) ppuDataTransfer::ppuDataPut1_val +(byte) ppuDataTransfer::ppuDataPut1_val#0 reg byte a 2002.0 +(word) ppuDataTransfer::size +(const word) ppuDataTransfer::size#0 size = (byte) $20*(const byte) SIZEOF_BYTE interrupt(HARDWARE_STACK)(void()) vblank() (byte~) vblank::$1 reg byte a 4.0 (byte~) vblank::$3 reg byte a 4.0 @@ -103,12 +181,28 @@ interrupt(HARDWARE_STACK)(void()) vblank() (label) vblank::@3 (label) vblank::@4 (label) vblank::@return -(label) vblank::transferSpriteBufferToPpu1 +(label) vblank::ppuSpriteBufferDmaTransfer1 +(struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer +reg byte x [ main::initNES1_i#2 main::initNES1_i#1 ] +reg byte x [ main::x#2 main::x#1 ] reg byte x [ main::i#2 main::i#1 ] -reg byte x [ initSpriteBuffer::i#2 initSpriteBuffer::i#1 ] -reg byte x [ initPalette::i#2 initPalette::i#1 ] -reg byte a [ main::waitForVBlank1_$0 ] -reg byte a [ main::waitForVBlank2_$0 ] +zp[2]:2 [ ppuDataFill::size#3 ppuDataPutTile::tile#10 ] +reg byte x [ ppuDataFill::val#4 ] +zp[2]:4 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ppuDataFill::i#2 ppuDataFill::i#1 ] +zp[2]:6 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataPutTile::ppuData#2 ppuDataPutTile::ppuData#9 ppuDataPutTile::ppuData#0 ppuDataPutTile::ppuDataPrepare2_ppuData#0 ] +reg byte a [ main::initNES1_waitForVBlank1_$0 ] +reg byte a [ main::initNES1_waitForVBlank2_$0 ] +reg byte a [ ppuDataPutTile::ppuDataPrepare1_$0 ] +reg byte a [ ppuDataPutTile::ppuDataPrepare1_$1 ] +reg byte a [ ppuDataPutTile::ppuDataPut1_val#0 ] +reg byte a [ ppuDataPutTile::ppuDataPut2_val#0 ] +reg byte a [ ppuDataPutTile::ppuDataPrepare2_$0 ] +reg byte a [ ppuDataPutTile::ppuDataPrepare2_$1 ] +reg byte a [ ppuDataPutTile::ppuDataPut3_val#0 ] +reg byte a [ ppuDataPutTile::ppuDataPut4_val#0 ] +reg byte a [ ppuDataFill::ppuDataPrepare1_$0 ] +reg byte a [ ppuDataFill::ppuDataPrepare1_$1 ] +reg byte a [ ppuDataTransfer::ppuDataPut1_val#0 ] reg byte a [ vblank::$1 ] reg byte a [ vblank::$3 ]