1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-08-03 01:29:04 +00:00

Changed NES CPU to allow illegal opcodes.

This commit is contained in:
jespergravgaard 2020-06-08 00:33:18 +02:00
parent 7928b2920a
commit 0d9d6f8d54
8 changed files with 2630 additions and 1062 deletions

View File

@ -1,7 +1,7 @@
{
"extension": "nes",
"link": "nes.ld",
"cpu": "MOS6502",
"cpu": "MOS6502X",
"emulator": "nestopia",
"zp_reserve": [ ],
"defines": {

View File

@ -27,6 +27,8 @@ void main() {
volatile char y_sin_idx = 0;
// Index into the X sine
volatile char x_sin_idx = 73;
// Index into the small X sine
volatile char x_sin_idx_2 = 82;
// NMI Called when the PPU refreshes the screen (also known as the V-Blank period)
interrupt(hardware_stack) void vblank() {
@ -35,14 +37,25 @@ interrupt(hardware_stack) void vblank() {
PPU->PPUSCROLL = 0;
// DMA transfer the entire sprite buffer to the PPU
ppuSpriteBufferDmaTransfer(SPRITE_BUFFER);
// Read controller 1
char joy = readJoy1();
// If anything pressed - pause
if(joy)
return;
// Update sprite positions
char y_idx = y_sin_idx++;
char x_idx = x_sin_idx++;
char y_idx = y_sin_idx++;
x_sin_idx = (x_sin_idx==238) ? 0 : x_sin_idx+1;
char x_idx = x_sin_idx;
x_sin_idx_2 = (x_sin_idx_2==88) ? 0 : x_sin_idx_2+1;
char x_idx_2 = x_sin_idx_2;
for(char s=0;s<0x40;s++) {
SPRITE_BUFFER[s].y = SINTABLE[y_idx];
SPRITE_BUFFER[s].x = SINTABLE[x_idx]+8;
y_idx += 4;
x_idx -= 7;
SPRITE_BUFFER[s].y = SINTABLE_240[y_idx];
y_idx -= 4;
SPRITE_BUFFER[s].x = SINTABLE_184[x_idx] + SINTABLE_64[x_idx_2];
x_idx = (x_idx<3) ? x_idx+236 : x_idx-3;
x_idx_2 = (x_idx_2>=86) ? x_idx_2-86 : x_idx_2+3 ;
}
}
@ -67,10 +80,21 @@ char PALETTE[0x20] = {
};
// Sinus Table (0-239)
const char SINTABLE[0x100] = kickasm {{
const char SINTABLE_240[0x100] = kickasm {{
.fill $100, round(115.5+107.5*sin(2*PI*i/256))
}};
// Sinus Table (0-63)
const char SINTABLE_64[89] = kickasm {{
.fill 89, round(52.5+52.5*sin(2*PI*i/89))
}};
// Sinus Table (0-183)
const char SINTABLE_184[239] = kickasm {{
.fill 239, round(71.5+71.5*sin(2*PI*i/239))
}};
// Tile Set (in CHR ROM) - A C64 charset from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c64/
#pragma data_seg(Tiles)
export char TILES[] = kickasm(resource "characters.901225-01.bin") {{

View File

@ -4038,7 +4038,7 @@ Allocated zp[1]:94 [ readJoy1::$1 ]
Allocated zp[1]:95 [ readJoy1::$2 ]
INITIAL ASM
Target platform is nes / MOS6502
Target platform is nes / MOS6502X
// File Comments
// NES conio printing
// Nintendo Entertainment System (NES
@ -5792,12 +5792,11 @@ Statement [48] (volatile byte) x_scroll ← (byte) 0 [ ] ( [ ] { } main:7 [ ]
Statement [49] (volatile byte) y_scroll ← (byte) -8 [ ] ( [ ] { } main:7 [ ] { } ) always clobbers reg byte a
Statement [50] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80 [ ] ( [ ] { } main:7 [ ] { } ) always clobbers reg byte a
Statement [51] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $1e [ ] ( [ ] { } main:7 [ ] { } ) always clobbers reg byte a
Statement [53] (byte) uctoa::value#1 ← (byte) main::i#2 & (byte) $f [ main::i#2 uctoa::value#1 ] ( [ main::i#2 uctoa::value#1 ] { } main:7 [ main::i#2 uctoa::value#1 ] { } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:5 [ main::i#2 main::i#1 ]
Statement [80] (nomodify byte*) ppuDataSet::ppuData#0 ← (byte*) conio_line_text + (byte) conio_cursor_x [ conio_cursor_x conio_cursor_y conio_line_text cputc::c#2 ppuDataSet::ppuData#0 ] ( cputcxy:60::cputc:76 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text cputc::c#2 ppuDataSet::ppuData#0 ] { { cputcxy::y#2 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 ppuDataSet::val#0 } } main:7::cputcxy:60::cputc:76 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text cputc::c#2 ppuDataSet::ppuData#0 ] { { cputcxy::y#2 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 ppuDataSet::val#0 } } cputcxy:63::cputc:76 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text cputc::c#2 ppuDataSet::ppuData#0 ] { { cputcxy::y#3 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 ppuDataSet::val#0 } } main:7::cputcxy:63::cputc:76 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text cputc::c#2 ppuDataSet::ppuData#0 ] { { cputcxy::y#3 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 ppuDataSet::val#0 } } cputcxy:66::cputc:76 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text cputc::c#2 ppuDataSet::ppuData#0 ] { { cputcxy::x#0 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 ppuDataSet::val#0 } } main:7::cputcxy:66::cputc:76 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text cputc::c#2 ppuDataSet::ppuData#0 ] { { cputcxy::x#0 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 ppuDataSet::val#0 } } cputcxy:69::cputc:76 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text cputc::c#2 ppuDataSet::ppuData#0 ] { { cputcxy::x#1 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 ppuDataSet::val#0 } } main:7::cputcxy:69::cputc:76 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text cputc::c#2 ppuDataSet::ppuData#0 ] { { cputcxy::x#1 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 ppuDataSet::val#0 } } cputsxy:57::cputs:171::cputc:180 [ main::i#2 cputs::s#0 conio_cursor_x conio_cursor_y conio_line_text cputc::c#2 ppuDataSet::ppuData#0 ] { { cputsxy::x#0 = main::i#2 cputsxy::y#0 } { cputc::c#0 = cputc::c#2 cputs::c#1 ppuDataSet::val#0 } } main:7::cputsxy:57::cputs:171::cputc:180 [ main::i#2 cputs::s#0 conio_cursor_x conio_cursor_y conio_line_text cputc::c#2 ppuDataSet::ppuData#0 ] { { cputsxy::x#0 = main::i#2 cputsxy::y#0 } { cputc::c#0 = cputc::c#2 cputs::c#1 ppuDataSet::val#0 } } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:4 [ main::y#10 main::y#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:9 [ cputc::c#2 cputc::c#1 cputc::c#0 ]
Removing always clobbered register reg byte a as potential for zp[1]:3 [ main::x#10 main::x#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:5 [ main::i#2 main::i#1 ]
Statement [84] if((byte) conio_cursor_x!=(byte) $20) goto cputc::@return [ conio_cursor_x conio_cursor_y conio_line_text ] ( cputcxy:60::cputc:76 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::y#2 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:60::cputc:76 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::y#2 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputcxy:63::cputc:76 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::y#3 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:63::cputc:76 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::y#3 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputcxy:66::cputc:76 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::x#0 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:66::cputc:76 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::x#0 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputcxy:69::cputc:76 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::x#1 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:69::cputc:76 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::x#1 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputsxy:57::cputs:171::cputc:180 [ main::i#2 cputs::s#0 conio_cursor_x conio_cursor_y conio_line_text ] { { cputsxy::x#0 = main::i#2 cputsxy::y#0 } { cputc::c#0 = cputc::c#2 cputs::c#1 } } main:7::cputsxy:57::cputs:171::cputc:180 [ main::i#2 cputs::s#0 conio_cursor_x conio_cursor_y conio_line_text ] { { cputsxy::x#0 = main::i#2 cputsxy::y#0 } { cputc::c#0 = cputc::c#2 cputs::c#1 } } ) always clobbers reg byte a
Statement [90] (byte*) conio_line_text ← (byte*) conio_line_text + (byte) $20 [ conio_cursor_y conio_line_text ] ( cputcxy:60::cputc:76::cputln:86 [ main::y#10 conio_cursor_y conio_line_text ] { { cputcxy::y#2 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:60::cputc:76::cputln:86 [ main::y#10 conio_cursor_y conio_line_text ] { { cputcxy::y#2 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputcxy:63::cputc:76::cputln:86 [ main::y#10 conio_cursor_y conio_line_text ] { { cputcxy::y#3 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:63::cputc:76::cputln:86 [ main::y#10 conio_cursor_y conio_line_text ] { { cputcxy::y#3 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputcxy:66::cputc:76::cputln:86 [ main::x#10 conio_cursor_y conio_line_text ] { { cputcxy::x#0 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:66::cputc:76::cputln:86 [ main::x#10 conio_cursor_y conio_line_text ] { { cputcxy::x#0 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputcxy:69::cputc:76::cputln:86 [ main::x#10 conio_cursor_y conio_line_text ] { { cputcxy::x#1 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:69::cputc:76::cputln:86 [ main::x#10 conio_cursor_y conio_line_text ] { { cputcxy::x#1 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputsxy:57::cputs:171::cputc:180::cputln:86 [ main::i#2 cputs::s#0 conio_cursor_y conio_line_text ] { { cputsxy::x#0 = main::i#2 cputsxy::y#0 } { cputc::c#0 = cputc::c#2 cputs::c#1 } } main:7::cputsxy:57::cputs:171::cputc:180::cputln:86 [ main::i#2 cputs::s#0 conio_cursor_y conio_line_text ] { { cputsxy::x#0 = main::i#2 cputsxy::y#0 } { cputc::c#0 = cputc::c#2 cputs::c#1 } } cputcxy:60::cputc:76::cputln:89 [ main::y#10 conio_cursor_y conio_line_text ] { { cputcxy::y#2 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:60::cputc:76::cputln:89 [ main::y#10 conio_cursor_y conio_line_text ] { { cputcxy::y#2 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputcxy:63::cputc:76::cputln:89 [ main::y#10 conio_cursor_y conio_line_text ] { { cputcxy::y#3 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:63::cputc:76::cputln:89 [ main::y#10 conio_cursor_y conio_line_text ] { { cputcxy::y#3 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputcxy:66::cputc:76::cputln:89 [ main::x#10 conio_cursor_y conio_line_text ] { { cputcxy::x#0 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:66::cputc:76::cputln:89 [ main::x#10 conio_cursor_y conio_line_text ] { { cputcxy::x#0 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputcxy:69::cputc:76::cputln:89 [ main::x#10 conio_cursor_y conio_line_text ] { { cputcxy::x#1 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:69::cputc:76::cputln:89 [ main::x#10 conio_cursor_y conio_line_text ] { { cputcxy::x#1 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputsxy:57::cputs:171::cputc:180::cputln:89 [ main::i#2 cputs::s#0 conio_cursor_y conio_line_text ] { { cputsxy::x#0 = main::i#2 cputsxy::y#0 } { cputc::c#0 = cputc::c#2 cputs::c#1 } } main:7::cputsxy:57::cputs:171::cputc:180::cputln:89 [ main::i#2 cputs::s#0 conio_cursor_y conio_line_text ] { { cputsxy::x#0 = main::i#2 cputsxy::y#0 } { cputc::c#0 = cputc::c#2 cputs::c#1 } } ) always clobbers reg byte a
Statement [91] (byte) conio_cursor_x ← (byte) 0 [ conio_cursor_x conio_cursor_y conio_line_text ] ( cputcxy:60::cputc:76::cputln:86 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::y#2 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:60::cputc:76::cputln:86 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::y#2 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputcxy:63::cputc:76::cputln:86 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::y#3 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:63::cputc:76::cputln:86 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::y#3 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputcxy:66::cputc:76::cputln:86 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::x#0 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:66::cputc:76::cputln:86 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::x#0 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputcxy:69::cputc:76::cputln:86 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::x#1 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:69::cputc:76::cputln:86 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::x#1 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputsxy:57::cputs:171::cputc:180::cputln:86 [ main::i#2 cputs::s#0 conio_cursor_x conio_cursor_y conio_line_text ] { { cputsxy::x#0 = main::i#2 cputsxy::y#0 } { cputc::c#0 = cputc::c#2 cputs::c#1 } } main:7::cputsxy:57::cputs:171::cputc:180::cputln:86 [ main::i#2 cputs::s#0 conio_cursor_x conio_cursor_y conio_line_text ] { { cputsxy::x#0 = main::i#2 cputsxy::y#0 } { cputc::c#0 = cputc::c#2 cputs::c#1 } } cputcxy:60::cputc:76::cputln:89 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::y#2 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:60::cputc:76::cputln:89 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::y#2 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputcxy:63::cputc:76::cputln:89 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::y#3 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:63::cputc:76::cputln:89 [ main::y#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::y#3 = cputcxy::y#4 main::y#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputcxy:66::cputc:76::cputln:89 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::x#0 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:66::cputc:76::cputln:89 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::x#0 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputcxy:69::cputc:76::cputln:89 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::x#1 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } main:7::cputcxy:69::cputc:76::cputln:89 [ main::x#10 conio_cursor_x conio_cursor_y conio_line_text ] { { cputcxy::x#1 = cputcxy::x#4 main::x#10 } { cputc::c#1 = cputc::c#2 cputcxy::c#4 } } cputsxy:57::cputs:171::cputc:180::cputln:89 [ main::i#2 cputs::s#0 conio_cursor_x conio_cursor_y conio_line_text ] { { cputsxy::x#0 = main::i#2 cputsxy::y#0 } { cputc::c#0 = cputc::c#2 cputs::c#1 } } main:7::cputsxy:57::cputs:171::cputc:180::cputln:89 [ main::i#2 cputs::s#0 conio_cursor_x conio_cursor_y conio_line_text ] { { cputsxy::x#0 = main::i#2 cputsxy::y#0 } { cputc::c#0 = cputc::c#2 cputs::c#1 } } ) always clobbers reg byte a
@ -5843,9 +5842,8 @@ Removing always clobbered register reg byte a as potential for zp[1]:46 [ uctoa_
Statement [209] (byte) conio_cursor_x ← (byte) 0 [ ] ( clrscr:41 [ ] { } main:7::clrscr:41 [ ] { } ) always clobbers reg byte a
Statement [210] (byte) conio_cursor_y ← (byte) 0 [ ] ( clrscr:41 [ ] { } main:7::clrscr:41 [ ] { } ) always clobbers reg byte a
Statement [211] (byte*) conio_line_text ← (const nomodify byte*) PPU_NAME_TABLE_0 [ ] ( clrscr:41 [ ] { } main:7::clrscr:41 [ ] { } ) always clobbers reg byte a
Statement [217] (byte~) vblank::$1 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_DOWN [ x_scroll y_scroll vblank::joy#0 vblank::$1 ] ( [ x_scroll y_scroll vblank::joy#0 vblank::$1 ] { } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:89 [ vblank::joy#0 ]
Statement [220] if((volatile byte) y_scroll!=(byte) $f0) goto vblank::@1 [ x_scroll y_scroll vblank::joy#0 ] ( [ x_scroll y_scroll vblank::joy#0 ] { } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:89 [ vblank::joy#0 ]
Statement [221] (volatile byte) y_scroll ← (byte) 0 [ x_scroll y_scroll vblank::joy#0 ] ( [ x_scroll y_scroll vblank::joy#0 ] { } ) always clobbers reg byte a
Statement [222] (byte~) vblank::$3 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_UP [ x_scroll y_scroll vblank::joy#0 vblank::$3 ] ( [ x_scroll y_scroll vblank::joy#0 vblank::$3 ] { } ) always clobbers reg byte a
Statement [225] if((volatile byte) y_scroll!=(byte) $ff) goto vblank::@2 [ x_scroll y_scroll vblank::joy#0 ] ( [ x_scroll y_scroll vblank::joy#0 ] { } ) always clobbers reg byte a

View File

@ -45,6 +45,7 @@
.const OFFSET_STRUCT_RICOH_2C02_PPUSTATUS = 2
.const OFFSET_STRUCT_RICOH_2C02_OAMADDR = 3
.const OFFSET_STRUCT_RICOH_2A03_OAMDMA = $14
.const OFFSET_STRUCT_RICOH_2A03_JOY1 = $16
.const OFFSET_STRUCT_RICOH_2C02_PPUADDR = 6
.const OFFSET_STRUCT_RICOH_2C02_PPUDATA = 7
.const OFFSET_STRUCT_RICOH_2C02_PPUSCROLL = 5
@ -76,8 +77,9 @@
.label PPU = $2000
// NES CPU and audion processing unit (APU)
.label APU = $4000
.label y_sin_idx = $a
.label x_sin_idx = $b
.label y_sin_idx = $c
.label x_sin_idx = $d
.label x_sin_idx_2 = $e
__bbegin:
// y_sin_idx = 0
// Index into the Y sine
@ -87,6 +89,10 @@ __bbegin:
// Index into the X sine
lda #$49
sta.z x_sin_idx
// x_sin_idx_2 = 82
// Index into the small X sine
lda #$52
sta.z x_sin_idx_2
jsr main
rts
.segment Code
@ -304,9 +310,15 @@ ppuDataTransfer: {
}
// NMI Called when the PPU refreshes the screen (also known as the V-Blank period)
vblank: {
.label __4 = $c
.label y_idx = 8
.label x_idx = 9
.label __17 = $a
.label __19 = $a
.label __23 = $b
.label __25 = $b
.label __28 = $f
.label y_idx = 9
.label x_idx = $a
.label x_idx_2 = $b
.label s = 8
pha
txa
pha
@ -322,20 +334,13 @@ vblank: {
// APU->OAMDMA = >spriteBuffer
lda #>SPRITE_BUFFER
sta APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA
// y_idx = y_sin_idx++
// Update sprite positions
lda.z y_sin_idx
sta.z y_idx
inc.z y_sin_idx
// x_idx = x_sin_idx++
lda.z x_sin_idx
sta.z x_idx
inc.z x_sin_idx
ldx #0
__b1:
// for(char s=0;s<0x40;s++)
cpx #$40
bcc __b2
// readJoy1()
jsr readJoy1
// joy = readJoy1()
// if(joy)
cmp #0
beq __b1
__breturn:
// }
pla
tay
@ -343,35 +348,141 @@ vblank: {
tax
pla
rti
__b2:
// SPRITE_BUFFER[s].y = SINTABLE[y_idx]
txa
asl
asl
sta.z __4
ldy.z y_idx
lda SINTABLE,y
ldy.z __4
sta SPRITE_BUFFER,y
// SINTABLE[x_idx]+8
lda #8
ldy.z x_idx
clc
adc SINTABLE,y
// SPRITE_BUFFER[s].x = SINTABLE[x_idx]+8
ldy.z __4
sta SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X,y
// y_idx += 4
lda #4
clc
adc.z y_idx
__b1:
// y_idx = y_sin_idx++
// Update sprite positions
lda.z y_sin_idx
sta.z y_idx
// x_idx -= 7
lda.z x_idx
sec
sbc #7
inc.z y_sin_idx
// (x_sin_idx==238) ? 0 : x_sin_idx+1
lda #$ee
cmp.z x_sin_idx
beq __b2
ldx.z x_sin_idx
inx
jmp __b3
__b2:
ldx #0
__b3:
// x_sin_idx = (x_sin_idx==238) ? 0 : x_sin_idx+1
stx.z x_sin_idx
// x_idx = x_sin_idx
txa
sta.z x_idx
// (x_sin_idx_2==88) ? 0 : x_sin_idx_2+1
lda #$58
cmp.z x_sin_idx_2
beq __b4
ldx.z x_sin_idx_2
inx
jmp __b5
__b4:
ldx #0
__b5:
// x_sin_idx_2 = (x_sin_idx_2==88) ? 0 : x_sin_idx_2+1
stx.z x_sin_idx_2
// x_idx_2 = x_sin_idx_2
txa
sta.z x_idx_2
lda #0
sta.z s
__b6:
// for(char s=0;s<0x40;s++)
lda.z s
cmp #$40
bcc __b7
jmp __breturn
__b7:
// SPRITE_BUFFER[s].y = SINTABLE_240[y_idx]
lda.z s
asl
asl
sta.z __28
ldy.z y_idx
lda SINTABLE_240,y
ldy.z __28
sta SPRITE_BUFFER,y
// y_idx -= 4
lax.z y_idx
axs #4
stx.z y_idx
// SINTABLE_184[x_idx] + SINTABLE_64[x_idx_2]
ldy.z x_idx
lda SINTABLE_184,y
ldy.z x_idx_2
clc
adc SINTABLE_64,y
// SPRITE_BUFFER[s].x = SINTABLE_184[x_idx] + SINTABLE_64[x_idx_2]
ldy.z __28
sta SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X,y
// (x_idx<3) ? x_idx+236 : x_idx-3
lda.z x_idx
cmp #3
bcc __b8
lax.z __17
axs #3
stx.z __17
__b10:
// (x_idx_2>=86) ? x_idx_2-86 : x_idx_2+3
lda.z x_idx_2
cmp #$56
bcs __b11
lax.z __23
axs #-[3]
stx.z __23
__b13:
// for(char s=0;s<0x40;s++)
inc.z s
jmp __b6
__b11:
// (x_idx_2>=86) ? x_idx_2-86 : x_idx_2+3
lax.z __25
axs #$56
stx.z __25
jmp __b13
__b8:
// (x_idx<3) ? x_idx+236 : x_idx-3
lax.z __19
axs #-[$ec]
stx.z __19
jmp __b10
}
// Read Standard Controller #1
// Returns a byte representing the pushed buttons
// - bit 0: right
// - bit 1: left
// - bit 2: down
// - bit 3: up
// - bit 4: start
// - bit 5: select
// - bit 6: B
// - bit 7: A
readJoy1: {
.label __1 = $10
// APU->JOY1 = 1
// Latch the controller buttons
lda #1
sta APU+OFFSET_STRUCT_RICOH_2A03_JOY1
// APU->JOY1 = 0
lda #0
sta APU+OFFSET_STRUCT_RICOH_2A03_JOY1
tax
__b1:
// for(char i=0;i<8;i++)
cpx #8
bcc __b2
// }
rts
__b2:
// joy<<1
asl
sta.z __1
// APU->JOY1&1
lda #1
and APU+OFFSET_STRUCT_RICOH_2A03_JOY1
// joy = joy<<1 | APU->JOY1&1
ora.z __1
// for(char i=0;i<8;i++)
inx
jmp __b1
}
@ -381,9 +492,17 @@ vblank: {
// Color Palette
PALETTE: .byte 1, $21, $f, $30, 1, $21, $f, $30, 1, $21, $f, $30, 1, $21, $f, $30, 1, $f, $30, 8, 1, $f, $18, 8, 1, $30, $37, $1a, $f, $f, $f, $f
// Sinus Table (0-239)
SINTABLE:
SINTABLE_240:
.fill $100, round(115.5+107.5*sin(2*PI*i/256))
// Sinus Table (0-63)
SINTABLE_64:
.fill 89, round(52.5+52.5*sin(2*PI*i/89))
// Sinus Table (0-183)
SINTABLE_184:
.fill 239, round(71.5+71.5*sin(2*PI*i/239))
.segment Tiles
TILES:
.var filechargen = LoadBinary("characters.901225-01.bin")

View File

@ -4,177 +4,243 @@
@1: scope:[] from @begin
[1] (volatile byte) y_sin_idx ← (byte) 0
[2] (volatile byte) x_sin_idx ← (byte) $49
[3] (volatile byte) x_sin_idx_2 ← (byte) $52
to:@2
@2: scope:[] from @1
[3] phi()
[4] call main
[4] phi()
[5] call main
to:@end
@end: scope:[] from @2
[5] phi()
[6] phi()
(void()) main()
main: scope:[main] from @2
[6] phi()
[7] phi()
to:main::initNES1
main::initNES1: scope:[main] from main
asm { cld ldx#$ff txs }
to:main::initNES1_disableVideoOutput1
main::initNES1_disableVideoOutput1: scope:[main] from main::initNES1
[8] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0
[9] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) 0
[9] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) 0
[10] *((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
[10] *((const nomodify byte*) FR_COUNTER) ← (byte) $40
[11] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) ← (byte) $40
[11] *((const nomodify byte*) FR_COUNTER) ← (byte) $40
[12] *((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::initNES1_waitForVBlank1
main::initNES1_waitForVBlank1: scope:[main] from main::initNES1_clearVBlankFlag1
[13] phi()
[14] phi()
to:main::initNES1_waitForVBlank1_@1
main::initNES1_waitForVBlank1_@1: scope:[main] from main::initNES1_waitForVBlank1 main::initNES1_waitForVBlank1_@1
[14] (byte~) main::initNES1_waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80
[15] if((byte) 0==(byte~) main::initNES1_waitForVBlank1_$0) goto main::initNES1_waitForVBlank1_@1
[15] (byte~) main::initNES1_waitForVBlank1_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80
[16] 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
[16] (byte) main::initNES1_i#2 ← phi( main::initNES1_@1/(byte) main::initNES1_i#1 main::initNES1_waitForVBlank1_@1/(byte) 0 )
[17] *((const nomodify byte*) MEMORY + (byte) main::initNES1_i#2) ← (byte) 0
[18] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::initNES1_i#2) ← (byte) 0
[19] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::initNES1_i#2) ← (byte) 0
[20] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::initNES1_i#2) ← (byte) 0
[21] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::initNES1_i#2) ← (byte) 0
[22] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::initNES1_i#2) ← (byte) 0
[23] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::initNES1_i#2) ← (byte) 0
[24] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::initNES1_i#2) ← (byte) 0
[25] (byte) main::initNES1_i#1 ← ++ (byte) main::initNES1_i#2
[26] if((byte) 0!=(byte) main::initNES1_i#1) goto main::initNES1_@1
[17] (byte) main::initNES1_i#2 ← phi( main::initNES1_@1/(byte) main::initNES1_i#1 main::initNES1_waitForVBlank1_@1/(byte) 0 )
[18] *((const nomodify byte*) MEMORY + (byte) main::initNES1_i#2) ← (byte) 0
[19] *((const nomodify byte*) MEMORY+(word) $100 + (byte) main::initNES1_i#2) ← (byte) 0
[20] *((const nomodify byte*) MEMORY+(word) $200 + (byte) main::initNES1_i#2) ← (byte) 0
[21] *((const nomodify byte*) MEMORY+(word) $300 + (byte) main::initNES1_i#2) ← (byte) 0
[22] *((const nomodify byte*) MEMORY+(word) $400 + (byte) main::initNES1_i#2) ← (byte) 0
[23] *((const nomodify byte*) MEMORY+(word) $500 + (byte) main::initNES1_i#2) ← (byte) 0
[24] *((const nomodify byte*) MEMORY+(word) $600 + (byte) main::initNES1_i#2) ← (byte) 0
[25] *((const nomodify byte*) MEMORY+(word) $700 + (byte) main::initNES1_i#2) ← (byte) 0
[26] (byte) main::initNES1_i#1 ← ++ (byte) main::initNES1_i#2
[27] 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
[27] phi()
[28] phi()
to:main::initNES1_waitForVBlank2_@1
main::initNES1_waitForVBlank2_@1: scope:[main] from main::initNES1_waitForVBlank2 main::initNES1_waitForVBlank2_@1
[28] (byte~) main::initNES1_waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80
[29] if((byte) 0==(byte~) main::initNES1_waitForVBlank2_$0) goto main::initNES1_waitForVBlank2_@1
[29] (byte~) main::initNES1_waitForVBlank2_$0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & (byte) $80
[30] 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::@4
main::@4: scope:[main] from main::initNES1_@7
[31] phi()
[32] call ppuDataTransfer
[32] phi()
[33] call ppuDataTransfer
to:main::@5
main::@5: scope:[main] from main::@4
[33] phi()
[34] call ppuDataFill
[34] phi()
[35] call ppuDataFill
to:main::@6
main::@6: scope:[main] from main::@5
[35] phi()
[36] call ppuDataFill
[36] phi()
[37] call ppuDataFill
to:main::@1
main::@1: scope:[main] from main::@2 main::@6
[37] (byte) main::s#2 ← phi( main::@2/(byte) main::s#1 main::@6/(byte) 0 )
[38] if((byte) main::s#2<(byte) $40) goto main::@2
[38] (byte) main::s#2 ← phi( main::@2/(byte) main::s#1 main::@6/(byte) 0 )
[39] if((byte) main::s#2<(byte) $40) goto main::@2
to:main::enableVideoOutput1
main::enableVideoOutput1: scope:[main] from main::@1
[39] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80
[40] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $1e
[40] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80
[41] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $1e
to:main::@3
main::@3: scope:[main] from main::@3 main::enableVideoOutput1
[41] phi()
[42] phi()
to:main::@3
main::@2: scope:[main] from main::@1
[42] (byte~) main::$7 ← (byte) main::s#2 << (byte) 2
[43] *((byte*)(const struct SpriteData*) SPRITE_BUFFER + (byte~) main::$7) ← (byte) 0
[44] *((byte*)(const struct SpriteData*) SPRITE_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_TILE + (byte~) main::$7) ← *((const byte*) MESSAGE + (byte) main::s#2)
[45] *((byte*)(const struct SpriteData*) SPRITE_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES + (byte~) main::$7) ← (byte) 2
[46] *((byte*)(const struct SpriteData*) SPRITE_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_X + (byte~) main::$7) ← (byte) 0
[47] (byte) main::s#1 ← ++ (byte) main::s#2
[43] (byte~) main::$7 ← (byte) main::s#2 << (byte) 2
[44] *((byte*)(const struct SpriteData*) SPRITE_BUFFER + (byte~) main::$7) ← (byte) 0
[45] *((byte*)(const struct SpriteData*) SPRITE_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_TILE + (byte~) main::$7) ← *((const byte*) MESSAGE + (byte) main::s#2)
[46] *((byte*)(const struct SpriteData*) SPRITE_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES + (byte~) main::$7) ← (byte) 2
[47] *((byte*)(const struct SpriteData*) SPRITE_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_X + (byte~) main::$7) ← (byte) 0
[48] (byte) main::s#1 ← ++ (byte) main::s#2
to:main::@1
(void()) ppuDataFill((nomodify void*) ppuDataFill::ppuData , (byte) ppuDataFill::val , (word) ppuDataFill::size)
ppuDataFill: scope:[ppuDataFill] from main::@5 main::@6
[48] (byte) ppuDataFill::val#4 ← phi( main::@5/(byte) '*' main::@6/(byte) 0 )
[48] (word) ppuDataFill::size#3 ← phi( main::@5/(word)(number) $20*(number) $1e main::@6/(byte) $40 )
[48] (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ← phi( main::@5/(void*)(const nomodify byte*) PPU_NAME_TABLE_0 main::@6/(void*)(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 )
[49] (byte) ppuDataFill::val#4 ← phi( main::@5/(byte) '*' main::@6/(byte) 0 )
[49] (word) ppuDataFill::size#3 ← phi( main::@5/(word)(number) $20*(number) $1e main::@6/(byte) $40 )
[49] (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ← phi( main::@5/(void*)(const nomodify byte*) PPU_NAME_TABLE_0 main::@6/(void*)(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 )
to:ppuDataFill::ppuDataPrepare1
ppuDataFill::ppuDataPrepare1: scope:[ppuDataFill] from ppuDataFill
[49] (byte~) ppuDataFill::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0
[50] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$0
[51] (byte~) ppuDataFill::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0
[52] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$1
[50] (byte~) ppuDataFill::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0
[51] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$0
[52] (byte~) ppuDataFill::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0
[53] *((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
[53] (word) ppuDataFill::i#2 ← phi( ppuDataFill::ppuDataPrepare1/(word) 0 ppuDataFill::@2/(word) ppuDataFill::i#1 )
[54] if((word) ppuDataFill::i#2<(word) ppuDataFill::size#3) goto ppuDataFill::ppuDataPut1
[54] (word) ppuDataFill::i#2 ← phi( ppuDataFill::ppuDataPrepare1/(word) 0 ppuDataFill::@2/(word) ppuDataFill::i#1 )
[55] if((word) ppuDataFill::i#2<(word) ppuDataFill::size#3) goto ppuDataFill::ppuDataPut1
to:ppuDataFill::@return
ppuDataFill::@return: scope:[ppuDataFill] from ppuDataFill::@1
[55] return
[56] return
to:@return
ppuDataFill::ppuDataPut1: scope:[ppuDataFill] from ppuDataFill::@1
[56] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataFill::val#4
[57] *((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
[57] (word) ppuDataFill::i#1 ← ++ (word) ppuDataFill::i#2
[58] (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::@4
[58] phi()
[59] phi()
to:ppuDataTransfer::ppuDataPrepare1
ppuDataTransfer::ppuDataPrepare1: scope:[ppuDataTransfer] from ppuDataTransfer
[59] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify void*) ppuDataTransfer::ppuData#0
[60] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0
[60] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify void*) ppuDataTransfer::ppuData#0
[61] *((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
[61] (byte*) ppuDataTransfer::cpuSrc#2 ← phi( ppuDataTransfer::ppuDataPrepare1/(byte*)(const nomodify void*) ppuDataTransfer::cpuData#0 ppuDataTransfer::@3/(byte*) ppuDataTransfer::cpuSrc#1 )
[61] (word) ppuDataTransfer::i#2 ← phi( ppuDataTransfer::ppuDataPrepare1/(word) 0 ppuDataTransfer::@3/(word) ppuDataTransfer::i#1 )
[62] if((word) ppuDataTransfer::i#2<(const word) ppuDataTransfer::size#0) goto ppuDataTransfer::@2
[62] (byte*) ppuDataTransfer::cpuSrc#2 ← phi( ppuDataTransfer::ppuDataPrepare1/(byte*)(const nomodify void*) ppuDataTransfer::cpuData#0 ppuDataTransfer::@3/(byte*) ppuDataTransfer::cpuSrc#1 )
[62] (word) ppuDataTransfer::i#2 ← phi( ppuDataTransfer::ppuDataPrepare1/(word) 0 ppuDataTransfer::@3/(word) ppuDataTransfer::i#1 )
[63] if((word) ppuDataTransfer::i#2<(const word) ppuDataTransfer::size#0) goto ppuDataTransfer::@2
to:ppuDataTransfer::@return
ppuDataTransfer::@return: scope:[ppuDataTransfer] from ppuDataTransfer::@1
[63] return
[64] return
to:@return
ppuDataTransfer::@2: scope:[ppuDataTransfer] from ppuDataTransfer::@1
[64] (byte) ppuDataTransfer::ppuDataPut1_val#0 ← *((byte*) ppuDataTransfer::cpuSrc#2)
[65] (byte) ppuDataTransfer::ppuDataPut1_val#0 ← *((byte*) ppuDataTransfer::cpuSrc#2)
to:ppuDataTransfer::ppuDataPut1
ppuDataTransfer::ppuDataPut1: scope:[ppuDataTransfer] from ppuDataTransfer::@2
[65] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataTransfer::ppuDataPut1_val#0
[66] *((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
[66] (byte*) ppuDataTransfer::cpuSrc#1 ← ++ (byte*) ppuDataTransfer::cpuSrc#2
[67] (word) ppuDataTransfer::i#1 ← ++ (word) ppuDataTransfer::i#2
[67] (byte*) ppuDataTransfer::cpuSrc#1 ← ++ (byte*) ppuDataTransfer::cpuSrc#2
[68] (word) ppuDataTransfer::i#1 ← ++ (word) ppuDataTransfer::i#2
to:ppuDataTransfer::@1
interrupt(HARDWARE_STACK)(void()) vblank()
vblank: scope:[vblank] from
[68] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) 0
[69] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) 0
[70] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) 0
to:vblank::ppuSpriteBufferDmaTransfer1
vblank::ppuSpriteBufferDmaTransfer1: scope:[vblank] from vblank
[70] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0
[71] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const struct SpriteData*) SPRITE_BUFFER
to:vblank::@3
vblank::@3: scope:[vblank] from vblank::ppuSpriteBufferDmaTransfer1
[72] (byte) vblank::y_idx#0 ← (volatile byte) y_sin_idx
[73] (volatile byte) y_sin_idx ← ++ (volatile byte) y_sin_idx
[74] (byte) vblank::x_idx#0 ← (volatile byte) x_sin_idx
[75] (volatile byte) x_sin_idx ← ++ (volatile byte) x_sin_idx
to:vblank::@1
vblank::@1: scope:[vblank] from vblank::@2 vblank::@3
[76] (byte) vblank::x_idx#2 ← phi( vblank::@2/(byte) vblank::x_idx#1 vblank::@3/(byte) vblank::x_idx#0 )
[76] (byte) vblank::y_idx#2 ← phi( vblank::@2/(byte) vblank::y_idx#1 vblank::@3/(byte) vblank::y_idx#0 )
[76] (byte) vblank::s#2 ← phi( vblank::@2/(byte) vblank::s#1 vblank::@3/(byte) 0 )
[77] if((byte) vblank::s#2<(byte) $40) goto vblank::@2
[71] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0
[72] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const struct SpriteData*) SPRITE_BUFFER
to:vblank::@14
vblank::@14: scope:[vblank] from vblank::ppuSpriteBufferDmaTransfer1
[73] phi()
[74] call readJoy1
[75] (byte) readJoy1::return#2 ← (byte) readJoy1::joy#2
to:vblank::@15
vblank::@15: scope:[vblank] from vblank::@14
[76] (byte) vblank::joy#0 ← (byte) readJoy1::return#2
[77] if((byte) 0==(byte) vblank::joy#0) goto vblank::@1
to:vblank::@return
vblank::@return: scope:[vblank] from vblank::@1
vblank::@return: scope:[vblank] from vblank::@15 vblank::@6
[78] return
to:@return
vblank::@1: scope:[vblank] from vblank::@15
[79] (byte) vblank::y_idx#0 ← (volatile byte) y_sin_idx
[80] (volatile byte) y_sin_idx ← ++ (volatile byte) y_sin_idx
[81] if((volatile byte) x_sin_idx==(byte) $ee) goto vblank::@3
to:vblank::@2
vblank::@2: scope:[vblank] from vblank::@1
[79] (byte~) vblank::$4 ← (byte) vblank::s#2 << (byte) 2
[80] *((byte*)(const struct SpriteData*) SPRITE_BUFFER + (byte~) vblank::$4) ← *((const to_nomodify byte*) SINTABLE + (byte) vblank::y_idx#2)
[81] (byte~) vblank::$2 ← *((const to_nomodify byte*) SINTABLE + (byte) vblank::x_idx#2) + (byte) 8
[82] *((byte*)(const struct SpriteData*) SPRITE_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_X + (byte~) vblank::$4) ← (byte~) vblank::$2
[83] (byte) vblank::y_idx#1 ← (byte) vblank::y_idx#2 + (byte) 4
[84] (byte) vblank::x_idx#1 ← (byte) vblank::x_idx#2 - (byte) 7
[85] (byte) vblank::s#1 ← ++ (byte) vblank::s#2
to:vblank::@1
[82] (byte~) vblank::$5 ← (volatile byte) x_sin_idx + (byte) 1
to:vblank::@3
vblank::@3: scope:[vblank] from vblank::@1 vblank::@2
[83] (byte~) vblank::$7 ← phi( vblank::@1/(byte) 0 vblank::@2/(byte~) vblank::$5 )
[84] (volatile byte) x_sin_idx ← (byte~) vblank::$7
[85] (byte) vblank::x_idx#0 ← (volatile byte) x_sin_idx
[86] if((volatile byte) x_sin_idx_2==(byte) $58) goto vblank::@5
to:vblank::@4
vblank::@4: scope:[vblank] from vblank::@3
[87] (byte~) vblank::$10 ← (volatile byte) x_sin_idx_2 + (byte) 1
to:vblank::@5
vblank::@5: scope:[vblank] from vblank::@3 vblank::@4
[88] (byte~) vblank::$12 ← phi( vblank::@3/(byte) 0 vblank::@4/(byte~) vblank::$10 )
[89] (volatile byte) x_sin_idx_2 ← (byte~) vblank::$12
[90] (byte) vblank::x_idx_2#0 ← (volatile byte) x_sin_idx_2
to:vblank::@6
vblank::@6: scope:[vblank] from vblank::@13 vblank::@5
[91] (byte) vblank::x_idx_2#2 ← phi( vblank::@13/(byte) vblank::x_idx_2#1 vblank::@5/(byte) vblank::x_idx_2#0 )
[91] (byte) vblank::x_idx#2 ← phi( vblank::@13/(byte) vblank::x_idx#1 vblank::@5/(byte) vblank::x_idx#0 )
[91] (byte) vblank::y_idx#2 ← phi( vblank::@13/(byte) vblank::y_idx#1 vblank::@5/(byte) vblank::y_idx#0 )
[91] (byte) vblank::s#2 ← phi( vblank::@13/(byte) vblank::s#1 vblank::@5/(byte) 0 )
[92] if((byte) vblank::s#2<(byte) $40) goto vblank::@7
to:vblank::@return
vblank::@7: scope:[vblank] from vblank::@6
[93] (byte~) vblank::$28 ← (byte) vblank::s#2 << (byte) 2
[94] *((byte*)(const struct SpriteData*) SPRITE_BUFFER + (byte~) vblank::$28) ← *((const to_nomodify byte*) SINTABLE_240 + (byte) vblank::y_idx#2)
[95] (byte) vblank::y_idx#1 ← (byte) vblank::y_idx#2 - (byte) 4
[96] (byte~) vblank::$14 ← *((const to_nomodify byte*) SINTABLE_184 + (byte) vblank::x_idx#2) + *((const to_nomodify byte*) SINTABLE_64 + (byte) vblank::x_idx_2#2)
[97] *((byte*)(const struct SpriteData*) SPRITE_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_X + (byte~) vblank::$28) ← (byte~) vblank::$14
[98] if((byte) vblank::x_idx#2<(byte) 3) goto vblank::@8
to:vblank::@9
vblank::@9: scope:[vblank] from vblank::@7
[99] (byte~) vblank::$17 ← (byte) vblank::x_idx#2 - (byte) 3
to:vblank::@10
vblank::@10: scope:[vblank] from vblank::@8 vblank::@9
[100] (byte) vblank::x_idx#1 ← phi( vblank::@8/(byte~) vblank::$19 vblank::@9/(byte~) vblank::$17 )
[101] if((byte) vblank::x_idx_2#2>=(byte) $56) goto vblank::@11
to:vblank::@12
vblank::@12: scope:[vblank] from vblank::@10
[102] (byte~) vblank::$23 ← (byte) vblank::x_idx_2#2 + (byte) 3
to:vblank::@13
vblank::@13: scope:[vblank] from vblank::@11 vblank::@12
[103] (byte) vblank::x_idx_2#1 ← phi( vblank::@11/(byte~) vblank::$25 vblank::@12/(byte~) vblank::$23 )
[104] (byte) vblank::s#1 ← ++ (byte) vblank::s#2
to:vblank::@6
vblank::@11: scope:[vblank] from vblank::@10
[105] (byte~) vblank::$25 ← (byte) vblank::x_idx_2#2 - (byte) $56
to:vblank::@13
vblank::@8: scope:[vblank] from vblank::@7
[106] (byte~) vblank::$19 ← (byte) vblank::x_idx#2 + (byte) $ec
to:vblank::@10
(byte()) readJoy1()
readJoy1: scope:[readJoy1] from vblank::@14
[107] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1
[108] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0
to:readJoy1::@1
readJoy1::@1: scope:[readJoy1] from readJoy1 readJoy1::@2
[109] (byte) readJoy1::joy#2 ← phi( readJoy1/(byte) 0 readJoy1::@2/(byte) readJoy1::joy#1 )
[109] (byte) readJoy1::i#2 ← phi( readJoy1/(byte) 0 readJoy1::@2/(byte) readJoy1::i#1 )
[110] if((byte) readJoy1::i#2<(byte) 8) goto readJoy1::@2
to:readJoy1::@return
readJoy1::@return: scope:[readJoy1] from readJoy1::@1
[111] return
to:@return
readJoy1::@2: scope:[readJoy1] from readJoy1::@1
[112] (byte~) readJoy1::$1 ← (byte) readJoy1::joy#2 << (byte) 1
[113] (byte~) readJoy1::$2 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1
[114] (byte) readJoy1::joy#1 ← (byte~) readJoy1::$1 | (byte~) readJoy1::$2
[115] (byte) readJoy1::i#1 ← ++ (byte) readJoy1::i#2
to:readJoy1::@1

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,7 @@
(const nomodify byte*) MEMORY = (byte*) 0
(const byte*) MESSAGE[(number) $40] = (byte*) "rex-of-camelot-presents-a-dxycp-on-nintendo-entertainment-system"z
(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
(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR = (byte) 3
(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR = (byte) 6
@ -55,7 +56,11 @@
(byte) RICOH_2C02::PPUMASK
(byte) RICOH_2C02::PPUSCROLL
(volatile byte) RICOH_2C02::PPUSTATUS loadstore
(const to_nomodify byte*) SINTABLE[(number) $100] = kickasm {{ .fill $100, round(115.5+107.5*sin(2*PI*i/256))
(const to_nomodify byte*) SINTABLE_184[(number) $ef] = kickasm {{ .fill 239, round(71.5+71.5*sin(2*PI*i/239))
}}
(const to_nomodify byte*) SINTABLE_240[(number) $100] = kickasm {{ .fill $100, round(115.5+107.5*sin(2*PI*i/256))
}}
(const to_nomodify byte*) SINTABLE_64[(number) $59] = kickasm {{ .fill 89, round(52.5+52.5*sin(2*PI*i/89))
}}
(const byte) SIZEOF_BYTE = (byte) 1
(const struct SpriteData*) SPRITE_BUFFER[(number) $100] = { fill( $100, 0) }
@ -140,28 +145,69 @@
(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
(byte()) readJoy1()
(byte~) readJoy1::$1 zp[1]:16 101.0
(byte~) readJoy1::$2 reg byte a 202.0
(label) readJoy1::@1
(label) readJoy1::@2
(label) readJoy1::@return
(byte) readJoy1::i
(byte) readJoy1::i#1 reg byte x 202.0
(byte) readJoy1::i#2 reg byte x 60.599999999999994
(byte) readJoy1::joy
(byte) readJoy1::joy#1 reg byte a 101.0
(byte) readJoy1::joy#2 reg byte a 51.0
(byte) readJoy1::return
(byte) readJoy1::return#2 reg byte a 4.0
interrupt(HARDWARE_STACK)(void()) vblank()
(byte~) vblank::$2 reg byte a 22.0
(byte~) vblank::$4 zp[1]:12 11.0
(byte~) vblank::$10 reg byte x 4.0
(byte~) vblank::$12 reg byte x 4.0
(byte~) vblank::$14 reg byte a 22.0
(byte~) vblank::$17 zp[1]:10 22.0
(byte~) vblank::$19 zp[1]:10 22.0
(byte~) vblank::$23 zp[1]:11 22.0
(byte~) vblank::$25 zp[1]:11 22.0
(byte~) vblank::$28 zp[1]:15 8.25
(byte~) vblank::$5 reg byte x 4.0
(byte~) vblank::$7 reg byte x 4.0
(label) vblank::@1
(label) vblank::@10
(label) vblank::@11
(label) vblank::@12
(label) vblank::@13
(label) vblank::@14
(label) vblank::@15
(label) vblank::@2
(label) vblank::@3
(label) vblank::@4
(label) vblank::@5
(label) vblank::@6
(label) vblank::@7
(label) vblank::@8
(label) vblank::@9
(label) vblank::@return
(byte) vblank::joy
(byte) vblank::joy#0 reg byte a 4.0
(label) vblank::ppuSpriteBufferDmaTransfer1
(struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer
(byte) vblank::s
(byte) vblank::s#1 reg byte x 22.0
(byte) vblank::s#2 reg byte x 5.5
(byte) vblank::s#1 s zp[1]:8 22.0
(byte) vblank::s#2 s zp[1]:8 2.933333333333333
(byte) vblank::x_idx
(byte) vblank::x_idx#0 x_idx zp[1]:9 2.0
(byte) vblank::x_idx#1 x_idx zp[1]:9 11.0
(byte) vblank::x_idx#2 x_idx zp[1]:9 5.0
(byte) vblank::x_idx#0 x_idx zp[1]:10 0.6666666666666666
(byte) vblank::x_idx#1 x_idx zp[1]:10 5.5
(byte) vblank::x_idx#2 x_idx zp[1]:10 7.125
(byte) vblank::x_idx_2
(byte) vblank::x_idx_2#0 x_idx_2 zp[1]:11 4.0
(byte) vblank::x_idx_2#1 x_idx_2 zp[1]:11 16.5
(byte) vblank::x_idx_2#2 x_idx_2 zp[1]:11 4.75
(byte) vblank::y_idx
(byte) vblank::y_idx#0 y_idx zp[1]:8 1.0
(byte) vblank::y_idx#1 y_idx zp[1]:8 7.333333333333333
(byte) vblank::y_idx#2 y_idx zp[1]:8 5.833333333333333
(volatile byte) x_sin_idx loadstore zp[1]:11 1.1428571428571428
(volatile byte) y_sin_idx loadstore zp[1]:10 1.6
(byte) vblank::y_idx#0 y_idx zp[1]:9 0.3333333333333333
(byte) vblank::y_idx#1 y_idx zp[1]:9 1.8333333333333333
(byte) vblank::y_idx#2 y_idx zp[1]:9 8.75
(volatile byte) x_sin_idx loadstore zp[1]:13 0.7692307692307693
(volatile byte) x_sin_idx_2 loadstore zp[1]:14 0.5555555555555556
(volatile byte) y_sin_idx loadstore zp[1]:12 0.8
reg byte x [ main::initNES1_i#2 main::initNES1_i#1 ]
reg byte x [ main::s#2 main::s#1 ]
@ -169,16 +215,26 @@ reg byte x [ ppuDataFill::val#4 ]
zp[2]:2 [ ppuDataFill::i#2 ppuDataFill::i#1 ]
zp[2]:4 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ppuDataFill::ppuDataPrepare1_ppuData#0 ]
zp[2]:6 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ppuDataFill::size#3 ]
reg byte x [ vblank::s#2 vblank::s#1 ]
zp[1]:8 [ vblank::y_idx#2 vblank::y_idx#1 vblank::y_idx#0 ]
zp[1]:9 [ vblank::x_idx#2 vblank::x_idx#1 vblank::x_idx#0 ]
zp[1]:10 [ y_sin_idx ]
zp[1]:11 [ x_sin_idx ]
reg byte x [ vblank::$7 vblank::$5 ]
reg byte x [ vblank::$12 vblank::$10 ]
zp[1]:8 [ vblank::s#2 vblank::s#1 ]
zp[1]:9 [ vblank::y_idx#2 vblank::y_idx#1 vblank::y_idx#0 ]
zp[1]:10 [ vblank::x_idx#2 vblank::x_idx#1 vblank::x_idx#0 vblank::$19 vblank::$17 ]
zp[1]:11 [ vblank::x_idx_2#2 vblank::x_idx_2#1 vblank::x_idx_2#0 vblank::$25 vblank::$23 ]
reg byte x [ readJoy1::i#2 readJoy1::i#1 ]
reg byte a [ readJoy1::joy#2 readJoy1::joy#1 ]
zp[1]:12 [ y_sin_idx ]
zp[1]:13 [ x_sin_idx ]
zp[1]:14 [ x_sin_idx_2 ]
reg byte a [ main::initNES1_waitForVBlank1_$0 ]
reg byte a [ main::initNES1_waitForVBlank2_$0 ]
reg byte y [ main::$7 ]
reg byte a [ ppuDataFill::ppuDataPrepare1_$0 ]
reg byte a [ ppuDataFill::ppuDataPrepare1_$1 ]
reg byte a [ ppuDataTransfer::ppuDataPut1_val#0 ]
zp[1]:12 [ vblank::$4 ]
reg byte a [ vblank::$2 ]
reg byte a [ readJoy1::return#2 ]
reg byte a [ vblank::joy#0 ]
zp[1]:15 [ vblank::$28 ]
reg byte a [ vblank::$14 ]
zp[1]:16 [ readJoy1::$1 ]
reg byte a [ readJoy1::$2 ]

View File

@ -2418,7 +2418,7 @@ Allocated zp[1]:48 [ readJoy1::$1 ]
Allocated zp[1]:49 [ readJoy1::$2 ]
INITIAL ASM
Target platform is nes / MOS6502
Target platform is nes / MOS6502X
// File Comments
// A minimal NES demo
// Based on: https://github.com/gregkrsak/first_nes written by Greg M. Krsak, 2018.
@ -3397,11 +3397,6 @@ Statement [85] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUC
Statement [86] *((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 [88] 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 [90] (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 [98] (byte~) vblank::$1 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_DOWN [ vblank::joy#0 vblank::$1 ] ( [ vblank::joy#0 vblank::$1 ] { } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:43 [ vblank::joy#0 ]
Statement [104] (byte~) vblank::$3 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_UP [ vblank::joy#0 vblank::$3 ] ( [ vblank::joy#0 vblank::$3 ] { } ) always clobbers reg byte a
Statement [110] (byte~) vblank::$5 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_LEFT [ vblank::joy#0 vblank::$5 ] ( [ vblank::joy#0 vblank::$5 ] { } ) always clobbers reg byte a
Statement [116] (byte~) vblank::$7 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_RIGHT [ vblank::$7 ] ( [ vblank::$7 ] { } ) always clobbers reg byte a
Statement [122] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 [ ] ( [ ] { } ) always clobbers reg byte a
Statement [123] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const struct SpriteData*) SPRITE_BUFFER [ ] ( [ ] { } ) always clobbers reg byte a
Statement [124] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) 0 [ ] ( [ ] { } ) always clobbers reg byte a
@ -3446,10 +3441,6 @@ Statement [85] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUC
Statement [86] *((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 [88] 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 [90] (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 [98] (byte~) vblank::$1 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_DOWN [ vblank::joy#0 vblank::$1 ] ( [ vblank::joy#0 vblank::$1 ] { } ) always clobbers reg byte a
Statement [104] (byte~) vblank::$3 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_UP [ vblank::joy#0 vblank::$3 ] ( [ vblank::joy#0 vblank::$3 ] { } ) always clobbers reg byte a
Statement [110] (byte~) vblank::$5 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_LEFT [ vblank::joy#0 vblank::$5 ] ( [ vblank::joy#0 vblank::$5 ] { } ) always clobbers reg byte a
Statement [116] (byte~) vblank::$7 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_RIGHT [ vblank::$7 ] ( [ vblank::$7 ] { } ) always clobbers reg byte a
Statement [122] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_OAMADDR) ← (byte) 0 [ ] ( [ ] { } ) always clobbers reg byte a
Statement [123] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_OAMDMA) ← >(const struct SpriteData*) SPRITE_BUFFER [ ] ( [ ] { } ) always clobbers reg byte a
Statement [124] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (byte) 0 [ ] ( [ ] { } ) always clobbers reg byte a
@ -3489,7 +3480,7 @@ Potential registers zp[1]:39 [ ppuDataFill::ppuDataPrepare1_$0 ] : zp[1]:39 , re
Potential registers zp[1]:40 [ ppuDataFill::ppuDataPrepare1_$1 ] : zp[1]:40 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:41 [ ppuDataTransfer::ppuDataPut1_val#0 ] : zp[1]:41 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:42 [ readJoy1::return#2 ] : zp[1]:42 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:43 [ vblank::joy#0 ] : zp[1]:43 , reg byte x , reg byte y ,
Potential registers zp[1]:43 [ vblank::joy#0 ] : zp[1]:43 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:44 [ vblank::$1 ] : zp[1]:44 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:45 [ vblank::$3 ] : zp[1]:45 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:46 [ vblank::$5 ] : zp[1]:46 , reg byte a , reg byte x , reg byte y ,
@ -3519,7 +3510,7 @@ Uplifting [main] best 5326 combination reg byte x [ main::x#2 main::x#1 ] reg by
Uplifting [readJoy1] best 5083 combination reg byte x [ readJoy1::i#2 readJoy1::i#1 ] reg byte a [ readJoy1::$2 ] reg byte a [ readJoy1::joy#2 readJoy1::joy#1 ] zp[1]:48 [ readJoy1::$1 ] zp[1]:42 [ readJoy1::return#2 ]
Limited combination testing to 100 combinations of 576 possible.
Uplifting [vblank] best 5059 combination reg byte a [ vblank::$1 ] reg byte a [ vblank::$3 ] reg byte a [ vblank::$5 ] reg byte a [ vblank::$7 ] zp[1]:43 [ vblank::joy#0 ]
Limited combination testing to 100 combinations of 768 possible.
Limited combination testing to 100 combinations of 1024 possible.
Uplifting [RICOH_2C02] best 5059 combination
Uplifting [RICOH_2A03] best 5059 combination
Uplifting [SpriteData] best 5059 combination