1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-02-20 00:29:10 +00:00

Ported plasma sample from CC65 to KickC.

This commit is contained in:
jespergravgaard 2019-04-08 00:44:09 +02:00
parent 23b1f15101
commit 35659a67be
13 changed files with 10040 additions and 4192 deletions

View File

@ -0,0 +1 @@
eor {z1}

View File

@ -32,6 +32,11 @@ public class TestPrograms {
public TestPrograms() {
}
@Test
public void testPlasma() throws IOException, URISyntaxException {
compileAndCompare("examples/plasma/plasma");
}
@Test
public void testTernary3() throws IOException, URISyntaxException {
compileAndCompare("ternary-3");

View File

@ -21,7 +21,7 @@ void sid_rnd_init() {
// Get a random number from the SID voice 3,
// Must be initialized with sid_rnd_init()
byte sid_rnd() {
inline byte sid_rnd() {
return *SID_VOICE3_OSC;
}

View File

@ -0,0 +1,94 @@
// A KickC version of the plasma routine from the CC65 samples
// (w)2001 by groepaz/hitmen
// Cleanup and porting to CC65 by Ullrich von Bassewitz.
// Ported to KickC by Jesper Gravgaard.
// Original source https://github.com/cc65/cc65/blob/master/samples/plasma.c
import "c64"
import "print"
import "sid"
const byte* SCREEN1 = $2800;
const byte* SCREEN2 = $2c00;
const byte* CHARSET = $2000;
const byte* SINTABLE = $1f00;
kickasm(pc SINTABLE) {{
.for(var i=0;i<$100;i++)
.byte round(127.5+127.5*sin(toRadians(360*i/256)))
}}
void main() {
asm { sei }
*BORDERCOL = BLUE;
*BGCOL = BLUE;
for(byte* col : COLS..COLS+1000) *col = BLACK;
makecharset(CHARSET);
// Show double-buffered plasma
while(true) {
doplasma(SCREEN1);
*D018 = toD018(SCREEN1, CHARSET);
doplasma(SCREEN2);
*D018 = toD018(SCREEN2, CHARSET);
}
}
// Plasma state variables
byte c1A = 0;
byte c1B = 0;
byte c2A = 0;
byte c2B = 0;
// Render plasma to the passed screen
void doplasma (byte* screen) {
byte[40] xbuf;
byte[25] ybuf;
byte c1a = c1A;
byte c1b = c1B;
for (byte i = 0; i < 25; ++i) {
ybuf[i] = (SINTABLE[c1a] + SINTABLE[c1b]);
c1a += 4;
c1b += 9;
}
c1A += 3;
c1B -= 5;
byte c2a = c2A;
byte c2b = c2B;
for (byte i = 0; i < 40; ++i) {
xbuf[i] = (SINTABLE[c2a] + SINTABLE[c2b]);
c2a += 3;
c2b += 7;
}
c2A += 2;
c2B -= 3;
for (byte ii = 0; ii < 25; ++ii) {
for (byte i = 0; i < 40; ++i) {
screen[i] = (xbuf[i] + ybuf[ii]);
}
screen += 40;
}
}
// Make a plasma-friendly charset where the chars are randomly filled
void makecharset(byte* charset) {
const byte[8] bittab = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
sid_rnd_init();
print_cls();
for (word c = 0; c < 0x100; ++c) {
byte s = SINTABLE[<c];
for ( byte i = 0; i < 8; ++i){
byte b = 0;
for (byte ii = 0; ii < 8; ++ii) {
if ((sid_rnd() & 0xFF) > s) {
b |= bittab[ii];
}
}
charset[(c<<3) + i] = b;
}
if ((c & 0x07) == 0) {
print_char('.');
}
}
}

View File

@ -0,0 +1,27 @@
// SID registers for random number generation
const word* SID_VOICE3_FREQ = $d40e;
const byte* SID_VOICE3_FREQ_LOW = $d40e;
const byte* SID_VOICE3_FREQ_HIGH = $d40f;
const byte* SID_VOICE3_CONTROL = $d412;
const byte SID_CONTROL_NOISE = $80;
const byte SID_CONTROL_PULSE = $40;
const byte SID_CONTROL_SAWTOOTH = $20;
const byte SID_CONTROL_TRIANGLE = $10;
const byte SID_CONTROL_TEST = $08;
const byte SID_CONTROL_RING = $04;
const byte SID_CONTROL_SYNC = $02;
const byte SID_CONTROL_GATE = $01;
const byte* SID_VOICE3_OSC = $d41b;
// Initialize SID voice 3 for random number generation
void sid_rnd_init() {
*SID_VOICE3_FREQ = $ffff;
*SID_VOICE3_CONTROL = SID_CONTROL_NOISE;
}
// Get a random number from the SID voice 3,
// Must be initialized with sid_rnd_init()
byte sid_rnd() {
return *SID_VOICE3_OSC;
}

View File

@ -154,17 +154,17 @@
.label current_piece_gfx_64 = 5
.label current_piece_char_68 = $b
.label render_screen_render_69 = 9
.label current_xpos_128 = $a
.label current_xpos_129 = $a
.label current_piece_gfx_118 = 5
.label current_piece_gfx_119 = 5
.label current_piece_char_106 = $b
.label current_piece_char_107 = $b
.label current_piece_98 = 5
.label current_piece_99 = 5
.label current_xpos_130 = $a
.label current_xpos_131 = $a
.label current_piece_gfx_120 = 5
.label current_piece_gfx_121 = 5
.label current_piece_char_108 = $b
.label current_piece_char_109 = $b
.label current_piece_100 = 5
.label current_piece_101 = 5
.label current_piece_102 = 5
.label current_piece_103 = 5
.label current_piece_104 = 5
bbegin:
// The screen currently being showed to the user. $00 for screen 1 / $40 for screen 2.
lda #0
@ -200,13 +200,13 @@ main: {
jsr render_playfield
ldx current_ypos
lda current_xpos
sta current_xpos_128
sta current_xpos_130
lda current_piece_gfx
sta current_piece_gfx_118
sta current_piece_gfx_120
lda current_piece_gfx+1
sta current_piece_gfx_118+1
sta current_piece_gfx_120+1
lda current_piece_char
sta current_piece_char_106
sta current_piece_char_108
lda #$40
sta render_screen_render_33
jsr render_moving
@ -261,13 +261,13 @@ main: {
lda render_screen_render
sta render_screen_render_69
lda current_xpos
sta current_xpos_129
sta current_xpos_131
lda current_piece_gfx
sta current_piece_gfx_119
sta current_piece_gfx_121
lda current_piece_gfx+1
sta current_piece_gfx_119+1
sta current_piece_gfx_121+1
lda current_piece_char
sta current_piece_char_107
sta current_piece_char_109
jsr render_moving
lda render_screen_render
ldx next_piece_idx
@ -278,11 +278,11 @@ main: {
}
// Swap rendering to the other screen (used for double buffering)
render_screen_swap: {
lda render_screen_render
eor #$40
lda #$40
eor render_screen_render
sta render_screen_render
lda render_screen_show
eor #$40
lda #$40
eor render_screen_show
sta render_screen_show
rts
}
@ -629,9 +629,9 @@ play_move_rotate: {
sta play_collision.ypos
ldx orientation
lda current_piece
sta current_piece_101
sta current_piece_103
lda current_piece+1
sta current_piece_101+1
sta current_piece_103+1
jsr play_collision
cmp #COLLISION_NONE
bne b4
@ -762,9 +762,9 @@ play_move_leftright: {
sta play_collision.ypos
ldx current_orientation
lda current_piece
sta current_piece_100
sta current_piece_102
lda current_piece+1
sta current_piece_100+1
sta current_piece_102+1
jsr play_collision
cmp #COLLISION_NONE
bne b3
@ -784,9 +784,9 @@ play_move_leftright: {
sta play_collision.ypos
ldx current_orientation
lda current_piece
sta current_piece_99
sta current_piece_101
lda current_piece+1
sta current_piece_99+1
sta current_piece_101+1
jsr play_collision
cmp #COLLISION_NONE
bne b3
@ -829,9 +829,9 @@ play_move_down: {
sta play_collision.xpos
ldx current_orientation
lda current_piece
sta current_piece_98
sta current_piece_100
lda current_piece+1
sta current_piece_98+1
sta current_piece_100+1
jsr play_collision
cmp #COLLISION_NONE
beq b10
@ -887,9 +887,9 @@ play_spawn_current: {
lda current_ypos
sta play_collision.ypos
lda PIECES,y
sta current_piece_102
sta current_piece_104
lda PIECES+1,y
sta current_piece_102+1
sta current_piece_104+1
ldx #0
jsr play_collision
cmp #COLLISION_PLAYFIELD
@ -902,20 +902,14 @@ play_spawn_current: {
b2:
lda #7
cmp piece_idx
beq b3
beq sid_rnd1
rts
b3:
jsr sid_rnd
sid_rnd1:
lda SID_VOICE3_OSC
and #7
sta piece_idx
jmp b2
}
// Get a random number from the SID voice 3,
// Must be initialized with sid_rnd_init()
sid_rnd: {
lda SID_VOICE3_OSC
rts
}
// Update the score based on the number of lines removed
// play_update_score(byte register(X) removed)
play_update_score: {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -323,37 +323,37 @@
(byte*~) current_piece#100 current_piece#100 zp ZP_WORD:5 4.0
(byte*~) current_piece#101 current_piece#101 zp ZP_WORD:5 4.0
(byte*~) current_piece#102 current_piece#102 zp ZP_WORD:5 4.0
(byte*~) current_piece#104 current_piece zp ZP_WORD:26 4.0
(byte*~) current_piece#103 current_piece#103 zp ZP_WORD:5 4.0
(byte*~) current_piece#104 current_piece#104 zp ZP_WORD:5 4.0
(byte*~) current_piece#106 current_piece zp ZP_WORD:26 4.0
(byte*) current_piece#15 current_piece zp ZP_WORD:26 1.5696202531645564
(byte*) current_piece#17 current_piece#17 zp ZP_WORD:5 12.0
(byte*) current_piece#28 current_piece zp ZP_WORD:26 6.0
(byte*~) current_piece#96 current_piece zp ZP_WORD:26 4.0
(byte*~) current_piece#98 current_piece#98 zp ZP_WORD:5 4.0
(byte*~) current_piece#99 current_piece#99 zp ZP_WORD:5 4.0
(byte*~) current_piece#98 current_piece zp ZP_WORD:26 4.0
(byte) current_piece_char
(byte) current_piece_char#10 current_piece_char zp ZP_BYTE:28 187.38888888888889
(byte~) current_piece_char#106 current_piece_char#106 zp ZP_BYTE:11 4.0
(byte~) current_piece_char#107 current_piece_char#107 zp ZP_BYTE:11 22.0
(byte~) current_piece_char#108 current_piece_char#108 zp ZP_BYTE:11 4.0
(byte~) current_piece_char#109 current_piece_char#109 zp ZP_BYTE:11 22.0
(byte) current_piece_char#16 current_piece_char zp ZP_BYTE:28 3.3421052631578956
(byte) current_piece_char#29 current_piece_char zp ZP_BYTE:28 6.0
(byte) current_piece_char#5 current_piece_char zp ZP_BYTE:28 0.23529411764705882
(byte) current_piece_char#5 current_piece_char zp ZP_BYTE:28 0.25806451612903225
(byte) current_piece_char#68 current_piece_char#68 zp ZP_BYTE:11 50.699999999999996
(byte*) current_piece_gfx
(byte*) current_piece_gfx#112 current_piece_gfx zp ZP_WORD:30 187.38888888888889
(byte*~) current_piece_gfx#118 current_piece_gfx#118 zp ZP_WORD:5 2.0
(byte*~) current_piece_gfx#119 current_piece_gfx#119 zp ZP_WORD:5 11.0
(byte*) current_piece_gfx#114 current_piece_gfx zp ZP_WORD:30 187.38888888888889
(byte*~) current_piece_gfx#120 current_piece_gfx#120 zp ZP_WORD:5 2.0
(byte*~) current_piece_gfx#121 current_piece_gfx#121 zp ZP_WORD:5 11.0
(byte*) current_piece_gfx#18 current_piece_gfx zp ZP_WORD:30 6.047619047619047
(byte*) current_piece_gfx#20 current_piece_gfx zp ZP_WORD:30 0.3571428571428571
(byte*) current_piece_gfx#21 current_piece_gfx zp ZP_WORD:30 1.3333333333333333
(byte*) current_piece_gfx#35 current_piece_gfx zp ZP_WORD:30 6.0
(byte*) current_piece_gfx#64 current_piece_gfx#64 zp ZP_WORD:5 50.699999999999996
(byte*) current_piece_gfx#7 current_piece_gfx zp ZP_WORD:30 4.0
(byte*) current_piece_gfx#74 current_piece_gfx zp ZP_WORD:30 0.24242424242424243
(byte*) current_piece_gfx#74 current_piece_gfx zp ZP_WORD:30 0.26666666666666666
(byte) current_xpos
(byte) current_xpos#103 current_xpos zp ZP_BYTE:32 0.3125
(byte) current_xpos#122 current_xpos zp ZP_BYTE:32 20.75925925925926
(byte~) current_xpos#128 current_xpos#128 zp ZP_BYTE:10 1.3333333333333333
(byte~) current_xpos#129 current_xpos#129 zp ZP_BYTE:10 7.333333333333333
(byte) current_xpos#103 current_xpos zp ZP_BYTE:32 0.3448275862068966
(byte) current_xpos#124 current_xpos zp ZP_BYTE:32 20.75925925925926
(byte~) current_xpos#130 current_xpos#130 zp ZP_BYTE:10 1.3333333333333333
(byte~) current_xpos#131 current_xpos#131 zp ZP_BYTE:10 7.333333333333333
(byte) current_xpos#19 current_xpos zp ZP_BYTE:32 6.047619047619047
(byte) current_xpos#22 current_xpos zp ZP_BYTE:32 0.7692307692307692
(byte) current_xpos#26 current_xpos zp ZP_BYTE:32 0.4666666666666666
@ -362,19 +362,19 @@
(byte) current_xpos#6 current_xpos zp ZP_BYTE:32 4.0
(byte) current_xpos#8 current_xpos zp ZP_BYTE:32 4.0
(byte) current_ypos
(byte~) current_ypos#104 reg byte x 1.0
(byte~) current_ypos#105 reg byte x 4.4
(byte) current_ypos#11 current_ypos zp ZP_BYTE:16 3.297297297297297
(byte) current_ypos#100 current_ypos zp ZP_BYTE:16 3.297297297297297
(byte~) current_ypos#106 reg byte x 1.0
(byte~) current_ypos#107 reg byte x 4.4
(byte) current_ypos#13 reg byte x 15.0
(byte) current_ypos#19 current_ypos zp ZP_BYTE:16 1.683544303797468
(byte) current_ypos#3 current_ypos zp ZP_BYTE:16 4.0
(byte) current_ypos#38 current_ypos zp ZP_BYTE:16 6.0
(byte) current_ypos#6 current_ypos zp ZP_BYTE:16 0.3225806451612903
(byte) current_ypos#6 current_ypos zp ZP_BYTE:16 0.3571428571428571
(byte) game_over
(byte) game_over#10 game_over zp ZP_BYTE:34 4.804347826086958
(byte) game_over#15 game_over zp ZP_BYTE:34 3.1052631578947376
(byte) game_over#27 game_over zp ZP_BYTE:34 6.0
(byte) game_over#52 game_over zp ZP_BYTE:34 0.3333333333333333
(byte) game_over#52 game_over zp ZP_BYTE:34 0.38095238095238093
(byte) game_over#65 game_over zp ZP_BYTE:34 0.4
(byte) irq_cnt
(byte) irq_cnt#0 irq_cnt zp ZP_BYTE:41 0.17391304347826086
@ -814,21 +814,22 @@
(byte) play_remove_lines::y#1 y zp ZP_BYTE:4 1501.5
(byte) play_remove_lines::y#8 y zp ZP_BYTE:4 133.46666666666667
(void()) play_spawn_current()
(byte~) play_spawn_current::$0 $0 zp ZP_BYTE:4 0.06060606060606061
(byte~) play_spawn_current::$0 $0 zp ZP_BYTE:4 0.06666666666666667
(byte~) play_spawn_current::$2 reg byte a 4.0
(byte~) play_spawn_current::$6 reg byte a 2002.0
(label) play_spawn_current::@1
(label) play_spawn_current::@2
(label) play_spawn_current::@3
(label) play_spawn_current::@4
(label) play_spawn_current::@5
(label) play_spawn_current::@6
(label) play_spawn_current::@return
(byte) play_spawn_current::current_piece_idx
(byte) play_spawn_current::current_piece_idx#0 reg byte x 2.0
(byte) play_spawn_current::piece_idx
(byte) play_spawn_current::piece_idx#1 piece_idx zp ZP_BYTE:33 2002.0
(byte) play_spawn_current::piece_idx#2 piece_idx zp ZP_BYTE:33 111.66666666666667
(label) play_spawn_current::sid_rnd1
(byte) play_spawn_current::sid_rnd1_return
(byte) play_spawn_current::sid_rnd1_return#0 reg byte a 2002.0
(void()) play_update_score((byte) play_update_score::removed)
(byte~) play_update_score::$2 reg byte a 4.0
(byte~) play_update_score::$4 reg byte a 4.0
@ -1127,11 +1128,6 @@
(const byte*[PLAYFIELD_LINES#0]) screen_lines_1#0 screen_lines_1 = { fill( PLAYFIELD_LINES#0, 0) }
(byte*[PLAYFIELD_LINES#0]) screen_lines_2
(const byte*[PLAYFIELD_LINES#0]) screen_lines_2#0 screen_lines_2 = { fill( PLAYFIELD_LINES#0, 0) }
(byte()) sid_rnd()
(label) sid_rnd::@return
(byte) sid_rnd::return
(byte) sid_rnd::return#0 reg byte a 334.33333333333337
(byte) sid_rnd::return#2 reg byte a 2002.0
(void()) sid_rnd_init()
(label) sid_rnd_init::@return
(void()) sprites_init()
@ -1189,7 +1185,7 @@ interrupt(HARDWARE_CLOBBER)(void()) sprites_irq()
zp ZP_BYTE:2 [ render_screen_show#16 render_screen_show#13 play_init::idx#2 play_init::idx#1 sprites_init::xpos#2 sprites_init::xpos#1 render_screen_original::y#6 render_screen_original::y#1 ]
zp ZP_BYTE:3 [ render_screen_render#18 render_screen_render#11 ]
zp ZP_BYTE:4 [ current_movedown_counter#16 current_movedown_counter#14 current_movedown_counter#12 play_remove_lines::y#8 play_remove_lines::y#1 play_lock_current::l#6 play_lock_current::l#1 play_spawn_current::$0 play_update_score::lines_before#0 ]
zp ZP_WORD:5 [ render_score::screen#3 render_bcd::screen#6 render_bcd::screen#0 render_bcd::screen#1 render_bcd::screen#2 render_bcd::screen#3 render_bcd::screen#4 render_bcd::screen#5 render_next::next_piece_gfx#2 render_next::next_piece_gfx#3 render_next::next_piece_gfx#1 render_next::next_piece_gfx#9 current_piece_gfx#64 current_piece_gfx#118 current_piece_gfx#119 render_playfield::screen_line#2 render_playfield::screen_line#0 render_playfield::screen_line#1 current_piece#17 current_piece#98 current_piece#99 current_piece#100 current_piece#101 current_piece#102 play_collision::piece_gfx#0 play_init::pli#2 play_init::pli#1 render_init::li_1#2 render_init::li_1#1 render_screen_original::oscr#2 render_screen_original::oscr#4 render_screen_original::oscr#1 play_lock_current::playfield_line#0 ]
zp ZP_WORD:5 [ render_score::screen#3 render_bcd::screen#6 render_bcd::screen#0 render_bcd::screen#1 render_bcd::screen#2 render_bcd::screen#3 render_bcd::screen#4 render_bcd::screen#5 render_next::next_piece_gfx#2 render_next::next_piece_gfx#3 render_next::next_piece_gfx#1 render_next::next_piece_gfx#9 current_piece_gfx#64 current_piece_gfx#120 current_piece_gfx#121 render_playfield::screen_line#2 render_playfield::screen_line#0 render_playfield::screen_line#1 current_piece#17 current_piece#100 current_piece#101 current_piece#102 current_piece#103 current_piece#104 play_collision::piece_gfx#0 play_init::pli#2 play_init::pli#1 render_init::li_1#2 render_init::li_1#1 render_screen_original::oscr#2 render_screen_original::oscr#4 render_screen_original::oscr#1 play_lock_current::playfield_line#0 ]
zp ZP_WORD:7 [ render_bcd::offset#6 render_bcd::screen_pos#3 render_bcd::screen_pos#0 render_bcd::screen_pos#2 render_bcd::screen_pos#1 render_next::screen_next_area#5 render_next::screen_next_area#10 render_next::screen_next_area#4 render_next::screen_next_area#11 render_next::screen_next_area#3 render_init::li_2#2 render_init::li_2#1 render_screen_original::ocols#2 render_screen_original::ocols#4 render_screen_original::ocols#1 render_moving::screen_line#0 play_collision::playfield_line#0 ]
reg byte y [ render_bcd::only_low#6 ]
reg byte x [ render_bcd::bcd#6 render_bcd::bcd#0 render_bcd::bcd#1 render_bcd::bcd#2 render_bcd::bcd#3 render_bcd::bcd#4 render_bcd::bcd#5 ]
@ -1197,9 +1193,9 @@ reg byte a [ render_screen_render#15 render_screen_render#68 ]
reg byte x [ next_piece_idx#12 next_piece_idx#84 next_piece_idx#85 ]
zp ZP_BYTE:9 [ render_next::l#7 render_next::l#1 render_screen_render#33 render_screen_render#69 render_playfield::l#2 render_playfield::l#1 play_movement::return#2 play_movement::render#1 play_movement::return#0 play_movement::render#2 play_remove_lines::removed#11 play_remove_lines::removed#8 play_remove_lines::removed#1 play_lock_current::i#2 play_lock_current::i#3 play_lock_current::i#7 play_lock_current::i#9 keyboard_event_pressed::keycode#5 keyboard_event_scan::row#2 keyboard_event_scan::row#1 ]
reg byte x [ render_next::c#2 render_next::c#1 ]
reg byte x [ current_ypos#13 current_ypos#104 current_ypos#105 ]
zp ZP_BYTE:10 [ current_xpos#59 current_xpos#128 current_xpos#129 render_playfield::i#2 render_playfield::i#3 render_playfield::i#1 play_move_rotate::orientation#3 play_move_rotate::orientation#1 play_move_rotate::orientation#2 play_remove_lines::x#2 play_remove_lines::x#1 play_lock_current::col#2 play_lock_current::col#0 play_lock_current::col#1 keyboard_event_scan::keycode#10 keyboard_event_scan::keycode#11 keyboard_event_scan::keycode#14 keyboard_event_scan::keycode#15 keyboard_event_scan::keycode#1 render_next::next_piece_char#0 keyboard_event_pressed::row_bits#0 ]
zp ZP_BYTE:11 [ current_piece_char#68 current_piece_char#106 current_piece_char#107 render_playfield::c#2 render_playfield::c#1 play_collision::ypos#5 play_collision::ypos#0 play_collision::ypos#1 play_collision::ypos#2 play_collision::ypos#3 play_collision::ypos#4 play_collision::ypos2#2 play_collision::ypos2#0 play_collision::ypos2#1 play_remove_lines::full#4 play_remove_lines::full#2 play_lock_current::i#1 keyboard_event_scan::row_scan#0 ]
reg byte x [ current_ypos#13 current_ypos#106 current_ypos#107 ]
zp ZP_BYTE:10 [ current_xpos#59 current_xpos#130 current_xpos#131 render_playfield::i#2 render_playfield::i#3 render_playfield::i#1 play_move_rotate::orientation#3 play_move_rotate::orientation#1 play_move_rotate::orientation#2 play_remove_lines::x#2 play_remove_lines::x#1 play_lock_current::col#2 play_lock_current::col#0 play_lock_current::col#1 keyboard_event_scan::keycode#10 keyboard_event_scan::keycode#11 keyboard_event_scan::keycode#14 keyboard_event_scan::keycode#15 keyboard_event_scan::keycode#1 render_next::next_piece_char#0 keyboard_event_pressed::row_bits#0 ]
zp ZP_BYTE:11 [ current_piece_char#68 current_piece_char#108 current_piece_char#109 render_playfield::c#2 render_playfield::c#1 play_collision::ypos#5 play_collision::ypos#0 play_collision::ypos#1 play_collision::ypos#2 play_collision::ypos#3 play_collision::ypos#4 play_collision::ypos2#2 play_collision::ypos2#0 play_collision::ypos2#1 play_remove_lines::full#4 play_remove_lines::full#2 play_lock_current::i#1 keyboard_event_scan::row_scan#0 ]
zp ZP_BYTE:12 [ render_moving::ypos2#2 render_moving::ypos2#0 render_moving::ypos2#1 play_collision::xpos#6 play_collision::xpos#0 play_collision::xpos#1 play_collision::xpos#2 play_collision::xpos#3 play_collision::xpos#4 play_remove_lines::c#0 ]
zp ZP_BYTE:13 [ render_moving::l#4 render_moving::l#1 play_collision::l#6 play_collision::l#1 ]
zp ZP_BYTE:14 [ render_moving::i#4 render_moving::i#3 render_moving::i#8 render_moving::i#2 render_moving::i#1 play_collision::i#2 play_collision::i#3 play_collision::i#11 play_collision::i#13 ]
@ -1212,17 +1208,17 @@ reg byte x [ play_collision::c#2 play_collision::c#1 ]
reg byte a [ play_collision::return#15 ]
reg byte a [ play_move_leftright::return#2 ]
reg byte x [ play_move_down::movedown#6 play_move_down::movedown#7 play_move_down::movedown#10 play_move_down::movedown#2 play_move_down::movedown#3 ]
zp ZP_BYTE:16 [ current_ypos#38 current_ypos#3 current_ypos#11 current_ypos#19 current_ypos#6 play_lock_current::ypos2#2 play_lock_current::ypos2#0 play_lock_current::ypos2#1 ]
zp ZP_BYTE:16 [ current_ypos#38 current_ypos#3 current_ypos#100 current_ypos#19 current_ypos#6 play_lock_current::ypos2#2 play_lock_current::ypos2#0 play_lock_current::ypos2#1 ]
zp ZP_WORD:17 [ lines_bcd#26 lines_bcd#19 lines_bcd#15 lines_bcd#17 lines_bcd#30 render_screen_original::screen#7 render_screen_original::screen#6 render_screen_original::screen#5 render_screen_original::screen#8 render_screen_original::screen#9 render_screen_original::screen#10 render_screen_original::screen#2 render_screen_original::screen#3 ]
zp ZP_DWORD:19 [ score_bcd#26 score_bcd#18 score_bcd#14 score_bcd#16 score_bcd#30 ]
zp ZP_BYTE:23 [ level#33 level#10 level#17 level#19 level#21 ]
zp ZP_BYTE:24 [ current_movedown_slow#37 current_movedown_slow#14 current_movedown_slow#21 current_movedown_slow#1 current_movedown_slow#23 current_movedown_slow#69 current_movedown_slow#10 ]
zp ZP_BYTE:25 [ level_bcd#31 level_bcd#11 level_bcd#17 level_bcd#19 level_bcd#64 level_bcd#21 level_bcd#8 ]
zp ZP_WORD:26 [ current_piece#28 current_piece#10 current_piece#15 current_piece#96 current_piece#104 render_screen_original::cols#6 render_screen_original::cols#5 render_screen_original::cols#4 render_screen_original::cols#7 render_screen_original::cols#3 render_screen_original::cols#1 render_screen_original::cols#2 ]
zp ZP_WORD:26 [ current_piece#28 current_piece#10 current_piece#15 current_piece#98 current_piece#106 render_screen_original::cols#6 render_screen_original::cols#5 render_screen_original::cols#4 render_screen_original::cols#7 render_screen_original::cols#3 render_screen_original::cols#1 render_screen_original::cols#2 ]
zp ZP_BYTE:28 [ current_piece_char#29 current_piece_char#10 current_piece_char#16 current_piece_char#5 ]
zp ZP_BYTE:29 [ current_orientation#37 current_orientation#13 current_orientation#17 current_orientation#20 current_orientation#25 current_orientation#7 ]
zp ZP_WORD:30 [ current_piece_gfx#35 current_piece_gfx#112 current_piece_gfx#18 current_piece_gfx#74 current_piece_gfx#20 current_piece_gfx#21 current_piece_gfx#7 ]
zp ZP_BYTE:32 [ current_xpos#43 current_xpos#122 current_xpos#19 current_xpos#103 current_xpos#22 current_xpos#26 current_xpos#6 current_xpos#8 ]
zp ZP_WORD:30 [ current_piece_gfx#35 current_piece_gfx#114 current_piece_gfx#18 current_piece_gfx#74 current_piece_gfx#20 current_piece_gfx#21 current_piece_gfx#7 ]
zp ZP_BYTE:32 [ current_xpos#43 current_xpos#124 current_xpos#19 current_xpos#103 current_xpos#22 current_xpos#26 current_xpos#6 current_xpos#8 ]
reg byte x [ play_move_down::return#3 ]
zp ZP_BYTE:33 [ next_piece_idx#17 next_piece_idx#30 next_piece_idx#10 next_piece_idx#16 play_spawn_current::piece_idx#2 play_spawn_current::piece_idx#1 ]
zp ZP_BYTE:34 [ game_over#65 game_over#27 game_over#10 game_over#15 game_over#52 ]
@ -1290,9 +1286,7 @@ reg byte x [ play_update_score::removed#0 ]
reg byte x [ play_spawn_current::current_piece_idx#0 ]
reg byte a [ play_collision::return#10 ]
reg byte a [ play_spawn_current::$2 ]
reg byte a [ sid_rnd::return#2 ]
reg byte a [ play_spawn_current::$6 ]
reg byte a [ sid_rnd::return#0 ]
reg byte a [ play_spawn_current::sid_rnd1_return#0 ]
reg byte a [ play_update_score::$2 ]
reg byte a [ play_update_score::$4 ]
zp ZP_DWORD:44 [ play_update_score::add_bcd#0 ]

View File

@ -0,0 +1,330 @@
// A KickC version of the plasma routine from the CC65 samples
// (w)2001 by groepaz/hitmen
// Cleanup and porting to CC65 by Ullrich von Bassewitz.
// Ported to KickC by Jesper Gravgaard.
// Original source https://github.com/cc65/cc65/blob/master/samples/plasma.c
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label BORDERCOL = $d020
.label BGCOL = $d021
.label D018 = $d018
// Color Ram
.label COLS = $d800
// The colors of the C64
.const BLACK = 0
.const BLUE = 6
.label print_line_cursor = $400
// SID registers for random number generation
.label SID_VOICE3_FREQ = $d40e
.label SID_VOICE3_CONTROL = $d412
.const SID_CONTROL_NOISE = $80
.label SID_VOICE3_OSC = $d41b
.label SCREEN1 = $2800
.label SCREEN2 = $2c00
.label CHARSET = $2000
.label SINTABLE = $1f00
.label print_char_cursor = $b
.label c1A = 4
.label c1B = 5
.label c2A = 6
.label c2B = 7
main: {
.const toD0181_return = (>(SCREEN1&$3fff)<<2)|(>CHARSET)>>2&$f
.const toD0182_return = (>(SCREEN2&$3fff)<<2)|(>CHARSET)>>2&$f
.label col = 2
sei
lda #BLUE
sta BORDERCOL
sta BGCOL
lda #<COLS
sta col
lda #>COLS
sta col+1
b1:
lda #BLACK
ldy #0
sta (col),y
inc col
bne !+
inc col+1
!:
lda col+1
cmp #>COLS+$3e8+1
bne b1
lda col
cmp #<COLS+$3e8+1
bne b1
jsr makecharset
lda #0
sta c2B
sta c2A
sta c1B
sta c1A
// Show double-buffered plasma
b4:
lda #<SCREEN1
sta doplasma.screen
lda #>SCREEN1
sta doplasma.screen+1
jsr doplasma
lda #toD0181_return
sta D018
lda #<SCREEN2
sta doplasma.screen
lda #>SCREEN2
sta doplasma.screen+1
jsr doplasma
lda #toD0182_return
sta D018
jmp b4
}
// Render plasma to the passed screen
// doplasma(byte* zeropage(2) screen)
doplasma: {
.label c1a = 8
.label c1b = 9
.label i = $a
.label c2a = 8
.label c2b = 9
.label i1 = $a
.label screen = 2
lda c1A
sta c1a
lda c1B
sta c1b
lda #0
sta i
b1:
ldy c1a
lda SINTABLE,y
ldy c1b
clc
adc SINTABLE,y
ldy i
sta ybuf,y
lax c1a
axs #-[4]
stx c1a
lax c1b
axs #-[9]
stx c1b
inc i
lda i
cmp #$19
bcc b1
lax c1A
axs #-[3]
stx c1A
lax c1B
axs #5
stx c1B
lda c2A
sta c2a
lda c2B
sta c2b
lda #0
sta i1
b3:
ldy c2a
lda SINTABLE,y
ldy c2b
clc
adc SINTABLE,y
ldy i1
sta xbuf,y
lax c2a
axs #-[3]
stx c2a
lax c2b
axs #-[7]
stx c2b
inc i1
lda i1
cmp #$28
bcc b3
lda c2A
clc
adc #2
sta c2A
lax c2B
axs #3
stx c2B
ldx #0
b5:
ldy #0
b6:
lda xbuf,y
clc
adc ybuf,x
sta (screen),y
iny
cpy #$28
bcc b6
lda #$28
clc
adc screen
sta screen
bcc !+
inc screen+1
!:
inx
cpx #$19
bcc b5
rts
xbuf: .fill $28, 0
ybuf: .fill $19, 0
}
// Make a plasma-friendly charset where the chars are randomly filled
makecharset: {
.label _4 = 6
.label _8 = $d
.label _9 = $d
.label s = 5
.label i = 4
.label c = 2
jsr sid_rnd_init
jsr print_cls
lda #<print_line_cursor
sta print_char_cursor
lda #>print_line_cursor
sta print_char_cursor+1
lda #0
sta c
sta c+1
b1:
lda c
tay
lda SINTABLE,y
sta s
lda #0
sta i
b2:
ldy #0
ldx #0
b3:
jsr sid_rnd
and #$ff
sta _4
lda s
cmp _4
bcs b4
tya
ora bittab,x
tay
b4:
inx
cpx #8
bcc b3
lda c
asl
sta _8
lda c+1
rol
sta _8+1
asl _8
rol _8+1
asl _8
rol _8+1
lda i
clc
adc _9
sta _9
bcc !+
inc _9+1
!:
tya
sta !v++1
lda #<CHARSET
clc
adc _9
sta !a++1
lda #>CHARSET
adc _9+1
sta !a++2
!v:
lda #0
!a:
sta CHARSET
inc i
lda i
cmp #8
bcc b2
lda c
and #7
cmp #0
bne b9
jsr print_char
b9:
inc c
bne !+
inc c+1
!:
lda c+1
cmp #>$100
bcc b1
bne !+
lda c
cmp #<$100
bcs !b1+
jmp b1
!b1:
!:
rts
bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80
}
// Print a single char
print_char: {
.const ch = '.'
lda #ch
ldy #0
sta (print_char_cursor),y
inc print_char_cursor
bne !+
inc print_char_cursor+1
!:
rts
}
// Get a random number from the SID voice 3,
// Must be initialized with sid_rnd_init()
sid_rnd: {
lda SID_VOICE3_OSC
rts
}
// Clear the screen. Also resets current line/char cursor.
print_cls: {
.label sc = 2
lda #<print_line_cursor
sta sc
lda #>print_line_cursor
sta sc+1
b1:
lda #' '
ldy #0
sta (sc),y
inc sc
bne !+
inc sc+1
!:
lda sc+1
cmp #>print_line_cursor+$3e8
bne b1
lda sc
cmp #<print_line_cursor+$3e8
bne b1
rts
}
// Initialize SID voice 3 for random number generation
sid_rnd_init: {
lda #<$ffff
sta SID_VOICE3_FREQ
lda #>$ffff
sta SID_VOICE3_FREQ+1
lda #SID_CONTROL_NOISE
sta SID_VOICE3_CONTROL
rts
}
.pc = SINTABLE "SINTABLE"
.for(var i=0;i<$100;i++)
.byte round(127.5+127.5*sin(toRadians(360*i/256)))

View File

@ -0,0 +1,203 @@
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
kickasm(location (const byte*) SINTABLE#0) {{ .for(var i=0;i<$100;i++)
.byte round(127.5+127.5*sin(toRadians(360*i/256)))
}}
to:@2
@2: scope:[] from @1
[2] phi()
[3] call main
to:@end
@end: scope:[] from @2
[4] phi()
main: scope:[main] from @2
asm { sei }
[6] *((const byte*) BORDERCOL#0) ← (const byte) BLUE#0
[7] *((const byte*) BGCOL#0) ← (const byte) BLUE#0
to:main::@1
main::@1: scope:[main] from main main::@1
[8] (byte*) main::col#2 ← phi( main/(const byte*) COLS#0 main::@1/(byte*) main::col#1 )
[9] *((byte*) main::col#2) ← (const byte) BLACK#0
[10] (byte*) main::col#1 ← ++ (byte*) main::col#2
[11] if((byte*) main::col#1!=(byte*)(const byte*) COLS#0+(word/signed word/dword/signed dword) $3e8+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1
[12] phi()
[13] call makecharset
to:main::@3
main::@3: scope:[main] from main::@2 main::@6
[14] (byte) c2B#14 ← phi( main::@6/(byte) c2B#4 main::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 )
[14] (byte) c2A#14 ← phi( main::@6/(byte) c2A#4 main::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 )
[14] (byte) c1B#14 ← phi( main::@6/(byte) c1B#4 main::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 )
[14] (byte) c1A#14 ← phi( main::@6/(byte) c1A#4 main::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 )
to:main::@4
main::@4: scope:[main] from main::@3
[15] phi()
[16] call doplasma
to:main::toD0181
main::toD0181: scope:[main] from main::@4
[17] phi()
to:main::@5
main::@5: scope:[main] from main::toD0181
[18] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0
[19] call doplasma
to:main::toD0182
main::toD0182: scope:[main] from main::@5
[20] phi()
to:main::@6
main::@6: scope:[main] from main::toD0182
[21] *((const byte*) D018#0) ← (const byte) main::toD0182_return#0
to:main::@3
doplasma: scope:[doplasma] from main::@4 main::@5
[22] (byte*) doplasma::screen#10 ← phi( main::@4/(const byte*) SCREEN1#0 main::@5/(const byte*) SCREEN2#0 )
[22] (byte) c2B#24 ← phi( main::@4/(byte) c2B#14 main::@5/(byte) c2B#4 )
[22] (byte) c2A#24 ← phi( main::@4/(byte) c2A#14 main::@5/(byte) c2A#4 )
[22] (byte) c1B#10 ← phi( main::@4/(byte) c1B#14 main::@5/(byte) c1B#4 )
[22] (byte) c1A#10 ← phi( main::@4/(byte) c1A#14 main::@5/(byte) c1A#4 )
[23] (byte) doplasma::c1a#0 ← (byte) c1A#10
[24] (byte) doplasma::c1b#0 ← (byte) c1B#10
to:doplasma::@1
doplasma::@1: scope:[doplasma] from doplasma doplasma::@1
[25] (byte) doplasma::i#2 ← phi( doplasma/(byte/signed byte/word/signed word/dword/signed dword) 0 doplasma::@1/(byte) doplasma::i#1 )
[25] (byte) doplasma::c1b#2 ← phi( doplasma/(byte) doplasma::c1b#0 doplasma::@1/(byte) doplasma::c1b#1 )
[25] (byte) doplasma::c1a#2 ← phi( doplasma/(byte) doplasma::c1a#0 doplasma::@1/(byte) doplasma::c1a#1 )
[26] (byte~) doplasma::$0 ← *((const byte*) SINTABLE#0 + (byte) doplasma::c1a#2) + *((const byte*) SINTABLE#0 + (byte) doplasma::c1b#2)
[27] *((const byte[$19]) doplasma::ybuf#0 + (byte) doplasma::i#2) ← (byte~) doplasma::$0
[28] (byte) doplasma::c1a#1 ← (byte) doplasma::c1a#2 + (byte/signed byte/word/signed word/dword/signed dword) 4
[29] (byte) doplasma::c1b#1 ← (byte) doplasma::c1b#2 + (byte/signed byte/word/signed word/dword/signed dword) 9
[30] (byte) doplasma::i#1 ← ++ (byte) doplasma::i#2
[31] if((byte) doplasma::i#1<(byte/signed byte/word/signed word/dword/signed dword) $19) goto doplasma::@1
to:doplasma::@2
doplasma::@2: scope:[doplasma] from doplasma::@1
[32] (byte) c1A#4 ← (byte) c1A#10 + (byte/signed byte/word/signed word/dword/signed dword) 3
[33] (byte) c1B#4 ← (byte) c1B#10 - (byte/signed byte/word/signed word/dword/signed dword) 5
[34] (byte) doplasma::c2a#0 ← (byte) c2A#24
[35] (byte) doplasma::c2b#0 ← (byte) c2B#24
to:doplasma::@3
doplasma::@3: scope:[doplasma] from doplasma::@2 doplasma::@3
[36] (byte) doplasma::i1#2 ← phi( doplasma::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 doplasma::@3/(byte) doplasma::i1#1 )
[36] (byte) doplasma::c2b#2 ← phi( doplasma::@2/(byte) doplasma::c2b#0 doplasma::@3/(byte) doplasma::c2b#1 )
[36] (byte) doplasma::c2a#2 ← phi( doplasma::@2/(byte) doplasma::c2a#0 doplasma::@3/(byte) doplasma::c2a#1 )
[37] (byte~) doplasma::$2 ← *((const byte*) SINTABLE#0 + (byte) doplasma::c2a#2) + *((const byte*) SINTABLE#0 + (byte) doplasma::c2b#2)
[38] *((const byte[$28]) doplasma::xbuf#0 + (byte) doplasma::i1#2) ← (byte~) doplasma::$2
[39] (byte) doplasma::c2a#1 ← (byte) doplasma::c2a#2 + (byte/signed byte/word/signed word/dword/signed dword) 3
[40] (byte) doplasma::c2b#1 ← (byte) doplasma::c2b#2 + (byte/signed byte/word/signed word/dword/signed dword) 7
[41] (byte) doplasma::i1#1 ← ++ (byte) doplasma::i1#2
[42] if((byte) doplasma::i1#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto doplasma::@3
to:doplasma::@4
doplasma::@4: scope:[doplasma] from doplasma::@3
[43] (byte) c2A#4 ← (byte) c2A#24 + (byte/signed byte/word/signed word/dword/signed dword) 2
[44] (byte) c2B#4 ← (byte) c2B#24 - (byte/signed byte/word/signed word/dword/signed dword) 3
to:doplasma::@5
doplasma::@5: scope:[doplasma] from doplasma::@4 doplasma::@7
[45] (byte*) doplasma::screen#5 ← phi( doplasma::@4/(byte*) doplasma::screen#10 doplasma::@7/(byte*) doplasma::screen#2 )
[45] (byte) doplasma::ii#4 ← phi( doplasma::@4/(byte/signed byte/word/signed word/dword/signed dword) 0 doplasma::@7/(byte) doplasma::ii#1 )
to:doplasma::@6
doplasma::@6: scope:[doplasma] from doplasma::@5 doplasma::@6
[46] (byte) doplasma::i2#2 ← phi( doplasma::@5/(byte/signed byte/word/signed word/dword/signed dword) 0 doplasma::@6/(byte) doplasma::i2#1 )
[47] (byte~) doplasma::$4 ← *((const byte[$28]) doplasma::xbuf#0 + (byte) doplasma::i2#2) + *((const byte[$19]) doplasma::ybuf#0 + (byte) doplasma::ii#4)
[48] *((byte*) doplasma::screen#5 + (byte) doplasma::i2#2) ← (byte~) doplasma::$4
[49] (byte) doplasma::i2#1 ← ++ (byte) doplasma::i2#2
[50] if((byte) doplasma::i2#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto doplasma::@6
to:doplasma::@7
doplasma::@7: scope:[doplasma] from doplasma::@6
[51] (byte*) doplasma::screen#2 ← (byte*) doplasma::screen#5 + (byte/signed byte/word/signed word/dword/signed dword) $28
[52] (byte) doplasma::ii#1 ← ++ (byte) doplasma::ii#4
[53] if((byte) doplasma::ii#1<(byte/signed byte/word/signed word/dword/signed dword) $19) goto doplasma::@5
to:doplasma::@return
doplasma::@return: scope:[doplasma] from doplasma::@7
[54] return
to:@return
makecharset: scope:[makecharset] from main::@2
[55] phi()
[56] call sid_rnd_init
to:makecharset::@10
makecharset::@10: scope:[makecharset] from makecharset
[57] phi()
[58] call print_cls
to:makecharset::@1
makecharset::@1: scope:[makecharset] from makecharset::@10 makecharset::@9
[59] (byte*) print_char_cursor#47 ← phi( makecharset::@10/(const byte*) print_line_cursor#0 makecharset::@9/(byte*) print_char_cursor#18 )
[59] (word) makecharset::c#2 ← phi( makecharset::@10/(byte/signed byte/word/signed word/dword/signed dword) 0 makecharset::@9/(word) makecharset::c#1 )
[60] (byte~) makecharset::$2 ← < (word) makecharset::c#2
[61] (byte) makecharset::s#0 ← *((const byte*) SINTABLE#0 + (byte~) makecharset::$2)
to:makecharset::@2
makecharset::@2: scope:[makecharset] from makecharset::@1 makecharset::@6
[62] (byte) makecharset::i#7 ← phi( makecharset::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 makecharset::@6/(byte) makecharset::i#1 )
to:makecharset::@3
makecharset::@3: scope:[makecharset] from makecharset::@2 makecharset::@4
[63] (byte) makecharset::b#2 ← phi( makecharset::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 makecharset::@4/(byte) makecharset::b#3 )
[63] (byte) makecharset::ii#2 ← phi( makecharset::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 makecharset::@4/(byte) makecharset::ii#1 )
[64] call sid_rnd
[65] (byte) sid_rnd::return#2 ← (byte) sid_rnd::return#0
to:makecharset::@11
makecharset::@11: scope:[makecharset] from makecharset::@3
[66] (byte~) makecharset::$3 ← (byte) sid_rnd::return#2
[67] (byte~) makecharset::$4 ← (byte~) makecharset::$3 & (byte/word/signed word/dword/signed dword) $ff
[68] if((byte~) makecharset::$4<=(byte) makecharset::s#0) goto makecharset::@4
to:makecharset::@5
makecharset::@5: scope:[makecharset] from makecharset::@11
[69] (byte) makecharset::b#1 ← (byte) makecharset::b#2 | *((const byte[8]) makecharset::bittab#0 + (byte) makecharset::ii#2)
to:makecharset::@4
makecharset::@4: scope:[makecharset] from makecharset::@11 makecharset::@5
[70] (byte) makecharset::b#3 ← phi( makecharset::@11/(byte) makecharset::b#2 makecharset::@5/(byte) makecharset::b#1 )
[71] (byte) makecharset::ii#1 ← ++ (byte) makecharset::ii#2
[72] if((byte) makecharset::ii#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@3
to:makecharset::@6
makecharset::@6: scope:[makecharset] from makecharset::@4
[73] (word~) makecharset::$8 ← (word) makecharset::c#2 << (byte/signed byte/word/signed word/dword/signed dword) 3
[74] (word~) makecharset::$9 ← (word~) makecharset::$8 + (byte) makecharset::i#7
[75] *((const byte*) CHARSET#0 + (word~) makecharset::$9) ← (byte) makecharset::b#3
[76] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7
[77] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2
to:makecharset::@7
makecharset::@7: scope:[makecharset] from makecharset::@6
[78] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7
[79] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9
to:makecharset::@8
makecharset::@8: scope:[makecharset] from makecharset::@7
[80] phi()
[81] call print_char
to:makecharset::@9
makecharset::@9: scope:[makecharset] from makecharset::@7 makecharset::@8
[82] (byte*) print_char_cursor#18 ← phi( makecharset::@8/(byte*) print_char_cursor#1 makecharset::@7/(byte*) print_char_cursor#47 )
[83] (word) makecharset::c#1 ← ++ (word) makecharset::c#2
[84] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1
to:makecharset::@return
makecharset::@return: scope:[makecharset] from makecharset::@9
[85] return
to:@return
print_char: scope:[print_char] from makecharset::@8
[86] *((byte*) print_char_cursor#47) ← (const byte) print_char::ch#0
[87] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#47
to:print_char::@return
print_char::@return: scope:[print_char] from print_char
[88] return
to:@return
sid_rnd: scope:[sid_rnd] from makecharset::@3
[89] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0)
to:sid_rnd::@return
sid_rnd::@return: scope:[sid_rnd] from sid_rnd
[90] return
to:@return
print_cls: scope:[print_cls] from makecharset::@10
[91] phi()
to:print_cls::@1
print_cls::@1: scope:[print_cls] from print_cls print_cls::@1
[92] (byte*) print_cls::sc#2 ← phi( print_cls/(const byte*) print_line_cursor#0 print_cls::@1/(byte*) print_cls::sc#1 )
[93] *((byte*) print_cls::sc#2) ← (byte) ' '
[94] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2
[95] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1
to:print_cls::@return
print_cls::@return: scope:[print_cls] from print_cls::@1
[96] return
to:@return
sid_rnd_init: scope:[sid_rnd_init] from makecharset
[97] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff
[98] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0
to:sid_rnd_init::@return
sid_rnd_init::@return: scope:[sid_rnd_init] from sid_rnd_init
[99] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,301 @@
(label) @1
(label) @2
(label) @begin
(label) @end
(byte*) BGCOL
(const byte*) BGCOL#0 BGCOL = ((byte*))(word/dword/signed dword) $d021
(byte*) BGCOL1
(byte*) BGCOL2
(byte*) BGCOL3
(byte*) BGCOL4
(byte) BLACK
(const byte) BLACK#0 BLACK = (byte/signed byte/word/signed word/dword/signed dword) 0
(byte) BLUE
(const byte) BLUE#0 BLUE = (byte/signed byte/word/signed word/dword/signed dword) 6
(byte*) BORDERCOL
(const byte*) BORDERCOL#0 BORDERCOL = ((byte*))(word/dword/signed dword) $d020
(byte) BROWN
(byte*) CHARGEN
(byte*) CHARSET
(const byte*) CHARSET#0 CHARSET = ((byte*))(word/signed word/dword/signed dword) $2000
(byte*) CIA1_INTERRUPT
(byte*) CIA1_PORT_A
(byte*) CIA1_PORT_A_DDR
(byte*) CIA1_PORT_B
(byte*) CIA1_PORT_B_DDR
(byte*) CIA2_INTERRUPT
(byte*) CIA2_PORT_A
(byte*) CIA2_PORT_A_DDR
(byte*) CIA2_PORT_B
(byte*) CIA2_PORT_B_DDR
(byte) CIA_INTERRUPT_CLEAR
(byte*) COLS
(const byte*) COLS#0 COLS = ((byte*))(word/dword/signed dword) $d800
(byte) CYAN
(byte*) D011
(byte*) D016
(byte*) D018
(const byte*) D018#0 D018 = ((byte*))(word/dword/signed dword) $d018
(byte) DARK_GREY
(byte) GREEN
(byte) GREY
(void()**) HARDWARE_IRQ
(byte) IRQ_COLLISION_BG
(byte) IRQ_COLLISION_SPRITE
(byte*) IRQ_ENABLE
(byte) IRQ_LIGHTPEN
(byte) IRQ_RASTER
(byte*) IRQ_STATUS
(void()**) KERNEL_IRQ
(byte*) LIGHTPEN_X
(byte*) LIGHTPEN_Y
(byte) LIGHT_BLUE
(byte) LIGHT_GREEN
(byte) LIGHT_GREY
(byte) ORANGE
(byte) PINK
(byte*) PROCPORT
(byte) PROCPORT_BASIC_KERNEL_IO
(byte*) PROCPORT_DDR
(byte) PROCPORT_DDR_MEMORY_MASK
(byte) PROCPORT_KERNEL_IO
(byte) PROCPORT_RAM_ALL
(byte) PROCPORT_RAM_CHARROM
(byte) PROCPORT_RAM_IO
(byte) PURPLE
(byte*) RASTER
(byte) RED
(byte*) SCREEN1
(const byte*) SCREEN1#0 SCREEN1 = ((byte*))(word/signed word/dword/signed dword) $2800
(byte*) SCREEN2
(const byte*) SCREEN2#0 SCREEN2 = ((byte*))(word/signed word/dword/signed dword) $2c00
(byte) SID_CONTROL_GATE
(byte) SID_CONTROL_NOISE
(const byte) SID_CONTROL_NOISE#0 SID_CONTROL_NOISE = (byte/word/signed word/dword/signed dword) $80
(byte) SID_CONTROL_PULSE
(byte) SID_CONTROL_RING
(byte) SID_CONTROL_SAWTOOTH
(byte) SID_CONTROL_SYNC
(byte) SID_CONTROL_TEST
(byte) SID_CONTROL_TRIANGLE
(byte*) SID_VOICE3_CONTROL
(const byte*) SID_VOICE3_CONTROL#0 SID_VOICE3_CONTROL = ((byte*))(word/dword/signed dword) $d412
(word*) SID_VOICE3_FREQ
(const word*) SID_VOICE3_FREQ#0 SID_VOICE3_FREQ = ((word*))(word/dword/signed dword) $d40e
(byte*) SID_VOICE3_FREQ_HIGH
(byte*) SID_VOICE3_FREQ_LOW
(byte*) SID_VOICE3_OSC
(const byte*) SID_VOICE3_OSC#0 SID_VOICE3_OSC = ((byte*))(word/dword/signed dword) $d41b
(byte*) SINTABLE
(const byte*) SINTABLE#0 SINTABLE = ((byte*))(word/signed word/dword/signed dword) $1f00
(byte*) SPRITES_COLS
(byte*) SPRITES_ENABLE
(byte*) SPRITES_EXPAND_X
(byte*) SPRITES_EXPAND_Y
(byte*) SPRITES_MC
(byte*) SPRITES_MC1
(byte*) SPRITES_MC2
(byte*) SPRITES_PRIORITY
(byte*) SPRITES_XMSB
(byte*) SPRITES_XPOS
(byte*) SPRITES_YPOS
(word) SPRITE_PTRS
(byte) VIC_BMM
(byte*) VIC_CONTROL
(byte*) VIC_CONTROL2
(byte) VIC_CSEL
(byte) VIC_DEN
(byte) VIC_ECM
(byte) VIC_MCM
(byte*) VIC_MEMORY
(byte) VIC_RSEL
(byte) VIC_RST8
(byte) WHITE
(byte) YELLOW
(byte) c1A
(byte) c1A#10 c1A zp ZP_BYTE:4 2.6000000000000005
(byte) c1A#14 c1A zp ZP_BYTE:4 11.0
(byte) c1A#4 c1A zp ZP_BYTE:4 0.8275862068965517
(byte) c1B
(byte) c1B#10 c1B zp ZP_BYTE:5 2.3636363636363633
(byte) c1B#14 c1B zp ZP_BYTE:5 11.0
(byte) c1B#4 c1B zp ZP_BYTE:5 0.8571428571428571
(byte) c2A
(byte) c2A#14 c2A zp ZP_BYTE:6 11.0
(byte) c2A#24 c2A zp ZP_BYTE:6 1.2380952380952381
(byte) c2A#4 c2A zp ZP_BYTE:6 1.3333333333333335
(byte) c2B
(byte) c2B#14 c2B zp ZP_BYTE:7 11.0
(byte) c2B#24 c2B zp ZP_BYTE:7 1.1818181818181817
(byte) c2B#4 c2B zp ZP_BYTE:7 1.411764705882353
(void()) doplasma((byte*) doplasma::screen)
(byte~) doplasma::$0 reg byte a 202.0
(byte~) doplasma::$2 reg byte a 202.0
(byte~) doplasma::$4 reg byte a 2002.0
(label) doplasma::@1
(label) doplasma::@2
(label) doplasma::@3
(label) doplasma::@4
(label) doplasma::@5
(label) doplasma::@6
(label) doplasma::@7
(label) doplasma::@return
(byte) doplasma::c1a
(byte) doplasma::c1a#0 c1a zp ZP_BYTE:8 2.0
(byte) doplasma::c1a#1 c1a zp ZP_BYTE:8 50.5
(byte) doplasma::c1a#2 c1a zp ZP_BYTE:8 101.66666666666666
(byte) doplasma::c1b
(byte) doplasma::c1b#0 c1b zp ZP_BYTE:9 4.0
(byte) doplasma::c1b#1 c1b zp ZP_BYTE:9 67.33333333333333
(byte) doplasma::c1b#2 c1b zp ZP_BYTE:9 76.25
(byte) doplasma::c2a
(byte) doplasma::c2a#0 c2a zp ZP_BYTE:8 2.0
(byte) doplasma::c2a#1 c2a zp ZP_BYTE:8 50.5
(byte) doplasma::c2a#2 c2a zp ZP_BYTE:8 101.66666666666666
(byte) doplasma::c2b
(byte) doplasma::c2b#0 c2b zp ZP_BYTE:9 4.0
(byte) doplasma::c2b#1 c2b zp ZP_BYTE:9 67.33333333333333
(byte) doplasma::c2b#2 c2b zp ZP_BYTE:9 76.25
(byte) doplasma::i
(byte) doplasma::i#1 i zp ZP_BYTE:10 151.5
(byte) doplasma::i#2 i zp ZP_BYTE:10 60.599999999999994
(byte) doplasma::i1
(byte) doplasma::i1#1 i1 zp ZP_BYTE:10 151.5
(byte) doplasma::i1#2 i1 zp ZP_BYTE:10 60.599999999999994
(byte) doplasma::i2
(byte) doplasma::i2#1 reg byte y 1501.5
(byte) doplasma::i2#2 reg byte y 1334.6666666666667
(byte) doplasma::ii
(byte) doplasma::ii#1 reg byte x 151.5
(byte) doplasma::ii#4 reg byte x 171.85714285714283
(byte*) doplasma::screen
(byte*) doplasma::screen#10 screen zp ZP_WORD:2 0.08695652173913043
(byte*) doplasma::screen#2 screen zp ZP_WORD:2 67.33333333333333
(byte*) doplasma::screen#5 screen zp ZP_WORD:2 200.83333333333334
(byte[$28]) doplasma::xbuf
(const byte[$28]) doplasma::xbuf#0 xbuf = { fill( $28, 0) }
(byte[$19]) doplasma::ybuf
(const byte[$19]) doplasma::ybuf#0 ybuf = { fill( $19, 0) }
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(byte*) main::col
(byte*) main::col#1 col zp ZP_WORD:2 16.5
(byte*) main::col#2 col zp ZP_WORD:2 16.5
(label) main::toD0181
(word~) main::toD0181_$0
(word~) main::toD0181_$1
(word~) main::toD0181_$2
(byte~) main::toD0181_$3
(word~) main::toD0181_$4
(byte~) main::toD0181_$5
(byte~) main::toD0181_$6
(byte~) main::toD0181_$7
(byte~) main::toD0181_$8
(byte*) main::toD0181_gfx
(byte) main::toD0181_return
(const byte) main::toD0181_return#0 toD0181_return = >((word))(const byte*) SCREEN1#0&(word/signed word/dword/signed dword) $3fff<<(byte/signed byte/word/signed word/dword/signed dword) 2|>((word))(const byte*) CHARSET#0>>(byte/signed byte/word/signed word/dword/signed dword) 2&(byte/signed byte/word/signed word/dword/signed dword) $f
(byte*) main::toD0181_screen
(label) main::toD0182
(word~) main::toD0182_$0
(word~) main::toD0182_$1
(word~) main::toD0182_$2
(byte~) main::toD0182_$3
(word~) main::toD0182_$4
(byte~) main::toD0182_$5
(byte~) main::toD0182_$6
(byte~) main::toD0182_$7
(byte~) main::toD0182_$8
(byte*) main::toD0182_gfx
(byte) main::toD0182_return
(const byte) main::toD0182_return#0 toD0182_return = >((word))(const byte*) SCREEN2#0&(word/signed word/dword/signed dword) $3fff<<(byte/signed byte/word/signed word/dword/signed dword) 2|>((word))(const byte*) CHARSET#0>>(byte/signed byte/word/signed word/dword/signed dword) 2&(byte/signed byte/word/signed word/dword/signed dword) $f
(byte*) main::toD0182_screen
(void()) makecharset((byte*) makecharset::charset)
(byte/word~) makecharset::$11 reg byte a 22.0
(byte~) makecharset::$2 reg byte a 22.0
(byte~) makecharset::$3 reg byte a 2002.0
(byte~) makecharset::$4 $4 zp ZP_BYTE:6 2002.0
(word~) makecharset::$8 $8 zp ZP_WORD:13 202.0
(word~) makecharset::$9 $9 zp ZP_WORD:13 202.0
(label) makecharset::@1
(label) makecharset::@10
(label) makecharset::@11
(label) makecharset::@2
(label) makecharset::@3
(label) makecharset::@4
(label) makecharset::@5
(label) makecharset::@6
(label) makecharset::@7
(label) makecharset::@8
(label) makecharset::@9
(label) makecharset::@return
(byte) makecharset::b
(byte) makecharset::b#1 reg byte y 2002.0
(byte) makecharset::b#2 reg byte y 500.5
(byte) makecharset::b#3 reg byte y 620.8
(byte[8]) makecharset::bittab
(const byte[8]) makecharset::bittab#0 bittab = { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) $10, (byte/signed byte/word/signed word/dword/signed dword) $20, (byte/signed byte/word/signed word/dword/signed dword) $40, (byte/word/signed word/dword/signed dword) $80 }
(word) makecharset::c
(word) makecharset::c#1 c zp ZP_WORD:2 16.5
(word) makecharset::c#2 c zp ZP_WORD:2 6.041666666666666
(byte*) makecharset::charset
(byte) makecharset::i
(byte) makecharset::i#1 i zp ZP_BYTE:4 151.5
(byte) makecharset::i#7 i zp ZP_BYTE:4 21.642857142857142
(byte) makecharset::ii
(byte) makecharset::ii#1 reg byte x 1501.5
(byte) makecharset::ii#2 reg byte x 375.375
(byte) makecharset::s
(byte) makecharset::s#0 s zp ZP_BYTE:5 59.529411764705884
(void()) print_char((byte) print_char::ch)
(label) print_char::@return
(byte) print_char::ch
(const byte) print_char::ch#0 ch = (byte) '.'
(byte*) print_char_cursor
(byte*) print_char_cursor#1 print_char_cursor zp ZP_WORD:11 4.333333333333333
(byte*) print_char_cursor#18 print_char_cursor zp ZP_WORD:11 11.0
(byte*) print_char_cursor#47 print_char_cursor zp ZP_WORD:11 1.1304347826086956
(void()) print_cls()
(label) print_cls::@1
(label) print_cls::@return
(byte*) print_cls::sc
(byte*) print_cls::sc#1 sc zp ZP_WORD:2 16.5
(byte*) print_cls::sc#2 sc zp ZP_WORD:2 16.5
(byte[]) print_hextab
(byte*) print_line_cursor
(const byte*) print_line_cursor#0 print_line_cursor = ((byte*))(word/signed word/dword/signed dword) $400
(byte*) print_screen
(byte()) sid_rnd()
(label) sid_rnd::@return
(byte) sid_rnd::return
(byte) sid_rnd::return#0 reg byte a 334.33333333333337
(byte) sid_rnd::return#2 reg byte a 2002.0
(void()) sid_rnd_init()
(label) sid_rnd_init::@return
zp ZP_WORD:2 [ main::col#2 main::col#1 doplasma::screen#5 doplasma::screen#10 doplasma::screen#2 makecharset::c#2 makecharset::c#1 print_cls::sc#2 print_cls::sc#1 ]
zp ZP_BYTE:4 [ c1A#10 c1A#14 c1A#4 makecharset::i#7 makecharset::i#1 ]
zp ZP_BYTE:5 [ c1B#10 c1B#14 c1B#4 makecharset::s#0 ]
zp ZP_BYTE:6 [ c2A#24 c2A#14 c2A#4 makecharset::$4 ]
zp ZP_BYTE:7 [ c2B#24 c2B#14 c2B#4 ]
zp ZP_BYTE:8 [ doplasma::c1a#2 doplasma::c1a#0 doplasma::c1a#1 doplasma::c2a#2 doplasma::c2a#0 doplasma::c2a#1 ]
zp ZP_BYTE:9 [ doplasma::c1b#2 doplasma::c1b#0 doplasma::c1b#1 doplasma::c2b#2 doplasma::c2b#0 doplasma::c2b#1 ]
zp ZP_BYTE:10 [ doplasma::i#2 doplasma::i#1 doplasma::i1#2 doplasma::i1#1 ]
reg byte x [ doplasma::ii#4 doplasma::ii#1 ]
reg byte y [ doplasma::i2#2 doplasma::i2#1 ]
zp ZP_WORD:11 [ print_char_cursor#47 print_char_cursor#18 print_char_cursor#1 ]
reg byte x [ makecharset::ii#2 makecharset::ii#1 ]
reg byte y [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ]
reg byte a [ doplasma::$0 ]
reg byte a [ doplasma::$2 ]
reg byte a [ doplasma::$4 ]
reg byte a [ makecharset::$2 ]
reg byte a [ sid_rnd::return#2 ]
reg byte a [ makecharset::$3 ]
zp ZP_WORD:13 [ makecharset::$8 makecharset::$9 ]
reg byte a [ makecharset::$11 ]
reg byte a [ sid_rnd::return#0 ]