mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-27 04:49:27 +00:00
Merge remote-tracking branch 'origin/328-memvars' into 328-memvars
This commit is contained in:
commit
e427cb648b
@ -1,27 +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;
|
||||
const unsigned int* SID_VOICE3_FREQ = 0xd40e;
|
||||
const char* SID_VOICE3_FREQ_LOW = 0xd40e;
|
||||
const char* SID_VOICE3_FREQ_HIGH = 0xd40f;
|
||||
const char* SID_VOICE3_CONTROL = 0xd412;
|
||||
const char SID_CONTROL_NOISE = 0x80;
|
||||
const char SID_CONTROL_PULSE = 0x40;
|
||||
const char SID_CONTROL_SAWTOOTH = 0x20;
|
||||
const char SID_CONTROL_TRIANGLE = 0x10;
|
||||
const char SID_CONTROL_TEST = 0x08;
|
||||
const char SID_CONTROL_RING = 0x04;
|
||||
const char SID_CONTROL_SYNC = 0x02;
|
||||
const char SID_CONTROL_GATE = 0x01;
|
||||
const char* SID_VOICE3_OSC = 0xd41b;
|
||||
|
||||
// Initialize SID voice 3 for random number generation
|
||||
void sid_rnd_init() {
|
||||
*SID_VOICE3_FREQ = $ffff;
|
||||
*SID_VOICE3_FREQ = 0xffff;
|
||||
*SID_VOICE3_CONTROL = SID_CONTROL_NOISE;
|
||||
}
|
||||
|
||||
// Get a random number from the SID voice 3,
|
||||
// Must be initialized with sid_rnd_init()
|
||||
inline byte sid_rnd() {
|
||||
inline char sid_rnd() {
|
||||
return *SID_VOICE3_OSC;
|
||||
}
|
||||
|
||||
|
@ -1,30 +1,30 @@
|
||||
import "tetris-sprites"
|
||||
|
||||
byte[256] SIN = kickasm {{
|
||||
char[256] SIN = kickasm {{
|
||||
.var AMPL = 200-21
|
||||
.for(var i=0; i<256; i++) {
|
||||
.byte 51+AMPL/2+sin(toRadians([i*360]/256))*AMPL/2
|
||||
}
|
||||
}};
|
||||
|
||||
byte* SIN_SPRITE = $2800;
|
||||
char* SIN_SPRITE = 0x2800;
|
||||
kickasm(pc SIN_SPRITE) {{
|
||||
.fill $40, $ff
|
||||
}}
|
||||
|
||||
byte sin_idx = 0;
|
||||
char sin_idx = 0;
|
||||
|
||||
void main() {
|
||||
vicSelectGfxBank(PLAYFIELD_SCREEN_1);
|
||||
*D018 = toD018(PLAYFIELD_SCREEN_1, PLAYFIELD_CHARSET);
|
||||
sprites_init();
|
||||
|
||||
*SPRITES_ENABLE = $ff;
|
||||
*SPRITES_ENABLE = 0xff;
|
||||
|
||||
byte xpos = 24;
|
||||
byte ypos = 50;
|
||||
for(byte s:4..7) {
|
||||
byte s2 = s*2;
|
||||
char xpos = 24;
|
||||
char ypos = 50;
|
||||
for(char s:4..7) {
|
||||
char s2 = s*2;
|
||||
SPRITES_XPOS[s2] = xpos;
|
||||
SPRITES_YPOS[s2] = ypos;
|
||||
SPRITES_COLS[s] = s-3;
|
||||
@ -40,9 +40,9 @@ void main() {
|
||||
|
||||
void loop() {
|
||||
while(true) {
|
||||
do {} while (*RASTER!=$ff);
|
||||
byte idx = sin_idx;
|
||||
for(byte s:4..7) {
|
||||
do {} while (*RASTER!=0xff);
|
||||
char idx = sin_idx;
|
||||
for(char s:4..7) {
|
||||
SPRITES_YPOS[s*2] = SIN[idx];
|
||||
idx += 10;
|
||||
}
|
||||
|
@ -2,55 +2,55 @@
|
||||
// Memory Layout and Shared Data
|
||||
|
||||
// Address of the first screen
|
||||
const byte* PLAYFIELD_SCREEN_1 = $0400;
|
||||
const char* PLAYFIELD_SCREEN_1 = 0x0400;
|
||||
// Address of the second screen
|
||||
const byte* PLAYFIELD_SCREEN_2 = $2c00;
|
||||
const char* PLAYFIELD_SCREEN_2 = 0x2c00;
|
||||
// Screen Sprite pointers on screen 1
|
||||
const byte* PLAYFIELD_SPRITE_PTRS_1 = (PLAYFIELD_SCREEN_1+SPRITE_PTRS);
|
||||
const char* PLAYFIELD_SPRITE_PTRS_1 = (PLAYFIELD_SCREEN_1+SPRITE_PTRS);
|
||||
// Screen Sprite pointers on screen 2
|
||||
const byte* PLAYFIELD_SPRITE_PTRS_2 = (PLAYFIELD_SCREEN_2+SPRITE_PTRS);
|
||||
const char* PLAYFIELD_SPRITE_PTRS_2 = (PLAYFIELD_SCREEN_2+SPRITE_PTRS);
|
||||
// Address of the original playscreen chars
|
||||
const byte* PLAYFIELD_SCREEN_ORIGINAL = $1800;
|
||||
const char* PLAYFIELD_SCREEN_ORIGINAL = 0x1800;
|
||||
// Address of the original playscreen colors
|
||||
const byte* PLAYFIELD_COLORS_ORIGINAL = $1c00;
|
||||
const char* PLAYFIELD_COLORS_ORIGINAL = 0x1c00;
|
||||
// Address of the sprites covering the playfield
|
||||
const byte* PLAYFIELD_SPRITES = $2000;
|
||||
const char* PLAYFIELD_SPRITES = 0x2000;
|
||||
// Address of the charset
|
||||
const byte* PLAYFIELD_CHARSET = $2800;
|
||||
const char* PLAYFIELD_CHARSET = 0x2800;
|
||||
|
||||
// The size of the playfield
|
||||
const byte PLAYFIELD_LINES = 22;
|
||||
const byte PLAYFIELD_COLS = 10;
|
||||
const char PLAYFIELD_LINES = 22;
|
||||
const char PLAYFIELD_COLS = 10;
|
||||
|
||||
// The playfield. 0 is empty non-zero is color.
|
||||
// The playfield is layed out line by line, meaning the first 10 bytes are line 1, the next 10 line 2 and so forth,
|
||||
byte[PLAYFIELD_LINES*PLAYFIELD_COLS] playfield;
|
||||
char[PLAYFIELD_LINES*PLAYFIELD_COLS] playfield;
|
||||
|
||||
// Pointer to the current piece in the current orientation. Updated each time current_orientation is updated.
|
||||
byte* current_piece_gfx;
|
||||
char* current_piece_gfx;
|
||||
|
||||
// The char of the current piece
|
||||
byte current_piece_char;
|
||||
char current_piece_char;
|
||||
|
||||
// Position of top left corner of current moving piece on the playfield
|
||||
byte current_xpos;
|
||||
byte current_ypos;
|
||||
char current_xpos;
|
||||
char current_ypos;
|
||||
|
||||
// The screen currently being rendered to. $00 for screen 1 / $20 for screen 2.
|
||||
byte render_screen_render = $20;
|
||||
// The screen currently to show next to the user. $00 for screen 1 / $20 for screen 2.
|
||||
byte render_screen_show = 0;
|
||||
// The screen currently being showed to the user. $00 for screen 1 / $20 for screen 2.
|
||||
volatile byte render_screen_showing = 0;
|
||||
// The screen currently being rendered to. 0x00 for screen 1 / 0x20 for screen 2.
|
||||
char render_screen_render = 0x20;
|
||||
// The screen currently to show next to the user. 0x00 for screen 1 / 0x20 for screen 2.
|
||||
char render_screen_show = 0;
|
||||
// The screen currently being showed to the user. 0x00 for screen 1 / 0x20 for screen 2.
|
||||
volatile char render_screen_showing = 0;
|
||||
|
||||
// Current score in BCD-format
|
||||
dword score_bcd = 0;
|
||||
unsigned long score_bcd = 0;
|
||||
// Current number of cleared lines in BCD-format
|
||||
word lines_bcd = 0;
|
||||
unsigned int lines_bcd = 0;
|
||||
// Current level BCD-format
|
||||
byte level_bcd = 0;
|
||||
char level_bcd = 0;
|
||||
// Current level in normal (non-BCD) format
|
||||
byte level = 0;
|
||||
char level = 0;
|
||||
// Is the game over?
|
||||
byte game_over = 0;
|
||||
char game_over = 0;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// The tetris pieces
|
||||
|
||||
// The T-piece
|
||||
align($40) byte[4*4*4] PIECE_T = {
|
||||
align(0x40) char[4*4*4] PIECE_T = {
|
||||
0, 0, 0, 0,
|
||||
1, 1, 1, 0,
|
||||
0, 1, 0, 0,
|
||||
@ -25,7 +25,7 @@ align($40) byte[4*4*4] PIECE_T = {
|
||||
};
|
||||
|
||||
// The S-piece
|
||||
align($40) byte[4*4*4] PIECE_S = {
|
||||
align(0x40) char[4*4*4] PIECE_S = {
|
||||
0, 0, 0, 0,
|
||||
0, 1, 1, 0,
|
||||
1, 1, 0, 0,
|
||||
@ -49,7 +49,7 @@ align($40) byte[4*4*4] PIECE_S = {
|
||||
};
|
||||
|
||||
// The Z-piece
|
||||
align($40) byte[4*4*4] PIECE_Z = {
|
||||
align(0x40) char[4*4*4] PIECE_Z = {
|
||||
0, 0, 0, 0,
|
||||
1, 1, 0, 0,
|
||||
0, 1, 1, 0,
|
||||
@ -73,7 +73,7 @@ align($40) byte[4*4*4] PIECE_Z = {
|
||||
};
|
||||
|
||||
// The L-piece
|
||||
align($40) byte[4*4*4] PIECE_L = {
|
||||
align(0x40) char[4*4*4] PIECE_L = {
|
||||
0, 0, 0, 0,
|
||||
1, 1, 1, 0,
|
||||
1, 0, 0, 0,
|
||||
@ -97,7 +97,7 @@ align($40) byte[4*4*4] PIECE_L = {
|
||||
};
|
||||
|
||||
// The J-piece
|
||||
align($40) byte[4*4*4] PIECE_J = {
|
||||
align(0x40) char[4*4*4] PIECE_J = {
|
||||
0, 0, 0, 0,
|
||||
1, 1, 1, 0,
|
||||
0, 0, 1, 0,
|
||||
@ -121,7 +121,7 @@ align($40) byte[4*4*4] PIECE_J = {
|
||||
};
|
||||
|
||||
// The O-piece
|
||||
align($40) byte[4*4*4] PIECE_O = {
|
||||
align(0x40) char[4*4*4] PIECE_O = {
|
||||
0, 0, 0, 0,
|
||||
0, 1, 1, 0,
|
||||
0, 1, 1, 0,
|
||||
@ -145,7 +145,7 @@ align($40) byte[4*4*4] PIECE_O = {
|
||||
};
|
||||
|
||||
// The I-piece
|
||||
align($40) byte[4*4*4] PIECE_I = {
|
||||
align(0x40) char[4*4*4] PIECE_I = {
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
1, 1, 1, 1,
|
||||
@ -169,14 +169,14 @@ align($40) byte[4*4*4] PIECE_I = {
|
||||
};
|
||||
|
||||
// The different pieces
|
||||
word[] PIECES = { (word)PIECE_T, (word)PIECE_S, (word)PIECE_Z, (word)PIECE_J, (word)PIECE_O, (word)PIECE_I, (word)PIECE_L };
|
||||
unsigned int[] PIECES = { (unsigned int)PIECE_T, (unsigned int)PIECE_S, (unsigned int)PIECE_Z, (unsigned int)PIECE_J, (unsigned int)PIECE_O, (unsigned int)PIECE_I, (unsigned int)PIECE_L };
|
||||
|
||||
// The chars to use for the different pieces - when inside the playing area
|
||||
byte[] PIECES_CHARS = { $65, $66, $a6, $66, $65, $65, $a6 };
|
||||
char[] PIECES_CHARS = { 0x65, 0x66, 0xa6, 0x66, 0x65, 0x65, 0xa6 };
|
||||
|
||||
// The chars to use for the different pieces - when outside the playing area (eg. the next area).
|
||||
byte[] PIECES_NEXT_CHARS = { $63, $64, $a4, $64, $63, $63, $a4 };
|
||||
char[] PIECES_NEXT_CHARS = { 0x63, 0x64, 0xa4, 0x64, 0x63, 0x63, 0xa4 };
|
||||
|
||||
// The initial X/Y for each piece
|
||||
byte[] PIECES_START_X = { 4, 4, 4, 4, 4, 4, 4 };
|
||||
byte[] PIECES_START_Y = { 1, 1, 1, 1, 1, 0, 1 };
|
||||
char[] PIECES_START_X = { 4, 4, 4, 4, 4, 4, 4 };
|
||||
char[] PIECES_START_Y = { 1, 1, 1, 1, 1, 0, 1 };
|
@ -6,48 +6,48 @@ import "tetris-data"
|
||||
import "tetris-pieces"
|
||||
|
||||
// Pointers to the playfield address for each playfield line
|
||||
byte*[PLAYFIELD_LINES] playfield_lines;
|
||||
char*[PLAYFIELD_LINES] playfield_lines;
|
||||
|
||||
// Indixes into the playfield for each playfield line
|
||||
byte[PLAYFIELD_LINES+1] playfield_lines_idx;
|
||||
char[PLAYFIELD_LINES+1] playfield_lines_idx;
|
||||
|
||||
// The index of the next moving piece. (0-6)
|
||||
byte next_piece_idx = 0;
|
||||
char next_piece_idx = 0;
|
||||
|
||||
// The current moving piece. Points to the start of the piece definition.
|
||||
byte* current_piece = 0;
|
||||
char* current_piece = 0;
|
||||
|
||||
// The curent piece orientation - each piece have 4 orientations (00/$10/$20/$30).
|
||||
// The curent piece orientation - each piece have 4 orientations (00/0x10/0x20/0x30).
|
||||
// The orientation chooses one of the 4 sub-graphics of the piece.
|
||||
byte current_orientation = 0;
|
||||
char current_orientation = 0;
|
||||
|
||||
// The speed of moving down the piece when soft-drop is not activated
|
||||
// This array holds the number of frames per move by level (0-29). For all levels 29+ the value is 1.
|
||||
const byte[] MOVEDOWN_SLOW_SPEEDS = { 48, 43, 38, 33, 28, 23, 18, 13, 8, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 };
|
||||
const char[] MOVEDOWN_SLOW_SPEEDS = { 48, 43, 38, 33, 28, 23, 18, 13, 8, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 };
|
||||
|
||||
// The rate of moving down the current piece (number of frames between moves if movedown is not forced)
|
||||
byte current_movedown_slow = 48;
|
||||
char current_movedown_slow = 48;
|
||||
|
||||
// The rate of moving down the current piece fast (number of frames between moves if movedown is not forced)
|
||||
const byte current_movedown_fast = 10;
|
||||
const char current_movedown_fast = 10;
|
||||
|
||||
// Counts up to the next movedown of current piece
|
||||
byte current_movedown_counter = 0;
|
||||
char current_movedown_counter = 0;
|
||||
|
||||
// Base Score values for removing 0-4 lines (in BCD)
|
||||
// These values are added to score_add_bcd for each level gained.
|
||||
const dword[] SCORE_BASE_BCD = { $0000, $0040, $0100, $0300, $1200 };
|
||||
const unsigned long[] SCORE_BASE_BCD = { 0x0000, 0x0040, 0x0100, 0x0300, 0x1200 };
|
||||
|
||||
// Score values for removing 0-4 lines (in BCD)
|
||||
// These values are updated based on the players level and the base values from SCORE_BASE_BCD
|
||||
dword[5] score_add_bcd;
|
||||
unsigned long[5] score_add_bcd;
|
||||
|
||||
// Initialize play data tables
|
||||
void play_init() {
|
||||
// Initialize the playfield line pointers;
|
||||
byte idx = 0;
|
||||
byte* pli = playfield;
|
||||
for(byte j:0..PLAYFIELD_LINES-1) {
|
||||
char idx = 0;
|
||||
char* pli = playfield;
|
||||
for(char j:0..PLAYFIELD_LINES-1) {
|
||||
playfield_lines[j] = pli;
|
||||
playfield_lines_idx[j] = idx;
|
||||
pli += PLAYFIELD_COLS;
|
||||
@ -58,17 +58,17 @@ void play_init() {
|
||||
// Set initial speed of moving down a tetromino
|
||||
current_movedown_slow = MOVEDOWN_SLOW_SPEEDS[level];
|
||||
// Set the initial score add values
|
||||
for(byte b: 0..4) {
|
||||
for(char b: 0..4) {
|
||||
score_add_bcd[b] = SCORE_BASE_BCD[b];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Perform any movement of the current piece
|
||||
// key_event is the next keyboard_event() og $ff if no keyboard event is pending
|
||||
// key_event is the next keyboard_event() og 0xff if no keyboard event is pending
|
||||
// Returns a byte signaling whether rendering is needed. (0 no render, >0 render needed)
|
||||
byte play_movement(byte key_event) {
|
||||
byte render = 0;
|
||||
char play_movement(char key_event) {
|
||||
char render = 0;
|
||||
render += play_move_down(key_event);
|
||||
if(game_over!=0) {
|
||||
return render;
|
||||
@ -80,10 +80,10 @@ byte play_movement(byte key_event) {
|
||||
|
||||
// Move down the current piece
|
||||
// Return non-zero if a render is needed
|
||||
byte play_move_down(byte key_event) {
|
||||
char play_move_down(byte key_event) {
|
||||
// Handle moving down current piece
|
||||
++current_movedown_counter;
|
||||
byte movedown = 0;
|
||||
char movedown = 0;
|
||||
// As soon as space is pressed move down once
|
||||
if(key_event==KEY_SPACE) {
|
||||
movedown++;
|
||||
@ -107,7 +107,7 @@ byte play_move_down(byte key_event) {
|
||||
// Lock current piece
|
||||
play_lock_current();
|
||||
// Check for any lines and remove them
|
||||
byte removed = play_remove_lines();
|
||||
char removed = play_remove_lines();
|
||||
// Tally up the score
|
||||
play_update_score(removed);
|
||||
// Spawn a new piece
|
||||
@ -121,7 +121,7 @@ byte play_move_down(byte key_event) {
|
||||
|
||||
// Move left/right or rotate the current piece
|
||||
// Return non-zero if a render is needed
|
||||
byte play_move_leftright(byte key_event) {
|
||||
char play_move_leftright(char key_event) {
|
||||
// Handle keyboard events
|
||||
if(key_event==KEY_COMMA) {
|
||||
if(play_collision(current_xpos-1,current_ypos,current_orientation)==COLLISION_NONE) {
|
||||
@ -139,13 +139,13 @@ byte play_move_leftright(byte key_event) {
|
||||
|
||||
// Rotate the current piece based on key-presses
|
||||
// Return non-zero if a render is needed
|
||||
byte play_move_rotate(byte key_event) {
|
||||
char play_move_rotate(char key_event) {
|
||||
// Handle keyboard events
|
||||
byte orientation = $80;
|
||||
char orientation = 0x80;
|
||||
if(key_event==KEY_Z) {
|
||||
orientation = (current_orientation-$10)&$3f;
|
||||
orientation = (current_orientation-0x10)&0x3f;
|
||||
} else if(key_event==KEY_X) {
|
||||
orientation = (current_orientation+$10)&$3f;
|
||||
orientation = (current_orientation+0x10)&0x3f;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@ -158,32 +158,32 @@ byte play_move_rotate(byte key_event) {
|
||||
}
|
||||
|
||||
// No collision
|
||||
const byte COLLISION_NONE = 0;
|
||||
const char COLLISION_NONE = 0;
|
||||
// Playfield piece collision (cell on top of other cell on the playfield)
|
||||
const byte COLLISION_PLAYFIELD = 1;
|
||||
const char COLLISION_PLAYFIELD = 1;
|
||||
// Bottom collision (cell below bottom of the playfield)
|
||||
const byte COLLISION_BOTTOM = 2;
|
||||
const char COLLISION_BOTTOM = 2;
|
||||
// Left side collision (cell beyond the left side of the playfield)
|
||||
const byte COLLISION_LEFT = 4;
|
||||
const char COLLISION_LEFT = 4;
|
||||
// Right side collision (cell beyond the right side of the playfield)
|
||||
const byte COLLISION_RIGHT = 8;
|
||||
const char COLLISION_RIGHT = 8;
|
||||
|
||||
// Test if there is a collision between the current piece moved to (x, y) and anything on the playfield or the playfield boundaries
|
||||
// Returns information about the type of the collision detected
|
||||
byte play_collision(byte xpos, byte ypos, byte orientation) {
|
||||
byte* piece_gfx = current_piece + orientation;
|
||||
byte i = 0;
|
||||
byte yp = ypos;
|
||||
for(byte l:0..3) {
|
||||
byte* playfield_line = playfield_lines[yp];
|
||||
byte xp = xpos;
|
||||
for(byte c:0..3) {
|
||||
char play_collision(char xpos, char ypos, char orientation) {
|
||||
char* piece_gfx = current_piece + orientation;
|
||||
char i = 0;
|
||||
char yp = ypos;
|
||||
for(char l:0..3) {
|
||||
char* playfield_line = playfield_lines[yp];
|
||||
char xp = xpos;
|
||||
for(char c:0..3) {
|
||||
if(piece_gfx[i++]!=0) {
|
||||
if(yp>=PLAYFIELD_LINES) {
|
||||
// Below the playfield bottom
|
||||
return COLLISION_BOTTOM;
|
||||
}
|
||||
if((xp&$80)!=0) {
|
||||
if((xp&0x80)!=0) {
|
||||
// Beyond left side of the playfield
|
||||
return COLLISION_LEFT;
|
||||
}
|
||||
@ -205,12 +205,12 @@ byte play_collision(byte xpos, byte ypos, byte orientation) {
|
||||
|
||||
// Lock the current piece onto the playfield
|
||||
void play_lock_current() {
|
||||
byte i = 0;
|
||||
byte yp = current_ypos;
|
||||
for(byte l:0..3) {
|
||||
byte* playfield_line = playfield_lines[yp];
|
||||
byte xp = current_xpos;
|
||||
for(byte c:0..3) {
|
||||
char i = 0;
|
||||
char yp = current_ypos;
|
||||
for(char l:0..3) {
|
||||
char* playfield_line = playfield_lines[yp];
|
||||
char xp = current_xpos;
|
||||
for(char c:0..3) {
|
||||
if(current_piece_gfx[i++]!=0) {
|
||||
playfield_line[xp] = current_piece_char;
|
||||
}
|
||||
@ -224,7 +224,7 @@ void play_lock_current() {
|
||||
// Moves the next piece into the current and spawns a new next piece
|
||||
void play_spawn_current() {
|
||||
// Move next piece into current
|
||||
byte current_piece_idx = next_piece_idx;
|
||||
char current_piece_idx = next_piece_idx;
|
||||
current_piece = PIECES[current_piece_idx];
|
||||
current_piece_char = PIECES_CHARS[current_piece_idx];
|
||||
current_orientation = 0;
|
||||
@ -237,7 +237,7 @@ void play_spawn_current() {
|
||||
|
||||
// Spawn a new next piece
|
||||
// Pick a random piece (0-6)
|
||||
byte piece_idx = 7;
|
||||
char piece_idx = 7;
|
||||
while(piece_idx==7) {
|
||||
piece_idx = sid_rnd()&7;
|
||||
}
|
||||
@ -249,17 +249,17 @@ void play_spawn_current() {
|
||||
// Utilizes two cursors on the playfield - one reading cells and one writing cells
|
||||
// Whenever a full line is detected the writing cursor is instructed to write to the same line once more.
|
||||
// Returns the number of lines removed
|
||||
byte play_remove_lines() {
|
||||
char play_remove_lines() {
|
||||
// Start both cursors at the end of the playfield
|
||||
byte r = PLAYFIELD_LINES*PLAYFIELD_COLS-1;
|
||||
byte w = PLAYFIELD_LINES*PLAYFIELD_COLS-1;
|
||||
char r = PLAYFIELD_LINES*PLAYFIELD_COLS-1;
|
||||
char w = PLAYFIELD_LINES*PLAYFIELD_COLS-1;
|
||||
|
||||
byte removed = 0;
|
||||
char removed = 0;
|
||||
// Read all lines and rewrite them
|
||||
for(byte y:0..PLAYFIELD_LINES-1) {
|
||||
byte full = 1;
|
||||
for(byte x:0..PLAYFIELD_COLS-1) {
|
||||
byte c = playfield[r--];
|
||||
for(char y:0..PLAYFIELD_LINES-1) {
|
||||
char full = 1;
|
||||
for(char x:0..PLAYFIELD_COLS-1) {
|
||||
char c = playfield[r--];
|
||||
if(c==0) {
|
||||
full = 0;
|
||||
}
|
||||
@ -273,7 +273,7 @@ byte play_remove_lines() {
|
||||
}
|
||||
|
||||
// Write zeros in the rest of the lines
|
||||
while(w!=$ff) {
|
||||
while(w!=0xff) {
|
||||
playfield[w--] = 0;
|
||||
}
|
||||
// Return the number of removed lines
|
||||
@ -281,10 +281,10 @@ byte play_remove_lines() {
|
||||
}
|
||||
|
||||
// Update the score based on the number of lines removed
|
||||
void play_update_score(byte removed) {
|
||||
void play_update_score(char removed) {
|
||||
if(removed!=0){
|
||||
byte lines_before = <lines_bcd&$f0;
|
||||
dword add_bcd = score_add_bcd[removed];
|
||||
char lines_before = <lines_bcd&0xf0;
|
||||
unsigned long add_bcd = score_add_bcd[removed];
|
||||
|
||||
asm { sed }
|
||||
lines_bcd += removed;
|
||||
@ -292,7 +292,7 @@ void play_update_score(byte removed) {
|
||||
asm { cld }
|
||||
|
||||
// If line 10-part updated increase the level
|
||||
byte lines_after = <lines_bcd&$f0;
|
||||
char lines_after = <lines_bcd&0xf0;
|
||||
if(lines_before!=lines_after) {
|
||||
play_increase_level();
|
||||
}
|
||||
@ -311,13 +311,13 @@ void play_increase_level() {
|
||||
}
|
||||
// Increase BCD-format level
|
||||
level_bcd++;
|
||||
if((level_bcd&$f)==$a) {
|
||||
// If level low nybble hits $a change to $10
|
||||
if((level_bcd&0xf)==0xa) {
|
||||
// If level low nybble hits 0xa change to 0x10
|
||||
level_bcd += 6;
|
||||
}
|
||||
// Increase the score values gained
|
||||
asm { sed }
|
||||
for(byte b: 0..4) {
|
||||
for(char b: 0..4) {
|
||||
score_add_bcd[b] += SCORE_BASE_BCD[b];
|
||||
}
|
||||
asm { cld }
|
||||
|
@ -9,7 +9,7 @@ kickasm(pc PLAYFIELD_CHARSET, resource "playfield-screen.imap") {{
|
||||
.import binary "playfield-screen.imap"
|
||||
}}
|
||||
|
||||
const byte PLAYFIELD_SCREEN_ORIGINAL_WIDTH=32;
|
||||
const char PLAYFIELD_SCREEN_ORIGINAL_WIDTH=32;
|
||||
kickasm(pc PLAYFIELD_SCREEN_ORIGINAL, resource "playfield-screen.iscr", resource "playfield-extended.col" ) {{
|
||||
// Load chars for the screen
|
||||
.var screen = LoadBinary("playfield-screen.iscr")
|
||||
@ -27,22 +27,22 @@ kickasm(pc PLAYFIELD_COLORS_ORIGINAL, resource "playfield-screen.col") {{
|
||||
}}
|
||||
|
||||
// The color #1 to use for the pieces for each level
|
||||
byte[] PIECES_COLORS_1 = {
|
||||
char[] PIECES_COLORS_1 = {
|
||||
BLUE, GREEN, PURPLE, BLUE, RED, LIGHT_GREEN, RED, BLUE, LIGHT_BLUE, RED,
|
||||
BLUE, GREEN, PURPLE, BLUE, RED, LIGHT_GREEN, RED, BLUE, LIGHT_BLUE, RED,
|
||||
BLUE, GREEN, PURPLE, BLUE, RED, LIGHT_GREEN, RED, BLUE, LIGHT_BLUE, RED
|
||||
};
|
||||
// The color #2 to use for the pieces for each level
|
||||
byte[] PIECES_COLORS_2 = {
|
||||
char[] PIECES_COLORS_2 = {
|
||||
CYAN, LIGHT_GREEN, PINK, LIGHT_GREEN, LIGHT_GREEN, LIGHT_BLUE, DARK_GREY, PURPLE, RED, ORANGE,
|
||||
CYAN, LIGHT_GREEN, PINK, LIGHT_GREEN, LIGHT_GREEN, LIGHT_BLUE, DARK_GREY, PURPLE, RED, ORANGE,
|
||||
CYAN, LIGHT_GREEN, PINK, LIGHT_GREEN, LIGHT_GREEN, LIGHT_BLUE, DARK_GREY, PURPLE, RED, ORANGE
|
||||
};
|
||||
|
||||
// Pointers to the screen address for rendering each playfield line
|
||||
// The lines for screen 1 is aligned with $80 and screen 2 with $40 - so XOR'ing with $40 gives screen 2 lines.
|
||||
align($80) byte*[PLAYFIELD_LINES] screen_lines_1;
|
||||
align($40) byte*[PLAYFIELD_LINES] screen_lines_2;
|
||||
// The lines for screen 1 is aligned with 0x80 and screen 2 with 0x40 - so XOR'ing with 0x40 gives screen 2 lines.
|
||||
align(0x80) char*[PLAYFIELD_LINES] screen_lines_1;
|
||||
align(0x40) char*[PLAYFIELD_LINES] screen_lines_2;
|
||||
|
||||
// Initialize rendering
|
||||
void render_init() {
|
||||
@ -60,9 +60,9 @@ void render_init() {
|
||||
render_screen_original(PLAYFIELD_SCREEN_2);
|
||||
|
||||
// Initialize the screen line pointers;
|
||||
byte* li_1 = PLAYFIELD_SCREEN_1 + 2*40 + 16;
|
||||
byte* li_2 = PLAYFIELD_SCREEN_2 + 2*40 + 16;
|
||||
for(byte i:0..PLAYFIELD_LINES-1) {
|
||||
char* li_1 = PLAYFIELD_SCREEN_1 + 2*40 + 16;
|
||||
char* li_2 = PLAYFIELD_SCREEN_2 + 2*40 + 16;
|
||||
for(char i:0..PLAYFIELD_LINES-1) {
|
||||
screen_lines_1[i] = li_1;
|
||||
screen_lines_2[i] = li_2;
|
||||
li_1 += 40;
|
||||
@ -71,12 +71,12 @@ void render_init() {
|
||||
|
||||
// Show showing screen 1 and rendering to screen 2
|
||||
render_screen_show = 0;
|
||||
render_screen_render = $20;
|
||||
render_screen_render = 0x20;
|
||||
}
|
||||
|
||||
// Update $D018 to show the current screen (used for double buffering)
|
||||
// Update 0xD018 to show the current screen (used for double buffering)
|
||||
void render_show() {
|
||||
byte d018val = 0;
|
||||
char d018val = 0;
|
||||
if(render_screen_show==0) {
|
||||
d018val = toD018(PLAYFIELD_SCREEN_1, PLAYFIELD_CHARSET);
|
||||
} else {
|
||||
@ -90,30 +90,30 @@ void render_show() {
|
||||
|
||||
// Swap rendering to the other screen (used for double buffering)
|
||||
void render_screen_swap() {
|
||||
render_screen_render ^= $20;
|
||||
render_screen_show ^= $20;
|
||||
render_screen_render ^= 0x20;
|
||||
render_screen_show ^= 0x20;
|
||||
}
|
||||
|
||||
// Show the current score
|
||||
void render_score() {
|
||||
byte* screen;
|
||||
char* screen;
|
||||
if(render_screen_render==0) {
|
||||
screen = PLAYFIELD_SCREEN_1;
|
||||
} else {
|
||||
screen = PLAYFIELD_SCREEN_2;
|
||||
}
|
||||
|
||||
byte* score_bytes = (byte*)(&score_bcd);
|
||||
word score_offset = 40*$05 + $1c;
|
||||
char* score_bytes = (byte*)(&score_bcd);
|
||||
unsigned int score_offset = 40*0x05 + 0x1c;
|
||||
render_bcd( screen, score_offset, score_bytes[2], 0);
|
||||
render_bcd( screen, score_offset+2, score_bytes[1], 0);
|
||||
render_bcd( screen, score_offset+4, score_bytes[0], 0);
|
||||
|
||||
word lines_offset = 40*$01 + $16;
|
||||
unsigned int lines_offset = 40*0x01 + 0x16;
|
||||
render_bcd( screen, lines_offset, >lines_bcd, 1);
|
||||
render_bcd( screen, lines_offset+1, <lines_bcd, 0);
|
||||
|
||||
word level_offset = 40*19 + $1f;
|
||||
unsigned int level_offset = 40*19 + 0x1f;
|
||||
render_bcd( screen, level_offset, level_bcd, 0);
|
||||
|
||||
}
|
||||
@ -123,24 +123,24 @@ void render_score() {
|
||||
// - offset: offset on the screen
|
||||
// - bcd: The BCD-value to render
|
||||
// - only_low: if non-zero only renders the low digit
|
||||
void render_bcd(byte* screen, word offset, byte bcd, byte only_low) {
|
||||
const byte ZERO_CHAR = 53;
|
||||
byte* screen_pos = screen+offset;
|
||||
void render_bcd(char* screen, unsigned int offset, char bcd, char only_low) {
|
||||
const char ZERO_CHAR = 53;
|
||||
char* screen_pos = screen+offset;
|
||||
if(only_low==0) {
|
||||
*screen_pos++ = ZERO_CHAR + (bcd >> 4);
|
||||
}
|
||||
*screen_pos++ = ZERO_CHAR + (bcd & $0f);
|
||||
*screen_pos++ = ZERO_CHAR + (bcd & 0x0f);
|
||||
}
|
||||
|
||||
// Copy the original screen data to the passed screen
|
||||
// Also copies colors to $d800
|
||||
void render_screen_original(byte* screen) {
|
||||
byte SPACE = 0;
|
||||
byte* oscr = PLAYFIELD_SCREEN_ORIGINAL+32*2;
|
||||
byte* ocols = PLAYFIELD_COLORS_ORIGINAL+32*2;
|
||||
byte* cols = COLS;
|
||||
for(byte y:0..24) {
|
||||
byte x=0;
|
||||
// Also copies colors to 0xd800
|
||||
void render_screen_original(char* screen) {
|
||||
char SPACE = 0;
|
||||
char* oscr = PLAYFIELD_SCREEN_ORIGINAL+32*2;
|
||||
char* ocols = PLAYFIELD_COLORS_ORIGINAL+32*2;
|
||||
char* cols = COLS;
|
||||
for(char y:0..24) {
|
||||
char x=0;
|
||||
do {
|
||||
*screen++ = SPACE;
|
||||
*cols++ = BLACK;
|
||||
@ -159,10 +159,10 @@ void render_screen_original(byte* screen) {
|
||||
// Render the static playfield on the screen (all pieces already locked into place)
|
||||
void render_playfield() {
|
||||
// Do not render the top 2 lines.
|
||||
byte i = PLAYFIELD_COLS*2;
|
||||
for(byte l:2..PLAYFIELD_LINES-1) {
|
||||
byte* screen_line = screen_lines_1[render_screen_render+l];
|
||||
for(byte c:0..PLAYFIELD_COLS-1) {
|
||||
char i = PLAYFIELD_COLS*2;
|
||||
for(char l:2..PLAYFIELD_LINES-1) {
|
||||
char* screen_line = screen_lines_1[render_screen_render+l];
|
||||
for(char c:0..PLAYFIELD_COLS-1) {
|
||||
*(screen_line++) = playfield[i++];
|
||||
}
|
||||
}
|
||||
@ -171,14 +171,14 @@ void render_playfield() {
|
||||
// Render the current moving piece at position (current_xpos, current_ypos)
|
||||
// Ignores cases where parts of the tetromino is outside the playfield (sides/bottom) since the movement collision routine prevents this.
|
||||
void render_moving() {
|
||||
byte i = 0;
|
||||
byte ypos = current_ypos;
|
||||
for(byte l:0..3) {
|
||||
char i = 0;
|
||||
char ypos = current_ypos;
|
||||
for(char l:0..3) {
|
||||
if(ypos>1) {
|
||||
byte* screen_line = screen_lines_1[render_screen_render+ypos];
|
||||
byte xpos = current_xpos;
|
||||
for(byte c:0..3) {
|
||||
byte current_cell = current_piece_gfx[i++];
|
||||
char* screen_line = screen_lines_1[render_screen_render+ypos];
|
||||
char xpos = current_xpos;
|
||||
for(char c:0..3) {
|
||||
char current_cell = current_piece_gfx[i++];
|
||||
if(current_cell!=0) {
|
||||
screen_line[xpos] = current_piece_char;
|
||||
}
|
||||
@ -195,8 +195,8 @@ void render_moving() {
|
||||
void render_next() {
|
||||
|
||||
// Find the screen area
|
||||
word next_area_offset = 40*12 + 24 + 4;
|
||||
byte* screen_next_area;
|
||||
unsigned int next_area_offset = 40*12 + 24 + 4;
|
||||
char* screen_next_area;
|
||||
if(render_screen_render==0) {
|
||||
screen_next_area = PLAYFIELD_SCREEN_1+next_area_offset;
|
||||
} else {
|
||||
@ -204,11 +204,11 @@ void render_next() {
|
||||
}
|
||||
|
||||
// Render the next piece
|
||||
byte* next_piece_gfx = PIECES[next_piece_idx];
|
||||
byte next_piece_char = PIECES_NEXT_CHARS[next_piece_idx];
|
||||
for(byte l:0..3) {
|
||||
for(byte c:0..3) {
|
||||
byte cell = *next_piece_gfx++;
|
||||
char* next_piece_gfx = PIECES[next_piece_idx];
|
||||
char next_piece_char = PIECES_NEXT_CHARS[next_piece_idx];
|
||||
for(char l:0..3) {
|
||||
for(char c:0..3) {
|
||||
char cell = *next_piece_gfx++;
|
||||
if(cell!=0) {
|
||||
*screen_next_area = next_piece_char;
|
||||
} else {
|
||||
|
@ -24,9 +24,9 @@ kickasm(pc PLAYFIELD_SPRITES, resource "playfield-sprites.png") {{
|
||||
void sprites_init() {
|
||||
*SPRITES_ENABLE = %00001111;
|
||||
*SPRITES_EXPAND_X = *SPRITES_EXPAND_Y = *SPRITES_MC = 0;
|
||||
byte xpos = 24+15*8;
|
||||
for(byte s:0..3) {
|
||||
byte s2 = s*2;
|
||||
char xpos = 24+15*8;
|
||||
for(char s:0..3) {
|
||||
char s2 = s*2;
|
||||
SPRITES_XPOS[s2] = xpos;
|
||||
SPRITES_COLS[s] = BLACK;
|
||||
xpos = xpos+24;
|
||||
@ -34,17 +34,17 @@ void sprites_init() {
|
||||
}
|
||||
|
||||
// The Y-position of the first sprite row
|
||||
const byte SPRITES_FIRST_YPOS = 49;
|
||||
const char SPRITES_FIRST_YPOS = 49;
|
||||
// The line of the first IRQ
|
||||
const byte IRQ_RASTER_FIRST = SPRITES_FIRST_YPOS + 19;
|
||||
const char IRQ_RASTER_FIRST = SPRITES_FIRST_YPOS + 19;
|
||||
// The raster line of the next IRQ
|
||||
volatile byte irq_raster_next = IRQ_RASTER_FIRST;
|
||||
volatile char irq_raster_next = IRQ_RASTER_FIRST;
|
||||
// Y-pos of the sprites on the next IRQ
|
||||
volatile byte irq_sprite_ypos = SPRITES_FIRST_YPOS + 21;
|
||||
volatile char irq_sprite_ypos = SPRITES_FIRST_YPOS + 21;
|
||||
// Index of the sprites to show on the next IRQ
|
||||
volatile byte irq_sprite_ptr = toSpritePtr(PLAYFIELD_SPRITES) + 3;
|
||||
volatile char irq_sprite_ptr = toSpritePtr(PLAYFIELD_SPRITES) + 3;
|
||||
// Counting the 10 IRQs
|
||||
volatile byte irq_cnt = 0;
|
||||
volatile char irq_cnt = 0;
|
||||
|
||||
// Setup the IRQ
|
||||
void sprites_irq_init() {
|
||||
@ -59,7 +59,7 @@ void sprites_irq_init() {
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
// Set raster line
|
||||
*VIC_CONTROL &=$7f;
|
||||
*VIC_CONTROL &=0x7f;
|
||||
*RASTER = IRQ_RASTER_FIRST;
|
||||
// Enable Raster Interrupt
|
||||
*IRQ_ENABLE = IRQ_RASTER;
|
||||
@ -77,18 +77,18 @@ interrupt(hardware_clobber) void sprites_irq() {
|
||||
// Clear decimal flag (because it is used by the score algorithm)
|
||||
asm { cld }
|
||||
// Place the sprites
|
||||
byte ypos = irq_sprite_ypos;
|
||||
char ypos = irq_sprite_ypos;
|
||||
SPRITES_YPOS[0] = ypos;
|
||||
SPRITES_YPOS[2] = ypos;
|
||||
SPRITES_YPOS[4] = ypos;
|
||||
SPRITES_YPOS[6] = ypos;
|
||||
|
||||
// Wait for the y-position before changing sprite pointers
|
||||
volatile byte raster_sprite_gfx_modify = irq_raster_next+1;
|
||||
volatile char raster_sprite_gfx_modify = irq_raster_next+1;
|
||||
do {
|
||||
} while(*RASTER<raster_sprite_gfx_modify);
|
||||
|
||||
byte ptr = irq_sprite_ptr;
|
||||
char ptr = irq_sprite_ptr;
|
||||
if(render_screen_showing==0) {
|
||||
PLAYFIELD_SPRITE_PTRS_1[0] = ptr++;
|
||||
PLAYFIELD_SPRITE_PTRS_1[1] = ptr;
|
||||
|
@ -25,14 +25,14 @@ void main() {
|
||||
render_next();
|
||||
while(true) {
|
||||
// Wait for a frame to pass
|
||||
while(*RASTER!=$ff) {}
|
||||
//*BORDERCOL = render_screen_show/$10;
|
||||
while(*RASTER!=0xff) {}
|
||||
//*BORDERCOL = render_screen_show/0x10;
|
||||
// Update D018 to show the selected screen
|
||||
render_show();
|
||||
// Scan keyboard events
|
||||
keyboard_event_scan();
|
||||
byte key_event = keyboard_event_get();
|
||||
byte render = 0;
|
||||
char key_event = keyboard_event_get();
|
||||
char render = 0;
|
||||
if(game_over==0) {
|
||||
render = play_movement(key_event);
|
||||
} else {
|
||||
|
@ -4030,7 +4030,7 @@ main: {
|
||||
lax.z ypos
|
||||
axs #-[$18]
|
||||
stx.z ypos
|
||||
// for(byte s:4..7)
|
||||
// for(char s:4..7)
|
||||
// [30] (byte) main::s#1 ← ++ (byte) main::s#2 -- vbuyy=_inc_vbuyy
|
||||
iny
|
||||
// [31] if((byte) main::s#1!=(byte) 8) goto main::@1 -- vbuyy_neq_vbuc1_then_la1
|
||||
@ -4094,7 +4094,7 @@ loop: {
|
||||
// [44] (byte) loop::idx#1 ← (byte) loop::idx#2 + (byte) $a -- vbuxx=vbuxx_plus_vbuc1
|
||||
txa
|
||||
axs #-[$a]
|
||||
// for(byte s:4..7)
|
||||
// for(char s:4..7)
|
||||
// [45] (byte) loop::s#1 ← ++ (byte) loop::s#2 -- vbuz1=_inc_vbuz1
|
||||
inc.z s
|
||||
// [46] if((byte) loop::s#1!=(byte) 8) goto loop::@4 -- vbuz1_neq_vbuc1_then_la1
|
||||
@ -4214,7 +4214,7 @@ sprites_init: {
|
||||
lax.z xpos
|
||||
axs #-[$18]
|
||||
stx.z xpos
|
||||
// for(byte s:0..3)
|
||||
// for(char s:0..3)
|
||||
// [69] (byte) sprites_init::s#1 ← ++ (byte) sprites_init::s#2 -- vbuyy=_inc_vbuyy
|
||||
iny
|
||||
// [70] if((byte) sprites_init::s#1!=(byte) 4) goto sprites_init::@1 -- vbuyy_neq_vbuc1_then_la1
|
||||
|
@ -146,7 +146,7 @@
|
||||
.label current_piece_gfx_1 = $24
|
||||
.label current_piece_char_1 = $f
|
||||
__b1:
|
||||
// The screen currently being showed to the user. $00 for screen 1 / $20 for screen 2.
|
||||
// The screen currently being showed to the user. 0x00 for screen 1 / 0x20 for screen 2.
|
||||
lda #0
|
||||
sta.z render_screen_showing
|
||||
// Current score in BCD-format
|
||||
@ -551,7 +551,7 @@ render_playfield: {
|
||||
rts
|
||||
}
|
||||
// Perform any movement of the current piece
|
||||
// key_event is the next keyboard_event() og $ff if no keyboard event is pending
|
||||
// key_event is the next keyboard_event() og 0xff if no keyboard event is pending
|
||||
// Returns a byte signaling whether rendering is needed. (0 no render, >0 render needed)
|
||||
// play_movement(byte zeropage($20) key_event)
|
||||
play_movement: {
|
||||
@ -948,7 +948,7 @@ play_increase_level: {
|
||||
and.z level_bcd
|
||||
cmp #$a
|
||||
bne __b2
|
||||
// If level low nybble hits $a change to $10
|
||||
// If level low nybble hits 0xa change to 0x10
|
||||
lax.z level_bcd
|
||||
axs #-[6]
|
||||
stx.z level_bcd
|
||||
@ -1224,7 +1224,7 @@ keyboard_matrix_read: {
|
||||
eor #$ff
|
||||
rts
|
||||
}
|
||||
// Update $D018 to show the current screen (used for double buffering)
|
||||
// Update 0xD018 to show the current screen (used for double buffering)
|
||||
render_show: {
|
||||
.const toD0181_return = (>(PLAYFIELD_SCREEN_1&$3fff)*4)|(>PLAYFIELD_CHARSET)/4&$f
|
||||
.const toD0182_return = (>(PLAYFIELD_SCREEN_2&$3fff)*4)|(>PLAYFIELD_CHARSET)/4&$f
|
||||
@ -1437,7 +1437,7 @@ render_init: {
|
||||
rts
|
||||
}
|
||||
// Copy the original screen data to the passed screen
|
||||
// Also copies colors to $d800
|
||||
// Also copies colors to 0xd800
|
||||
// render_screen_original(byte* zeropage($24) screen)
|
||||
render_screen_original: {
|
||||
.const SPACE = 0
|
||||
@ -1683,7 +1683,7 @@ sprites_irq: {
|
||||
// These values are updated based on the players level and the base values from SCORE_BASE_BCD
|
||||
score_add_bcd: .fill 4*5, 0
|
||||
// Pointers to the screen address for rendering each playfield line
|
||||
// The lines for screen 1 is aligned with $80 and screen 2 with $40 - so XOR'ing with $40 gives screen 2 lines.
|
||||
// The lines for screen 1 is aligned with 0x80 and screen 2 with 0x40 - so XOR'ing with 0x40 gives screen 2 lines.
|
||||
.align $80
|
||||
screen_lines_1: .fill 2*PLAYFIELD_LINES, 0
|
||||
.align $40
|
||||
|
@ -13792,7 +13792,7 @@ __bbegin:
|
||||
// @1
|
||||
__b1:
|
||||
// [1] (byte) render_screen_showing#0 ← (byte) 0 -- vbuz1=vbuc1
|
||||
// The screen currently being showed to the user. $00 for screen 1 / $20 for screen 2.
|
||||
// The screen currently being showed to the user. 0x00 for screen 1 / 0x20 for screen 2.
|
||||
lda #0
|
||||
sta.z render_screen_showing
|
||||
// [2] (dword) score_bcd#0 ← (byte) 0 -- vduz1=vbuc1
|
||||
@ -14847,7 +14847,7 @@ render_playfield: {
|
||||
}
|
||||
// play_movement
|
||||
// Perform any movement of the current piece
|
||||
// key_event is the next keyboard_event() og $ff if no keyboard event is pending
|
||||
// key_event is the next keyboard_event() og 0xff if no keyboard event is pending
|
||||
// Returns a byte signaling whether rendering is needed. (0 no render, >0 render needed)
|
||||
// play_movement(byte zeropage($7c) key_event)
|
||||
play_movement: {
|
||||
@ -15907,7 +15907,7 @@ play_increase_level: {
|
||||
// play_increase_level::@4
|
||||
__b4:
|
||||
// [330] (byte) level_bcd#8 ← (byte) level_bcd#21 + (byte) 6 -- vbuz1=vbuz1_plus_vbuc1
|
||||
// If level low nybble hits $a change to $10
|
||||
// If level low nybble hits 0xa change to 0x10
|
||||
lax.z level_bcd
|
||||
axs #-[6]
|
||||
stx.z level_bcd
|
||||
@ -16648,7 +16648,7 @@ keyboard_matrix_read: {
|
||||
rts
|
||||
}
|
||||
// render_show
|
||||
// Update $D018 to show the current screen (used for double buffering)
|
||||
// Update 0xD018 to show the current screen (used for double buffering)
|
||||
render_show: {
|
||||
.const toD0181_return = (>(PLAYFIELD_SCREEN_1&$3fff)*4)|(>PLAYFIELD_CHARSET)/4&$f
|
||||
.const toD0182_return = (>(PLAYFIELD_SCREEN_2&$3fff)*4)|(>PLAYFIELD_CHARSET)/4&$f
|
||||
@ -17064,7 +17064,7 @@ render_init: {
|
||||
}
|
||||
// render_screen_original
|
||||
// Copy the original screen data to the passed screen
|
||||
// Also copies colors to $d800
|
||||
// Also copies colors to 0xd800
|
||||
// render_screen_original(byte* zeropage($70) screen)
|
||||
render_screen_original: {
|
||||
.const SPACE = 0
|
||||
@ -17514,7 +17514,7 @@ sprites_irq: {
|
||||
// These values are updated based on the players level and the base values from SCORE_BASE_BCD
|
||||
score_add_bcd: .fill 4*5, 0
|
||||
// Pointers to the screen address for rendering each playfield line
|
||||
// The lines for screen 1 is aligned with $80 and screen 2 with $40 - so XOR'ing with $40 gives screen 2 lines.
|
||||
// The lines for screen 1 is aligned with 0x80 and screen 2 with 0x40 - so XOR'ing with 0x40 gives screen 2 lines.
|
||||
.align $80
|
||||
screen_lines_1: .fill 2*PLAYFIELD_LINES, 0
|
||||
.align $40
|
||||
@ -18904,7 +18904,7 @@ __bbegin:
|
||||
// @1
|
||||
__b1:
|
||||
// [1] (byte) render_screen_showing#0 ← (byte) 0 -- vbuz1=vbuc1
|
||||
// The screen currently being showed to the user. $00 for screen 1 / $20 for screen 2.
|
||||
// The screen currently being showed to the user. 0x00 for screen 1 / 0x20 for screen 2.
|
||||
lda #0
|
||||
sta.z render_screen_showing
|
||||
// [2] (dword) score_bcd#0 ← (byte) 0 -- vduz1=vbuc1
|
||||
@ -19866,7 +19866,7 @@ render_playfield: {
|
||||
}
|
||||
// play_movement
|
||||
// Perform any movement of the current piece
|
||||
// key_event is the next keyboard_event() og $ff if no keyboard event is pending
|
||||
// key_event is the next keyboard_event() og 0xff if no keyboard event is pending
|
||||
// Returns a byte signaling whether rendering is needed. (0 no render, >0 render needed)
|
||||
// play_movement(byte zeropage($20) key_event)
|
||||
play_movement: {
|
||||
@ -20785,7 +20785,7 @@ play_increase_level: {
|
||||
// play_increase_level::@4
|
||||
__b4:
|
||||
// [330] (byte) level_bcd#8 ← (byte) level_bcd#21 + (byte) 6 -- vbuz1=vbuz1_plus_vbuc1
|
||||
// If level low nybble hits $a change to $10
|
||||
// If level low nybble hits 0xa change to 0x10
|
||||
lax.z level_bcd
|
||||
axs #-[6]
|
||||
stx.z level_bcd
|
||||
@ -21441,7 +21441,7 @@ keyboard_matrix_read: {
|
||||
rts
|
||||
}
|
||||
// render_show
|
||||
// Update $D018 to show the current screen (used for double buffering)
|
||||
// Update 0xD018 to show the current screen (used for double buffering)
|
||||
render_show: {
|
||||
.const toD0181_return = (>(PLAYFIELD_SCREEN_1&$3fff)*4)|(>PLAYFIELD_CHARSET)/4&$f
|
||||
.const toD0182_return = (>(PLAYFIELD_SCREEN_2&$3fff)*4)|(>PLAYFIELD_CHARSET)/4&$f
|
||||
@ -21830,7 +21830,7 @@ render_init: {
|
||||
}
|
||||
// render_screen_original
|
||||
// Copy the original screen data to the passed screen
|
||||
// Also copies colors to $d800
|
||||
// Also copies colors to 0xd800
|
||||
// render_screen_original(byte* zeropage($24) screen)
|
||||
render_screen_original: {
|
||||
.const SPACE = 0
|
||||
@ -22244,7 +22244,7 @@ sprites_irq: {
|
||||
// These values are updated based on the players level and the base values from SCORE_BASE_BCD
|
||||
score_add_bcd: .fill 4*5, 0
|
||||
// Pointers to the screen address for rendering each playfield line
|
||||
// The lines for screen 1 is aligned with $80 and screen 2 with $40 - so XOR'ing with $40 gives screen 2 lines.
|
||||
// The lines for screen 1 is aligned with 0x80 and screen 2 with 0x40 - so XOR'ing with 0x40 gives screen 2 lines.
|
||||
.align $80
|
||||
screen_lines_1: .fill 2*PLAYFIELD_LINES, 0
|
||||
.align $40
|
||||
@ -24178,7 +24178,7 @@ Score: 3353851
|
||||
__b1:
|
||||
// render_screen_showing = 0
|
||||
// [1] (byte) render_screen_showing#0 ← (byte) 0 -- vbuz1=vbuc1
|
||||
// The screen currently being showed to the user. $00 for screen 1 / $20 for screen 2.
|
||||
// The screen currently being showed to the user. 0x00 for screen 1 / 0x20 for screen 2.
|
||||
lda #0
|
||||
sta.z render_screen_showing
|
||||
// score_bcd = 0
|
||||
@ -24386,7 +24386,7 @@ main: {
|
||||
// Wait for a frame to pass
|
||||
// main::@2
|
||||
__b2:
|
||||
// while(*RASTER!=$ff)
|
||||
// while(*RASTER!=0xff)
|
||||
// [41] if(*((const byte*) RASTER)!=(byte) $ff) goto main::@2 -- _deref_pbuc1_neq_vbuc2_then_la1
|
||||
lda #$ff
|
||||
cmp RASTER
|
||||
@ -24499,12 +24499,12 @@ main: {
|
||||
// render_screen_swap
|
||||
// Swap rendering to the other screen (used for double buffering)
|
||||
render_screen_swap: {
|
||||
// render_screen_render ^= $20
|
||||
// render_screen_render ^= 0x20
|
||||
// [72] (byte) render_screen_render#11 ← (byte) render_screen_render#18 ^ (byte) $20 -- vbuz1=vbuz1_bxor_vbuc1
|
||||
lda #$20
|
||||
eor.z render_screen_render
|
||||
sta.z render_screen_render
|
||||
// render_screen_show ^= $20
|
||||
// render_screen_show ^= 0x20
|
||||
// [73] (byte) render_screen_show#13 ← (byte) render_screen_show#16 ^ (byte) $20 -- vbuz1=vbuz1_bxor_vbuc1
|
||||
lda #$20
|
||||
eor.z render_screen_show
|
||||
@ -24704,15 +24704,15 @@ render_bcd: {
|
||||
// [104] phi (byte*) render_bcd::screen_pos#3 = (byte*) render_bcd::screen_pos#0 [phi:render_bcd/render_bcd::@2->render_bcd::@1#0] -- register_copy
|
||||
// render_bcd::@1
|
||||
__b1:
|
||||
// bcd & $0f
|
||||
// bcd & 0x0f
|
||||
// [105] (byte~) render_bcd::$3 ← (byte) render_bcd::bcd#6 & (byte) $f -- vbuaa=vbuxx_band_vbuc1
|
||||
txa
|
||||
and #$f
|
||||
// ZERO_CHAR + (bcd & $0f)
|
||||
// ZERO_CHAR + (bcd & 0x0f)
|
||||
// [106] (byte~) render_bcd::$4 ← (const byte) render_bcd::ZERO_CHAR + (byte~) render_bcd::$3 -- vbuaa=vbuc1_plus_vbuaa
|
||||
clc
|
||||
adc #ZERO_CHAR
|
||||
// *screen_pos++ = ZERO_CHAR + (bcd & $0f)
|
||||
// *screen_pos++ = ZERO_CHAR + (bcd & 0x0f)
|
||||
// [107] *((byte*) render_bcd::screen_pos#3) ← (byte~) render_bcd::$4 -- _deref_pbuz1=vbuaa
|
||||
ldy #0
|
||||
sta (screen_pos),y
|
||||
@ -24816,7 +24816,7 @@ render_next: {
|
||||
bne !+
|
||||
inc.z screen_next_area+1
|
||||
!:
|
||||
// for(byte c:0..3)
|
||||
// for(char c:0..3)
|
||||
// [123] (byte) render_next::c#1 ← ++ (byte) render_next::c#2 -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
// [124] if((byte) render_next::c#1!=(byte) 4) goto render_next::@4 -- vbuxx_neq_vbuc1_then_la1
|
||||
@ -24832,7 +24832,7 @@ render_next: {
|
||||
bcc !+
|
||||
inc.z screen_next_area+1
|
||||
!:
|
||||
// for(byte l:0..3)
|
||||
// for(char l:0..3)
|
||||
// [126] (byte) render_next::l#1 ← ++ (byte) render_next::l#7 -- vbuz1=_inc_vbuz1
|
||||
inc.z l
|
||||
// [127] if((byte) render_next::l#1!=(byte) 4) goto render_next::@3 -- vbuz1_neq_vbuc1_then_la1
|
||||
@ -24895,7 +24895,7 @@ render_moving: {
|
||||
// ypos++;
|
||||
// [136] (byte) render_moving::ypos#1 ← ++ (byte) render_moving::ypos#2 -- vbuz1=_inc_vbuz1
|
||||
inc.z ypos
|
||||
// for(byte l:0..3)
|
||||
// for(char l:0..3)
|
||||
// [137] (byte) render_moving::l#1 ← ++ (byte) render_moving::l#4 -- vbuz1=_inc_vbuz1
|
||||
inc.z l
|
||||
// [138] if((byte) render_moving::l#1!=(byte) 4) goto render_moving::@1 -- vbuz1_neq_vbuc1_then_la1
|
||||
@ -24958,7 +24958,7 @@ render_moving: {
|
||||
// xpos++;
|
||||
// [149] (byte) render_moving::xpos#1 ← ++ (byte) render_moving::xpos#2 -- vbuz1=_inc_vbuz1
|
||||
inc.z xpos
|
||||
// for(byte c:0..3)
|
||||
// for(char c:0..3)
|
||||
// [150] (byte) render_moving::c#1 ← ++ (byte) render_moving::c#2 -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
// [151] if((byte) render_moving::c#1!=(byte) 4) goto render_moving::@4 -- vbuxx_neq_vbuc1_then_la1
|
||||
@ -25025,7 +25025,7 @@ render_playfield: {
|
||||
!:
|
||||
// [160] (byte) render_playfield::i#1 ← ++ (byte) render_playfield::i#2 -- vbuz1=_inc_vbuz1
|
||||
inc.z i
|
||||
// for(byte c:0..PLAYFIELD_COLS-1)
|
||||
// for(char c:0..PLAYFIELD_COLS-1)
|
||||
// [161] (byte) render_playfield::c#1 ← ++ (byte) render_playfield::c#2 -- vbuz1=_inc_vbuz1
|
||||
inc.z c
|
||||
// [162] if((byte) render_playfield::c#1!=(const byte) PLAYFIELD_COLS-(byte) 1+(byte) 1) goto render_playfield::@2 -- vbuz1_neq_vbuc1_then_la1
|
||||
@ -25033,7 +25033,7 @@ render_playfield: {
|
||||
cmp.z c
|
||||
bne __b2
|
||||
// render_playfield::@3
|
||||
// for(byte l:2..PLAYFIELD_LINES-1)
|
||||
// for(char l:2..PLAYFIELD_LINES-1)
|
||||
// [163] (byte) render_playfield::l#1 ← ++ (byte) render_playfield::l#2 -- vbuz1=_inc_vbuz1
|
||||
inc.z l
|
||||
// [164] if((byte) render_playfield::l#1!=(const byte) PLAYFIELD_LINES-(byte) 1+(byte) 1) goto render_playfield::@1 -- vbuz1_neq_vbuc1_then_la1
|
||||
@ -25047,7 +25047,7 @@ render_playfield: {
|
||||
}
|
||||
// play_movement
|
||||
// Perform any movement of the current piece
|
||||
// key_event is the next keyboard_event() og $ff if no keyboard event is pending
|
||||
// key_event is the next keyboard_event() og 0xff if no keyboard event is pending
|
||||
// Returns a byte signaling whether rendering is needed. (0 no render, >0 render needed)
|
||||
// play_movement(byte zeropage($20) key_event)
|
||||
play_movement: {
|
||||
@ -25136,11 +25136,11 @@ play_move_rotate: {
|
||||
rts
|
||||
// play_move_rotate::@2
|
||||
__b2:
|
||||
// current_orientation+$10
|
||||
// current_orientation+0x10
|
||||
// [187] (byte~) play_move_rotate::$5 ← (byte) current_orientation#20 + (byte) $10 -- vbuxx=vbuz1_plus_vbuc1
|
||||
lax.z current_orientation
|
||||
axs #-[$10]
|
||||
// orientation = (current_orientation+$10)&$3f
|
||||
// orientation = (current_orientation+0x10)&0x3f
|
||||
// [188] (byte) play_move_rotate::orientation#2 ← (byte~) play_move_rotate::$5 & (byte) $3f -- vbuz1=vbuxx_band_vbuc1
|
||||
lda #$3f
|
||||
sax.z orientation
|
||||
@ -25199,11 +25199,11 @@ play_move_rotate: {
|
||||
rts
|
||||
// play_move_rotate::@1
|
||||
__b1:
|
||||
// current_orientation-$10
|
||||
// current_orientation-0x10
|
||||
// [200] (byte~) play_move_rotate::$7 ← (byte) current_orientation#20 - (byte) $10 -- vbuxx=vbuz1_minus_vbuc1
|
||||
lax.z current_orientation
|
||||
axs #$10
|
||||
// orientation = (current_orientation-$10)&$3f
|
||||
// orientation = (current_orientation-0x10)&0x3f
|
||||
// [201] (byte) play_move_rotate::orientation#1 ← (byte~) play_move_rotate::$7 & (byte) $3f -- vbuz1=vbuxx_band_vbuc1
|
||||
lda #$3f
|
||||
sax.z orientation
|
||||
@ -25283,11 +25283,11 @@ play_collision: {
|
||||
rts
|
||||
// play_collision::@4
|
||||
__b4:
|
||||
// xp&$80
|
||||
// xp&0x80
|
||||
// [212] (byte~) play_collision::$5 ← (byte) play_collision::xp#2 & (byte) $80 -- vbuaa=vbuz1_band_vbuc1
|
||||
lda #$80
|
||||
and.z xp
|
||||
// if((xp&$80)!=0)
|
||||
// if((xp&0x80)!=0)
|
||||
// [213] if((byte~) play_collision::$5==(byte) 0) goto play_collision::@5 -- vbuaa_eq_0_then_la1
|
||||
cmp #0
|
||||
beq __b5
|
||||
@ -25326,7 +25326,7 @@ play_collision: {
|
||||
// xp++;
|
||||
// [218] (byte) play_collision::xp#1 ← ++ (byte) play_collision::xp#2 -- vbuz1=_inc_vbuz1
|
||||
inc.z xp
|
||||
// for(byte c:0..3)
|
||||
// for(char c:0..3)
|
||||
// [219] (byte) play_collision::c#1 ← ++ (byte) play_collision::c#2 -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
// [220] if((byte) play_collision::c#1!=(byte) 4) goto play_collision::@10 -- vbuxx_neq_vbuc1_then_la1
|
||||
@ -25336,7 +25336,7 @@ play_collision: {
|
||||
// yp++;
|
||||
// [221] (byte) play_collision::yp#1 ← ++ (byte) play_collision::yp#2 -- vbuz1=_inc_vbuz1
|
||||
inc.z yp
|
||||
// for(byte l:0..3)
|
||||
// for(char l:0..3)
|
||||
// [222] (byte) play_collision::l#1 ← ++ (byte) play_collision::l#6 -- vbuz1=_inc_vbuz1
|
||||
inc.z l
|
||||
// [223] if((byte) play_collision::l#1!=(byte) 4) goto play_collision::@9 -- vbuz1_neq_vbuc1_then_la1
|
||||
@ -25808,7 +25808,7 @@ play_update_score: {
|
||||
// <lines_bcd
|
||||
// [308] (byte~) play_update_score::$2 ← < (word) lines_bcd#19 -- vbuaa=_lo_vwuz1
|
||||
lda.z lines_bcd
|
||||
// lines_before = <lines_bcd&$f0
|
||||
// lines_before = <lines_bcd&0xf0
|
||||
// [309] (byte) play_update_score::lines_before#0 ← (byte~) play_update_score::$2 & (byte) $f0 -- vbuz1=vbuaa_band_vbuc1
|
||||
and #$f0
|
||||
sta.z lines_before
|
||||
@ -25860,7 +25860,7 @@ play_update_score: {
|
||||
// <lines_bcd
|
||||
// [316] (byte~) play_update_score::$4 ← < (word) lines_bcd#29 -- vbuaa=_lo_vwuz1
|
||||
lda.z lines_bcd
|
||||
// lines_after = <lines_bcd&$f0
|
||||
// lines_after = <lines_bcd&0xf0
|
||||
// [317] (byte) play_update_score::lines_after#0 ← (byte~) play_update_score::$4 & (byte) $f0 -- vbuaa=vbuaa_band_vbuc1
|
||||
and #$f0
|
||||
// if(lines_before!=lines_after)
|
||||
@ -25915,18 +25915,18 @@ play_increase_level: {
|
||||
// level_bcd++;
|
||||
// [327] (byte) level_bcd#21 ← ++ (byte) level_bcd#11 -- vbuz1=_inc_vbuz1
|
||||
inc.z level_bcd
|
||||
// level_bcd&$f
|
||||
// level_bcd&0xf
|
||||
// [328] (byte~) play_increase_level::$1 ← (byte) level_bcd#21 & (byte) $f -- vbuaa=vbuz1_band_vbuc1
|
||||
lda #$f
|
||||
and.z level_bcd
|
||||
// if((level_bcd&$f)==$a)
|
||||
// if((level_bcd&0xf)==0xa)
|
||||
// [329] if((byte~) play_increase_level::$1!=(byte) $a) goto play_increase_level::@2 -- vbuaa_neq_vbuc1_then_la1
|
||||
cmp #$a
|
||||
bne __b2
|
||||
// play_increase_level::@4
|
||||
// level_bcd += 6
|
||||
// [330] (byte) level_bcd#8 ← (byte) level_bcd#21 + (byte) 6 -- vbuz1=vbuz1_plus_vbuc1
|
||||
// If level low nybble hits $a change to $10
|
||||
// If level low nybble hits 0xa change to 0x10
|
||||
lax.z level_bcd
|
||||
axs #-[6]
|
||||
stx.z level_bcd
|
||||
@ -25965,7 +25965,7 @@ play_increase_level: {
|
||||
lda score_add_bcd+3,y
|
||||
adc SCORE_BASE_BCD+3,y
|
||||
sta score_add_bcd+3,y
|
||||
// for(byte b: 0..4)
|
||||
// for(char b: 0..4)
|
||||
// [336] (byte) play_increase_level::b#1 ← ++ (byte) play_increase_level::b#2 -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
// [337] if((byte) play_increase_level::b#1!=(byte) 5) goto play_increase_level::@5 -- vbuxx_neq_vbuc1_then_la1
|
||||
@ -26052,7 +26052,7 @@ play_remove_lines: {
|
||||
// playfield[w--] = c;
|
||||
// [349] (byte) play_remove_lines::w#1 ← -- (byte) play_remove_lines::w#4 -- vbuxx=_dec_vbuxx
|
||||
dex
|
||||
// for(byte x:0..PLAYFIELD_COLS-1)
|
||||
// for(char x:0..PLAYFIELD_COLS-1)
|
||||
// [350] (byte) play_remove_lines::x#1 ← ++ (byte) play_remove_lines::x#2 -- vbuz1=_inc_vbuz1
|
||||
inc.z x
|
||||
// [351] if((byte) play_remove_lines::x#1!=(const byte) PLAYFIELD_COLS-(byte) 1+(byte) 1) goto play_remove_lines::@2 -- vbuz1_neq_vbuc1_then_la1
|
||||
@ -26078,7 +26078,7 @@ play_remove_lines: {
|
||||
// [355] phi (byte) play_remove_lines::w#11 = (byte) play_remove_lines::w#1 [phi:play_remove_lines::@4/play_remove_lines::@5->play_remove_lines::@6#1] -- register_copy
|
||||
// play_remove_lines::@6
|
||||
__b6:
|
||||
// for(byte y:0..PLAYFIELD_LINES-1)
|
||||
// for(char y:0..PLAYFIELD_LINES-1)
|
||||
// [356] (byte) play_remove_lines::y#1 ← ++ (byte) play_remove_lines::y#8 -- vbuz1=_inc_vbuz1
|
||||
inc.z y
|
||||
// [357] if((byte) play_remove_lines::y#1!=(const byte) PLAYFIELD_LINES-(byte) 1+(byte) 1) goto play_remove_lines::@1 -- vbuz1_neq_vbuc1_then_la1
|
||||
@ -26090,7 +26090,7 @@ play_remove_lines: {
|
||||
// [358] phi (byte) play_remove_lines::w#6 = (byte) play_remove_lines::w#11 [phi:play_remove_lines::@6/play_remove_lines::@8->play_remove_lines::@7#0] -- register_copy
|
||||
// Write zeros in the rest of the lines
|
||||
// play_remove_lines::@7
|
||||
// while(w!=$ff)
|
||||
// while(w!=0xff)
|
||||
// [359] if((byte) play_remove_lines::w#6!=(byte) $ff) goto play_remove_lines::@8 -- vbuxx_neq_vbuc1_then_la1
|
||||
cpx #$ff
|
||||
bne __b8
|
||||
@ -26171,7 +26171,7 @@ play_lock_current: {
|
||||
// xp++;
|
||||
// [372] (byte) play_lock_current::xp#1 ← ++ (byte) play_lock_current::xp#2 -- vbuz1=_inc_vbuz1
|
||||
inc.z xp
|
||||
// for(byte c:0..3)
|
||||
// for(char c:0..3)
|
||||
// [373] (byte) play_lock_current::c#1 ← ++ (byte) play_lock_current::c#2 -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
// [374] if((byte) play_lock_current::c#1!=(byte) 4) goto play_lock_current::@7 -- vbuxx_neq_vbuc1_then_la1
|
||||
@ -26181,7 +26181,7 @@ play_lock_current: {
|
||||
// yp++;
|
||||
// [375] (byte) play_lock_current::yp#1 ← ++ (byte) play_lock_current::yp#2 -- vbuz1=_inc_vbuz1
|
||||
inc.z yp
|
||||
// for(byte l:0..3)
|
||||
// for(char l:0..3)
|
||||
// [376] (byte) play_lock_current::l#1 ← ++ (byte) play_lock_current::l#6 -- vbuz1=_inc_vbuz1
|
||||
inc.z l
|
||||
// [377] if((byte) play_lock_current::l#1!=(byte) 4) goto play_lock_current::@6 -- vbuz1_neq_vbuc1_then_la1
|
||||
@ -26516,7 +26516,7 @@ keyboard_matrix_read: {
|
||||
rts
|
||||
}
|
||||
// render_show
|
||||
// Update $D018 to show the current screen (used for double buffering)
|
||||
// Update 0xD018 to show the current screen (used for double buffering)
|
||||
render_show: {
|
||||
.const toD0181_return = (>(PLAYFIELD_SCREEN_1&$3fff)*4)|(>PLAYFIELD_CHARSET)/4&$f
|
||||
.const toD0182_return = (>(PLAYFIELD_SCREEN_2&$3fff)*4)|(>PLAYFIELD_CHARSET)/4&$f
|
||||
@ -26610,7 +26610,7 @@ play_init: {
|
||||
lax.z idx
|
||||
axs #-[PLAYFIELD_COLS]
|
||||
stx.z idx
|
||||
// for(byte j:0..PLAYFIELD_LINES-1)
|
||||
// for(char j:0..PLAYFIELD_LINES-1)
|
||||
// [464] (byte) play_init::j#1 ← ++ (byte) play_init::j#2 -- vbuyy=_inc_vbuyy
|
||||
iny
|
||||
// [465] if((byte) play_init::j#1!=(const byte) PLAYFIELD_LINES-(byte) 1+(byte) 1) goto play_init::@1 -- vbuyy_neq_vbuc1_then_la1
|
||||
@ -26649,7 +26649,7 @@ play_init: {
|
||||
sta score_add_bcd+2,y
|
||||
lda SCORE_BASE_BCD+3,y
|
||||
sta score_add_bcd+3,y
|
||||
// for(byte b: 0..4)
|
||||
// for(char b: 0..4)
|
||||
// [471] (byte) play_init::b#1 ← ++ (byte) play_init::b#2 -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
// [472] if((byte) play_init::b#1!=(byte) 5) goto play_init::@3 -- vbuxx_neq_vbuc1_then_la1
|
||||
@ -26688,7 +26688,7 @@ sprites_irq_init: {
|
||||
// Disable CIA 1 Timer IRQ
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
sta CIA1_INTERRUPT
|
||||
// *VIC_CONTROL &=$7f
|
||||
// *VIC_CONTROL &=0x7f
|
||||
// [480] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f -- _deref_pbuc1=_deref_pbuc1_band_vbuc2
|
||||
// Set raster line
|
||||
lda #$7f
|
||||
@ -26765,7 +26765,7 @@ sprites_init: {
|
||||
lax.z xpos
|
||||
axs #-[$18]
|
||||
stx.z xpos
|
||||
// for(byte s:0..3)
|
||||
// for(char s:0..3)
|
||||
// [495] (byte) sprites_init::s#1 ← ++ (byte) sprites_init::s#2 -- vbuyy=_inc_vbuyy
|
||||
iny
|
||||
// [496] if((byte) sprites_init::s#1!=(byte) 4) goto sprites_init::@1 -- vbuyy_neq_vbuc1_then_la1
|
||||
@ -26892,7 +26892,7 @@ render_init: {
|
||||
bcc !+
|
||||
inc.z li_2+1
|
||||
!:
|
||||
// for(byte i:0..PLAYFIELD_LINES-1)
|
||||
// for(char i:0..PLAYFIELD_LINES-1)
|
||||
// [517] (byte) render_init::i#1 ← ++ (byte) render_init::i#2 -- vbuyy=_inc_vbuyy
|
||||
iny
|
||||
// [518] if((byte) render_init::i#1!=(const byte) PLAYFIELD_LINES-(byte) 1+(byte) 1) goto render_init::@1 -- vbuyy_neq_vbuc1_then_la1
|
||||
@ -26905,7 +26905,7 @@ render_init: {
|
||||
}
|
||||
// render_screen_original
|
||||
// Copy the original screen data to the passed screen
|
||||
// Also copies colors to $d800
|
||||
// Also copies colors to 0xd800
|
||||
// render_screen_original(byte* zeropage($24) screen)
|
||||
render_screen_original: {
|
||||
.const SPACE = 0
|
||||
@ -27062,7 +27062,7 @@ render_screen_original: {
|
||||
cpx #$28
|
||||
bne __b4
|
||||
// render_screen_original::@5
|
||||
// for(byte y:0..24)
|
||||
// for(char y:0..24)
|
||||
// [545] (byte) render_screen_original::y#1 ← ++ (byte) render_screen_original::y#6 -- vbuz1=_inc_vbuz1
|
||||
inc.z y
|
||||
// [546] if((byte) render_screen_original::y#1!=(byte) $19) goto render_screen_original::@1 -- vbuz1_neq_vbuc1_then_la1
|
||||
@ -27077,7 +27077,7 @@ render_screen_original: {
|
||||
// sid_rnd_init
|
||||
// Initialize SID voice 3 for random number generation
|
||||
sid_rnd_init: {
|
||||
// *SID_VOICE3_FREQ = $ffff
|
||||
// *SID_VOICE3_FREQ = 0xffff
|
||||
// [548] *((const word*) SID_VOICE3_FREQ) ← (word) $ffff -- _deref_pwuc1=vwuc2
|
||||
lda #<$ffff
|
||||
sta SID_VOICE3_FREQ
|
||||
@ -27335,7 +27335,7 @@ sprites_irq: {
|
||||
// These values are updated based on the players level and the base values from SCORE_BASE_BCD
|
||||
score_add_bcd: .fill 4*5, 0
|
||||
// Pointers to the screen address for rendering each playfield line
|
||||
// The lines for screen 1 is aligned with $80 and screen 2 with $40 - so XOR'ing with $40 gives screen 2 lines.
|
||||
// The lines for screen 1 is aligned with 0x80 and screen 2 with 0x40 - so XOR'ing with 0x40 gives screen 2 lines.
|
||||
.align $80
|
||||
screen_lines_1: .fill 2*PLAYFIELD_LINES, 0
|
||||
.align $40
|
||||
|
Loading…
Reference in New Issue
Block a user