1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-26 12:49:21 +00:00

Updated Atari 2600 minial sample.

This commit is contained in:
jespergravgaard 2020-05-17 00:19:22 +02:00
parent 26718942e9
commit c2993e4d82
8 changed files with 732 additions and 271 deletions

View File

@ -0,0 +1,128 @@
// Atari Television Interface Adaptor (TIA)
// https://en.wikipedia.org/wiki/Television_Interface_Adaptor
// http://www.qotile.net/minidig/docs/stella.pdf
struct ATARI_TIA_WRITE {
// $00 0000 00x0 Vertical Sync Set-Clear
char VSYNC;
// $01 xx00 00x0 Vertical Blank Set-Clear
char VBLANK;
// $02 ---- ---- Wait for Horizontal Blank
char WSYNC;
// $03 ---- ---- Reset Horizontal Sync Counter
char RSYNC;
// $04 00xx 0xxx Number-Size player/missle 0
char NUSIZ0;
// $05 00xx 0xxx Number-Size player/missle 1
char NUSIZ1;
// $06 xxxx xxx0 Color-Luminance Player 0
char COLUP0;
// $07 xxxx xxx0 Color-Luminance Player 1
char COLUP1;
// $08 xxxx xxx0 Color-Luminance Playfield
char COLUPF;
// $09 xxxx xxx0 Color-Luminance Background
char COLUBK;
// $0A 00xx 0xxx Control Playfield, Ball, Collisions
char CTRLPF;
// $0B 0000 x000 Reflection Player 0
char REFP0;
// $0C 0000 x000 Reflection Player 1
char REFP1;
// $0D xxxx 0000 Playfield Register Byte 0
char PF0;
// $0E xxxx xxxx Playfield Register Byte 1
char PF1;
// $0F xxxx xxxx Playfield Register Byte 2
char PF2;
// $10 ---- ---- Reset Player 0
char RESP0;
// $11 ---- ---- Reset Player 1
char RESP1;
// $12 ---- ---- Reset Missle 0
char RESM0;
// $13 ---- ---- Reset Missle 1
char RESM1;
// $14 ---- ---- Reset Ball
char RESBL;
// $15 0000 xxxx Audio Control 0
char AUDC0;
// $16 0000 xxxx Audio Control 1
char AUDC1;
// $17 000x xxxx Audio Frequency 0
char AUDF0;
// $18 000x xxxx Audio Frequency 1
char AUDF1;
// $19 0000 xxxx Audio Volume 0
char AUDV0;
// $1A 0000 xxxx Audio Volume 1
char AUDV1;
// $1B xxxx xxxx Graphics Register Player 0
char GRP0;
// $1C xxxx xxxx Graphics Register Player 1
char GRP1;
// $1D 0000 00x0 Graphics Enable Missle 0
char ENAM0;
// $1E 0000 00x0 Graphics Enable Missle 1
char ENAM1;
// $1F 0000 00x0 Graphics Enable Ball
char ENABL;
// $20 xxxx 0000 Horizontal Motion Player 0
char HMP0;
// $21 xxxx 0000 Horizontal Motion Player 1
char HMP1;
// $22 xxxx 0000 Horizontal Motion Missle 0
char HMM0;
// $23 xxxx 0000 Horizontal Motion Missle 1
char HMM1;
// $24 xxxx 0000 Horizontal Motion Ball
char HMBL;
// $25 0000 000x Vertical Delay Player 0
char VDELP0;
// $26 0000 000x Vertical Delay Player 1
char VDELP1;
// $27 0000 000x Vertical Delay Ball
char VDELBL;
// $28 0000 00x0 Reset Missle 0 to Player 0
char RESMP0;
// $29 0000 00x0 Reset Missle 1 to Player 1
char RESMP1;
// $2A ---- ---- Apply Horizontal Motion
char HMOVE;
// $2B ---- ---- Clear Horizontal Move Registers
char HMCLR;
// $2C ---- ---- Clear Collision Latches
char CXCLR;
};
struct ATARI_TIA_READ {
// bit 7 bit 6
// $00 xx00 0000 Read Collision M0-P1 M0-P0
char CXM0P;
// $01 xx00 0000 Read Collision M1-P0 M1-P1
char CXM1P;
// $02 xx00 0000 Read Collision P0-PF P0-BL
char CXP0FB;
// $03 xx00 0000 Read Collision P1-PF P1-BL
char CXP1FB;
// $04 xx00 0000 Read Collision M0-PF M0-BL
char CXM0FB;
// $05 xx00 0000 Read Collision M1-PF M1-BL
char CXM1FB;
// $06 x000 0000 Read Collision BL-PF -----
char CXBLPF;
// $07 xx00 0000 Read Collision P0-P1 M0-M1
char CXPPMM;
// $08 x000 0000 Read Pot Port 0
char INPT0;
// $09 x000 0000 Read Pot Port 1
char INPT1;
// $0A x000 0000 Read Pot Port 2
char INPT2;
// $0B x000 0000 Read Pot Port 3
char INPT3;
// $0C x000 0000 Read Input (Trigger) 0
char INPT4;
// $0D x000 0000 Read Input (Trigger) 1
char INPT5;
};

View File

@ -0,0 +1,14 @@
// Atari 2600 Registers and Constants
// https://web.archive.org/web/20170215054248/http://www.atariguide.com/pdfs/Atari_2600_VCS_Domestic_Field_Service_Manual.pdf
#include <atari-tia.h>
#include <mos6532.h>
// Atari TIA write registers
struct ATARI_TIA_WRITE * const TIA = 0x00;
// Atari TIA read registers
struct ATARI_TIA_READ * const TIA_READ = 0x00;
// Atari RIOT registers
struct MOS6532_RIOT * const RIOT = 0x280;

View File

@ -0,0 +1,27 @@
// MOS 6532 RAM-I/O-Timer (RIOT)
// http://www.ionpool.net/arcade/gottlieb/technical/datasheets/R6532_datasheet.pdf
// http://www.qotile.net/minidig/docs/stella.pdf
// https://en.wikipedia.org/wiki/MOS_Technology_6532
struct MOS6532_RIOT {
// $280 Port A data register for joysticks: Bits 4-7 for player 1. Bits 0-3 for player 2.
char SWCHA;
// $281 Port A data direction register (DDR)
char SWACNT;
// $282 Port B data (console switches)
char SWCHB;
// $283 Port B DDR
char SWBCNT;
// $284 Timer output
char INTIM;
// Unused/undefined registers ($285-$294)
char UNUSED[15];
// $294 set 1 clock interval
char TIM1T;
// $295 set 8 clock interval
char TIM8T;
// $296 set 64 clock interval
char TIM64T;
// $297 set 1024 clock interval
char T1024T;
};

View File

@ -1,10 +1,7 @@
// Minimal Atari 2600 VCS Program
// Source: https://atariage.com/forums/blogs/entry/11109-step-1-generate-a-stable-display/
#pragma target(atari2600)
char * const VSYNC = 0x00;
char * const VBLANK = 0x01;
char * const WSYNC = 0x02;
char * const BACKGROUND_COLOR = 0x09;
#include <atari2600.h>
char __mem col=0;
@ -15,36 +12,36 @@ void main() {
// here we generate the signal that tells the TV to move the beam to the top of
// the screen so we can start the next frame of video.
// The Sync Signal must be on for 3 scanlines.
*WSYNC = 2; // Wait for SYNC (halts CPU until end of scanline)
*VSYNC = 2; // Accumulator D1=1, turns on Vertical Sync signal
*WSYNC = 2; // Wait for Sync - halts CPU until end of 1st scanline of VSYNC
*WSYNC = 2; // wait until end of 2nd scanline of VSYNC
*WSYNC = 0; // wait until end of 3rd scanline of VSYNC
*VSYNC = 0; // Accumulator D1=0, turns off Vertical Sync signal
TIA->WSYNC = 2; // Wait for SYNC (halts CPU until end of scanline)
TIA->VSYNC = 2; // Accumulator D1=1, turns on Vertical Sync signal
TIA->WSYNC = 2; // Wait for Sync - halts CPU until end of 1st scanline of VSYNC
TIA->WSYNC = 2; // wait until end of 2nd scanline of VSYNC
TIA->WSYNC = 0; // wait until end of 3rd scanline of VSYNC
TIA->VSYNC = 0; // Accumulator D1=0, turns off Vertical Sync signal
// Vertical Blank - game logic
// Since we don't have any yet, just delay
for(char i=0;i<37;i++) {
*WSYNC = 0; // Wait for SYNC (halts CPU until end of scanline)
TIA->WSYNC = 0; // Wait for SYNC (halts CPU until end of scanline)
}
// Screen - display logic
// Update the registers in TIA (the video chip) in order to generate what the player sees.
// For now we're just going to output 192 colored scanlines lines so we have something to see.
*VBLANK = 0; // D1=1, turns off Vertical Blank signal (image output on)
TIA->VBLANK = 0; // D1=1, turns off Vertical Blank signal (image output on)
char c = col++;
for(char i=0;i<192;i++) {
*WSYNC = 0; // Wait for SYNC (halts CPU until end of scanline)
*BACKGROUND_COLOR = c++; // Set background color
TIA->WSYNC = 0; // Wait for SYNC (halts CPU until end of scanline)
TIA->COLUBK = c++; // Set background color
}
// Overscan - game logic
// Since we don't have any yet, just delay
*WSYNC = 0; // Wait for SYNC (halts CPU until end of scanline)
*VBLANK = 2; // // D1=1 turns image output off
*BACKGROUND_COLOR = 0;
TIA->WSYNC = 0; // Wait for SYNC (halts CPU until end of scanline)
TIA->VBLANK = 2; // // D1=1 turns image output off
TIA->COLUBK = 0;
for(char i=0;i<07;i++) {
*WSYNC = 0; // Wait for SYNC (halts CPU until end of scanline)
TIA->WSYNC = 0; // Wait for SYNC (halts CPU until end of scanline)
}
}

View File

@ -1,4 +1,5 @@
// Minimal Atari 2600 VCS Program
// Source: https://atariage.com/forums/blogs/entry/11109-step-1-generate-a-stable-display/
// Atari 2600 VCS 4K ROM
.file [name="atari2600-min.prg", type="bin", segments="Code, Vectors"]
.segmentdef Code [start=$f800,min=$f800,max=$fff9]
@ -10,37 +11,38 @@
.word main // IRQ
.segment Code
.label VSYNC = 0
.label VBLANK = 1
.label WSYNC = 2
.label BACKGROUND_COLOR = 9
.const OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC = 2
.const OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK = 1
.const OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK = 9
// Atari TIA write registers
.label TIA = 0
.segment Code
main: {
lda #0
sta col
__b2:
// *WSYNC = 2
// TIA->WSYNC = 2
// Vertical Sync
// here we generate the signal that tells the TV to move the beam to the top of
// the screen so we can start the next frame of video.
// The Sync Signal must be on for 3 scanlines.
lda #2
sta WSYNC
// *VSYNC = 2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// TIA->VSYNC = 2
// Wait for SYNC (halts CPU until end of scanline)
sta VSYNC
// *WSYNC = 2
sta TIA
// TIA->WSYNC = 2
// Accumulator D1=1, turns on Vertical Sync signal
sta WSYNC
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// Wait for Sync - halts CPU until end of 1st scanline of VSYNC
sta WSYNC
// *WSYNC = 0
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// TIA->WSYNC = 0
// wait until end of 2nd scanline of VSYNC
lda #0
sta WSYNC
// *VSYNC = 0
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// TIA->VSYNC = 0
// wait until end of 3rd scanline of VSYNC
sta VSYNC
sta TIA
tax
// Vertical Blank - game logic
// Since we don't have any yet, just delay
@ -48,12 +50,12 @@ main: {
// for(char i=0;i<37;i++)
cpx #$25
bcc __b4
// *VBLANK = 0
// TIA->VBLANK = 0
// Screen - display logic
// Update the registers in TIA (the video chip) in order to generate what the player sees.
// For now we're just going to output 192 colored scanlines lines so we have something to see.
lda #0
sta VBLANK
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK
// c = col++
// D1=1, turns off Vertical Blank signal (image output on)
ldx col
@ -63,19 +65,19 @@ main: {
// for(char i=0;i<192;i++)
cpy #$c0
bcc __b7
// *WSYNC = 0
// TIA->WSYNC = 0
// Overscan - game logic
// Since we don't have any yet, just delay
lda #0
sta WSYNC
// *VBLANK = 2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// TIA->VBLANK = 2
// Wait for SYNC (halts CPU until end of scanline)
lda #2
sta VBLANK
// *BACKGROUND_COLOR = 0
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK
// TIA->COLUBK = 0
// // D1=1 turns image output off
lda #0
sta BACKGROUND_COLOR
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK
tax
__b9:
// for(char i=0;i<07;i++)
@ -83,28 +85,28 @@ main: {
bcc __b10
jmp __b2
__b10:
// *WSYNC = 0
// TIA->WSYNC = 0
lda #0
sta WSYNC
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// for(char i=0;i<07;i++)
inx
jmp __b9
__b7:
// *WSYNC = 0
// TIA->WSYNC = 0
lda #0
sta WSYNC
// *BACKGROUND_COLOR = c++
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// TIA->COLUBK = c++
// Wait for SYNC (halts CPU until end of scanline)
stx BACKGROUND_COLOR
// *BACKGROUND_COLOR = c++;
stx TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK
// TIA->COLUBK = c++;
inx
// for(char i=0;i<192;i++)
iny
jmp __b6
__b4:
// *WSYNC = 0
// TIA->WSYNC = 0
lda #0
sta WSYNC
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// for(char i=0;i<37;i++)
inx
jmp __b3

View File

@ -16,19 +16,19 @@ main::@1: scope:[main] from main main::@9
[5] (byte) col#12 ← phi( main/(byte) 0 main::@9/(byte) col#1 )
to:main::@2
main::@2: scope:[main] from main::@1
[6] *((const nomodify byte*) WSYNC) ← (byte) 2
[7] *((const nomodify byte*) VSYNC) ← (byte) 2
[8] *((const nomodify byte*) WSYNC) ← (byte) 2
[9] *((const nomodify byte*) WSYNC) ← (byte) 2
[10] *((const nomodify byte*) WSYNC) ← (byte) 0
[11] *((const nomodify byte*) VSYNC) ← (byte) 0
[6] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2
[7] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA) ← (byte) 2
[8] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2
[9] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2
[10] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0
[11] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA) ← (byte) 0
to:main::@3
main::@3: scope:[main] from main::@2 main::@4
[12] (byte) main::i#2 ← phi( main::@2/(byte) 0 main::@4/(byte) main::i#1 )
[13] if((byte) main::i#2<(byte) $25) goto main::@4
to:main::@5
main::@5: scope:[main] from main::@3
[14] *((const nomodify byte*) VBLANK) ← (byte) 0
[14] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (byte) 0
[15] (byte) main::c#0 ← (byte) col#12
[16] (byte) col#1 ← ++ (byte) col#12
to:main::@6
@ -38,25 +38,25 @@ main::@6: scope:[main] from main::@5 main::@7
[18] if((byte) main::i1#2<(byte) $c0) goto main::@7
to:main::@8
main::@8: scope:[main] from main::@6
[19] *((const nomodify byte*) WSYNC) ← (byte) 0
[20] *((const nomodify byte*) VBLANK) ← (byte) 2
[21] *((const nomodify byte*) BACKGROUND_COLOR) ← (byte) 0
[19] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0
[20] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (byte) 2
[21] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (byte) 0
to:main::@9
main::@9: scope:[main] from main::@10 main::@8
[22] (byte) main::i2#2 ← phi( main::@10/(byte) main::i2#1 main::@8/(byte) 0 )
[23] if((byte) main::i2#2<(byte) 7) goto main::@10
to:main::@1
main::@10: scope:[main] from main::@9
[24] *((const nomodify byte*) WSYNC) ← (byte) 0
[24] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0
[25] (byte) main::i2#1 ← ++ (byte) main::i2#2
to:main::@9
main::@7: scope:[main] from main::@6
[26] *((const nomodify byte*) WSYNC) ← (byte) 0
[27] *((const nomodify byte*) BACKGROUND_COLOR) ← (byte) main::c#2
[26] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0
[27] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (byte) main::c#2
[28] (byte) main::c#1 ← ++ (byte) main::c#2
[29] (byte) main::i1#1 ← ++ (byte) main::i1#2
to:main::@6
main::@4: scope:[main] from main::@3
[30] *((const nomodify byte*) WSYNC) ← (byte) 0
[30] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0
[31] (byte) main::i#1 ← ++ (byte) main::i#2
to:main::@3

View File

@ -1,3 +1,6 @@
Fixing struct type size struct MOS6532_RIOT to 24
Fixing struct type SIZE_OF struct MOS6532_RIOT to 24
Fixing struct type SIZE_OF struct MOS6532_RIOT to 24
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
@ -15,12 +18,12 @@ main::@1: scope:[main] from main main::@9
to:main::@return
main::@2: scope:[main] from main::@1
(byte) col#12 ← phi( main::@1/(byte) col#8 )
*((const nomodify byte*) WSYNC) ← (number) 2
*((const nomodify byte*) VSYNC) ← (number) 2
*((const nomodify byte*) WSYNC) ← (number) 2
*((const nomodify byte*) WSYNC) ← (number) 2
*((const nomodify byte*) WSYNC) ← (number) 0
*((const nomodify byte*) VSYNC) ← (number) 0
*((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 2
*((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) ← (number) 2
*((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 2
*((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 2
*((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 0
*((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) ← (number) 0
(byte) main::i#0 ← (byte) 0
to:main::@3
main::@3: scope:[main] from main::@2 main::@4
@ -32,12 +35,12 @@ main::@3: scope:[main] from main::@2 main::@4
main::@4: scope:[main] from main::@3
(byte) col#13 ← phi( main::@3/(byte) col#7 )
(byte) main::i#3 ← phi( main::@3/(byte) main::i#2 )
*((const nomodify byte*) WSYNC) ← (number) 0
*((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 0
(byte) main::i#1 ← ++ (byte) main::i#3
to:main::@3
main::@5: scope:[main] from main::@3
(byte) col#4 ← phi( main::@3/(byte) col#7 )
*((const nomodify byte*) VBLANK) ← (number) 0
*((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (number) 0
(byte) main::c#0 ← (byte) col#4
(byte) col#1 ← ++ (byte) col#4
(byte) main::i1#0 ← (byte) 0
@ -53,16 +56,16 @@ main::@7: scope:[main] from main::@6
(byte) col#17 ← phi( main::@6/(byte) col#16 )
(byte) main::i1#3 ← phi( main::@6/(byte) main::i1#2 )
(byte) main::c#2 ← phi( main::@6/(byte) main::c#3 )
*((const nomodify byte*) WSYNC) ← (number) 0
*((const nomodify byte*) BACKGROUND_COLOR) ← (byte) main::c#2
*((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 0
*((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (byte) main::c#2
(byte) main::c#1 ← ++ (byte) main::c#2
(byte) main::i1#1 ← ++ (byte) main::i1#3
to:main::@6
main::@8: scope:[main] from main::@6
(byte) col#15 ← phi( main::@6/(byte) col#16 )
*((const nomodify byte*) WSYNC) ← (number) 0
*((const nomodify byte*) VBLANK) ← (number) 2
*((const nomodify byte*) BACKGROUND_COLOR) ← (number) 0
*((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 0
*((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (number) 2
*((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (number) 0
(byte) main::i2#0 ← (byte) 0
to:main::@9
main::@9: scope:[main] from main::@10 main::@8
@ -74,7 +77,7 @@ main::@9: scope:[main] from main::@10 main::@8
main::@10: scope:[main] from main::@9
(byte) col#14 ← phi( main::@9/(byte) col#11 )
(byte) main::i2#3 ← phi( main::@9/(byte) main::i2#2 )
*((const nomodify byte*) WSYNC) ← (number) 0
*((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 0
(byte) main::i2#1 ← ++ (byte) main::i2#3
to:main::@9
main::@return: scope:[main] from main::@1
@ -97,10 +100,80 @@ SYMBOL TABLE SSA
(label) @2
(label) @begin
(label) @end
(const nomodify byte*) BACKGROUND_COLOR = (byte*)(number) 9
(const nomodify byte*) VBLANK = (byte*)(number) 1
(const nomodify byte*) VSYNC = (byte*)(number) 0
(const nomodify byte*) WSYNC = (byte*)(number) 2
(byte) ATARI_TIA_READ::CXBLPF
(byte) ATARI_TIA_READ::CXM0FB
(byte) ATARI_TIA_READ::CXM0P
(byte) ATARI_TIA_READ::CXM1FB
(byte) ATARI_TIA_READ::CXM1P
(byte) ATARI_TIA_READ::CXP0FB
(byte) ATARI_TIA_READ::CXP1FB
(byte) ATARI_TIA_READ::CXPPMM
(byte) ATARI_TIA_READ::INPT0
(byte) ATARI_TIA_READ::INPT1
(byte) ATARI_TIA_READ::INPT2
(byte) ATARI_TIA_READ::INPT3
(byte) ATARI_TIA_READ::INPT4
(byte) ATARI_TIA_READ::INPT5
(byte) ATARI_TIA_WRITE::AUDC0
(byte) ATARI_TIA_WRITE::AUDC1
(byte) ATARI_TIA_WRITE::AUDF0
(byte) ATARI_TIA_WRITE::AUDF1
(byte) ATARI_TIA_WRITE::AUDV0
(byte) ATARI_TIA_WRITE::AUDV1
(byte) ATARI_TIA_WRITE::COLUBK
(byte) ATARI_TIA_WRITE::COLUP0
(byte) ATARI_TIA_WRITE::COLUP1
(byte) ATARI_TIA_WRITE::COLUPF
(byte) ATARI_TIA_WRITE::CTRLPF
(byte) ATARI_TIA_WRITE::CXCLR
(byte) ATARI_TIA_WRITE::ENABL
(byte) ATARI_TIA_WRITE::ENAM0
(byte) ATARI_TIA_WRITE::ENAM1
(byte) ATARI_TIA_WRITE::GRP0
(byte) ATARI_TIA_WRITE::GRP1
(byte) ATARI_TIA_WRITE::HMBL
(byte) ATARI_TIA_WRITE::HMCLR
(byte) ATARI_TIA_WRITE::HMM0
(byte) ATARI_TIA_WRITE::HMM1
(byte) ATARI_TIA_WRITE::HMOVE
(byte) ATARI_TIA_WRITE::HMP0
(byte) ATARI_TIA_WRITE::HMP1
(byte) ATARI_TIA_WRITE::NUSIZ0
(byte) ATARI_TIA_WRITE::NUSIZ1
(byte) ATARI_TIA_WRITE::PF0
(byte) ATARI_TIA_WRITE::PF1
(byte) ATARI_TIA_WRITE::PF2
(byte) ATARI_TIA_WRITE::REFP0
(byte) ATARI_TIA_WRITE::REFP1
(byte) ATARI_TIA_WRITE::RESBL
(byte) ATARI_TIA_WRITE::RESM0
(byte) ATARI_TIA_WRITE::RESM1
(byte) ATARI_TIA_WRITE::RESMP0
(byte) ATARI_TIA_WRITE::RESMP1
(byte) ATARI_TIA_WRITE::RESP0
(byte) ATARI_TIA_WRITE::RESP1
(byte) ATARI_TIA_WRITE::RSYNC
(byte) ATARI_TIA_WRITE::VBLANK
(byte) ATARI_TIA_WRITE::VDELBL
(byte) ATARI_TIA_WRITE::VDELP0
(byte) ATARI_TIA_WRITE::VDELP1
(byte) ATARI_TIA_WRITE::VSYNC
(byte) ATARI_TIA_WRITE::WSYNC
(byte) MOS6532_RIOT::INTIM
(byte) MOS6532_RIOT::SWACNT
(byte) MOS6532_RIOT::SWBCNT
(byte) MOS6532_RIOT::SWCHA
(byte) MOS6532_RIOT::SWCHB
(byte) MOS6532_RIOT::T1024T
(byte) MOS6532_RIOT::TIM1T
(byte) MOS6532_RIOT::TIM64T
(byte) MOS6532_RIOT::TIM8T
(const byte*) MOS6532_RIOT::UNUSED[(number) $f] = { fill( $f, 0) }
(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK = (byte) 9
(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK = (byte) 1
(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC = (byte) 0
(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC = (byte) 2
(const nomodify struct ATARI_TIA_WRITE*) TIA = (struct ATARI_TIA_WRITE*)(number) 0
(byte) col
(byte) col#0
(byte) col#1
@ -157,41 +230,38 @@ SYMBOL TABLE SSA
(byte) main::i2#2
(byte) main::i2#3
Adding number conversion cast (unumber) 2 in *((const nomodify byte*) WSYNC) ← (number) 2
Adding number conversion cast (unumber) 2 in *((const nomodify byte*) VSYNC) ← (number) 2
Adding number conversion cast (unumber) 2 in *((const nomodify byte*) WSYNC) ← (number) 2
Adding number conversion cast (unumber) 2 in *((const nomodify byte*) WSYNC) ← (number) 2
Adding number conversion cast (unumber) 0 in *((const nomodify byte*) WSYNC) ← (number) 0
Adding number conversion cast (unumber) 0 in *((const nomodify byte*) VSYNC) ← (number) 0
Adding number conversion cast (unumber) 2 in *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 2
Adding number conversion cast (unumber) 2 in *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) ← (number) 2
Adding number conversion cast (unumber) 2 in *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 2
Adding number conversion cast (unumber) 2 in *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 2
Adding number conversion cast (unumber) 0 in *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 0
Adding number conversion cast (unumber) 0 in *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) ← (number) 0
Adding number conversion cast (unumber) $25 in (bool~) main::$0 ← (byte) main::i#2 < (number) $25
Adding number conversion cast (unumber) 0 in *((const nomodify byte*) WSYNC) ← (number) 0
Adding number conversion cast (unumber) 0 in *((const nomodify byte*) VBLANK) ← (number) 0
Adding number conversion cast (unumber) 0 in *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 0
Adding number conversion cast (unumber) 0 in *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (number) 0
Adding number conversion cast (unumber) $c0 in (bool~) main::$1 ← (byte) main::i1#2 < (number) $c0
Adding number conversion cast (unumber) 0 in *((const nomodify byte*) WSYNC) ← (number) 0
Adding number conversion cast (unumber) 0 in *((const nomodify byte*) WSYNC) ← (number) 0
Adding number conversion cast (unumber) 2 in *((const nomodify byte*) VBLANK) ← (number) 2
Adding number conversion cast (unumber) 0 in *((const nomodify byte*) BACKGROUND_COLOR) ← (number) 0
Adding number conversion cast (unumber) 0 in *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 0
Adding number conversion cast (unumber) 0 in *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 0
Adding number conversion cast (unumber) 2 in *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (number) 2
Adding number conversion cast (unumber) 0 in *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (number) 0
Adding number conversion cast (unumber) 7 in (bool~) main::$2 ← (byte) main::i2#2 < (number) 7
Adding number conversion cast (unumber) 0 in *((const nomodify byte*) WSYNC) ← (number) 0
Adding number conversion cast (unumber) 0 in *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (number) 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *((const nomodify byte*) WSYNC) ← (unumber)(number) 2
Inlining cast *((const nomodify byte*) VSYNC) ← (unumber)(number) 2
Inlining cast *((const nomodify byte*) WSYNC) ← (unumber)(number) 2
Inlining cast *((const nomodify byte*) WSYNC) ← (unumber)(number) 2
Inlining cast *((const nomodify byte*) WSYNC) ← (unumber)(number) 0
Inlining cast *((const nomodify byte*) VSYNC) ← (unumber)(number) 0
Inlining cast *((const nomodify byte*) WSYNC) ← (unumber)(number) 0
Inlining cast *((const nomodify byte*) VBLANK) ← (unumber)(number) 0
Inlining cast *((const nomodify byte*) WSYNC) ← (unumber)(number) 0
Inlining cast *((const nomodify byte*) WSYNC) ← (unumber)(number) 0
Inlining cast *((const nomodify byte*) VBLANK) ← (unumber)(number) 2
Inlining cast *((const nomodify byte*) BACKGROUND_COLOR) ← (unumber)(number) 0
Inlining cast *((const nomodify byte*) WSYNC) ← (unumber)(number) 0
Inlining cast *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (unumber)(number) 2
Inlining cast *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) ← (unumber)(number) 2
Inlining cast *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (unumber)(number) 2
Inlining cast *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (unumber)(number) 2
Inlining cast *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (unumber)(number) 0
Inlining cast *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) ← (unumber)(number) 0
Inlining cast *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (unumber)(number) 0
Inlining cast *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (unumber)(number) 0
Inlining cast *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (unumber)(number) 0
Inlining cast *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (unumber)(number) 0
Inlining cast *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (unumber)(number) 2
Inlining cast *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (unumber)(number) 0
Inlining cast *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 0
Simplifying constant pointer cast (byte*) 1
Simplifying constant pointer cast (byte*) 2
Simplifying constant pointer cast (byte*) 9
Simplifying constant pointer cast (struct ATARI_TIA_WRITE*) 0
Simplifying constant integer cast 2
Simplifying constant integer cast 2
Simplifying constant integer cast 2
@ -255,6 +325,11 @@ Constant (const byte) main::i2#0 = 0
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [4] if((number) 0!=(number) 1) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Simplifying expression containing zero (byte*)TIA in [6] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) ← (byte) 2
Simplifying expression containing zero (byte*)TIA in [10] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) ← (byte) 0
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Inlining constant with var siblings (const byte) main::i#0
@ -309,19 +384,19 @@ main::@1: scope:[main] from main main::@9
[5] (byte) col#12 ← phi( main/(byte) 0 main::@9/(byte) col#1 )
to:main::@2
main::@2: scope:[main] from main::@1
[6] *((const nomodify byte*) WSYNC) ← (byte) 2
[7] *((const nomodify byte*) VSYNC) ← (byte) 2
[8] *((const nomodify byte*) WSYNC) ← (byte) 2
[9] *((const nomodify byte*) WSYNC) ← (byte) 2
[10] *((const nomodify byte*) WSYNC) ← (byte) 0
[11] *((const nomodify byte*) VSYNC) ← (byte) 0
[6] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2
[7] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA) ← (byte) 2
[8] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2
[9] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2
[10] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0
[11] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA) ← (byte) 0
to:main::@3
main::@3: scope:[main] from main::@2 main::@4
[12] (byte) main::i#2 ← phi( main::@2/(byte) 0 main::@4/(byte) main::i#1 )
[13] if((byte) main::i#2<(byte) $25) goto main::@4
to:main::@5
main::@5: scope:[main] from main::@3
[14] *((const nomodify byte*) VBLANK) ← (byte) 0
[14] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (byte) 0
[15] (byte) main::c#0 ← (byte) col#12
[16] (byte) col#1 ← ++ (byte) col#12
to:main::@6
@ -331,31 +406,99 @@ main::@6: scope:[main] from main::@5 main::@7
[18] if((byte) main::i1#2<(byte) $c0) goto main::@7
to:main::@8
main::@8: scope:[main] from main::@6
[19] *((const nomodify byte*) WSYNC) ← (byte) 0
[20] *((const nomodify byte*) VBLANK) ← (byte) 2
[21] *((const nomodify byte*) BACKGROUND_COLOR) ← (byte) 0
[19] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0
[20] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (byte) 2
[21] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (byte) 0
to:main::@9
main::@9: scope:[main] from main::@10 main::@8
[22] (byte) main::i2#2 ← phi( main::@10/(byte) main::i2#1 main::@8/(byte) 0 )
[23] if((byte) main::i2#2<(byte) 7) goto main::@10
to:main::@1
main::@10: scope:[main] from main::@9
[24] *((const nomodify byte*) WSYNC) ← (byte) 0
[24] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0
[25] (byte) main::i2#1 ← ++ (byte) main::i2#2
to:main::@9
main::@7: scope:[main] from main::@6
[26] *((const nomodify byte*) WSYNC) ← (byte) 0
[27] *((const nomodify byte*) BACKGROUND_COLOR) ← (byte) main::c#2
[26] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0
[27] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (byte) main::c#2
[28] (byte) main::c#1 ← ++ (byte) main::c#2
[29] (byte) main::i1#1 ← ++ (byte) main::i1#2
to:main::@6
main::@4: scope:[main] from main::@3
[30] *((const nomodify byte*) WSYNC) ← (byte) 0
[30] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0
[31] (byte) main::i#1 ← ++ (byte) main::i#2
to:main::@3
VARIABLE REGISTER WEIGHTS
(byte) ATARI_TIA_READ::CXBLPF
(byte) ATARI_TIA_READ::CXM0FB
(byte) ATARI_TIA_READ::CXM0P
(byte) ATARI_TIA_READ::CXM1FB
(byte) ATARI_TIA_READ::CXM1P
(byte) ATARI_TIA_READ::CXP0FB
(byte) ATARI_TIA_READ::CXP1FB
(byte) ATARI_TIA_READ::CXPPMM
(byte) ATARI_TIA_READ::INPT0
(byte) ATARI_TIA_READ::INPT1
(byte) ATARI_TIA_READ::INPT2
(byte) ATARI_TIA_READ::INPT3
(byte) ATARI_TIA_READ::INPT4
(byte) ATARI_TIA_READ::INPT5
(byte) ATARI_TIA_WRITE::AUDC0
(byte) ATARI_TIA_WRITE::AUDC1
(byte) ATARI_TIA_WRITE::AUDF0
(byte) ATARI_TIA_WRITE::AUDF1
(byte) ATARI_TIA_WRITE::AUDV0
(byte) ATARI_TIA_WRITE::AUDV1
(byte) ATARI_TIA_WRITE::COLUBK
(byte) ATARI_TIA_WRITE::COLUP0
(byte) ATARI_TIA_WRITE::COLUP1
(byte) ATARI_TIA_WRITE::COLUPF
(byte) ATARI_TIA_WRITE::CTRLPF
(byte) ATARI_TIA_WRITE::CXCLR
(byte) ATARI_TIA_WRITE::ENABL
(byte) ATARI_TIA_WRITE::ENAM0
(byte) ATARI_TIA_WRITE::ENAM1
(byte) ATARI_TIA_WRITE::GRP0
(byte) ATARI_TIA_WRITE::GRP1
(byte) ATARI_TIA_WRITE::HMBL
(byte) ATARI_TIA_WRITE::HMCLR
(byte) ATARI_TIA_WRITE::HMM0
(byte) ATARI_TIA_WRITE::HMM1
(byte) ATARI_TIA_WRITE::HMOVE
(byte) ATARI_TIA_WRITE::HMP0
(byte) ATARI_TIA_WRITE::HMP1
(byte) ATARI_TIA_WRITE::NUSIZ0
(byte) ATARI_TIA_WRITE::NUSIZ1
(byte) ATARI_TIA_WRITE::PF0
(byte) ATARI_TIA_WRITE::PF1
(byte) ATARI_TIA_WRITE::PF2
(byte) ATARI_TIA_WRITE::REFP0
(byte) ATARI_TIA_WRITE::REFP1
(byte) ATARI_TIA_WRITE::RESBL
(byte) ATARI_TIA_WRITE::RESM0
(byte) ATARI_TIA_WRITE::RESM1
(byte) ATARI_TIA_WRITE::RESMP0
(byte) ATARI_TIA_WRITE::RESMP1
(byte) ATARI_TIA_WRITE::RESP0
(byte) ATARI_TIA_WRITE::RESP1
(byte) ATARI_TIA_WRITE::RSYNC
(byte) ATARI_TIA_WRITE::VBLANK
(byte) ATARI_TIA_WRITE::VDELBL
(byte) ATARI_TIA_WRITE::VDELP0
(byte) ATARI_TIA_WRITE::VDELP1
(byte) ATARI_TIA_WRITE::VSYNC
(byte) ATARI_TIA_WRITE::WSYNC
(byte) MOS6532_RIOT::INTIM
(byte) MOS6532_RIOT::SWACNT
(byte) MOS6532_RIOT::SWBCNT
(byte) MOS6532_RIOT::SWCHA
(byte) MOS6532_RIOT::SWCHB
(byte) MOS6532_RIOT::T1024T
(byte) MOS6532_RIOT::TIM1T
(byte) MOS6532_RIOT::TIM64T
(byte) MOS6532_RIOT::TIM8T
(byte) col
(byte) col#1 78.71428571428571
(byte) col#12 92.53846153846155
@ -396,6 +539,7 @@ INITIAL ASM
Target platform is atari2600 / MOS6502X
// File Comments
// Minimal Atari 2600 VCS Program
// Source: https://atariage.com/forums/blogs/entry/11109-step-1-generate-a-stable-display/
// Upstart
// Atari 2600 VCS 4K ROM
.file [name="atari2600-min.prg", type="bin", segments="Code, Vectors"]
@ -409,10 +553,11 @@ Target platform is atari2600 / MOS6502X
.segment Code
// Global Constants & labels
.label VSYNC = 0
.label VBLANK = 1
.label WSYNC = 2
.label BACKGROUND_COLOR = 9
.const OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC = 2
.const OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK = 1
.const OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK = 9
// Atari TIA write registers
.label TIA = 0
// @begin
__bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
@ -447,33 +592,33 @@ main: {
jmp __b2
// main::@2
__b2:
// [6] *((const nomodify byte*) WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
// [6] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
// Vertical Sync
// here we generate the signal that tells the TV to move the beam to the top of
// the screen so we can start the next frame of video.
// The Sync Signal must be on for 3 scanlines.
lda #2
sta WSYNC
// [7] *((const nomodify byte*) VSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [7] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA) ← (byte) 2 -- _deref_pbuc1=vbuc2
// Wait for SYNC (halts CPU until end of scanline)
lda #2
sta VSYNC
// [8] *((const nomodify byte*) WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
sta TIA
// [8] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
// Accumulator D1=1, turns on Vertical Sync signal
lda #2
sta WSYNC
// [9] *((const nomodify byte*) WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [9] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
// Wait for Sync - halts CPU until end of 1st scanline of VSYNC
lda #2
sta WSYNC
// [10] *((const nomodify byte*) WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [10] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// wait until end of 2nd scanline of VSYNC
lda #0
sta WSYNC
// [11] *((const nomodify byte*) VSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [11] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA) ← (byte) 0 -- _deref_pbuc1=vbuc2
// wait until end of 3rd scanline of VSYNC
lda #0
sta VSYNC
sta TIA
// [12] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
__b3_from___b2:
// [12] phi (byte) main::i#2 = (byte) 0 [phi:main::@2->main::@3#0] -- vbuz1=vbuc1
@ -491,12 +636,12 @@ main: {
jmp __b5
// main::@5
__b5:
// [14] *((const nomodify byte*) VBLANK) ← (byte) 0 -- _deref_pbuc1=vbuc2
// [14] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (byte) 0 -- _deref_pbuc1=vbuc2
// Screen - display logic
// Update the registers in TIA (the video chip) in order to generate what the player sees.
// For now we're just going to output 192 colored scanlines lines so we have something to see.
lda #0
sta VBLANK
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK
// [15] (byte) main::c#0 ← (byte) col#12 -- vbuz1=vbum2
// D1=1, turns off Vertical Blank signal (image output on)
lda col
@ -519,19 +664,19 @@ main: {
jmp __b8
// main::@8
__b8:
// [19] *((const nomodify byte*) WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// [19] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// Overscan - game logic
// Since we don't have any yet, just delay
lda #0
sta WSYNC
// [20] *((const nomodify byte*) VBLANK) ← (byte) 2 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [20] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (byte) 2 -- _deref_pbuc1=vbuc2
// Wait for SYNC (halts CPU until end of scanline)
lda #2
sta VBLANK
// [21] *((const nomodify byte*) BACKGROUND_COLOR) ← (byte) 0 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK
// [21] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (byte) 0 -- _deref_pbuc1=vbuc2
// // D1=1 turns image output off
lda #0
sta BACKGROUND_COLOR
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK
// [22] phi from main::@8 to main::@9 [phi:main::@8->main::@9]
__b9_from___b8:
// [22] phi (byte) main::i2#2 = (byte) 0 [phi:main::@8->main::@9#0] -- vbuz1=vbuc1
@ -550,9 +695,9 @@ main: {
jmp __b1
// main::@10
__b10:
// [24] *((const nomodify byte*) WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// [24] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
lda #0
sta WSYNC
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [25] (byte) main::i2#1 ← ++ (byte) main::i2#2 -- vbuz1=_inc_vbuz1
inc.z i2
// [22] phi from main::@10 to main::@9 [phi:main::@10->main::@9]
@ -561,13 +706,13 @@ main: {
jmp __b9
// main::@7
__b7:
// [26] *((const nomodify byte*) WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// [26] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
lda #0
sta WSYNC
// [27] *((const nomodify byte*) BACKGROUND_COLOR) ← (byte) main::c#2 -- _deref_pbuc1=vbuz1
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [27] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (byte) main::c#2 -- _deref_pbuc1=vbuz1
// Wait for SYNC (halts CPU until end of scanline)
lda.z c
sta BACKGROUND_COLOR
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK
// [28] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuz1=_inc_vbuz1
inc.z c
// [29] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuz1=_inc_vbuz1
@ -579,9 +724,9 @@ main: {
jmp __b6
// main::@4
__b4:
// [30] *((const nomodify byte*) WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// [30] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
lda #0
sta WSYNC
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [31] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
inc.z i
// [12] phi from main::@4 to main::@3 [phi:main::@4->main::@3]
@ -594,37 +739,37 @@ main: {
col: .byte 0
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] *((const nomodify byte*) WSYNC) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [6] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for mem[1] [ col#12 col#1 ]
Statement [7] *((const nomodify byte*) VSYNC) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [8] *((const nomodify byte*) WSYNC) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [9] *((const nomodify byte*) WSYNC) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [10] *((const nomodify byte*) WSYNC) ← (byte) 0 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [11] *((const nomodify byte*) VSYNC) ← (byte) 0 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [14] *((const nomodify byte*) VBLANK) ← (byte) 0 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [19] *((const nomodify byte*) WSYNC) ← (byte) 0 [ col#1 ] ( main:2 [ col#1 ] { } ) always clobbers reg byte a
Statement [20] *((const nomodify byte*) VBLANK) ← (byte) 2 [ col#1 ] ( main:2 [ col#1 ] { } ) always clobbers reg byte a
Statement [21] *((const nomodify byte*) BACKGROUND_COLOR) ← (byte) 0 [ col#1 ] ( main:2 [ col#1 ] { } ) always clobbers reg byte a
Statement [24] *((const nomodify byte*) WSYNC) ← (byte) 0 [ col#1 main::i2#2 ] ( main:2 [ col#1 main::i2#2 ] { } ) always clobbers reg byte a
Statement [7] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [8] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [9] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [10] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [11] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA) ← (byte) 0 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [14] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (byte) 0 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [19] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 [ col#1 ] ( main:2 [ col#1 ] { } ) always clobbers reg byte a
Statement [20] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (byte) 2 [ col#1 ] ( main:2 [ col#1 ] { } ) always clobbers reg byte a
Statement [21] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (byte) 0 [ col#1 ] ( main:2 [ col#1 ] { } ) always clobbers reg byte a
Statement [24] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 [ col#1 main::i2#2 ] ( main:2 [ col#1 main::i2#2 ] { } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:5 [ main::i2#2 main::i2#1 ]
Statement [26] *((const nomodify byte*) WSYNC) ← (byte) 0 [ col#1 main::i1#2 main::c#2 ] ( main:2 [ col#1 main::i1#2 main::c#2 ] { } ) always clobbers reg byte a
Statement [26] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 [ col#1 main::i1#2 main::c#2 ] ( main:2 [ col#1 main::i1#2 main::c#2 ] { } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:3 [ main::i1#2 main::i1#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:4 [ main::c#2 main::c#0 main::c#1 ]
Statement [30] *((const nomodify byte*) WSYNC) ← (byte) 0 [ col#12 main::i#2 ] ( main:2 [ col#12 main::i#2 ] { } ) always clobbers reg byte a
Statement [30] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 [ col#12 main::i#2 ] ( main:2 [ col#12 main::i#2 ] { } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::i#2 main::i#1 ]
Statement [6] *((const nomodify byte*) WSYNC) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [7] *((const nomodify byte*) VSYNC) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [8] *((const nomodify byte*) WSYNC) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [9] *((const nomodify byte*) WSYNC) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [10] *((const nomodify byte*) WSYNC) ← (byte) 0 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [11] *((const nomodify byte*) VSYNC) ← (byte) 0 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [14] *((const nomodify byte*) VBLANK) ← (byte) 0 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [19] *((const nomodify byte*) WSYNC) ← (byte) 0 [ col#1 ] ( main:2 [ col#1 ] { } ) always clobbers reg byte a
Statement [20] *((const nomodify byte*) VBLANK) ← (byte) 2 [ col#1 ] ( main:2 [ col#1 ] { } ) always clobbers reg byte a
Statement [21] *((const nomodify byte*) BACKGROUND_COLOR) ← (byte) 0 [ col#1 ] ( main:2 [ col#1 ] { } ) always clobbers reg byte a
Statement [24] *((const nomodify byte*) WSYNC) ← (byte) 0 [ col#1 main::i2#2 ] ( main:2 [ col#1 main::i2#2 ] { } ) always clobbers reg byte a
Statement [26] *((const nomodify byte*) WSYNC) ← (byte) 0 [ col#1 main::i1#2 main::c#2 ] ( main:2 [ col#1 main::i1#2 main::c#2 ] { } ) always clobbers reg byte a
Statement [30] *((const nomodify byte*) WSYNC) ← (byte) 0 [ col#12 main::i#2 ] ( main:2 [ col#12 main::i#2 ] { } ) always clobbers reg byte a
Statement [6] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [7] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [8] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [9] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [10] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [11] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA) ← (byte) 0 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [14] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (byte) 0 [ col#12 ] ( main:2 [ col#12 ] { } ) always clobbers reg byte a
Statement [19] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 [ col#1 ] ( main:2 [ col#1 ] { } ) always clobbers reg byte a
Statement [20] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (byte) 2 [ col#1 ] ( main:2 [ col#1 ] { } ) always clobbers reg byte a
Statement [21] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (byte) 0 [ col#1 ] ( main:2 [ col#1 ] { } ) always clobbers reg byte a
Statement [24] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 [ col#1 main::i2#2 ] ( main:2 [ col#1 main::i2#2 ] { } ) always clobbers reg byte a
Statement [26] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 [ col#1 main::i1#2 main::c#2 ] ( main:2 [ col#1 main::i1#2 main::c#2 ] { } ) always clobbers reg byte a
Statement [30] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 [ col#12 main::i#2 ] ( main:2 [ col#12 main::i#2 ] { } ) always clobbers reg byte a
Potential registers mem[1] [ col#12 col#1 ] : mem[1] , reg byte x , reg byte y ,
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , reg byte y ,
Potential registers zp[1]:3 [ main::i1#2 main::i1#1 ] : zp[1]:3 , reg byte x , reg byte y ,
@ -634,15 +779,22 @@ Potential registers zp[1]:5 [ main::i2#2 main::i2#1 ] : zp[1]:5 , reg byte x , r
REGISTER UPLIFT SCOPES
Uplift Scope [main] 3,003: zp[1]:2 [ main::i#2 main::i#1 ] 3,003: zp[1]:5 [ main::i2#2 main::i2#1 ] 2,602.6: zp[1]:3 [ main::i1#2 main::i1#1 ] 1,878: zp[1]:4 [ main::c#2 main::c#0 main::c#1 ]
Uplift Scope [] 171.25: mem[1] [ col#12 col#1 ]
Uplift Scope [ATARI_TIA_WRITE]
Uplift Scope [ATARI_TIA_READ]
Uplift Scope [MOS6532_RIOT]
Uplifting [main] best 8212 combination reg byte x [ main::i#2 main::i#1 ] reg byte x [ main::i2#2 main::i2#1 ] reg byte y [ main::i1#2 main::i1#1 ] reg byte x [ main::c#2 main::c#0 main::c#1 ]
Uplifting [] best 8212 combination mem[1] [ col#12 col#1 ]
Uplifting [ATARI_TIA_WRITE] best 8212 combination
Uplifting [ATARI_TIA_READ] best 8212 combination
Uplifting [MOS6532_RIOT] best 8212 combination
Attempting to uplift remaining variables inmem[1] [ col#12 col#1 ]
Uplifting [] best 8212 combination mem[1] [ col#12 col#1 ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Minimal Atari 2600 VCS Program
// Source: https://atariage.com/forums/blogs/entry/11109-step-1-generate-a-stable-display/
// Upstart
// Atari 2600 VCS 4K ROM
.file [name="atari2600-min.prg", type="bin", segments="Code, Vectors"]
@ -656,10 +808,11 @@ ASSEMBLER BEFORE OPTIMIZATION
.segment Code
// Global Constants & labels
.label VSYNC = 0
.label VBLANK = 1
.label WSYNC = 2
.label BACKGROUND_COLOR = 9
.const OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC = 2
.const OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK = 1
.const OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK = 9
// Atari TIA write registers
.label TIA = 0
// @begin
__bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
@ -690,33 +843,33 @@ main: {
jmp __b2
// main::@2
__b2:
// [6] *((const nomodify byte*) WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
// [6] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
// Vertical Sync
// here we generate the signal that tells the TV to move the beam to the top of
// the screen so we can start the next frame of video.
// The Sync Signal must be on for 3 scanlines.
lda #2
sta WSYNC
// [7] *((const nomodify byte*) VSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [7] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA) ← (byte) 2 -- _deref_pbuc1=vbuc2
// Wait for SYNC (halts CPU until end of scanline)
lda #2
sta VSYNC
// [8] *((const nomodify byte*) WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
sta TIA
// [8] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
// Accumulator D1=1, turns on Vertical Sync signal
lda #2
sta WSYNC
// [9] *((const nomodify byte*) WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [9] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
// Wait for Sync - halts CPU until end of 1st scanline of VSYNC
lda #2
sta WSYNC
// [10] *((const nomodify byte*) WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [10] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// wait until end of 2nd scanline of VSYNC
lda #0
sta WSYNC
// [11] *((const nomodify byte*) VSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [11] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA) ← (byte) 0 -- _deref_pbuc1=vbuc2
// wait until end of 3rd scanline of VSYNC
lda #0
sta VSYNC
sta TIA
// [12] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
__b3_from___b2:
// [12] phi (byte) main::i#2 = (byte) 0 [phi:main::@2->main::@3#0] -- vbuxx=vbuc1
@ -732,12 +885,12 @@ main: {
jmp __b5
// main::@5
__b5:
// [14] *((const nomodify byte*) VBLANK) ← (byte) 0 -- _deref_pbuc1=vbuc2
// [14] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (byte) 0 -- _deref_pbuc1=vbuc2
// Screen - display logic
// Update the registers in TIA (the video chip) in order to generate what the player sees.
// For now we're just going to output 192 colored scanlines lines so we have something to see.
lda #0
sta VBLANK
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK
// [15] (byte) main::c#0 ← (byte) col#12 -- vbuxx=vbum1
// D1=1, turns off Vertical Blank signal (image output on)
ldx col
@ -757,19 +910,19 @@ main: {
jmp __b8
// main::@8
__b8:
// [19] *((const nomodify byte*) WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// [19] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// Overscan - game logic
// Since we don't have any yet, just delay
lda #0
sta WSYNC
// [20] *((const nomodify byte*) VBLANK) ← (byte) 2 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [20] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (byte) 2 -- _deref_pbuc1=vbuc2
// Wait for SYNC (halts CPU until end of scanline)
lda #2
sta VBLANK
// [21] *((const nomodify byte*) BACKGROUND_COLOR) ← (byte) 0 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK
// [21] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (byte) 0 -- _deref_pbuc1=vbuc2
// // D1=1 turns image output off
lda #0
sta BACKGROUND_COLOR
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK
// [22] phi from main::@8 to main::@9 [phi:main::@8->main::@9]
__b9_from___b8:
// [22] phi (byte) main::i2#2 = (byte) 0 [phi:main::@8->main::@9#0] -- vbuxx=vbuc1
@ -786,9 +939,9 @@ main: {
jmp __b1
// main::@10
__b10:
// [24] *((const nomodify byte*) WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// [24] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
lda #0
sta WSYNC
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [25] (byte) main::i2#1 ← ++ (byte) main::i2#2 -- vbuxx=_inc_vbuxx
inx
// [22] phi from main::@10 to main::@9 [phi:main::@10->main::@9]
@ -797,12 +950,12 @@ main: {
jmp __b9
// main::@7
__b7:
// [26] *((const nomodify byte*) WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// [26] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
lda #0
sta WSYNC
// [27] *((const nomodify byte*) BACKGROUND_COLOR) ← (byte) main::c#2 -- _deref_pbuc1=vbuxx
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [27] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (byte) main::c#2 -- _deref_pbuc1=vbuxx
// Wait for SYNC (halts CPU until end of scanline)
stx BACKGROUND_COLOR
stx TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK
// [28] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx
inx
// [29] (byte) main::i1#1 ← ++ (byte) main::i1#2 -- vbuyy=_inc_vbuyy
@ -814,9 +967,9 @@ main: {
jmp __b6
// main::@4
__b4:
// [30] *((const nomodify byte*) WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// [30] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
lda #0
sta WSYNC
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [31] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
// [12] phi from main::@4 to main::@3 [phi:main::@4->main::@3]
@ -874,10 +1027,79 @@ FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const nomodify byte*) BACKGROUND_COLOR = (byte*) 9
(const nomodify byte*) VBLANK = (byte*) 1
(const nomodify byte*) VSYNC = (byte*) 0
(const nomodify byte*) WSYNC = (byte*) 2
(byte) ATARI_TIA_READ::CXBLPF
(byte) ATARI_TIA_READ::CXM0FB
(byte) ATARI_TIA_READ::CXM0P
(byte) ATARI_TIA_READ::CXM1FB
(byte) ATARI_TIA_READ::CXM1P
(byte) ATARI_TIA_READ::CXP0FB
(byte) ATARI_TIA_READ::CXP1FB
(byte) ATARI_TIA_READ::CXPPMM
(byte) ATARI_TIA_READ::INPT0
(byte) ATARI_TIA_READ::INPT1
(byte) ATARI_TIA_READ::INPT2
(byte) ATARI_TIA_READ::INPT3
(byte) ATARI_TIA_READ::INPT4
(byte) ATARI_TIA_READ::INPT5
(byte) ATARI_TIA_WRITE::AUDC0
(byte) ATARI_TIA_WRITE::AUDC1
(byte) ATARI_TIA_WRITE::AUDF0
(byte) ATARI_TIA_WRITE::AUDF1
(byte) ATARI_TIA_WRITE::AUDV0
(byte) ATARI_TIA_WRITE::AUDV1
(byte) ATARI_TIA_WRITE::COLUBK
(byte) ATARI_TIA_WRITE::COLUP0
(byte) ATARI_TIA_WRITE::COLUP1
(byte) ATARI_TIA_WRITE::COLUPF
(byte) ATARI_TIA_WRITE::CTRLPF
(byte) ATARI_TIA_WRITE::CXCLR
(byte) ATARI_TIA_WRITE::ENABL
(byte) ATARI_TIA_WRITE::ENAM0
(byte) ATARI_TIA_WRITE::ENAM1
(byte) ATARI_TIA_WRITE::GRP0
(byte) ATARI_TIA_WRITE::GRP1
(byte) ATARI_TIA_WRITE::HMBL
(byte) ATARI_TIA_WRITE::HMCLR
(byte) ATARI_TIA_WRITE::HMM0
(byte) ATARI_TIA_WRITE::HMM1
(byte) ATARI_TIA_WRITE::HMOVE
(byte) ATARI_TIA_WRITE::HMP0
(byte) ATARI_TIA_WRITE::HMP1
(byte) ATARI_TIA_WRITE::NUSIZ0
(byte) ATARI_TIA_WRITE::NUSIZ1
(byte) ATARI_TIA_WRITE::PF0
(byte) ATARI_TIA_WRITE::PF1
(byte) ATARI_TIA_WRITE::PF2
(byte) ATARI_TIA_WRITE::REFP0
(byte) ATARI_TIA_WRITE::REFP1
(byte) ATARI_TIA_WRITE::RESBL
(byte) ATARI_TIA_WRITE::RESM0
(byte) ATARI_TIA_WRITE::RESM1
(byte) ATARI_TIA_WRITE::RESMP0
(byte) ATARI_TIA_WRITE::RESMP1
(byte) ATARI_TIA_WRITE::RESP0
(byte) ATARI_TIA_WRITE::RESP1
(byte) ATARI_TIA_WRITE::RSYNC
(byte) ATARI_TIA_WRITE::VBLANK
(byte) ATARI_TIA_WRITE::VDELBL
(byte) ATARI_TIA_WRITE::VDELP0
(byte) ATARI_TIA_WRITE::VDELP1
(byte) ATARI_TIA_WRITE::VSYNC
(byte) ATARI_TIA_WRITE::WSYNC
(byte) MOS6532_RIOT::INTIM
(byte) MOS6532_RIOT::SWACNT
(byte) MOS6532_RIOT::SWBCNT
(byte) MOS6532_RIOT::SWCHA
(byte) MOS6532_RIOT::SWCHB
(byte) MOS6532_RIOT::T1024T
(byte) MOS6532_RIOT::TIM1T
(byte) MOS6532_RIOT::TIM64T
(byte) MOS6532_RIOT::TIM8T
(const byte*) MOS6532_RIOT::UNUSED[(number) $f] = { fill( $f, 0) }
(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK = (byte) 9
(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK = (byte) 1
(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC = (byte) 2
(const nomodify struct ATARI_TIA_WRITE*) TIA = (struct ATARI_TIA_WRITE*) 0
(byte) col
(byte) col#1 col mem[1] 78.71428571428571
(byte) col#12 col mem[1] 92.53846153846155
@ -918,6 +1140,7 @@ Score: 6560
// File Comments
// Minimal Atari 2600 VCS Program
// Source: https://atariage.com/forums/blogs/entry/11109-step-1-generate-a-stable-display/
// Upstart
// Atari 2600 VCS 4K ROM
.file [name="atari2600-min.prg", type="bin", segments="Code, Vectors"]
@ -931,10 +1154,11 @@ Score: 6560
.segment Code
// Global Constants & labels
.label VSYNC = 0
.label VBLANK = 1
.label WSYNC = 2
.label BACKGROUND_COLOR = 9
.const OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC = 2
.const OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK = 1
.const OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK = 9
// Atari TIA write registers
.label TIA = 0
// @begin
// [1] phi from @begin to @1 [phi:@begin->@1]
// @1
@ -952,34 +1176,34 @@ main: {
// main::@1
// main::@2
__b2:
// *WSYNC = 2
// [6] *((const nomodify byte*) WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
// TIA->WSYNC = 2
// [6] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
// Vertical Sync
// here we generate the signal that tells the TV to move the beam to the top of
// the screen so we can start the next frame of video.
// The Sync Signal must be on for 3 scanlines.
lda #2
sta WSYNC
// *VSYNC = 2
// [7] *((const nomodify byte*) VSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// TIA->VSYNC = 2
// [7] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA) ← (byte) 2 -- _deref_pbuc1=vbuc2
// Wait for SYNC (halts CPU until end of scanline)
sta VSYNC
// *WSYNC = 2
// [8] *((const nomodify byte*) WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
sta TIA
// TIA->WSYNC = 2
// [8] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
// Accumulator D1=1, turns on Vertical Sync signal
sta WSYNC
// [9] *((const nomodify byte*) WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// [9] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 2 -- _deref_pbuc1=vbuc2
// Wait for Sync - halts CPU until end of 1st scanline of VSYNC
sta WSYNC
// *WSYNC = 0
// [10] *((const nomodify byte*) WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// TIA->WSYNC = 0
// [10] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// wait until end of 2nd scanline of VSYNC
lda #0
sta WSYNC
// *VSYNC = 0
// [11] *((const nomodify byte*) VSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// TIA->VSYNC = 0
// [11] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA) ← (byte) 0 -- _deref_pbuc1=vbuc2
// wait until end of 3rd scanline of VSYNC
sta VSYNC
sta TIA
// [12] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
// [12] phi (byte) main::i#2 = (byte) 0 [phi:main::@2->main::@3#0] -- vbuxx=vbuc1
tax
@ -992,13 +1216,13 @@ main: {
cpx #$25
bcc __b4
// main::@5
// *VBLANK = 0
// [14] *((const nomodify byte*) VBLANK) ← (byte) 0 -- _deref_pbuc1=vbuc2
// TIA->VBLANK = 0
// [14] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (byte) 0 -- _deref_pbuc1=vbuc2
// Screen - display logic
// Update the registers in TIA (the video chip) in order to generate what the player sees.
// For now we're just going to output 192 colored scanlines lines so we have something to see.
lda #0
sta VBLANK
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK
// c = col++
// [15] (byte) main::c#0 ← (byte) col#12 -- vbuxx=vbum1
// D1=1, turns off Vertical Blank signal (image output on)
@ -1016,22 +1240,22 @@ main: {
cpy #$c0
bcc __b7
// main::@8
// *WSYNC = 0
// [19] *((const nomodify byte*) WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// TIA->WSYNC = 0
// [19] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// Overscan - game logic
// Since we don't have any yet, just delay
lda #0
sta WSYNC
// *VBLANK = 2
// [20] *((const nomodify byte*) VBLANK) ← (byte) 2 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// TIA->VBLANK = 2
// [20] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) ← (byte) 2 -- _deref_pbuc1=vbuc2
// Wait for SYNC (halts CPU until end of scanline)
lda #2
sta VBLANK
// *BACKGROUND_COLOR = 0
// [21] *((const nomodify byte*) BACKGROUND_COLOR) ← (byte) 0 -- _deref_pbuc1=vbuc2
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK
// TIA->COLUBK = 0
// [21] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (byte) 0 -- _deref_pbuc1=vbuc2
// // D1=1 turns image output off
lda #0
sta BACKGROUND_COLOR
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK
// [22] phi from main::@8 to main::@9 [phi:main::@8->main::@9]
// [22] phi (byte) main::i2#2 = (byte) 0 [phi:main::@8->main::@9#0] -- vbuxx=vbuc1
tax
@ -1046,10 +1270,10 @@ main: {
jmp __b2
// main::@10
__b10:
// *WSYNC = 0
// [24] *((const nomodify byte*) WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// TIA->WSYNC = 0
// [24] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
lda #0
sta WSYNC
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// for(char i=0;i<07;i++)
// [25] (byte) main::i2#1 ← ++ (byte) main::i2#2 -- vbuxx=_inc_vbuxx
inx
@ -1058,15 +1282,15 @@ main: {
jmp __b9
// main::@7
__b7:
// *WSYNC = 0
// [26] *((const nomodify byte*) WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// TIA->WSYNC = 0
// [26] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
lda #0
sta WSYNC
// *BACKGROUND_COLOR = c++
// [27] *((const nomodify byte*) BACKGROUND_COLOR) ← (byte) main::c#2 -- _deref_pbuc1=vbuxx
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// TIA->COLUBK = c++
// [27] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) ← (byte) main::c#2 -- _deref_pbuc1=vbuxx
// Wait for SYNC (halts CPU until end of scanline)
stx BACKGROUND_COLOR
// *BACKGROUND_COLOR = c++;
stx TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK
// TIA->COLUBK = c++;
// [28] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx
inx
// for(char i=0;i<192;i++)
@ -1078,10 +1302,10 @@ main: {
jmp __b6
// main::@4
__b4:
// *WSYNC = 0
// [30] *((const nomodify byte*) WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
// TIA->WSYNC = 0
// [30] *((byte*)(const nomodify struct ATARI_TIA_WRITE*) TIA+(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) ← (byte) 0 -- _deref_pbuc1=vbuc2
lda #0
sta WSYNC
sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
// for(char i=0;i<37;i++)
// [31] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx

View File

@ -1,10 +1,79 @@
(label) @1
(label) @begin
(label) @end
(const nomodify byte*) BACKGROUND_COLOR = (byte*) 9
(const nomodify byte*) VBLANK = (byte*) 1
(const nomodify byte*) VSYNC = (byte*) 0
(const nomodify byte*) WSYNC = (byte*) 2
(byte) ATARI_TIA_READ::CXBLPF
(byte) ATARI_TIA_READ::CXM0FB
(byte) ATARI_TIA_READ::CXM0P
(byte) ATARI_TIA_READ::CXM1FB
(byte) ATARI_TIA_READ::CXM1P
(byte) ATARI_TIA_READ::CXP0FB
(byte) ATARI_TIA_READ::CXP1FB
(byte) ATARI_TIA_READ::CXPPMM
(byte) ATARI_TIA_READ::INPT0
(byte) ATARI_TIA_READ::INPT1
(byte) ATARI_TIA_READ::INPT2
(byte) ATARI_TIA_READ::INPT3
(byte) ATARI_TIA_READ::INPT4
(byte) ATARI_TIA_READ::INPT5
(byte) ATARI_TIA_WRITE::AUDC0
(byte) ATARI_TIA_WRITE::AUDC1
(byte) ATARI_TIA_WRITE::AUDF0
(byte) ATARI_TIA_WRITE::AUDF1
(byte) ATARI_TIA_WRITE::AUDV0
(byte) ATARI_TIA_WRITE::AUDV1
(byte) ATARI_TIA_WRITE::COLUBK
(byte) ATARI_TIA_WRITE::COLUP0
(byte) ATARI_TIA_WRITE::COLUP1
(byte) ATARI_TIA_WRITE::COLUPF
(byte) ATARI_TIA_WRITE::CTRLPF
(byte) ATARI_TIA_WRITE::CXCLR
(byte) ATARI_TIA_WRITE::ENABL
(byte) ATARI_TIA_WRITE::ENAM0
(byte) ATARI_TIA_WRITE::ENAM1
(byte) ATARI_TIA_WRITE::GRP0
(byte) ATARI_TIA_WRITE::GRP1
(byte) ATARI_TIA_WRITE::HMBL
(byte) ATARI_TIA_WRITE::HMCLR
(byte) ATARI_TIA_WRITE::HMM0
(byte) ATARI_TIA_WRITE::HMM1
(byte) ATARI_TIA_WRITE::HMOVE
(byte) ATARI_TIA_WRITE::HMP0
(byte) ATARI_TIA_WRITE::HMP1
(byte) ATARI_TIA_WRITE::NUSIZ0
(byte) ATARI_TIA_WRITE::NUSIZ1
(byte) ATARI_TIA_WRITE::PF0
(byte) ATARI_TIA_WRITE::PF1
(byte) ATARI_TIA_WRITE::PF2
(byte) ATARI_TIA_WRITE::REFP0
(byte) ATARI_TIA_WRITE::REFP1
(byte) ATARI_TIA_WRITE::RESBL
(byte) ATARI_TIA_WRITE::RESM0
(byte) ATARI_TIA_WRITE::RESM1
(byte) ATARI_TIA_WRITE::RESMP0
(byte) ATARI_TIA_WRITE::RESMP1
(byte) ATARI_TIA_WRITE::RESP0
(byte) ATARI_TIA_WRITE::RESP1
(byte) ATARI_TIA_WRITE::RSYNC
(byte) ATARI_TIA_WRITE::VBLANK
(byte) ATARI_TIA_WRITE::VDELBL
(byte) ATARI_TIA_WRITE::VDELP0
(byte) ATARI_TIA_WRITE::VDELP1
(byte) ATARI_TIA_WRITE::VSYNC
(byte) ATARI_TIA_WRITE::WSYNC
(byte) MOS6532_RIOT::INTIM
(byte) MOS6532_RIOT::SWACNT
(byte) MOS6532_RIOT::SWBCNT
(byte) MOS6532_RIOT::SWCHA
(byte) MOS6532_RIOT::SWCHB
(byte) MOS6532_RIOT::T1024T
(byte) MOS6532_RIOT::TIM1T
(byte) MOS6532_RIOT::TIM64T
(byte) MOS6532_RIOT::TIM8T
(const byte*) MOS6532_RIOT::UNUSED[(number) $f] = { fill( $f, 0) }
(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK = (byte) 9
(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK = (byte) 1
(const byte) OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC = (byte) 2
(const nomodify struct ATARI_TIA_WRITE*) TIA = (struct ATARI_TIA_WRITE*) 0
(byte) col
(byte) col#1 col mem[1] 78.71428571428571
(byte) col#12 col mem[1] 92.53846153846155