1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-24 20:32:39 +00:00

NES conio.h now working reasonably well. There is a few issues with __bbegin and data in ROM/RAM.

This commit is contained in:
jespergravgaard 2020-06-06 13:36:03 +02:00
parent d40ff86b03
commit b53392f5fd
13 changed files with 6909 additions and 2805 deletions

View File

@ -136,5 +136,7 @@ struct RICOH_2C02 {
};
// PPU Status Register for reading in ASM
volatile char * PPU_PPUSTATUS = 0x2002;
volatile char * const PPU_PPUSTATUS = 0x2002;
// PPU Data Register for reading in ASM
volatile char * const PPU_PPUDATA = 0x2007;

View File

@ -104,6 +104,11 @@ void cputln() {
cscroll();
}
#pragma data_seg(GameRam)
// Buffer used for scrolling the NES screen
char conio_cscroll_buffer[CONIO_WIDTH];
#pragma data_seg(Data)
// Scroll the entire screen if the cursor is beyond the last line
void cscroll() {
if(conio_cursor_y==CONIO_HEIGHT) {
@ -112,10 +117,10 @@ void cscroll() {
char* line1 = CONIO_SCREEN_TEXT;
char* line2 = CONIO_SCREEN_TEXT+CONIO_WIDTH;
for(char y=0;y<CONIO_HEIGHT-1;y++) {
for(char x=0;x<CONIO_WIDTH;x++) {
char ch = ppuDataGet(line2++);
ppuDataSet(line1++, ch);
}
ppuDataFetch(scroll_buffer, line2, CONIO_WIDTH);
ppuDataTransfer(line1, scroll_buffer, CONIO_WIDTH);
line1 += CONIO_WIDTH;
line2 += CONIO_WIDTH;
}
// Fill last line with space
ppuDataFill(CONIO_SCREEN_TEXT+CONIO_BYTES-CONIO_WIDTH, ' ', CONIO_WIDTH);

View File

@ -104,7 +104,7 @@ char readJoy1() {
return joy;
}
// Prepare for transferring data from the CPU to the PPU
// Prepare for transferring data to/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
@ -120,8 +120,12 @@ inline void ppuDataPut(char val) {
PPU->PPUDATA = val;
}
// Read one byte from PPU memory
// The byte is read from the current PPU address pointed to by the (autoincrementing) PPU->PPUADDR
// Read one byte from the PPU memory
// Note: Reading from the PPU works in a somewhat un-intuitive way.
// The read operation returns the current contents of the read-buffer and then fills the buffer from the current
// PPU->PPUADDR, which is also auto-incremented.
// This means the value returned is from the previous read address.
// If you want to get the value at PPU->PPUADDR you must call read twice.
inline char ppuDataRead() {
// Transfer from PPU
return PPU->PPUDATA;
@ -149,6 +153,20 @@ void ppuDataTransfer(void* const ppuData, void* const cpuData, unsigned int size
ppuDataPut(*cpuSrc++);
}
// Transfer a number of bytes from the PPU memory to the CPU memory
// - ppuData : Pointer in the PPU memory
// - cpuData : Pointer to the CPU memory (RAM of ROM)
// - size : The number of bytes to transfer
void ppuDataFetch(void* const cpuData, void* const ppuData, unsigned int size) {
ppuDataPrepare(ppuData);
// Perform a dummy-read to discard the current value in the data read buffer and update it with the first byte from the PPU address
asm { lda PPU_PPUDATA }
// Fetch from PPU to CPU
char* cpuDst = (char*)cpuData;
for(unsigned int i=0;i<size;i++)
*cpuDst++ = ppuDataRead();
}
// Transfer a 2x2 tile into the PPU memory
// - ppuData : Pointer in the PPU memory
// - tile : The tile to transfer
@ -161,7 +179,6 @@ void ppuDataPutTile(void* const ppuData, char* tile) {
ppuDataPut(tile[3]);
}
// Set one byte in PPU memory
// - ppuData : Pointer in the PPU memory
// - val : The value to set
@ -174,5 +191,8 @@ void ppuDataSet(void* const ppuData, char val) {
// - ppuData : Pointer in the PPU memory
char ppuDataGet(void* const ppuData) {
ppuDataPrepare(ppuData);
// Perform a dummy-read to discard the current value in the data read buffer and update it with the byte we want
asm { lda PPU_PPUDATA }
// Get the data we want out of the buffer (this unfortunately performs a second increment of the pointer)
return ppuDataRead();
}

5
src/test/kc/.vscode/kickass-nes.sh vendored Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
export ASM_FILE=$1
export NES_FILE=${ASM_FILE%.*}.nes
java -jar /Applications/KickAssembler/KickAss.jar $1 -showmem -vicesymbols
nestopia $NES_FILE

View File

@ -4,7 +4,7 @@
"version": "2.0.0",
"tasks": [
{
"label": "KickAsm Build & Run",
"label": "KickAsm Build & Run (C64)",
"type": "shell",
"group": {
"kind": "build",
@ -37,13 +37,21 @@
}
},
{
"label": "KickAsm Build & Debug",
"label": "KickAsm Build & Run (NES)",
"group": "build",
"type": "process",
"problemMatcher": [],
"command": ".vscode/kickass-nes.sh",
"args": [ "${file}" ]
},
{
"label": "KickAsm Build & Debug (C64)",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"windows": {
"command": "java",
"args": [

View File

@ -2,6 +2,13 @@
#pragma target(nes)
#include <nes.h>
#include <conio.h>
#include <stdio.h>
#pragma data_seg(GameRam)
char num_buffer[11];
char scroll_buffer[32];
#pragma data_seg(Data)
// RESET Called when the NES is reset, including when it is turned on.
void main() {
@ -14,12 +21,21 @@ void main() {
ppuDataFill(PPU_ATTRIBUTE_TABLE_1, 0, 0x40);
// Print a string
clrscr();
cputs("hello world!\ni am nes\n look at me \n\n");
for(char x=1;x<screensizex()-1;x++) {
cputcxy(x, 1, '-');
cputcxy(x, screensizey()-4, '-');
}
for(char y=1;y<screensizey()-3;y++) {
cputcxy(1, y, 'i');
cputcxy(screensizex()-2, y, 'i');
}
for(char i=0;i<screensizey();i++) {
uctoa(i&0xf, num_buffer, HEXADECIMAL);
cputsxy(i, i, num_buffer);
}
x_scroll = 0;
y_scroll = -8;
// Enable screen rendering and vblank
enableVideoOutput();
// Infinite loop

View File

@ -62,6 +62,10 @@
// $3000-$3eff $0f00 Mirrors of $2000-$2eff
// $3f00-$3f1f $0020 Palette RAM indexes
.label PPU_PALETTE = $3f00
// PPU Status Register for reading in ASM
.label PPU_PPUSTATUS = $2002
// PPU Data Register for reading in ASM
.label PPU_PPUDATA = $2007
// APU Frame Counter
// generates low-frequency clocks for the channels and an optional 60 Hz interrupt.
// https://wiki.nesdev.com/w/index.php/APU_Frame_Counter
@ -76,17 +80,15 @@
.label FR_COUNTER = $4017
// Pointer to the start of RAM memory
.label MEMORY = 0
// PPU Status Register for reading in ASM
.label PPU_PPUSTATUS = $2002
// NES Picture Processing Unit (PPU)
.label PPU = $2000
// NES CPU and audion processing unit (APU)
.label APU = $4000
.label conio_cursor_x = $b
.label conio_cursor_y = $c
.label conio_line_text = $d
.label x_scroll = $f
.label y_scroll = $10
.label conio_cursor_x = $11
.label conio_cursor_y = $12
.label conio_line_text = $13
.label x_scroll = $15
.label y_scroll = $16
__bbegin:
// conio_cursor_x = 0
// The current cursor x-position
@ -111,6 +113,14 @@ __bbegin:
.segment Code
// RESET Called when the NES is reset, including when it is turned on.
main: {
.const screensizex1_return = $20
.const screensizey1_return = $1e
.const screensizey2_return = $1e
.const screensizex2_return = $20
.const screensizey3_return = $1e
.label x = 2
.label y = 3
.label i = 4
// asm
cld
ldx #$ff
@ -168,6 +178,18 @@ main: {
lda PPU_PPUSTATUS
// ppuDataTransfer(PPU_PALETTE, PALETTE, sizeof(PALETTE))
// Transfer the palette
lda #<$20*SIZEOF_BYTE
sta.z ppuDataTransfer.size
lda #>$20*SIZEOF_BYTE
sta.z ppuDataTransfer.size+1
lda #<PALETTE
sta.z ppuDataTransfer.cpuData
lda #>PALETTE
sta.z ppuDataTransfer.cpuData+1
lda #<PPU_PALETTE
sta.z ppuDataTransfer.ppuDataPrepare1_ppuData
lda #>PPU_PALETTE
sta.z ppuDataTransfer.ppuDataPrepare1_ppuData+1
jsr ppuDataTransfer
// ppuDataFill(PPU_ATTRIBUTE_TABLE_0, 0, 0x40)
// Fill the PPU attribute table
@ -195,8 +217,27 @@ main: {
// clrscr()
// Print a string
jsr clrscr
// cputs("hello world!\ni am nes\n look at me \n\n")
jsr cputs
lda #1
sta.z x
__b7:
// for(char x=1;x<screensizex()-1;x++)
lda.z x
cmp #screensizex1_return-1
bcc __b1
lda #1
sta.z y
__b9:
// for(char y=1;y<screensizey()-3;y++)
lda.z y
cmp #screensizey2_return-3
bcc __b2
lda #0
sta.z i
__b11:
// for(char i=0;i<screensizey();i++)
lda.z i
cmp #screensizey3_return
bcc __b3
// x_scroll = 0
lda #0
sta.z x_scroll
@ -209,40 +250,63 @@ main: {
// PPU->PPUMASK = 0b00011110
lda #$1e
sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK
__b1:
__b4:
// Infinite loop
jmp __b1
.segment Data
s: .text @"hello world!\ni am nes\n look at me \n\n"
.byte 0
}
.segment Code
// Output a NUL-terminated string at the current cursor position
// cputs(byte* zp(7) s)
cputs: {
.label s = 7
lda #<main.s
sta.z s
lda #>main.s
sta.z s+1
__b1:
// c=*s++
ldy #0
lda (s),y
// while(c=*s++)
inc.z s
bne !+
inc.z s+1
!:
cmp #0
bne __b2
// }
rts
jmp __b4
__b3:
// uctoa(i&0xf, num_buffer, HEXADECIMAL)
lda #$f
and.z i
tax
jsr uctoa
// cputsxy(i, i, num_buffer)
ldx.z i
txa
jsr cputsxy
// for(char i=0;i<screensizey();i++)
inc.z i
jmp __b11
__b2:
// cputcxy(1, y, 'i')
lda.z y
ldy #'i'
ldx #1
jsr cputcxy
// cputcxy(screensizex()-2, y, 'i')
lda.z y
ldy #'i'
ldx #screensizex2_return-2
jsr cputcxy
// for(char y=1;y<screensizey()-3;y++)
inc.z y
jmp __b9
__b1:
// cputcxy(x, 1, '-')
ldx.z x
ldy #'-'
lda #1
jsr cputcxy
// cputcxy(x, screensizey()-4, '-')
ldx.z x
ldy #'-'
lda #screensizey1_return-4
jsr cputcxy
// for(char x=1;x<screensizex()-1;x++)
inc.z x
jmp __b7
}
// Move cursor and output one character
// Same as "gotoxy (x, y); cputc (c);"
// cputcxy(byte register(X) x, byte register(A) y, byte register(Y) c)
cputcxy: {
// gotoxy(x, y)
jsr gotoxy
// cputc(c)
tya
tax
jsr cputc
jmp __b1
// }
rts
}
// Output one character at the current cursor position
// Moves the cursor forward. Scrolls the entire screen if needed
@ -260,7 +324,7 @@ cputc: {
adc.z conio_line_text+1
sta.z ppuDataSet.ppuData+1
// ppuDataSet(conio_line_text+conio_cursor_x, c)
// ppuDataSet(conio_line_text+conio_cursor_x, c)
txa
jsr ppuDataSet
// if(++conio_cursor_x==CONIO_WIDTH)
inc.z conio_cursor_x
@ -299,10 +363,9 @@ cputln: {
}
// Scroll the entire screen if the cursor is beyond the last line
cscroll: {
.label line2 = 9
// Scroll lines up
.label line1 = 3
.label y = 2
.label line1 = $17
.label line2 = $f
// if(conio_cursor_y==CONIO_HEIGHT)
lda #$1e
cmp.z conio_cursor_y
@ -315,12 +378,10 @@ cscroll: {
sta.z line2
lda #>PPU_NAME_TABLE_0+$20
sta.z line2+1
lda #0
sta.z y
ldx #0
__b1:
// for(char y=0;y<CONIO_HEIGHT-1;y++)
lda.z y
cmp #$1e-1
cpx #$1e-1
bcc __b2
// ppuDataFill(CONIO_SCREEN_TEXT+CONIO_BYTES-CONIO_WIDTH, ' ', CONIO_WIDTH)
// Fill last line with space
@ -348,50 +409,58 @@ cscroll: {
// }
rts
__b2:
ldy #0
__b3:
// for(char x=0;x<CONIO_WIDTH;x++)
cpy #$20
bcc __b4
// for(char y=0;y<CONIO_HEIGHT-1;y++)
inc.z y
jmp __b1
__b4:
// ppuDataGet(line2++)
// ppuDataFetch(scroll_buffer, line2, CONIO_WIDTH)
lda.z line2
sta.z ppuDataGet.ppuData
sta.z ppuDataFetch.ppuData
lda.z line2+1
sta.z ppuDataGet.ppuData+1
jsr ppuDataGet
// ppuDataGet(line2++)
// ch = ppuDataGet(line2++)
tax
inc.z line2
bne !+
inc.z line2+1
!:
// ppuDataSet(line1++, ch)
sta.z ppuDataFetch.ppuData+1
jsr ppuDataFetch
// ppuDataTransfer(line1, scroll_buffer, CONIO_WIDTH)
lda.z line1
sta.z ppuDataSet.ppuData
sta.z ppuDataTransfer.ppuData
lda.z line1+1
sta.z ppuDataSet.ppuData+1
jsr ppuDataSet
// ppuDataSet(line1++, ch);
inc.z line1
bne !+
sta.z ppuDataTransfer.ppuData+1
lda #<$20
sta.z ppuDataTransfer.size
lda #>$20
sta.z ppuDataTransfer.size+1
lda #<scroll_buffer
sta.z ppuDataTransfer.cpuData
lda #>scroll_buffer
sta.z ppuDataTransfer.cpuData+1
jsr ppuDataTransfer
// line1 += CONIO_WIDTH
lda #$20
clc
adc.z line1
sta.z line1
bcc !+
inc.z line1+1
!:
// for(char x=0;x<CONIO_WIDTH;x++)
iny
jmp __b3
// line2 += CONIO_WIDTH
lda #$20
clc
adc.z line2
sta.z line2
bcc !+
inc.z line2+1
!:
// for(char y=0;y<CONIO_HEIGHT-1;y++)
inx
jmp __b1
}
// Set one byte in PPU memory
// 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
// - val : The value to set
// ppuDataSet(byte* zp(5) ppuData, byte register(X) val)
ppuDataSet: {
// - size : The number of bytes to transfer
// ppuDataTransfer(void* zp(5) ppuData, void* zp(7) cpuData, word zp(9) size)
ppuDataTransfer: {
.label ppuDataPrepare1_ppuData = 5
.label cpuSrc = 7
.label i = $b
.label ppuData = 5
.label cpuData = 7
.label size = 9
// >ppuData
lda.z ppuDataPrepare1_ppuData+1
// PPU->PPUADDR = >ppuData
@ -400,16 +469,51 @@ ppuDataSet: {
lda.z ppuDataPrepare1_ppuData
// PPU->PPUADDR = <ppuData
sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR
// PPU->PPUDATA = val
stx PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA
lda #<0
sta.z i
sta.z i+1
__b1:
// for(unsigned int i=0;i<size;i++)
lda.z i+1
cmp.z size+1
bcc __b2
bne !+
lda.z i
cmp.z size
bcc __b2
!:
// }
rts
__b2:
// ppuDataPut(*cpuSrc++)
ldy #0
lda (cpuSrc),y
// PPU->PPUDATA = val
sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA
// ppuDataPut(*cpuSrc++);
inc.z cpuSrc
bne !+
inc.z cpuSrc+1
!:
// for(unsigned int i=0;i<size;i++)
inc.z i
bne !+
inc.z i+1
!:
jmp __b1
}
// Get one byte from PPU memory
// Transfer a number of bytes from the PPU memory to the CPU memory
// - ppuData : Pointer in the PPU memory
// ppuDataGet(void* zp($11) ppuData)
ppuDataGet: {
.label ppuData = $11
// - cpuData : Pointer to the CPU memory (RAM of ROM)
// - size : The number of bytes to transfer
// ppuDataFetch(void* zp($19) ppuData)
ppuDataFetch: {
.const size = $20
.label cpuData = scroll_buffer
// Fetch from PPU to CPU
.label cpuDst = 7
.label i = 5
.label ppuData = $19
// >ppuData
lda.z ppuData+1
// PPU->PPUADDR = >ppuData
@ -418,19 +522,54 @@ ppuDataGet: {
lda.z ppuData
// PPU->PPUADDR = <ppuData
sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR
// return PPU->PPUDATA;
lda PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA
// asm
// Perform a dummy-read to discard the current value in the data read buffer and update it with the first byte from the PPU address
lda PPU_PPUDATA
lda #<cpuData
sta.z cpuDst
lda #>cpuData
sta.z cpuDst+1
lda #<0
sta.z i
sta.z i+1
__b1:
// for(unsigned int i=0;i<size;i++)
lda.z i+1
cmp #>size
bcc ppuDataRead1
bne !+
lda.z i
cmp #<size
bcc ppuDataRead1
!:
// }
rts
ppuDataRead1:
// return PPU->PPUDATA;
lda PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA
// *cpuDst++ = ppuDataRead()
ldy #0
sta (cpuDst),y
// *cpuDst++ = ppuDataRead();
inc.z cpuDst
bne !+
inc.z cpuDst+1
!:
// for(unsigned int i=0;i<size;i++)
inc.z i
bne !+
inc.z i+1
!:
jmp __b1
}
// 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($11) size)
// ppuDataFill(byte register(X) val, word zp($b) size)
ppuDataFill: {
.label ppuDataPrepare1_ppuData = 5
.label i = 9
.label size = $11
.label ppuDataPrepare1_ppuData = 9
.label i = $19
.label size = $b
// >ppuData
lda.z ppuDataPrepare1_ppuData+1
// PPU->PPUADDR = >ppuData
@ -465,6 +604,211 @@ ppuDataFill: {
!:
jmp __b1
}
// Set one byte in PPU memory
// - ppuData : Pointer in the PPU memory
// - val : The value to set
// ppuDataSet(byte* zp($17) ppuData, byte register(A) val)
ppuDataSet: {
.label ppuData = $17
// >ppuData
ldx.z ppuData+1
// PPU->PPUADDR = >ppuData
stx PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR
// <ppuData
ldx.z ppuData
// PPU->PPUADDR = <ppuData
stx PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR
// PPU->PPUDATA = val
sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA
// }
rts
}
// Set the cursor to the specified position
// gotoxy(byte register(X) x, byte register(A) y)
gotoxy: {
.label __5 = $13
.label __6 = $13
.label line_offset = $13
// if(y>CONIO_HEIGHT)
cmp #$1e+1
bcc __b1
lda #0
__b1:
// if(x>=CONIO_WIDTH)
cpx #$20
bcc __b2
ldx #0
__b2:
// conio_cursor_x = x
stx.z conio_cursor_x
// conio_cursor_y = y
sta.z conio_cursor_y
// (unsigned int)y*CONIO_WIDTH
sta.z __6
lda #0
sta.z __6+1
// line_offset = (unsigned int)y*CONIO_WIDTH
asl.z line_offset
rol.z line_offset+1
asl.z line_offset
rol.z line_offset+1
asl.z line_offset
rol.z line_offset+1
asl.z line_offset
rol.z line_offset+1
asl.z line_offset
rol.z line_offset+1
// CONIO_SCREEN_TEXT + line_offset
clc
lda.z __5
adc #<PPU_NAME_TABLE_0
sta.z __5
lda.z __5+1
adc #>PPU_NAME_TABLE_0
sta.z __5+1
// conio_line_text = CONIO_SCREEN_TEXT + line_offset
// }
rts
}
// Move cursor and output a NUL-terminated string
// Same as "gotoxy (x, y); puts (s);"
// cputsxy(byte register(X) x, byte register(A) y)
cputsxy: {
// gotoxy(x, y)
jsr gotoxy
// cputs(s)
jsr cputs
// }
rts
}
// Output a NUL-terminated string at the current cursor position
// cputs(byte* zp($d) s)
cputs: {
.label s = $d
lda #<num_buffer
sta.z s
lda #>num_buffer
sta.z s+1
__b1:
// c=*s++
ldy #0
lda (s),y
// while(c=*s++)
inc.z s
bne !+
inc.z s+1
!:
cmp #0
bne __b2
// }
rts
__b2:
// cputc(c)
tax
jsr cputc
jmp __b1
}
// Converts unsigned number value to a string representing it in RADIX format.
// If the leading digits are zero they are not included in the string.
// - value : The number to be converted to RADIX
// - buffer : receives the string representing the number and zero-termination.
// - radix : The radix to convert the number to (from the enum RADIX)
// uctoa(byte register(X) value, byte* zp($f) buffer)
uctoa: {
.const max_digits = 2
.label digit_value = $1b
.label buffer = $f
.label digit = $11
.label started = $12
lda #<num_buffer
sta.z buffer
lda #>num_buffer
sta.z buffer+1
lda #0
sta.z started
sta.z digit
__b1:
// for( char digit=0; digit<max_digits-1; digit++ )
lda.z digit
cmp #max_digits-1
bcc __b2
// *buffer++ = DIGITS[(char)value]
lda DIGITS,x
ldy #0
sta (buffer),y
// *buffer++ = DIGITS[(char)value];
inc.z buffer
bne !+
inc.z buffer+1
!:
// *buffer = 0
lda #0
tay
sta (buffer),y
// }
rts
__b2:
// digit_value = digit_values[digit]
ldy.z digit
lda RADIX_HEXADECIMAL_VALUES_CHAR,y
sta.z digit_value
// if (started || value >= digit_value)
lda #0
cmp.z started
bne __b5
cpx.z digit_value
bcs __b5
__b4:
// for( char digit=0; digit<max_digits-1; digit++ )
inc.z digit
jmp __b1
__b5:
// uctoa_append(buffer++, value, digit_value)
jsr uctoa_append
// uctoa_append(buffer++, value, digit_value)
// value = uctoa_append(buffer++, value, digit_value)
// value = uctoa_append(buffer++, value, digit_value);
inc.z buffer
bne !+
inc.z buffer+1
!:
lda #1
sta.z started
jmp __b4
}
// Used to convert a single digit of an unsigned number value to a string representation
// Counts a single digit up from '0' as long as the value is larger than sub.
// Each time the digit is increased sub is subtracted from value.
// - buffer : pointer to the char that receives the digit
// - value : The value where the digit will be derived from
// - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased.
// (For decimal the subs used are 10000, 1000, 100, 10, 1)
// returns : the value reduced by sub * digit so that it is less than sub.
// uctoa_append(byte* zp($f) buffer, byte register(X) value, byte zp($1b) sub)
uctoa_append: {
.label buffer = $f
.label sub = $1b
ldy #0
__b1:
// while (value >= sub)
cpx.z sub
bcs __b2
// *buffer = DIGITS[digit]
lda DIGITS,y
ldy #0
sta (buffer),y
// }
rts
__b2:
// digit++;
iny
// value -= sub
txa
sec
sbc.z sub
tax
jmp __b1
}
// clears the screen and moves the cursor to the upper left-hand corner of the screen.
clrscr: {
// ppuDataFill(CONIO_SCREEN_TEXT, ' ', 0x3c0)
@ -491,60 +835,6 @@ clrscr: {
// }
rts
}
// 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 = 9
.label i = 7
// PPU->PPUADDR = >ppuData
lda #>ppuData
sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR
// PPU->PPUADDR = <ppuData
lda #0
sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR
lda #<cpuData
sta.z cpuSrc
lda #>cpuData
sta.z cpuSrc+1
lda #<0
sta.z i
sta.z i+1
__b1:
// for(unsigned int i=0;i<size;i++)
lda.z i+1
cmp #>size
bcc __b2
bne !+
lda.z i
cmp #<size
bcc __b2
!:
// }
rts
__b2:
// ppuDataPut(*cpuSrc++)
ldy #0
lda (cpuSrc),y
// PPU->PPUDATA = val
sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA
// ppuDataPut(*cpuSrc++);
inc.z cpuSrc
bne !+
inc.z cpuSrc+1
!:
// for(unsigned int i=0;i<size;i++)
inc.z i
bne !+
inc.z i+1
!:
jmp __b1
}
// NMI Called when the PPU refreshes the screen (also known as the V-Blank period)
vblank: {
pha
@ -629,7 +919,7 @@ vblank: {
// - bit 6: B
// - bit 7: A
readJoy1: {
.label __1 = $13
.label __1 = $1c
// APU->JOY1 = 1
// Latch the controller buttons
lda #1
@ -657,6 +947,14 @@ readJoy1: {
inx
jmp __b1
}
.segment Data
// The digits used for numbers
DIGITS: .text "0123456789abcdef"
// Values of hexadecimal digits
RADIX_HEXADECIMAL_VALUES_CHAR: .byte $10
.segment GameRam
num_buffer: .fill $b, 0
scroll_buffer: .fill $20, 0
.segment Data
// 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

View File

@ -64,311 +64,496 @@ main::initNES1_waitForVBlank2_@1: scope:[main] from main::initNES1_waitForVBlan
to:main::initNES1_@7
main::initNES1_@7: scope:[main] from main::initNES1_waitForVBlank2_@1
asm { ldaPPU_PPUSTATUS }
to:main::@2
main::@2: scope:[main] from main::initNES1_@7
to:main::@6
main::@6: scope:[main] from main::initNES1_@7
[34] phi()
[35] call ppuDataTransfer
to:main::@3
main::@3: scope:[main] from main::@2
to:main::@12
main::@12: scope:[main] from main::@6
[36] phi()
[37] call ppuDataFill
to:main::@4
main::@4: scope:[main] from main::@3
to:main::@13
main::@13: scope:[main] from main::@12
[38] phi()
[39] call ppuDataFill
to:main::@5
main::@5: scope:[main] from main::@4
to:main::@14
main::@14: scope:[main] from main::@13
[40] phi()
[41] call clrscr
to:main::@6
main::@6: scope:[main] from main::@5
[42] phi()
[43] call cputs
to:main::screensizex1
main::screensizex1: scope:[main] from main::@14 main::@15
[42] (byte) main::x#10 ← phi( main::@14/(byte) 1 main::@15/(byte) main::x#1 )
to:main::@7
main::@7: scope:[main] from main::@6
[44] (volatile byte) x_scroll ← (byte) 0
[45] (volatile byte) y_scroll ← (byte) -8
main::@7: scope:[main] from main::screensizex1
[43] if((byte) main::x#10<(const byte) main::screensizex1_return#0-(byte) 1) goto main::@1
to:main::screensizey2
main::screensizey2: scope:[main] from main::@16 main::@7
[44] (byte) main::y#10 ← phi( main::@7/(byte) 1 main::@16/(byte) main::y#1 )
to:main::@9
main::@9: scope:[main] from main::screensizey2
[45] if((byte) main::y#10<(const byte) main::screensizey2_return#0-(byte) 3) goto main::@2
to:main::screensizey3
main::screensizey3: scope:[main] from main::@18 main::@9
[46] (byte) main::i#2 ← phi( main::@18/(byte) main::i#1 main::@9/(byte) 0 )
to:main::@11
main::@11: scope:[main] from main::screensizey3
[47] if((byte) main::i#2<(const byte) main::screensizey3_return#0) goto main::@3
to:main::@4
main::@4: scope:[main] from main::@11
[48] (volatile byte) x_scroll ← (byte) 0
[49] (volatile byte) y_scroll ← (byte) -8
to:main::enableVideoOutput1
main::enableVideoOutput1: scope:[main] from main::@7
[46] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80
[47] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $1e
to:main::@1
main::@1: scope:[main] from main::@1 main::enableVideoOutput1
[48] phi()
to:main::@1
main::enableVideoOutput1: scope:[main] from main::@4
[50] *((byte*)(const struct RICOH_2C02*) PPU) ← (byte) $80
[51] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUMASK) ← (byte) $1e
to:main::@5
main::@5: scope:[main] from main::@5 main::enableVideoOutput1
[52] phi()
to:main::@5
main::@3: scope:[main] from main::@11
[53] (byte) uctoa::value#1 ← (byte) main::i#2 & (byte) $f
[54] call uctoa
to:main::@17
main::@17: scope:[main] from main::@3
[55] (byte) cputsxy::x#0 ← (byte) main::i#2
[56] (byte) cputsxy::y#0 ← (byte) main::i#2
[57] call cputsxy
to:main::@18
main::@18: scope:[main] from main::@17
[58] (byte) main::i#1 ← ++ (byte) main::i#2
to:main::screensizey3
main::@2: scope:[main] from main::@9
[59] (byte) cputcxy::y#2 ← (byte) main::y#10
[60] call cputcxy
to:main::screensizex2
main::screensizex2: scope:[main] from main::@2
[61] phi()
to:main::@10
main::@10: scope:[main] from main::screensizex2
[62] (byte) cputcxy::y#3 ← (byte) main::y#10
[63] call cputcxy
to:main::@16
main::@16: scope:[main] from main::@10
[64] (byte) main::y#1 ← ++ (byte) main::y#10
to:main::screensizey2
main::@1: scope:[main] from main::@7
[65] (byte) cputcxy::x#0 ← (byte) main::x#10
[66] call cputcxy
to:main::screensizey1
main::screensizey1: scope:[main] from main::@1
[67] phi()
to:main::@8
main::@8: scope:[main] from main::screensizey1
[68] (byte) cputcxy::x#1 ← (byte) main::x#10
[69] call cputcxy
to:main::@15
main::@15: scope:[main] from main::@8
[70] (byte) main::x#1 ← ++ (byte) main::x#10
to:main::screensizex1
(void()) cputs((to_nomodify byte*) cputs::s)
cputs: scope:[cputs] from main::@6
[49] phi()
to:cputs::@1
cputs::@1: scope:[cputs] from cputs cputs::@2
[50] (to_nomodify byte*) cputs::s#2 ← phi( cputs/(const byte*) main::s cputs::@2/(to_nomodify byte*) cputs::s#0 )
[51] (byte) cputs::c#1 ← *((to_nomodify byte*) cputs::s#2)
[52] (to_nomodify byte*) cputs::s#0 ← ++ (to_nomodify byte*) cputs::s#2
[53] if((byte) 0!=(byte) cputs::c#1) goto cputs::@2
to:cputs::@return
cputs::@return: scope:[cputs] from cputs::@1
[54] return
(void()) cputcxy((byte) cputcxy::x , (byte) cputcxy::y , (byte) cputcxy::c)
cputcxy: scope:[cputcxy] from main::@1 main::@10 main::@2 main::@8
[71] (byte) cputcxy::c#4 ← phi( main::@1/(byte) '-' main::@8/(byte) '-' main::@10/(byte) 'i' main::@2/(byte) 'i' )
[71] (byte) cputcxy::y#4 ← phi( main::@1/(byte) 1 main::@8/(const byte) main::screensizey1_return#0-(byte) 4 main::@10/(byte) cputcxy::y#3 main::@2/(byte) cputcxy::y#2 )
[71] (byte) cputcxy::x#4 ← phi( main::@1/(byte) cputcxy::x#0 main::@8/(byte) cputcxy::x#1 main::@10/(const byte) main::screensizex2_return#0-(byte) 2 main::@2/(byte) 1 )
[72] (byte) gotoxy::x#2 ← (byte) cputcxy::x#4
[73] (byte) gotoxy::y#2 ← (byte) cputcxy::y#4
[74] call gotoxy
to:cputcxy::@1
cputcxy::@1: scope:[cputcxy] from cputcxy
[75] (byte) cputc::c#1 ← (byte) cputcxy::c#4
[76] call cputc
to:cputcxy::@return
cputcxy::@return: scope:[cputcxy] from cputcxy::@1
[77] return
to:@return
cputs::@2: scope:[cputs] from cputs::@1
[55] (byte) cputc::c#0 ← (byte) cputs::c#1
[56] call cputc
to:cputs::@1
(void()) cputc((byte) cputc::c)
cputc: scope:[cputc] from cputs::@2
[57] if((byte) cputc::c#0==(byte) '
cputc: scope:[cputc] from cputcxy::@1 cputs::@2
[78] (byte) cputc::c#2 ← phi( cputcxy::@1/(byte) cputc::c#1 cputs::@2/(byte) cputc::c#0 )
[79] if((byte) cputc::c#2==(byte) '
') goto cputc::@1
to:cputc::@2
cputc::@2: scope:[cputc] from cputc
[58] (nomodify byte*) ppuDataSet::ppuData#0 ← (byte*) conio_line_text + (byte) conio_cursor_x
[59] (byte) ppuDataSet::val#0 ← (byte) cputc::c#0
[60] (nomodify void*) ppuDataSet::ppuDataPrepare1_ppuData#2 ← (void*)(nomodify byte*) ppuDataSet::ppuData#0
[61] call ppuDataSet
[80] (nomodify byte*) ppuDataSet::ppuData#0 ← (byte*) conio_line_text + (byte) conio_cursor_x
[81] (byte) ppuDataSet::val#0 ← (byte) cputc::c#2
[82] call ppuDataSet
to:cputc::@4
cputc::@4: scope:[cputc] from cputc::@2
[62] (byte) conio_cursor_x ← ++ (byte) conio_cursor_x
[63] if((byte) conio_cursor_x!=(byte) $20) goto cputc::@return
[83] (byte) conio_cursor_x ← ++ (byte) conio_cursor_x
[84] if((byte) conio_cursor_x!=(byte) $20) goto cputc::@return
to:cputc::@3
cputc::@3: scope:[cputc] from cputc::@4
[64] phi()
[65] call cputln
[85] phi()
[86] call cputln
to:cputc::@return
cputc::@return: scope:[cputc] from cputc::@1 cputc::@3 cputc::@4
[66] return
[87] return
to:@return
cputc::@1: scope:[cputc] from cputc
[67] phi()
[68] call cputln
[88] phi()
[89] call cputln
to:cputc::@return
(void()) cputln()
cputln: scope:[cputln] from cputc::@1 cputc::@3
[69] (byte*) conio_line_text ← (byte*) conio_line_text + (byte) $20
[70] (byte) conio_cursor_x ← (byte) 0
[71] (byte) conio_cursor_y ← ++ (byte) conio_cursor_y
[72] call cscroll
[90] (byte*) conio_line_text ← (byte*) conio_line_text + (byte) $20
[91] (byte) conio_cursor_x ← (byte) 0
[92] (byte) conio_cursor_y ← ++ (byte) conio_cursor_y
[93] call cscroll
to:cputln::@return
cputln::@return: scope:[cputln] from cputln
[73] return
[94] return
to:@return
(void()) cscroll()
cscroll: scope:[cscroll] from cputln
[74] if((byte) conio_cursor_y!=(byte) $1e) goto cscroll::@return
[95] if((byte) conio_cursor_y!=(byte) $1e) goto cscroll::@return
to:cscroll::@1
cscroll::@1: scope:[cscroll] from cscroll cscroll::@5
[75] (byte*) cscroll::line1#6 ← phi( cscroll/(const nomodify byte*) PPU_NAME_TABLE_0 cscroll::@5/(byte*) cscroll::line1#2 )
[75] (byte*) cscroll::line2#6 ← phi( cscroll/(const nomodify byte*) PPU_NAME_TABLE_0+(byte) $20 cscroll::@5/(byte*) cscroll::line2#2 )
[75] (byte) cscroll::y#2 ← phi( cscroll/(byte) 0 cscroll::@5/(byte) cscroll::y#1 )
[76] if((byte) cscroll::y#2<(byte)(number) $1e-(number) 1) goto cscroll::@3
to:cscroll::@2
cscroll::@2: scope:[cscroll] from cscroll::@1
[77] phi()
[78] call ppuDataFill
[96] (byte*) cscroll::line1#2 ← phi( cscroll/(const nomodify byte*) PPU_NAME_TABLE_0 cscroll::@5/(byte*) cscroll::line1#1 )
[96] (byte*) cscroll::line2#2 ← phi( cscroll/(const nomodify byte*) PPU_NAME_TABLE_0+(byte) $20 cscroll::@5/(byte*) cscroll::line2#1 )
[96] (byte) cscroll::y#2 ← phi( cscroll/(byte) 0 cscroll::@5/(byte) cscroll::y#1 )
[97] if((byte) cscroll::y#2<(byte)(number) $1e-(number) 1) goto cscroll::@2
to:cscroll::@3
cscroll::@3: scope:[cscroll] from cscroll::@1
[98] phi()
[99] call ppuDataFill
to:cscroll::@6
cscroll::@6: scope:[cscroll] from cscroll::@2
[79] (byte*) conio_line_text ← (byte*) conio_line_text - (byte) $20
[80] (byte) conio_cursor_y ← -- (byte) conio_cursor_y
cscroll::@6: scope:[cscroll] from cscroll::@3
[100] (byte*) conio_line_text ← (byte*) conio_line_text - (byte) $20
[101] (byte) conio_cursor_y ← -- (byte) conio_cursor_y
to:cscroll::@return
cscroll::@return: scope:[cscroll] from cscroll cscroll::@6
[81] return
[102] return
to:@return
cscroll::@3: scope:[cscroll] from cscroll::@1 cscroll::@8
[82] (byte*) cscroll::line1#2 ← phi( cscroll::@8/(byte*) cscroll::line1#1 cscroll::@1/(byte*) cscroll::line1#6 )
[82] (byte*) cscroll::line2#2 ← phi( cscroll::@8/(byte*) cscroll::line2#1 cscroll::@1/(byte*) cscroll::line2#6 )
[82] (byte) cscroll::x#2 ← phi( cscroll::@8/(byte) cscroll::x#1 cscroll::@1/(byte) 0 )
[83] if((byte) cscroll::x#2<(byte) $20) goto cscroll::@4
cscroll::@2: scope:[cscroll] from cscroll::@1
[103] (nomodify void*) ppuDataFetch::ppuData#0 ← (void*)(byte*) cscroll::line2#2
[104] call ppuDataFetch
to:cscroll::@4
cscroll::@4: scope:[cscroll] from cscroll::@2
[105] (nomodify void*) ppuDataTransfer::ppuData#0 ← (void*)(byte*) cscroll::line1#2
[106] call ppuDataTransfer
to:cscroll::@5
cscroll::@5: scope:[cscroll] from cscroll::@3
[84] (byte) cscroll::y#1 ← ++ (byte) cscroll::y#2
cscroll::@5: scope:[cscroll] from cscroll::@4
[107] (byte*) cscroll::line1#1 ← (byte*) cscroll::line1#2 + (byte) $20
[108] (byte*) cscroll::line2#1 ← (byte*) cscroll::line2#2 + (byte) $20
[109] (byte) cscroll::y#1 ← ++ (byte) cscroll::y#2
to:cscroll::@1
cscroll::@4: scope:[cscroll] from cscroll::@3
[85] (nomodify void*) ppuDataGet::ppuData#0 ← (void*)(byte*) cscroll::line2#2
[86] call ppuDataGet
[87] (byte) ppuDataGet::return#2 ← (byte) ppuDataGet::ppuDataRead1_return#0
to:cscroll::@7
cscroll::@7: scope:[cscroll] from cscroll::@4
[88] (byte) cscroll::ch#0 ← (byte) ppuDataGet::return#2
[89] (byte*) cscroll::line2#1 ← ++ (byte*) cscroll::line2#2
[90] (nomodify void*) ppuDataSet::ppuData#1 ← (void*)(byte*) cscroll::line1#2
[91] (byte) ppuDataSet::val#1 ← (byte) cscroll::ch#0
[92] call ppuDataSet
to:cscroll::@8
cscroll::@8: scope:[cscroll] from cscroll::@7
[93] (byte*) cscroll::line1#1 ← ++ (byte*) cscroll::line1#2
[94] (byte) cscroll::x#1 ← ++ (byte) cscroll::x#2
to:cscroll::@3
(void()) ppuDataSet((nomodify void*) ppuDataSet::ppuData , (byte) ppuDataSet::val)
ppuDataSet: scope:[ppuDataSet] from cputc::@2 cscroll::@7
[95] (byte) ppuDataSet::val#2 ← phi( cputc::@2/(byte) ppuDataSet::val#0 cscroll::@7/(byte) ppuDataSet::val#1 )
[95] (nomodify void*) ppuDataSet::ppuDataPrepare1_ppuData#0 ← phi( cputc::@2/(nomodify void*) ppuDataSet::ppuDataPrepare1_ppuData#2 cscroll::@7/(nomodify void*) ppuDataSet::ppuData#1 )
to:ppuDataSet::ppuDataPrepare1
ppuDataSet::ppuDataPrepare1: scope:[ppuDataSet] from ppuDataSet
[96] (byte~) ppuDataSet::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataSet::ppuDataPrepare1_ppuData#0
[97] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataSet::ppuDataPrepare1_$0
[98] (byte~) ppuDataSet::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataSet::ppuDataPrepare1_ppuData#0
[99] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataSet::ppuDataPrepare1_$1
to:ppuDataSet::ppuDataPut1
ppuDataSet::ppuDataPut1: scope:[ppuDataSet] from ppuDataSet::ppuDataPrepare1
[100] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataSet::val#2
to:ppuDataSet::@return
ppuDataSet::@return: scope:[ppuDataSet] from ppuDataSet::ppuDataPut1
[101] return
to:@return
(byte()) ppuDataGet((nomodify void*) ppuDataGet::ppuData)
ppuDataGet: scope:[ppuDataGet] from cscroll::@4
[102] phi()
to:ppuDataGet::ppuDataPrepare1
ppuDataGet::ppuDataPrepare1: scope:[ppuDataGet] from ppuDataGet
[103] (byte~) ppuDataGet::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataGet::ppuData#0
[104] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataGet::ppuDataPrepare1_$0
[105] (byte~) ppuDataGet::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataGet::ppuData#0
[106] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataGet::ppuDataPrepare1_$1
to:ppuDataGet::ppuDataRead1
ppuDataGet::ppuDataRead1: scope:[ppuDataGet] from ppuDataGet::ppuDataPrepare1
[107] (byte) ppuDataGet::ppuDataRead1_return#0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA)
to:ppuDataGet::@return
ppuDataGet::@return: scope:[ppuDataGet] from ppuDataGet::ppuDataRead1
[108] return
to:@return
(void()) ppuDataFill((nomodify void*) ppuDataFill::ppuData , (byte) ppuDataFill::val , (word) ppuDataFill::size)
ppuDataFill: scope:[ppuDataFill] from clrscr cscroll::@2 main::@3 main::@4
[109] (byte) ppuDataFill::val#10 ← phi( clrscr/(byte) ' ' cscroll::@2/(byte) ' ' main::@3/(byte) 0 main::@4/(byte) 0 )
[109] (word) ppuDataFill::size#5 ← phi( clrscr/(word) $3c0 cscroll::@2/(byte) $20 main::@3/(byte) $40 main::@4/(byte) $40 )
[109] (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ← phi( clrscr/(void*)(const nomodify byte*) PPU_NAME_TABLE_0 cscroll::@2/(void*)(const nomodify byte*) PPU_NAME_TABLE_0+(word)(number) $1e*(number) $20-(byte) $20 main::@3/(void*)(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 main::@4/(void*)(const nomodify byte*) PPU_ATTRIBUTE_TABLE_1 )
to:ppuDataFill::ppuDataPrepare1
ppuDataFill::ppuDataPrepare1: scope:[ppuDataFill] from ppuDataFill
[110] (byte~) ppuDataFill::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0
[111] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$0
[112] (byte~) ppuDataFill::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0
[113] *((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
[114] (word) ppuDataFill::i#2 ← phi( ppuDataFill::ppuDataPrepare1/(word) 0 ppuDataFill::@2/(word) ppuDataFill::i#1 )
[115] if((word) ppuDataFill::i#2<(word) ppuDataFill::size#5) goto ppuDataFill::ppuDataPut1
to:ppuDataFill::@return
ppuDataFill::@return: scope:[ppuDataFill] from ppuDataFill::@1
[116] return
to:@return
ppuDataFill::ppuDataPut1: scope:[ppuDataFill] from ppuDataFill::@1
[117] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataFill::val#10
to:ppuDataFill::@2
ppuDataFill::@2: scope:[ppuDataFill] from ppuDataFill::ppuDataPut1
[118] (word) ppuDataFill::i#1 ← ++ (word) ppuDataFill::i#2
to:ppuDataFill::@1
(void()) clrscr()
clrscr: scope:[clrscr] from main::@5
[119] phi()
[120] call ppuDataFill
to:clrscr::@1
clrscr::@1: scope:[clrscr] from clrscr
[121] (byte) conio_cursor_x ← (byte) 0
[122] (byte) conio_cursor_y ← (byte) 0
[123] (byte*) conio_line_text ← (const nomodify byte*) PPU_NAME_TABLE_0
to:clrscr::@return
clrscr::@return: scope:[clrscr] from clrscr::@1
[124] return
to:@return
(void()) ppuDataTransfer((nomodify void*) ppuDataTransfer::ppuData , (nomodify void*) ppuDataTransfer::cpuData , (word) ppuDataTransfer::size)
ppuDataTransfer: scope:[ppuDataTransfer] from main::@2
[125] phi()
ppuDataTransfer: scope:[ppuDataTransfer] from cscroll::@4 main::@6
[110] (word) ppuDataTransfer::size#3 ← phi( cscroll::@4/(byte) $20 main::@6/(byte) $20*(const byte) SIZEOF_BYTE )
[110] (nomodify void*) ppuDataTransfer::cpuData#2 ← phi( cscroll::@4/(void*)(const byte*) scroll_buffer main::@6/(void*)(const byte*) PALETTE )
[110] (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0 ← phi( cscroll::@4/(nomodify void*) ppuDataTransfer::ppuData#0 main::@6/(void*)(const nomodify byte*) PPU_PALETTE )
to:ppuDataTransfer::ppuDataPrepare1
ppuDataTransfer::ppuDataPrepare1: scope:[ppuDataTransfer] from ppuDataTransfer
[126] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← >(const nomodify void*) ppuDataTransfer::ppuData#0
[127] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte) 0
[111] (byte~) ppuDataTransfer::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0
[112] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataTransfer::ppuDataPrepare1_$0
[113] (byte~) ppuDataTransfer::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0
[114] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataTransfer::ppuDataPrepare1_$1
to:ppuDataTransfer::@3
ppuDataTransfer::@3: scope:[ppuDataTransfer] from ppuDataTransfer::ppuDataPrepare1
[115] (byte*) ppuDataTransfer::cpuSrc#6 ← (byte*)(nomodify void*) ppuDataTransfer::cpuData#2
to:ppuDataTransfer::@1
ppuDataTransfer::@1: scope:[ppuDataTransfer] from ppuDataTransfer::@3 ppuDataTransfer::ppuDataPrepare1
[128] (byte*) ppuDataTransfer::cpuSrc#2 ← phi( ppuDataTransfer::ppuDataPrepare1/(byte*)(const nomodify void*) ppuDataTransfer::cpuData#0 ppuDataTransfer::@3/(byte*) ppuDataTransfer::cpuSrc#1 )
[128] (word) ppuDataTransfer::i#2 ← phi( ppuDataTransfer::ppuDataPrepare1/(word) 0 ppuDataTransfer::@3/(word) ppuDataTransfer::i#1 )
[129] if((word) ppuDataTransfer::i#2<(const word) ppuDataTransfer::size#0) goto ppuDataTransfer::@2
ppuDataTransfer::@1: scope:[ppuDataTransfer] from ppuDataTransfer::@3 ppuDataTransfer::@4
[116] (byte*) ppuDataTransfer::cpuSrc#2 ← phi( ppuDataTransfer::@3/(byte*) ppuDataTransfer::cpuSrc#6 ppuDataTransfer::@4/(byte*) ppuDataTransfer::cpuSrc#1 )
[116] (word) ppuDataTransfer::i#2 ← phi( ppuDataTransfer::@3/(word) 0 ppuDataTransfer::@4/(word) ppuDataTransfer::i#1 )
[117] if((word) ppuDataTransfer::i#2<(word) ppuDataTransfer::size#3) goto ppuDataTransfer::@2
to:ppuDataTransfer::@return
ppuDataTransfer::@return: scope:[ppuDataTransfer] from ppuDataTransfer::@1
[130] return
[118] return
to:@return
ppuDataTransfer::@2: scope:[ppuDataTransfer] from ppuDataTransfer::@1
[131] (byte) ppuDataTransfer::ppuDataPut1_val#0 ← *((byte*) ppuDataTransfer::cpuSrc#2)
[119] (byte) ppuDataTransfer::ppuDataPut1_val#0 ← *((byte*) ppuDataTransfer::cpuSrc#2)
to:ppuDataTransfer::ppuDataPut1
ppuDataTransfer::ppuDataPut1: scope:[ppuDataTransfer] from ppuDataTransfer::@2
[132] *((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
[133] (byte*) ppuDataTransfer::cpuSrc#1 ← ++ (byte*) ppuDataTransfer::cpuSrc#2
[134] (word) ppuDataTransfer::i#1 ← ++ (word) ppuDataTransfer::i#2
[120] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataTransfer::ppuDataPut1_val#0
to:ppuDataTransfer::@4
ppuDataTransfer::@4: scope:[ppuDataTransfer] from ppuDataTransfer::ppuDataPut1
[121] (byte*) ppuDataTransfer::cpuSrc#1 ← ++ (byte*) ppuDataTransfer::cpuSrc#2
[122] (word) ppuDataTransfer::i#1 ← ++ (word) ppuDataTransfer::i#2
to:ppuDataTransfer::@1
(void()) ppuDataFetch((nomodify void*) ppuDataFetch::cpuData , (nomodify void*) ppuDataFetch::ppuData , (word) ppuDataFetch::size)
ppuDataFetch: scope:[ppuDataFetch] from cscroll::@2
[123] phi()
to:ppuDataFetch::ppuDataPrepare1
ppuDataFetch::ppuDataPrepare1: scope:[ppuDataFetch] from ppuDataFetch
[124] (byte~) ppuDataFetch::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFetch::ppuData#0
[125] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFetch::ppuDataPrepare1_$0
[126] (byte~) ppuDataFetch::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataFetch::ppuData#0
[127] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFetch::ppuDataPrepare1_$1
to:ppuDataFetch::@2
ppuDataFetch::@2: scope:[ppuDataFetch] from ppuDataFetch::ppuDataPrepare1
asm { ldaPPU_PPUDATA }
to:ppuDataFetch::@1
ppuDataFetch::@1: scope:[ppuDataFetch] from ppuDataFetch::@2 ppuDataFetch::@3
[129] (byte*) ppuDataFetch::cpuDst#2 ← phi( ppuDataFetch::@2/(byte*)(const nomodify void*) ppuDataFetch::cpuData#0 ppuDataFetch::@3/(byte*) ppuDataFetch::cpuDst#1 )
[129] (word) ppuDataFetch::i#2 ← phi( ppuDataFetch::@2/(word) 0 ppuDataFetch::@3/(word) ppuDataFetch::i#1 )
[130] if((word) ppuDataFetch::i#2<(const word) ppuDataFetch::size#0) goto ppuDataFetch::ppuDataRead1
to:ppuDataFetch::@return
ppuDataFetch::@return: scope:[ppuDataFetch] from ppuDataFetch::@1
[131] return
to:@return
ppuDataFetch::ppuDataRead1: scope:[ppuDataFetch] from ppuDataFetch::@1
[132] (byte) ppuDataFetch::ppuDataRead1_return#0 ← *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA)
to:ppuDataFetch::@3
ppuDataFetch::@3: scope:[ppuDataFetch] from ppuDataFetch::ppuDataRead1
[133] *((byte*) ppuDataFetch::cpuDst#2) ← (byte) ppuDataFetch::ppuDataRead1_return#0
[134] (byte*) ppuDataFetch::cpuDst#1 ← ++ (byte*) ppuDataFetch::cpuDst#2
[135] (word) ppuDataFetch::i#1 ← ++ (word) ppuDataFetch::i#2
to:ppuDataFetch::@1
(void()) ppuDataFill((nomodify void*) ppuDataFill::ppuData , (byte) ppuDataFill::val , (word) ppuDataFill::size)
ppuDataFill: scope:[ppuDataFill] from clrscr cscroll::@3 main::@12 main::@13
[136] (byte) ppuDataFill::val#10 ← phi( clrscr/(byte) ' ' cscroll::@3/(byte) ' ' main::@12/(byte) 0 main::@13/(byte) 0 )
[136] (word) ppuDataFill::size#5 ← phi( clrscr/(word) $3c0 cscroll::@3/(byte) $20 main::@12/(byte) $40 main::@13/(byte) $40 )
[136] (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ← phi( clrscr/(void*)(const nomodify byte*) PPU_NAME_TABLE_0 cscroll::@3/(void*)(const nomodify byte*) PPU_NAME_TABLE_0+(word)(number) $1e*(number) $20-(byte) $20 main::@12/(void*)(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 main::@13/(void*)(const nomodify byte*) PPU_ATTRIBUTE_TABLE_1 )
to:ppuDataFill::ppuDataPrepare1
ppuDataFill::ppuDataPrepare1: scope:[ppuDataFill] from ppuDataFill
[137] (byte~) ppuDataFill::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0
[138] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$0
[139] (byte~) ppuDataFill::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0
[140] *((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
[141] (word) ppuDataFill::i#2 ← phi( ppuDataFill::ppuDataPrepare1/(word) 0 ppuDataFill::@2/(word) ppuDataFill::i#1 )
[142] if((word) ppuDataFill::i#2<(word) ppuDataFill::size#5) goto ppuDataFill::ppuDataPut1
to:ppuDataFill::@return
ppuDataFill::@return: scope:[ppuDataFill] from ppuDataFill::@1
[143] return
to:@return
ppuDataFill::ppuDataPut1: scope:[ppuDataFill] from ppuDataFill::@1
[144] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataFill::val#10
to:ppuDataFill::@2
ppuDataFill::@2: scope:[ppuDataFill] from ppuDataFill::ppuDataPut1
[145] (word) ppuDataFill::i#1 ← ++ (word) ppuDataFill::i#2
to:ppuDataFill::@1
(void()) ppuDataSet((nomodify void*) ppuDataSet::ppuData , (byte) ppuDataSet::val)
ppuDataSet: scope:[ppuDataSet] from cputc::@2
[146] phi()
to:ppuDataSet::ppuDataPrepare1
ppuDataSet::ppuDataPrepare1: scope:[ppuDataSet] from ppuDataSet
[147] (byte~) ppuDataSet::ppuDataPrepare1_$0 ← > (void*)(nomodify byte*) ppuDataSet::ppuData#0
[148] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataSet::ppuDataPrepare1_$0
[149] (byte~) ppuDataSet::ppuDataPrepare1_$1 ← < (void*)(nomodify byte*) ppuDataSet::ppuData#0
[150] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataSet::ppuDataPrepare1_$1
to:ppuDataSet::ppuDataPut1
ppuDataSet::ppuDataPut1: scope:[ppuDataSet] from ppuDataSet::ppuDataPrepare1
[151] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataSet::val#0
to:ppuDataSet::@return
ppuDataSet::@return: scope:[ppuDataSet] from ppuDataSet::ppuDataPut1
[152] return
to:@return
(void()) gotoxy((byte) gotoxy::x , (byte) gotoxy::y)
gotoxy: scope:[gotoxy] from cputcxy cputsxy
[153] (byte) gotoxy::x#4 ← phi( cputcxy/(byte) gotoxy::x#2 cputsxy/(byte) gotoxy::x#3 )
[153] (byte) gotoxy::y#4 ← phi( cputcxy/(byte) gotoxy::y#2 cputsxy/(byte) gotoxy::y#3 )
[154] if((byte) gotoxy::y#4<(byte) $1e+(byte) 1) goto gotoxy::@3
to:gotoxy::@1
gotoxy::@3: scope:[gotoxy] from gotoxy
[155] phi()
to:gotoxy::@1
gotoxy::@1: scope:[gotoxy] from gotoxy gotoxy::@3
[156] (byte) gotoxy::y#5 ← phi( gotoxy::@3/(byte) gotoxy::y#4 gotoxy/(byte) 0 )
[157] if((byte) gotoxy::x#4<(byte) $20) goto gotoxy::@4
to:gotoxy::@2
gotoxy::@4: scope:[gotoxy] from gotoxy::@1
[158] phi()
to:gotoxy::@2
gotoxy::@2: scope:[gotoxy] from gotoxy::@1 gotoxy::@4
[159] (byte) gotoxy::x#5 ← phi( gotoxy::@4/(byte) gotoxy::x#4 gotoxy::@1/(byte) 0 )
[160] (byte) conio_cursor_x ← (byte) gotoxy::x#5
[161] (byte) conio_cursor_y ← (byte) gotoxy::y#5
[162] (word~) gotoxy::$6 ← (word)(byte) gotoxy::y#5
[163] (word) gotoxy::line_offset#0 ← (word~) gotoxy::$6 << (byte) 5
[164] (byte*~) gotoxy::$5 ← (const nomodify byte*) PPU_NAME_TABLE_0 + (word) gotoxy::line_offset#0
[165] (byte*) conio_line_text ← (byte*~) gotoxy::$5
to:gotoxy::@return
gotoxy::@return: scope:[gotoxy] from gotoxy::@2
[166] return
to:@return
(void()) cputsxy((byte) cputsxy::x , (byte) cputsxy::y , (to_nomodify byte*) cputsxy::s)
cputsxy: scope:[cputsxy] from main::@17
[167] (byte) gotoxy::x#3 ← (byte) cputsxy::x#0
[168] (byte) gotoxy::y#3 ← (byte) cputsxy::y#0
[169] call gotoxy
to:cputsxy::@1
cputsxy::@1: scope:[cputsxy] from cputsxy
[170] phi()
[171] call cputs
to:cputsxy::@return
cputsxy::@return: scope:[cputsxy] from cputsxy::@1
[172] return
to:@return
(void()) cputs((to_nomodify byte*) cputs::s)
cputs: scope:[cputs] from cputsxy::@1
[173] phi()
to:cputs::@1
cputs::@1: scope:[cputs] from cputs cputs::@2
[174] (to_nomodify byte*) cputs::s#2 ← phi( cputs/(const byte*) num_buffer cputs::@2/(to_nomodify byte*) cputs::s#0 )
[175] (byte) cputs::c#1 ← *((to_nomodify byte*) cputs::s#2)
[176] (to_nomodify byte*) cputs::s#0 ← ++ (to_nomodify byte*) cputs::s#2
[177] if((byte) 0!=(byte) cputs::c#1) goto cputs::@2
to:cputs::@return
cputs::@return: scope:[cputs] from cputs::@1
[178] return
to:@return
cputs::@2: scope:[cputs] from cputs::@1
[179] (byte) cputc::c#0 ← (byte) cputs::c#1
[180] call cputc
to:cputs::@1
(void()) uctoa((byte) uctoa::value , (byte*) uctoa::buffer , (byte) uctoa::radix)
uctoa: scope:[uctoa] from main::@3
[181] phi()
to:uctoa::@1
uctoa::@1: scope:[uctoa] from uctoa uctoa::@4
[182] (byte*) uctoa::buffer#11 ← phi( uctoa::@4/(byte*) uctoa::buffer#14 uctoa/(const byte*) num_buffer )
[182] (byte) uctoa::started#2 ← phi( uctoa::@4/(byte) uctoa::started#4 uctoa/(byte) 0 )
[182] (byte) uctoa::value#2 ← phi( uctoa::@4/(byte) uctoa::value#6 uctoa/(byte) uctoa::value#1 )
[182] (byte) uctoa::digit#2 ← phi( uctoa::@4/(byte) uctoa::digit#1 uctoa/(byte) 0 )
[183] if((byte) uctoa::digit#2<(const byte) uctoa::max_digits#2-(byte) 1) goto uctoa::@2
to:uctoa::@3
uctoa::@3: scope:[uctoa] from uctoa::@1
[184] *((byte*) uctoa::buffer#11) ← *((const byte*) DIGITS + (byte) uctoa::value#2)
[185] (byte*) uctoa::buffer#3 ← ++ (byte*) uctoa::buffer#11
[186] *((byte*) uctoa::buffer#3) ← (byte) 0
to:uctoa::@return
uctoa::@return: scope:[uctoa] from uctoa::@3
[187] return
to:@return
uctoa::@2: scope:[uctoa] from uctoa::@1
[188] (byte) uctoa::digit_value#0 ← *((const byte*) RADIX_HEXADECIMAL_VALUES_CHAR + (byte) uctoa::digit#2)
[189] if((byte) 0!=(byte) uctoa::started#2) goto uctoa::@5
to:uctoa::@7
uctoa::@7: scope:[uctoa] from uctoa::@2
[190] if((byte) uctoa::value#2>=(byte) uctoa::digit_value#0) goto uctoa::@5
to:uctoa::@4
uctoa::@4: scope:[uctoa] from uctoa::@6 uctoa::@7
[191] (byte*) uctoa::buffer#14 ← phi( uctoa::@7/(byte*) uctoa::buffer#11 uctoa::@6/(byte*) uctoa::buffer#4 )
[191] (byte) uctoa::started#4 ← phi( uctoa::@7/(byte) uctoa::started#2 uctoa::@6/(byte) 1 )
[191] (byte) uctoa::value#6 ← phi( uctoa::@7/(byte) uctoa::value#2 uctoa::@6/(byte) uctoa::value#0 )
[192] (byte) uctoa::digit#1 ← ++ (byte) uctoa::digit#2
to:uctoa::@1
uctoa::@5: scope:[uctoa] from uctoa::@2 uctoa::@7
[193] (byte*) uctoa_append::buffer#0 ← (byte*) uctoa::buffer#11
[194] (byte) uctoa_append::value#0 ← (byte) uctoa::value#2
[195] (byte) uctoa_append::sub#0 ← (byte) uctoa::digit_value#0
[196] call uctoa_append
[197] (byte) uctoa_append::return#0 ← (byte) uctoa_append::value#2
to:uctoa::@6
uctoa::@6: scope:[uctoa] from uctoa::@5
[198] (byte) uctoa::value#0 ← (byte) uctoa_append::return#0
[199] (byte*) uctoa::buffer#4 ← ++ (byte*) uctoa::buffer#11
to:uctoa::@4
(byte()) uctoa_append((byte*) uctoa_append::buffer , (byte) uctoa_append::value , (byte) uctoa_append::sub)
uctoa_append: scope:[uctoa_append] from uctoa::@5
[200] phi()
to:uctoa_append::@1
uctoa_append::@1: scope:[uctoa_append] from uctoa_append uctoa_append::@2
[201] (byte) uctoa_append::digit#2 ← phi( uctoa_append/(byte) 0 uctoa_append::@2/(byte) uctoa_append::digit#1 )
[201] (byte) uctoa_append::value#2 ← phi( uctoa_append/(byte) uctoa_append::value#0 uctoa_append::@2/(byte) uctoa_append::value#1 )
[202] if((byte) uctoa_append::value#2>=(byte) uctoa_append::sub#0) goto uctoa_append::@2
to:uctoa_append::@3
uctoa_append::@3: scope:[uctoa_append] from uctoa_append::@1
[203] *((byte*) uctoa_append::buffer#0) ← *((const byte*) DIGITS + (byte) uctoa_append::digit#2)
to:uctoa_append::@return
uctoa_append::@return: scope:[uctoa_append] from uctoa_append::@3
[204] return
to:@return
uctoa_append::@2: scope:[uctoa_append] from uctoa_append::@1
[205] (byte) uctoa_append::digit#1 ← ++ (byte) uctoa_append::digit#2
[206] (byte) uctoa_append::value#1 ← (byte) uctoa_append::value#2 - (byte) uctoa_append::sub#0
to:uctoa_append::@1
(void()) clrscr()
clrscr: scope:[clrscr] from main::@14
[207] phi()
[208] call ppuDataFill
to:clrscr::@1
clrscr::@1: scope:[clrscr] from clrscr
[209] (byte) conio_cursor_x ← (byte) 0
[210] (byte) conio_cursor_y ← (byte) 0
[211] (byte*) conio_line_text ← (const nomodify byte*) PPU_NAME_TABLE_0
to:clrscr::@return
clrscr::@return: scope:[clrscr] from clrscr::@1
[212] return
to:@return
interrupt(HARDWARE_STACK)(void()) vblank()
vblank: scope:[vblank] from
[135] phi()
[136] call readJoy1
[137] (byte) readJoy1::return#2 ← (byte) readJoy1::joy#2
[213] phi()
[214] call readJoy1
[215] (byte) readJoy1::return#2 ← (byte) readJoy1::joy#2
to:vblank::@11
vblank::@11: scope:[vblank] from vblank
[138] (byte) vblank::joy#0 ← (byte) readJoy1::return#2
[139] (byte~) vblank::$1 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_DOWN
[140] if((byte) 0==(byte~) vblank::$1) goto vblank::@1
[216] (byte) vblank::joy#0 ← (byte) readJoy1::return#2
[217] (byte~) vblank::$1 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_DOWN
[218] if((byte) 0==(byte~) vblank::$1) goto vblank::@1
to:vblank::@5
vblank::@5: scope:[vblank] from vblank::@11
[141] (volatile byte) y_scroll ← ++ (volatile byte) y_scroll
[142] if((volatile byte) y_scroll!=(byte) $f0) goto vblank::@1
[219] (volatile byte) y_scroll ← ++ (volatile byte) y_scroll
[220] if((volatile byte) y_scroll!=(byte) $f0) goto vblank::@1
to:vblank::@6
vblank::@6: scope:[vblank] from vblank::@5
[143] (volatile byte) y_scroll ← (byte) 0
[221] (volatile byte) y_scroll ← (byte) 0
to:vblank::@1
vblank::@1: scope:[vblank] from vblank::@11 vblank::@5 vblank::@6
[144] (byte~) vblank::$3 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_UP
[145] if((byte) 0==(byte~) vblank::$3) goto vblank::@2
[222] (byte~) vblank::$3 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_UP
[223] if((byte) 0==(byte~) vblank::$3) goto vblank::@2
to:vblank::@7
vblank::@7: scope:[vblank] from vblank::@1
[146] (volatile byte) y_scroll ← -- (volatile byte) y_scroll
[147] if((volatile byte) y_scroll!=(byte) $ff) goto vblank::@2
[224] (volatile byte) y_scroll ← -- (volatile byte) y_scroll
[225] if((volatile byte) y_scroll!=(byte) $ff) goto vblank::@2
to:vblank::@8
vblank::@8: scope:[vblank] from vblank::@7
[148] (volatile byte) y_scroll ← (byte) $ef
[226] (volatile byte) y_scroll ← (byte) $ef
to:vblank::@2
vblank::@2: scope:[vblank] from vblank::@1 vblank::@7 vblank::@8
[149] (byte~) vblank::$5 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_LEFT
[150] if((byte) 0==(byte~) vblank::$5) goto vblank::@3
[227] (byte~) vblank::$5 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_LEFT
[228] if((byte) 0==(byte~) vblank::$5) goto vblank::@3
to:vblank::@9
vblank::@9: scope:[vblank] from vblank::@2
[151] (volatile byte) x_scroll ← ++ (volatile byte) x_scroll
[229] (volatile byte) x_scroll ← ++ (volatile byte) x_scroll
to:vblank::@3
vblank::@3: scope:[vblank] from vblank::@2 vblank::@9
[152] (byte~) vblank::$7 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_RIGHT
[153] if((byte) 0==(byte~) vblank::$7) goto vblank::@4
[230] (byte~) vblank::$7 ← (byte) vblank::joy#0 & (const nomodify byte) JOY_RIGHT
[231] if((byte) 0==(byte~) vblank::$7) goto vblank::@4
to:vblank::@10
vblank::@10: scope:[vblank] from vblank::@3
[154] (volatile byte) x_scroll ← -- (volatile byte) x_scroll
[232] (volatile byte) x_scroll ← -- (volatile byte) x_scroll
to:vblank::@4
vblank::@4: scope:[vblank] from vblank::@10 vblank::@3
[155] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (volatile byte) x_scroll
[156] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (volatile byte) y_scroll
[233] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (volatile byte) x_scroll
[234] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) ← (volatile byte) y_scroll
to:vblank::@return
vblank::@return: scope:[vblank] from vblank::@4
[157] return
[235] return
to:@return
(byte()) readJoy1()
readJoy1: scope:[readJoy1] from vblank
[158] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1
[159] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 0
[236] *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) ← (byte) 1
[237] *((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
[160] (byte) readJoy1::joy#2 ← phi( readJoy1/(byte) 0 readJoy1::@2/(byte) readJoy1::joy#1 )
[160] (byte) readJoy1::i#2 ← phi( readJoy1/(byte) 0 readJoy1::@2/(byte) readJoy1::i#1 )
[161] if((byte) readJoy1::i#2<(byte) 8) goto readJoy1::@2
[238] (byte) readJoy1::joy#2 ← phi( readJoy1/(byte) 0 readJoy1::@2/(byte) readJoy1::joy#1 )
[238] (byte) readJoy1::i#2 ← phi( readJoy1/(byte) 0 readJoy1::@2/(byte) readJoy1::i#1 )
[239] if((byte) readJoy1::i#2<(byte) 8) goto readJoy1::@2
to:readJoy1::@return
readJoy1::@return: scope:[readJoy1] from readJoy1::@1
[162] return
[240] return
to:@return
readJoy1::@2: scope:[readJoy1] from readJoy1::@1
[163] (byte~) readJoy1::$1 ← (byte) readJoy1::joy#2 << (byte) 1
[164] (byte~) readJoy1::$2 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1
[165] (byte) readJoy1::joy#1 ← (byte~) readJoy1::$1 | (byte~) readJoy1::$2
[166] (byte) readJoy1::i#1 ← ++ (byte) readJoy1::i#2
[241] (byte~) readJoy1::$1 ← (byte) readJoy1::joy#2 << (byte) 1
[242] (byte~) readJoy1::$2 ← *((byte*)(const struct RICOH_2A03*) APU+(const byte) OFFSET_STRUCT_RICOH_2A03_JOY1) & (byte) 1
[243] (byte) readJoy1::joy#1 ← (byte~) readJoy1::$1 | (byte~) readJoy1::$2
[244] (byte) readJoy1::i#1 ← ++ (byte) readJoy1::i#2
to:readJoy1::@1

File diff suppressed because one or more lines are too long

View File

@ -4,6 +4,7 @@
(label) @begin
(label) @end
(const struct RICOH_2A03*) APU = (struct RICOH_2A03*) 16384
(const byte*) DIGITS[] = (byte*) "0123456789abcdef"z
(const nomodify byte*) FR_COUNTER = (byte*) 16407
(const nomodify byte) JOY_DOWN = (byte) 4
(const nomodify byte) JOY_LEFT = (byte) 2
@ -23,7 +24,13 @@
(const nomodify byte*) PPU_ATTRIBUTE_TABLE_1 = (byte*) 10176
(const nomodify byte*) PPU_NAME_TABLE_0 = (byte*) 8192
(const nomodify byte*) PPU_PALETTE = (byte*) 16128
(const to_volatile byte*) PPU_PPUSTATUS = (byte*) 8194
(const nomodify to_volatile byte*) PPU_PPUDATA = (byte*) 8199
(const nomodify to_volatile byte*) PPU_PPUSTATUS = (byte*) 8194
(const byte) RADIX::BINARY = (number) 2
(const byte) RADIX::DECIMAL = (number) $a
(const byte) RADIX::HEXADECIMAL = (number) $10
(const byte) RADIX::OCTAL = (number) 8
(const byte*) RADIX_HEXADECIMAL_VALUES_CHAR[] = { (byte) $10 }
(byte) RICOH_2A03::DMC_FREQ
(byte) RICOH_2A03::DMC_LEN
(byte) RICOH_2A03::DMC_RAW
@ -73,9 +80,9 @@
(void()) clrscr()
(label) clrscr::@1
(label) clrscr::@return
(byte) conio_cursor_x loadstore zp[1]:11 5189.185185185185
(byte) conio_cursor_y loadstore zp[1]:12 64002.159999999996
(byte*) conio_line_text loadstore zp[2]:13 45104.24489795918
(byte) conio_cursor_x loadstore zp[1]:17 4375315.90625
(byte) conio_cursor_y loadstore zp[1]:18 6.5306328755102046E7
(byte*) conio_line_text loadstore zp[2]:19 4.9111335755555555E7
(void()) cputc((byte) cputc::c)
(label) cputc::@1
(label) cputc::@2
@ -83,7 +90,22 @@
(label) cputc::@4
(label) cputc::@return
(byte) cputc::c
(byte) cputc::c#0 reg byte x 7001.0
(byte) cputc::c#0 reg byte x 2000002.0
(byte) cputc::c#1 reg byte x 2002.0
(byte) cputc::c#2 reg byte x 7000334.666666666
(void()) cputcxy((byte) cputcxy::x , (byte) cputcxy::y , (byte) cputcxy::c)
(label) cputcxy::@1
(label) cputcxy::@return
(byte) cputcxy::c
(byte) cputcxy::c#4 reg byte y 250.25
(byte) cputcxy::x
(byte) cputcxy::x#0 reg byte x 202.0
(byte) cputcxy::x#1 reg byte x 202.0
(byte) cputcxy::x#4 reg byte x 1203.0
(byte) cputcxy::y
(byte) cputcxy::y#2 reg byte a 202.0
(byte) cputcxy::y#3 reg byte a 202.0
(byte) cputcxy::y#4 reg byte a 601.5
(void()) cputln()
(label) cputln::@return
(void()) cputs((to_nomodify byte*) cputs::s)
@ -91,10 +113,18 @@
(label) cputs::@2
(label) cputs::@return
(byte) cputs::c
(byte) cputs::c#1 reg byte a 1001.0
(byte) cputs::c#1 reg byte a 1000001.0
(to_nomodify byte*) cputs::s
(to_nomodify byte*) cputs::s#0 s zp[2]:7 500.5
(to_nomodify byte*) cputs::s#2 s zp[2]:7 1501.5
(to_nomodify byte*) cputs::s#0 s zp[2]:13 500000.5
(to_nomodify byte*) cputs::s#2 s zp[2]:13 1500001.5
(void()) cputsxy((byte) cputsxy::x , (byte) cputsxy::y , (to_nomodify byte*) cputsxy::s)
(label) cputsxy::@1
(label) cputsxy::@return
(to_nomodify byte*) cputsxy::s
(byte) cputsxy::x
(byte) cputsxy::x#0 reg byte x 551.0
(byte) cputsxy::y
(byte) cputsxy::y#0 reg byte a 551.0
(void()) cscroll()
(label) cscroll::@1
(label) cscroll::@2
@ -102,34 +132,59 @@
(label) cscroll::@4
(label) cscroll::@5
(label) cscroll::@6
(label) cscroll::@7
(label) cscroll::@8
(label) cscroll::@return
(byte) cscroll::ch
(byte) cscroll::ch#0 reg byte x 6.666666673333334E8
(byte*) cscroll::line1
(byte*) cscroll::line1#1 line1 zp[2]:3 1.000000001E9
(byte*) cscroll::line1#2 line1 zp[2]:3 2.0000000036363637E8
(byte*) cscroll::line1#6 line1 zp[2]:3 1.00000001E8
(byte*) cscroll::line1#1 line1 zp[2]:23 6.666666666673334E11
(byte*) cscroll::line1#2 line1 zp[2]:23 3.333333333336667E11
(byte*) cscroll::line2
(byte*) cscroll::line2#1 line2 zp[2]:9 3.333333336666667E8
(byte*) cscroll::line2#2 line2 zp[2]:9 3.1428571485714287E8
(byte*) cscroll::line2#6 line2 zp[2]:9 1.00000001E8
(byte) cscroll::x
(byte) cscroll::x#1 reg byte y 2.000000002E9
(byte) cscroll::x#2 reg byte y 2.72727273E8
(byte*) cscroll::line2#1 line2 zp[2]:15 1.000000000001E12
(byte*) cscroll::line2#2 line2 zp[2]:15 2.857142857145714E11
(byte) cscroll::y
(byte) cscroll::y#1 y zp[1]:2 2.00000002E8
(byte) cscroll::y#2 y zp[1]:2 2.142857164285714E7
(byte) cscroll::y#1 reg byte x 2.000000000002E12
(byte) cscroll::y#2 reg byte x 3.75000000000375E11
(void()) gotoxy((byte) gotoxy::x , (byte) gotoxy::y)
(byte*~) gotoxy::$5 zp[2]:19 20002.0
(word~) gotoxy::$6 zp[2]:19 20002.0
(label) gotoxy::@1
(label) gotoxy::@2
(label) gotoxy::@3
(label) gotoxy::@4
(label) gotoxy::@return
(word) gotoxy::line_offset
(word) gotoxy::line_offset#0 line_offset zp[2]:19 20002.0
(byte) gotoxy::x
(byte) gotoxy::x#2 reg byte x 1001.0
(byte) gotoxy::x#3 reg byte x 1001.0
(byte) gotoxy::x#4 reg byte x 3667.333333333333
(byte) gotoxy::x#5 reg byte x 20002.0
(byte) gotoxy::y
(byte) gotoxy::y#2 reg byte a 2002.0
(byte) gotoxy::y#3 reg byte a 2002.0
(byte) gotoxy::y#4 reg byte a 7334.666666666666
(byte) gotoxy::y#5 reg byte a 3333.6666666666665
(void()) main()
(label) main::@1
(label) main::@10
(label) main::@11
(label) main::@12
(label) main::@13
(label) main::@14
(label) main::@15
(label) main::@16
(label) main::@17
(label) main::@18
(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::enableVideoOutput1
(byte) main::i
(byte) main::i#1 i zp[1]:4 202.0
(byte) main::i#2 i zp[1]:4 86.57142857142857
(label) main::initNES1
(label) main::initNES1_@1
(label) main::initNES1_@7
@ -145,84 +200,122 @@
(label) main::initNES1_waitForVBlank2
(byte~) main::initNES1_waitForVBlank2_$0 reg byte a 202.0
(label) main::initNES1_waitForVBlank2_@1
(const byte*) main::s[(byte) $25] = (byte*) "hello world!
i am nes
look at me
"
(label) main::screensizex1
(byte) main::screensizex1_return
(const byte) main::screensizex1_return#0 screensizex1_return = (byte) $20
(label) main::screensizex2
(byte) main::screensizex2_return
(const byte) main::screensizex2_return#0 screensizex2_return = (byte) $20
(label) main::screensizey1
(byte) main::screensizey1_return
(const byte) main::screensizey1_return#0 screensizey1_return = (byte) $1e
(label) main::screensizey2
(byte) main::screensizey2_return
(const byte) main::screensizey2_return#0 screensizey2_return = (byte) $1e
(label) main::screensizey3
(byte) main::screensizey3_return
(const byte) main::screensizey3_return#0 screensizey3_return = (byte) $1e
(byte) main::x
(byte) main::x#1 x zp[1]:2 202.0
(byte) main::x#10 x zp[1]:2 72.14285714285714
(byte) main::y
(byte) main::y#1 y zp[1]:3 202.0
(byte) main::y#10 y zp[1]:3 72.14285714285714
(const byte*) num_buffer[(number) $b] = { fill( $b, 0) }
(void()) ppuDataFetch((nomodify void*) ppuDataFetch::cpuData , (nomodify void*) ppuDataFetch::ppuData , (word) ppuDataFetch::size)
(label) ppuDataFetch::@1
(label) ppuDataFetch::@2
(label) ppuDataFetch::@3
(label) ppuDataFetch::@return
(nomodify void*) ppuDataFetch::cpuData
(const nomodify void*) ppuDataFetch::cpuData#0 cpuData = (void*)(const byte*) scroll_buffer
(byte*) ppuDataFetch::cpuDst
(byte*) ppuDataFetch::cpuDst#1 cpuDst zp[2]:7 1.0E17
(byte*) ppuDataFetch::cpuDst#2 cpuDst zp[2]:7 7.5E16
(word) ppuDataFetch::i
(word) ppuDataFetch::i#1 i zp[2]:5 2.0E17
(word) ppuDataFetch::i#2 i zp[2]:5 6.0E16
(nomodify void*) ppuDataFetch::ppuData
(nomodify void*) ppuDataFetch::ppuData#0 ppuData zp[2]:25 5.25000000000075E12
(label) ppuDataFetch::ppuDataPrepare1
(byte~) ppuDataFetch::ppuDataPrepare1_$0 reg byte a 2.0000000000002E13
(byte~) ppuDataFetch::ppuDataPrepare1_$1 reg byte a 2.0000000000002E13
(nomodify void*) ppuDataFetch::ppuDataPrepare1_ppuData
(label) ppuDataFetch::ppuDataRead1
(byte) ppuDataFetch::ppuDataRead1_return
(byte) ppuDataFetch::ppuDataRead1_return#0 reg byte a 2.0E17
(word) ppuDataFetch::size
(const word) ppuDataFetch::size#0 size = (byte) $20
(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]:9 2.00000002E8
(word) ppuDataFill::i#2 i zp[2]:9 1.00000001E8
(word) ppuDataFill::i#1 i zp[2]:25 2.000000000002E12
(word) ppuDataFill::i#2 i zp[2]:25 1.000000000001E12
(nomodify void*) ppuDataFill::ppuData
(label) ppuDataFill::ppuDataPrepare1
(byte~) ppuDataFill::ppuDataPrepare1_$0 reg byte a 2.0000002E7
(byte~) ppuDataFill::ppuDataPrepare1_$1 reg byte a 2.0000002E7
(byte~) ppuDataFill::ppuDataPrepare1_$0 reg byte a 2.0000000002E10
(byte~) ppuDataFill::ppuDataPrepare1_$1 reg byte a 2.0000000002E10
(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData
(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataPrepare1_ppuData zp[2]:5 6666667.333333333
(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataPrepare1_ppuData zp[2]:9 6.666666667333333E9
(label) ppuDataFill::ppuDataPut1
(byte) ppuDataFill::ppuDataPut1_val
(word) ppuDataFill::size
(word) ppuDataFill::size#5 size zp[2]:17 1.1111111222222222E7
(word) ppuDataFill::size#5 size zp[2]:11 1.1111111111122223E11
(byte) ppuDataFill::val
(byte) ppuDataFill::val#10 reg byte x 1.1111111222222222E7
(byte()) ppuDataGet((nomodify void*) ppuDataGet::ppuData)
(label) ppuDataGet::@return
(nomodify void*) ppuDataGet::ppuData
(nomodify void*) ppuDataGet::ppuData#0 ppuData zp[2]:17 5.25000000075E9
(label) ppuDataGet::ppuDataPrepare1
(byte~) ppuDataGet::ppuDataPrepare1_$0 reg byte a 2.0000000002E10
(byte~) ppuDataGet::ppuDataPrepare1_$1 reg byte a 2.0000000002E10
(nomodify void*) ppuDataGet::ppuDataPrepare1_ppuData
(label) ppuDataGet::ppuDataRead1
(byte) ppuDataGet::ppuDataRead1_return
(byte) ppuDataGet::ppuDataRead1_return#0 reg byte a 3.666666667333333E9
(byte) ppuDataGet::return
(byte) ppuDataGet::return#2 reg byte a 2.000000002E9
(byte) ppuDataFill::val#10 reg byte x 1.1111111111122223E11
(void()) ppuDataSet((nomodify void*) ppuDataSet::ppuData , (byte) ppuDataSet::val)
(label) ppuDataSet::@return
(nomodify void*) ppuDataSet::ppuData
(nomodify byte*) ppuDataSet::ppuData#0 ppuData zp[2]:5 5000.5
(nomodify void*) ppuDataSet::ppuData#1 ppuData zp[2]:5 1.000000001E9
(nomodify byte*) ppuDataSet::ppuData#0 ppuData zp[2]:23 2000000.2
(label) ppuDataSet::ppuDataPrepare1
(byte~) ppuDataSet::ppuDataPrepare1_$0 reg byte a 2.0000000002E10
(byte~) ppuDataSet::ppuDataPrepare1_$1 reg byte a 2.0000000002E10
(byte~) ppuDataSet::ppuDataPrepare1_$0 reg byte x 2.00000002E8
(byte~) ppuDataSet::ppuDataPrepare1_$1 reg byte x 2.00000002E8
(nomodify void*) ppuDataSet::ppuDataPrepare1_ppuData
(nomodify void*) ppuDataSet::ppuDataPrepare1_ppuData#0 ppuDataPrepare1_ppuData zp[2]:5 7.000003334666666E9
(nomodify void*) ppuDataSet::ppuDataPrepare1_ppuData#2 ppuDataPrepare1_ppuData zp[2]:5 20002.0
(label) ppuDataSet::ppuDataPut1
(byte) ppuDataSet::ppuDataPut1_val
(byte) ppuDataSet::val
(byte) ppuDataSet::val#0 reg byte x 10001.0
(byte) ppuDataSet::val#1 reg byte x 2.000000002E9
(byte) ppuDataSet::val#2 reg byte x 2.2000020006E9
(byte) ppuDataSet::val#0 reg byte a 1.8333333666666668E7
(void()) ppuDataTransfer((nomodify void*) ppuDataTransfer::ppuData , (nomodify void*) ppuDataTransfer::cpuData , (word) ppuDataTransfer::size)
(label) ppuDataTransfer::@1
(label) ppuDataTransfer::@2
(label) ppuDataTransfer::@3
(label) ppuDataTransfer::@4
(label) ppuDataTransfer::@return
(nomodify void*) ppuDataTransfer::cpuData
(const nomodify void*) ppuDataTransfer::cpuData#0 cpuData = (void*)(const byte*) PALETTE
(nomodify void*) ppuDataTransfer::cpuData#2 cpuData zp[2]:7
(byte*) ppuDataTransfer::cpuSrc
(byte*) ppuDataTransfer::cpuSrc#1 cpuSrc zp[2]:9 1001.0
(byte*) ppuDataTransfer::cpuSrc#2 cpuSrc zp[2]:9 750.75
(byte*) ppuDataTransfer::cpuSrc#1 cpuSrc zp[2]:7 1.000000000000001E15
(byte*) ppuDataTransfer::cpuSrc#2 cpuSrc zp[2]:7 7.52500000000001E14
(byte*) ppuDataTransfer::cpuSrc#6 cpuSrc zp[2]:7 2.0000000000002E13
(word) ppuDataTransfer::i
(word) ppuDataTransfer::i#1 i zp[2]:7 2002.0
(word) ppuDataTransfer::i#2 i zp[2]:7 600.5999999999999
(word) ppuDataTransfer::i#1 i zp[2]:11 2.000000000000002E15
(word) ppuDataTransfer::i#2 i zp[2]:11 6.000000000000005E14
(nomodify void*) ppuDataTransfer::ppuData
(const nomodify void*) ppuDataTransfer::ppuData#0 ppuData = (void*)(const nomodify byte*) PPU_PALETTE
(nomodify void*) ppuDataTransfer::ppuData#0 ppuData zp[2]:5 2.000000000002E12
(label) ppuDataTransfer::ppuDataPrepare1
(byte~) ppuDataTransfer::ppuDataPrepare1_$0 reg byte a 2.0000000000002E13
(byte~) ppuDataTransfer::ppuDataPrepare1_$1 reg byte a 2.0000000000002E13
(nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData
(nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0 ppuDataPrepare1_ppuData zp[2]:5 7.000000000001E12
(label) ppuDataTransfer::ppuDataPut1
(byte) ppuDataTransfer::ppuDataPut1_val
(byte) ppuDataTransfer::ppuDataPut1_val#0 reg byte a 2002.0
(byte) ppuDataTransfer::ppuDataPut1_val#0 reg byte a 2.000000000000002E15
(word) ppuDataTransfer::size
(const word) ppuDataTransfer::size#0 size = (byte) $20*(const byte) SIZEOF_BYTE
(word) ppuDataTransfer::size#3 size zp[2]:9 8.333333333333342E13
(const byte*) printf_buffer_number::digits[(number) $b] = { fill( $b, 0) }
(byte) printf_buffer_number::sign
(byte) printf_format_number::justify_left
(byte) printf_format_number::min_length
(byte) printf_format_number::radix
(byte) printf_format_number::sign_always
(byte) printf_format_number::upper_case
(byte) printf_format_number::zero_padding
(byte) printf_format_string::justify_left
(byte) printf_format_string::min_length
(byte()) readJoy1()
(byte~) readJoy1::$1 zp[1]:19 101.0
(byte~) readJoy1::$1 zp[1]:28 101.0
(byte~) readJoy1::$2 reg byte a 202.0
(label) readJoy1::@1
(label) readJoy1::@2
@ -235,6 +328,56 @@ i am nes
(byte) readJoy1::joy#2 reg byte a 51.0
(byte) readJoy1::return
(byte) readJoy1::return#2 reg byte a 4.0
(const byte*) scroll_buffer[(number) $20] = { fill( $20, 0) }
(void()) uctoa((byte) uctoa::value , (byte*) uctoa::buffer , (byte) uctoa::radix)
(label) uctoa::@1
(label) uctoa::@2
(label) uctoa::@3
(label) uctoa::@4
(label) uctoa::@5
(label) uctoa::@6
(label) uctoa::@7
(label) uctoa::@return
(byte*) uctoa::buffer
(byte*) uctoa::buffer#11 buffer zp[2]:15 33500.49999999999
(byte*) uctoa::buffer#14 buffer zp[2]:15 150001.5
(byte*) uctoa::buffer#3 buffer zp[2]:15 2002.0
(byte*) uctoa::buffer#4 buffer zp[2]:15 200002.0
(byte) uctoa::digit
(byte) uctoa::digit#1 digit zp[1]:17 200002.0
(byte) uctoa::digit#2 digit zp[1]:17 30769.53846153846
(byte) uctoa::digit_value
(byte) uctoa::digit_value#0 digit_value zp[1]:27 60000.600000000006
(byte*) uctoa::digit_values
(byte) uctoa::max_digits
(const byte) uctoa::max_digits#2 max_digits = (byte) 2
(byte) uctoa::radix
(byte) uctoa::started
(byte) uctoa::started#2 started zp[1]:18 60000.600000000006
(byte) uctoa::started#4 started zp[1]:18 100001.0
(byte) uctoa::value
(byte) uctoa::value#0 reg byte x 100001.0
(byte) uctoa::value#1 reg byte x 551.0
(byte) uctoa::value#2 reg byte x 67000.99999999999
(byte) uctoa::value#6 reg byte x 150001.5
(byte()) uctoa_append((byte*) uctoa_append::buffer , (byte) uctoa_append::value , (byte) uctoa_append::sub)
(label) uctoa_append::@1
(label) uctoa_append::@2
(label) uctoa_append::@3
(label) uctoa_append::@return
(byte*) uctoa_append::buffer
(byte*) uctoa_append::buffer#0 buffer zp[2]:15 137500.25
(byte) uctoa_append::digit
(byte) uctoa_append::digit#1 reg byte y 1.000000001E9
(byte) uctoa_append::digit#2 reg byte y 1.0005000015E9
(byte) uctoa_append::return
(byte) uctoa_append::return#0 reg byte x 200002.0
(byte) uctoa_append::sub
(byte) uctoa_append::sub#0 sub zp[1]:27 3.333500005E8
(byte) uctoa_append::value
(byte) uctoa_append::value#0 reg byte x 366667.3333333334
(byte) uctoa_append::value#1 reg byte x 2.000000002E9
(byte) uctoa_append::value#2 reg byte x 5.0018333416666675E8
interrupt(HARDWARE_STACK)(void()) vblank()
(byte~) vblank::$1 reg byte a 4.0
(byte~) vblank::$3 reg byte a 4.0
@ -254,45 +397,62 @@ interrupt(HARDWARE_STACK)(void()) vblank()
(label) vblank::@return
(byte) vblank::joy
(byte) vblank::joy#0 reg byte x 0.7142857142857142
(volatile byte) x_scroll loadstore zp[1]:15 1.1500000000000001
(volatile byte) y_scroll loadstore zp[1]:16 1.4761904761904767
(volatile byte) x_scroll loadstore zp[1]:21 1.1500000000000001
(volatile byte) y_scroll loadstore zp[1]:22 1.4761904761904767
reg byte x [ main::initNES1_i#2 main::initNES1_i#1 ]
zp[1]:2 [ cscroll::y#2 cscroll::y#1 ]
zp[2]:3 [ cscroll::line1#6 cscroll::line1#2 cscroll::line1#1 ]
reg byte y [ cscroll::x#2 cscroll::x#1 ]
reg byte x [ ppuDataSet::val#2 ppuDataSet::val#0 ppuDataSet::val#1 ]
zp[2]:5 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataSet::ppuDataPrepare1_ppuData#0 ppuDataSet::ppuDataPrepare1_ppuData#2 ppuDataSet::ppuData#1 ppuDataSet::ppuData#0 ]
zp[1]:2 [ main::x#10 main::x#1 ]
zp[1]:3 [ main::y#10 main::y#1 ]
zp[1]:4 [ main::i#2 main::i#1 ]
reg byte x [ cputcxy::x#4 cputcxy::x#0 cputcxy::x#1 ]
reg byte a [ cputcxy::y#4 cputcxy::y#3 cputcxy::y#2 ]
reg byte y [ cputcxy::c#4 ]
reg byte x [ cputc::c#2 cputc::c#1 cputc::c#0 ]
reg byte x [ cscroll::y#2 cscroll::y#1 ]
zp[2]:5 [ ppuDataFetch::i#2 ppuDataFetch::i#1 ppuDataTransfer::ppuDataPrepare1_ppuData#0 ppuDataTransfer::ppuData#0 ]
zp[2]:7 [ ppuDataFetch::cpuDst#2 ppuDataFetch::cpuDst#1 ppuDataTransfer::cpuData#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#6 ppuDataTransfer::cpuSrc#1 ]
zp[2]:9 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataTransfer::size#3 ]
zp[2]:11 [ ppuDataFill::size#5 ppuDataTransfer::i#2 ppuDataTransfer::i#1 ]
reg byte x [ ppuDataFill::val#10 ]
zp[2]:7 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 cputs::s#2 cputs::s#0 ]
zp[2]:9 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 cscroll::line2#6 cscroll::line2#2 cscroll::line2#1 ppuDataFill::i#2 ppuDataFill::i#1 ]
reg byte a [ gotoxy::y#5 gotoxy::y#4 gotoxy::y#2 gotoxy::y#3 ]
reg byte x [ gotoxy::x#5 gotoxy::x#4 gotoxy::x#2 gotoxy::x#3 ]
zp[2]:13 [ cputs::s#2 cputs::s#0 ]
reg byte x [ uctoa::value#2 uctoa::value#6 uctoa::value#1 uctoa::value#0 ]
zp[2]:15 [ uctoa::buffer#11 uctoa::buffer#14 uctoa::buffer#4 uctoa::buffer#3 uctoa_append::buffer#0 cscroll::line2#2 cscroll::line2#1 ]
reg byte x [ uctoa_append::value#2 uctoa_append::value#0 uctoa_append::value#1 ]
reg byte y [ uctoa_append::digit#2 uctoa_append::digit#1 ]
reg byte x [ readJoy1::i#2 readJoy1::i#1 ]
reg byte a [ readJoy1::joy#2 readJoy1::joy#1 ]
zp[1]:11 [ conio_cursor_x ]
zp[1]:12 [ conio_cursor_y ]
zp[2]:13 [ conio_line_text ]
zp[1]:15 [ x_scroll ]
zp[1]:16 [ y_scroll ]
zp[1]:17 [ conio_cursor_x uctoa::digit#2 uctoa::digit#1 ]
zp[1]:18 [ conio_cursor_y uctoa::started#2 uctoa::started#4 ]
zp[2]:19 [ conio_line_text gotoxy::$5 gotoxy::$6 gotoxy::line_offset#0 ]
zp[1]:21 [ x_scroll ]
zp[1]:22 [ y_scroll ]
reg byte a [ main::initNES1_waitForVBlank1_$0 ]
reg byte a [ main::initNES1_waitForVBlank2_$0 ]
reg byte a [ cputs::c#1 ]
reg byte x [ cputc::c#0 ]
zp[2]:17 [ ppuDataGet::ppuData#0 ppuDataFill::size#5 ]
reg byte a [ ppuDataGet::return#2 ]
reg byte x [ cscroll::ch#0 ]
reg byte a [ ppuDataSet::ppuDataPrepare1_$0 ]
reg byte a [ ppuDataSet::ppuDataPrepare1_$1 ]
reg byte a [ ppuDataGet::ppuDataPrepare1_$0 ]
reg byte a [ ppuDataGet::ppuDataPrepare1_$1 ]
reg byte a [ ppuDataGet::ppuDataRead1_return#0 ]
reg byte x [ cputsxy::x#0 ]
reg byte a [ cputsxy::y#0 ]
zp[2]:23 [ ppuDataSet::ppuData#0 cscroll::line1#2 cscroll::line1#1 ]
reg byte a [ ppuDataSet::val#0 ]
zp[2]:25 [ ppuDataFetch::ppuData#0 ppuDataFill::i#2 ppuDataFill::i#1 ]
reg byte a [ ppuDataTransfer::ppuDataPrepare1_$0 ]
reg byte a [ ppuDataTransfer::ppuDataPrepare1_$1 ]
reg byte a [ ppuDataTransfer::ppuDataPut1_val#0 ]
reg byte a [ ppuDataFetch::ppuDataPrepare1_$0 ]
reg byte a [ ppuDataFetch::ppuDataPrepare1_$1 ]
reg byte a [ ppuDataFetch::ppuDataRead1_return#0 ]
reg byte a [ ppuDataFill::ppuDataPrepare1_$0 ]
reg byte a [ ppuDataFill::ppuDataPrepare1_$1 ]
reg byte a [ ppuDataTransfer::ppuDataPut1_val#0 ]
reg byte x [ ppuDataSet::ppuDataPrepare1_$0 ]
reg byte x [ ppuDataSet::ppuDataPrepare1_$1 ]
reg byte a [ cputs::c#1 ]
zp[1]:27 [ uctoa::digit_value#0 uctoa_append::sub#0 ]
reg byte x [ uctoa_append::return#0 ]
reg byte a [ readJoy1::return#2 ]
reg byte x [ vblank::joy#0 ]
reg byte a [ vblank::$1 ]
reg byte a [ vblank::$3 ]
reg byte a [ vblank::$5 ]
reg byte a [ vblank::$7 ]
zp[1]:19 [ readJoy1::$1 ]
zp[1]:28 [ readJoy1::$1 ]
reg byte a [ readJoy1::$2 ]

View File

@ -65,6 +65,8 @@
// $3000-$3eff $0f00 Mirrors of $2000-$2eff
// $3f00-$3f1f $0020 Palette RAM indexes
.label PPU_PALETTE = $3f00
// PPU Status Register for reading in ASM
.label PPU_PPUSTATUS = $2002
// APU Frame Counter
// generates low-frequency clocks for the channels and an optional 60 Hz interrupt.
// https://wiki.nesdev.com/w/index.php/APU_Frame_Counter
@ -79,8 +81,6 @@
.label FR_COUNTER = $4017
// Pointer to the start of RAM memory
.label MEMORY = 0
// PPU Status Register for reading in ASM
.label PPU_PPUSTATUS = $2002
// NES Picture Processing Unit (PPU)
.label PPU = $2000
// NES CPU and audion processing unit (APU)

View File

@ -63,6 +63,8 @@ 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*) ppuDataFetch::ppuData
Inlined call (byte~) ppuDataFetch::$2 ← call ppuDataRead
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)
@ -634,7 +636,7 @@ SYMBOL TABLE SSA
(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
(const nomodify to_volatile byte*) PPU_PPUSTATUS = (byte*)(number) $2002
(byte) RICOH_2A03::DMC_FREQ
(byte) RICOH_2A03::DMC_LEN
(byte) RICOH_2A03::DMC_RAW
@ -1176,10 +1178,10 @@ 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*) 8194
Simplifying constant pointer cast (byte*) 16407
Simplifying constant pointer cast (byte*) 0
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 1
@ -2487,6 +2489,8 @@ Target platform is nes / MOS6502
// $3000-$3eff $0f00 Mirrors of $2000-$2eff
// $3f00-$3f1f $0020 Palette RAM indexes
.label PPU_PALETTE = $3f00
// PPU Status Register for reading in ASM
.label PPU_PPUSTATUS = $2002
// APU Frame Counter
// generates low-frequency clocks for the channels and an optional 60 Hz interrupt.
// https://wiki.nesdev.com/w/index.php/APU_Frame_Counter
@ -2501,8 +2505,6 @@ Target platform is nes / MOS6502
.label FR_COUNTER = $4017
// Pointer to the start of RAM memory
.label MEMORY = 0
// PPU Status Register for reading in ASM
.label PPU_PPUSTATUS = $2002
// NES Picture Processing Unit (PPU)
.label PPU = $2000
// NES CPU and audion processing unit (APU)
@ -3620,6 +3622,8 @@ ASSEMBLER BEFORE OPTIMIZATION
// $3000-$3eff $0f00 Mirrors of $2000-$2eff
// $3f00-$3f1f $0020 Palette RAM indexes
.label PPU_PALETTE = $3f00
// PPU Status Register for reading in ASM
.label PPU_PPUSTATUS = $2002
// APU Frame Counter
// generates low-frequency clocks for the channels and an optional 60 Hz interrupt.
// https://wiki.nesdev.com/w/index.php/APU_Frame_Counter
@ -3634,8 +3638,6 @@ ASSEMBLER BEFORE OPTIMIZATION
.label FR_COUNTER = $4017
// Pointer to the start of RAM memory
.label MEMORY = 0
// PPU Status Register for reading in ASM
.label PPU_PPUSTATUS = $2002
// NES Picture Processing Unit (PPU)
.label PPU = $2000
// NES CPU and audion processing unit (APU)
@ -4589,7 +4591,7 @@ FINAL SYMBOL TABLE
(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
(const nomodify to_volatile byte*) PPU_PPUSTATUS = (byte*) 8194
(byte) RICOH_2A03::DMC_FREQ
(byte) RICOH_2A03::DMC_LEN
(byte) RICOH_2A03::DMC_RAW
@ -4894,6 +4896,8 @@ Score: 3905
// $3000-$3eff $0f00 Mirrors of $2000-$2eff
// $3f00-$3f1f $0020 Palette RAM indexes
.label PPU_PALETTE = $3f00
// PPU Status Register for reading in ASM
.label PPU_PPUSTATUS = $2002
// APU Frame Counter
// generates low-frequency clocks for the channels and an optional 60 Hz interrupt.
// https://wiki.nesdev.com/w/index.php/APU_Frame_Counter
@ -4908,8 +4912,6 @@ Score: 3905
.label FR_COUNTER = $4017
// Pointer to the start of RAM memory
.label MEMORY = 0
// PPU Status Register for reading in ASM
.label PPU_PPUSTATUS = $2002
// NES Picture Processing Unit (PPU)
.label PPU = $2000
// NES CPU and audion processing unit (APU)

View File

@ -25,7 +25,7 @@
(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
(const nomodify to_volatile byte*) PPU_PPUSTATUS = (byte*) 8194
(byte) RICOH_2A03::DMC_FREQ
(byte) RICOH_2A03::DMC_LEN
(byte) RICOH_2A03::DMC_RAW