mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-12-26 03:32:23 +00:00
Working on font 2x2 to sprite converter.
This commit is contained in:
parent
91da76e087
commit
90fccdebef
@ -15,42 +15,42 @@
|
||||
import "c64"
|
||||
|
||||
// The number of sprites in the multiplexer
|
||||
const byte PLEX_COUNT = 32;
|
||||
const char PLEX_COUNT = 32;
|
||||
|
||||
// The x-positions of the multiplexer sprites ($000-$1ff)
|
||||
word PLEX_XPOS[PLEX_COUNT];
|
||||
unsigned int PLEX_XPOS[PLEX_COUNT];
|
||||
|
||||
// The y-positions of the multiplexer sprites.
|
||||
byte PLEX_YPOS[PLEX_COUNT];
|
||||
char PLEX_YPOS[PLEX_COUNT];
|
||||
|
||||
// The sprite pointers for the multiplexed sprites
|
||||
byte PLEX_PTR[PLEX_COUNT];
|
||||
char PLEX_PTR[PLEX_COUNT];
|
||||
|
||||
// The address of the sprite pointers on the current screen (screen+$3f8).
|
||||
byte* PLEX_SCREEN_PTR = $400+$3f8;
|
||||
char* PLEX_SCREEN_PTR = $400+$3f8;
|
||||
|
||||
// Indexes of the plex-sprites sorted by sprite y-position. Each call to plexSort() will fix the sorting if changes to the Y-positions have ruined it.
|
||||
byte PLEX_SORTED_IDX[PLEX_COUNT];
|
||||
char PLEX_SORTED_IDX[PLEX_COUNT];
|
||||
|
||||
// Variables controlling the showing of sprites
|
||||
|
||||
// The index in the PLEX tables of the next sprite to show
|
||||
byte plex_show_idx=0;
|
||||
char plex_show_idx=0;
|
||||
// The index the next sprite to use for showing (sprites are used round-robin)
|
||||
byte plex_sprite_idx=0;
|
||||
char plex_sprite_idx=0;
|
||||
// The MSB bit of the next sprite to use for showing
|
||||
byte plex_sprite_msb=1;
|
||||
char plex_sprite_msb=1;
|
||||
|
||||
// Initialize the multiplexer data structures
|
||||
void plexInit(byte* screen) {
|
||||
void plexInit(char* screen) {
|
||||
plexSetScreen(screen);
|
||||
for(byte i: 0..PLEX_COUNT-1) {
|
||||
for(char i: 0..PLEX_COUNT-1) {
|
||||
PLEX_SORTED_IDX[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the address of the current screen used for setting sprite pointers (at screen+$3f8)
|
||||
inline void plexSetScreen(byte* screen) {
|
||||
inline void plexSetScreen(char* screen) {
|
||||
PLEX_SCREEN_PTR = screen+$3f8;
|
||||
}
|
||||
|
||||
@ -64,12 +64,12 @@ inline void plexSetScreen(byte* screen) {
|
||||
// elements before the marker are shifted right one at a time until encountering one smaller than the current one.
|
||||
// It is then inserted at the spot. Now the marker can move forward.
|
||||
void plexSort() {
|
||||
for(byte m: 0..PLEX_COUNT-2) {
|
||||
byte nxt_idx = PLEX_SORTED_IDX[m+1];
|
||||
byte nxt_y = PLEX_YPOS[nxt_idx];
|
||||
for(char m: 0..PLEX_COUNT-2) {
|
||||
char nxt_idx = PLEX_SORTED_IDX[m+1];
|
||||
char nxt_y = PLEX_YPOS[nxt_idx];
|
||||
if(nxt_y<PLEX_YPOS[PLEX_SORTED_IDX[m]]) {
|
||||
// Shift values until we encounter a value smaller than nxt_y
|
||||
byte s = m;
|
||||
char s = m;
|
||||
do {
|
||||
PLEX_SORTED_IDX[s+1] = PLEX_SORTED_IDX[s];
|
||||
s--;
|
||||
@ -89,12 +89,12 @@ void plexSort() {
|
||||
// Show the next sprite.
|
||||
// plexSort() prepares showing the sprites
|
||||
void plexShowSprite() {
|
||||
byte plex_sprite_idx2 = plex_sprite_idx*2;
|
||||
byte ypos = PLEX_YPOS[PLEX_SORTED_IDX[plex_show_idx]];
|
||||
char plex_sprite_idx2 = plex_sprite_idx*2;
|
||||
char ypos = PLEX_YPOS[PLEX_SORTED_IDX[plex_show_idx]];
|
||||
SPRITES_YPOS[plex_sprite_idx2] = ypos;
|
||||
plexFreeAdd(ypos);
|
||||
PLEX_SCREEN_PTR[plex_sprite_idx] = PLEX_PTR[PLEX_SORTED_IDX[plex_show_idx]];
|
||||
byte xpos_idx = PLEX_SORTED_IDX[plex_show_idx];
|
||||
char xpos_idx = PLEX_SORTED_IDX[plex_show_idx];
|
||||
SPRITES_XPOS[plex_sprite_idx2] = <PLEX_XPOS[xpos_idx];
|
||||
if(>PLEX_XPOS[xpos_idx]!=0) {
|
||||
*SPRITES_XMSB |= plex_sprite_msb;
|
||||
@ -110,31 +110,31 @@ void plexShowSprite() {
|
||||
}
|
||||
|
||||
// Get the y-position of the next sprite to show
|
||||
inline byte plexShowNextYpos() {
|
||||
inline char plexShowNextYpos() {
|
||||
return PLEX_YPOS[PLEX_SORTED_IDX[plex_show_idx]];
|
||||
}
|
||||
|
||||
// Contains the Y-position where each sprite is free again. PLEX_FREE_YPOS[s] holds the Y-position where sprite s is free to use again.
|
||||
byte PLEX_FREE_YPOS[8];
|
||||
char PLEX_FREE_YPOS[8];
|
||||
|
||||
// The index of the sprite that is free next. Since sprites are used round-robin this moves forward each time a sprite is shown.
|
||||
byte plex_free_next = 0;
|
||||
char plex_free_next = 0;
|
||||
|
||||
// Prepare for a new frame. Initialize free to zero for all sprites.
|
||||
inline void plexFreePrepare() {
|
||||
for( byte s: 0..7) {
|
||||
for( char s: 0..7) {
|
||||
PLEX_FREE_YPOS[s] = 0;
|
||||
}
|
||||
plex_free_next = 0;
|
||||
}
|
||||
|
||||
// Get the Y-position where the next sprite to be shown is free to use.
|
||||
inline byte plexFreeNextYpos() {
|
||||
inline char plexFreeNextYpos() {
|
||||
return PLEX_FREE_YPOS[plex_free_next];
|
||||
}
|
||||
|
||||
// Update the data structure to reflect that a sprite has been shown. This sprite will be free again after 21 lines.
|
||||
inline void plexFreeAdd(byte ypos) {
|
||||
inline void plexFreeAdd(char ypos) {
|
||||
PLEX_FREE_YPOS[plex_free_next] = ypos+21;
|
||||
plex_free_next = (plex_free_next+1)&7;
|
||||
}
|
@ -198,10 +198,10 @@ public class TestPrograms {
|
||||
assertError("constant-prepost", "Constant value contains a pre/post-modifier");
|
||||
}
|
||||
|
||||
//@Test
|
||||
//public void testElefont() throws IOException, URISyntaxException {
|
||||
// compileAndCompare("complex/elefont/elefont-sprites", log());
|
||||
//}
|
||||
@Test
|
||||
public void testSpriteScroller() throws IOException, URISyntaxException {
|
||||
compileAndCompare("complex/spritescroller/spritescroller");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGridBobs() throws IOException, URISyntaxException {
|
||||
|
@ -1,55 +0,0 @@
|
||||
// Put a 2x2 font into sprites and show on screen
|
||||
|
||||
import "c64"
|
||||
|
||||
char * const CHARSET_DEFAULT = 0x1000;
|
||||
char * const ELEFONT = 0x2000;
|
||||
char * const SPRITES = 0x3000;
|
||||
char * const SCREEN = 0x0400;
|
||||
char * const SCREEN_SPRITES = SCREEN + SPRITE_PTRS;
|
||||
|
||||
|
||||
kickasm(pc ELEFONT, resource "elefont.bin") {{
|
||||
.import binary "elefont.bin"
|
||||
}}
|
||||
|
||||
void main() {
|
||||
*D018 = toD018(SCREEN, CHARSET_DEFAULT);
|
||||
font_2x2_to_sprites(ELEFONT, SPRITES, 64);
|
||||
*SPRITES_ENABLE = 1;
|
||||
SPRITES_XPOS[0] = 100;
|
||||
SPRITES_YPOS[0] = 100;
|
||||
SPRITES_COLS[0] = WHITE;
|
||||
SCREEN_SPRITES[0] = toSpritePtr(SPRITES)+1;
|
||||
}
|
||||
|
||||
// Convert a 2x2-font to sprites
|
||||
// - font_2x2 The source 2x2-font
|
||||
// - sprites The destination sprites
|
||||
// - num_chars The number of chars to convert
|
||||
void font_2x2_to_sprites(char* font_2x2, char* sprites, char num_chars) {
|
||||
char * char_current = font_2x2;
|
||||
char * sprite = sprites;
|
||||
for(char c=0;c<num_chars;c++) {
|
||||
// Upper char
|
||||
char * char_left = char_current;
|
||||
char * char_right = char_current + 0x40*8;
|
||||
char sprite_idx = 0;
|
||||
for(char i: 0..20) {
|
||||
sprite[sprite_idx++] = char_left[i&7];
|
||||
sprite[sprite_idx++] = char_right[i&7];
|
||||
sprite[sprite_idx++] = 0x00;
|
||||
if(i==7) {
|
||||
// Lower char
|
||||
char_left = char_current + 0x80*8;
|
||||
char_right = char_current + 0xc0*8;
|
||||
} else if(i==15) {
|
||||
// Empty char
|
||||
char_left = font_2x2+' '*8;
|
||||
char_right = font_2x2+' '*8;
|
||||
}
|
||||
}
|
||||
char_current += 8;
|
||||
sprite += 0x40;
|
||||
}
|
||||
}
|
140
src/test/kc/complex/spritescroller/multiplexer-irq.kc
Normal file
140
src/test/kc/complex/spritescroller/multiplexer-irq.kc
Normal file
@ -0,0 +1,140 @@
|
||||
// A flexible sprite multiplexer routine for 32 sprites.
|
||||
// Usage:
|
||||
// - Once:
|
||||
// - plexInit(screen): Initialize the data structures and set the screen address
|
||||
// Each frame:
|
||||
// - Set x-pos, y-pos and pointer in PLEX_XPOS[id], PLEX_YPOS[id], PLEX_PTR[id]
|
||||
// - plexSort() Sorts the sprites according to y-positions and prepares for showing them. This uses an insertion sort that is quite fast when the relative order of the sprites does not change very much.
|
||||
// - plexShowSprite() Shows the next sprite by copying values from PLEX_XXX[] to an actual sprite. Actual sprites are used round-robin. This should be called once for each of the 24 virtual sprites.
|
||||
// - plexFreeNextYpos() Returns the Y-position where the next sprite is available to be shown (ie. the next pos where the next sprite is no longer in use showing something else).
|
||||
// - plexShowNextYpos() Returns the Y-position of the next sprite to show.
|
||||
//
|
||||
// In practice a good method is to wait until the raster is beyond plexFreeNextYpos() and then call plexShowSprite(). Repeat until all 32 sprites have been shown.
|
||||
// TODO: Let the caller specify the number of sprites to use (or add PLEX_ENABLE[PLEX_COUNT])
|
||||
|
||||
import "c64"
|
||||
|
||||
// The number of sprites in the multiplexer
|
||||
const char PLEX_COUNT = 32;
|
||||
|
||||
// The x-positions of the multiplexer sprites (0x000-0x1ff)
|
||||
unsigned int PLEX_XPOS[PLEX_COUNT];
|
||||
|
||||
// The y-positions of the multiplexer sprites.
|
||||
char PLEX_YPOS[PLEX_COUNT];
|
||||
|
||||
// The sprite pointers for the multiplexed sprites
|
||||
char PLEX_PTR[PLEX_COUNT];
|
||||
|
||||
// The address of the sprite pointers on the current screen (screen+0x3f8).
|
||||
char* PLEX_SCREEN_PTR = 0x400+0x3f8;
|
||||
|
||||
// Indexes of the plex-sprites sorted by sprite y-position. Each call to plexSort() will fix the sorting if changes to the Y-positions have ruined it.
|
||||
char PLEX_SORTED_IDX[PLEX_COUNT];
|
||||
|
||||
// Variables controlling the showing of sprites
|
||||
|
||||
// The index in the PLEX tables of the next sprite to show
|
||||
volatile char plex_show_idx=0;
|
||||
// The index the next sprite to use for showing (sprites are used round-robin)
|
||||
volatile char plex_sprite_idx=0;
|
||||
// The MSB bit of the next sprite to use for showing
|
||||
volatile char plex_sprite_msb=1;
|
||||
|
||||
// Initialize the multiplexer data structures
|
||||
void plexInit(char* screen) {
|
||||
plexSetScreen(screen);
|
||||
for(char i: 0..PLEX_COUNT-1) {
|
||||
PLEX_SORTED_IDX[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the address of the current screen used for setting sprite pointers (at screen+0x3f8)
|
||||
inline void plexSetScreen(char* screen) {
|
||||
PLEX_SCREEN_PTR = screen+0x3f8;
|
||||
}
|
||||
|
||||
// Ensure that the indices in PLEX_SORTED_IDX is sorted based on the y-positions in PLEX_YPOS
|
||||
// Assumes that the positions are nearly sorted already (as each sprite just moves a bit)
|
||||
// Uses an insertion sort:
|
||||
// 1. Moves a marker (m) from the start to end of the array. Every time the marker moves forward all elements before the marker are sorted correctly.
|
||||
// 2a. If the next element after the marker is larger that the current element
|
||||
// the marker can be moved forwards (as the sorting is correct).
|
||||
// 2b. If the next element after the marker is smaller than the current element:
|
||||
// elements before the marker are shifted right one at a time until encountering one smaller than the current one.
|
||||
// It is then inserted at the spot. Now the marker can move forward.
|
||||
void plexSort() {
|
||||
for(char m: 0..PLEX_COUNT-2) {
|
||||
char nxt_idx = PLEX_SORTED_IDX[m+1];
|
||||
char nxt_y = PLEX_YPOS[nxt_idx];
|
||||
if(nxt_y<PLEX_YPOS[PLEX_SORTED_IDX[m]]) {
|
||||
// Shift values until we encounter a value smaller than nxt_y
|
||||
char s = m;
|
||||
do {
|
||||
PLEX_SORTED_IDX[s+1] = PLEX_SORTED_IDX[s];
|
||||
s--;
|
||||
} while((s!=0xff) && (nxt_y<PLEX_YPOS[PLEX_SORTED_IDX[s]]));
|
||||
// store the mark at the found position
|
||||
s++;
|
||||
PLEX_SORTED_IDX[s] = nxt_idx;
|
||||
}
|
||||
}
|
||||
// Prepare for showing the sprites
|
||||
plex_show_idx = 0;
|
||||
plex_sprite_idx = 0;
|
||||
plex_sprite_msb = 1;
|
||||
plexFreePrepare();
|
||||
}
|
||||
|
||||
// Show the next sprite.
|
||||
// plexSort() prepares showing the sprites
|
||||
void plexShowSprite() {
|
||||
char plex_sprite_idx2 = plex_sprite_idx*2;
|
||||
char ypos = PLEX_YPOS[PLEX_SORTED_IDX[plex_show_idx]];
|
||||
SPRITES_YPOS[plex_sprite_idx2] = ypos;
|
||||
plexFreeAdd(ypos);
|
||||
PLEX_SCREEN_PTR[plex_sprite_idx] = PLEX_PTR[PLEX_SORTED_IDX[plex_show_idx]];
|
||||
char xpos_idx = PLEX_SORTED_IDX[plex_show_idx];
|
||||
SPRITES_XPOS[plex_sprite_idx2] = <PLEX_XPOS[xpos_idx];
|
||||
if(>PLEX_XPOS[xpos_idx]!=0) {
|
||||
*SPRITES_XMSB |= plex_sprite_msb;
|
||||
} else {
|
||||
*SPRITES_XMSB &= (0xff^plex_sprite_msb);
|
||||
}
|
||||
plex_sprite_idx = (plex_sprite_idx+1)&7;
|
||||
plex_show_idx++;
|
||||
plex_sprite_msb <<=1;
|
||||
if(plex_sprite_msb==0) {
|
||||
plex_sprite_msb = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the y-position of the next sprite to show
|
||||
inline char plexShowNextYpos() {
|
||||
return PLEX_YPOS[PLEX_SORTED_IDX[plex_show_idx]];
|
||||
}
|
||||
|
||||
// Contains the Y-position where each sprite is free again. PLEX_FREE_YPOS[s] holds the Y-position where sprite s is free to use again.
|
||||
char PLEX_FREE_YPOS[8];
|
||||
|
||||
// The index of the sprite that is free next. Since sprites are used round-robin this moves forward each time a sprite is shown.
|
||||
volatile char plex_free_next = 0;
|
||||
|
||||
// Prepare for a new frame. Initialize free to zero for all sprites.
|
||||
inline void plexFreePrepare() {
|
||||
for( char s: 0..7) {
|
||||
PLEX_FREE_YPOS[s] = 0;
|
||||
}
|
||||
plex_free_next = 0;
|
||||
}
|
||||
|
||||
// Get the Y-position where the next sprite to be shown is free to use.
|
||||
inline char plexFreeNextYpos() {
|
||||
return PLEX_FREE_YPOS[plex_free_next];
|
||||
}
|
||||
|
||||
// Update the data structure to reflect that a sprite has been shown. This sprite will be free again after 21 lines.
|
||||
inline void plexFreeAdd(char ypos) {
|
||||
PLEX_FREE_YPOS[plex_free_next] = ypos+21;
|
||||
plex_free_next = (plex_free_next+1)&7;
|
||||
}
|
201
src/test/kc/complex/spritescroller/spritescroller.kc
Normal file
201
src/test/kc/complex/spritescroller/spritescroller.kc
Normal file
@ -0,0 +1,201 @@
|
||||
// Put a 2x2 font into sprites and show it on screen
|
||||
import "c64"
|
||||
import "multiplexer-irq"
|
||||
|
||||
char * const CHARSET_DEFAULT = 0x1000;
|
||||
char * const FONT = 0x2000;
|
||||
char * const SPRITES = 0x3000;
|
||||
char * const SCREEN = 0x0400;
|
||||
char * const SCREEN_SPRITES = SCREEN + SPRITE_PTRS;
|
||||
|
||||
// Show raster time used
|
||||
const char DEBUG = 0;
|
||||
|
||||
//kickasm(pc FONT, resource "elefont.bin") {{
|
||||
// .import binary "elefont.bin"
|
||||
//}}
|
||||
|
||||
char align(0x100) YSIN[0x100] = kickasm {{
|
||||
.fill $100, round(142+89.5*sin(toRadians(360*i/256)))
|
||||
}};
|
||||
|
||||
void main() {
|
||||
|
||||
// Create 2x2 font from CHARGEN
|
||||
asm { sei }
|
||||
*PROCPORT = PROCPORT_RAM_CHARROM;
|
||||
font_2x2(CHARGEN, FONT);
|
||||
*PROCPORT = PROCPORT_BASIC_KERNEL_IO;
|
||||
asm { cli }
|
||||
|
||||
// Convert font to sprites
|
||||
font_2x2_to_sprites(FONT, SPRITES, 64);
|
||||
|
||||
// Initialize the multiplexer
|
||||
plexInit(SCREEN);
|
||||
|
||||
// Show screen
|
||||
*D018 = toD018(SCREEN, CHARSET_DEFAULT);
|
||||
|
||||
// Set the x-positions & pointers
|
||||
unsigned int xp = 24;
|
||||
char sprite = toSpritePtr(SPRITES);
|
||||
for(char s: 0..PLEX_COUNT-1) {
|
||||
PLEX_PTR[s] = sprite++;
|
||||
PLEX_XPOS[s] = xp;
|
||||
xp += 10;
|
||||
}
|
||||
// Enable & initialize sprites
|
||||
*SPRITES_ENABLE = 0xff;
|
||||
for(char s: 0..7) {
|
||||
SPRITES_COLS[s] = WHITE;
|
||||
}
|
||||
|
||||
// Move the sprites
|
||||
plexSine();
|
||||
// Sort the sprites by y-position
|
||||
plexSort();
|
||||
|
||||
// Enable the plex IRQ
|
||||
asm { sei }
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
// Set raster line to 0x00
|
||||
*VIC_CONTROL &=0x7f;
|
||||
*RASTER = 0x28;
|
||||
// Enable Raster Interrupt
|
||||
*IRQ_ENABLE = IRQ_RASTER;
|
||||
// Acknowledge any IRQ
|
||||
*IRQ_STATUS = IRQ_RASTER;
|
||||
// Set the IRQ routine
|
||||
*KERNEL_IRQ = &plex_irq;
|
||||
asm { cli }
|
||||
|
||||
// Move & Sort - when needed!
|
||||
while(true) {
|
||||
while(!framedone) {
|
||||
}
|
||||
//*BORDERCOL = RED;
|
||||
// Move the sprites
|
||||
plexSine();
|
||||
// Sort the sprites by y-position
|
||||
plexSort();
|
||||
//*BORDERCOL = GREEN;
|
||||
framedone = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Y-sine index
|
||||
char sin_idx = 0;
|
||||
|
||||
// Move the plex sprites in an Y-sine
|
||||
void plexSine() {
|
||||
// Assign sinus positions
|
||||
char y_idx = sin_idx;
|
||||
for(char sy: 0..PLEX_COUNT-1) {
|
||||
PLEX_YPOS[sy] = YSIN[y_idx];
|
||||
y_idx += 8;
|
||||
}
|
||||
sin_idx +=1;
|
||||
}
|
||||
|
||||
volatile bool framedone = false;
|
||||
|
||||
// Show sprites from the multiplexer, rescheduling the IRQ as many times as needed
|
||||
interrupt(kernel_min) void plex_irq() {
|
||||
asm { sei }
|
||||
//*BORDERCOL = WHITE;
|
||||
// Show sprites until finding one that should not be shown until a few raster lines later
|
||||
char rasterY;
|
||||
do {
|
||||
plexShowSprite();
|
||||
rasterY = plexFreeNextYpos();
|
||||
} while (plex_show_idx < PLEX_COUNT && rasterY < *RASTER+3);
|
||||
|
||||
if (plex_show_idx<PLEX_COUNT) {
|
||||
// Set raster IRQ line to the next sprite Y-position
|
||||
*RASTER = rasterY;
|
||||
} else {
|
||||
// Reset the raster IRQ to the top of the screen
|
||||
*RASTER = 0x28;
|
||||
framedone = true;
|
||||
}
|
||||
// Acknowledge the IRQ
|
||||
*IRQ_STATUS = IRQ_RASTER;
|
||||
//*BORDERCOL = 0;
|
||||
asm { cli }
|
||||
}
|
||||
|
||||
// Convert a 2x2-font to sprites
|
||||
// - font_2x2 The source 2x2-font
|
||||
// - sprites The destination sprites
|
||||
// - num_chars The number of chars to convert
|
||||
void font_2x2_to_sprites(char* font_2x2, char* sprites, char num_chars) {
|
||||
char * char_current = font_2x2;
|
||||
char * sprite = sprites;
|
||||
for(char c=0;c<num_chars;c++) {
|
||||
// Upper char
|
||||
char * char_left = char_current;
|
||||
char * char_right = char_current + 0x40*8;
|
||||
char sprite_idx = 0;
|
||||
for(char i: 0..20) {
|
||||
sprite[sprite_idx++] = char_left[i&7];
|
||||
sprite[sprite_idx++] = char_right[i&7];
|
||||
sprite[sprite_idx++] = 0x00;
|
||||
if(i==7) {
|
||||
// Lower char
|
||||
char_left = char_current + 0x80*8;
|
||||
char_right = char_current + 0xc0*8;
|
||||
} else if(i==15) {
|
||||
// Empty char
|
||||
char_left = font_2x2+' '*8;
|
||||
char_right = font_2x2+' '*8;
|
||||
}
|
||||
}
|
||||
char_current += 8;
|
||||
sprite += 0x40;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a 2x2-font by doubling all pixels of the 64 first chars
|
||||
// The font layout is:
|
||||
// - 0x00 - 0x3f Upper left glyphs
|
||||
// - 0x40 - 0x7f Upper right glyphs
|
||||
// - 0x80 - 0xbf Lower left glyphs
|
||||
// - 0xc0 - 0xff Lower right glyphs
|
||||
void font_2x2(char* font_original, char* font_2x2) {
|
||||
char* next_original = font_original;
|
||||
char* next_2x2 = font_2x2;
|
||||
for(char c: 0..0x3f) {
|
||||
char* next_2x2_left = next_2x2;
|
||||
char* next_2x2_right = next_2x2 + 0x40*8;
|
||||
char l2 = 0;
|
||||
for(char l: 0..7) {
|
||||
char glyph_bits = next_original[l];
|
||||
unsigned int glyph_bits_2x2 = 0;
|
||||
for(char b: 0..7) {
|
||||
// Find the bit
|
||||
char glyph_bit = (glyph_bits&0x80)?1uc:0uc;
|
||||
// Roll the bit into the current char twice
|
||||
glyph_bits_2x2 = glyph_bits_2x2<<1|glyph_bit;
|
||||
glyph_bits_2x2 = glyph_bits_2x2<<1|glyph_bit;
|
||||
// Move to next bit
|
||||
glyph_bits <<= 1;
|
||||
}
|
||||
// Put the generated 2x2-line into the 2x2-font twice
|
||||
next_2x2_left[l2] = >glyph_bits_2x2;
|
||||
next_2x2_left[l2+1] = >glyph_bits_2x2;
|
||||
next_2x2_right[l2] = <glyph_bits_2x2;
|
||||
next_2x2_right[l2+1] = <glyph_bits_2x2;
|
||||
l2 += 2;
|
||||
if(l2==8) {
|
||||
// Move to bottom chars
|
||||
next_2x2_left = next_2x2 + 0x80*8;
|
||||
next_2x2_right = next_2x2 + 0xc0*8;
|
||||
l2 = 0;
|
||||
}
|
||||
}
|
||||
next_2x2 += 8;
|
||||
next_original += 8;
|
||||
}
|
||||
}
|
@ -44,14 +44,17 @@ void init() {
|
||||
*IRQ_ENABLE = IRQ_RASTER;
|
||||
*IRQ_STATUS = IRQ_RASTER;
|
||||
*KERNEL_IRQ = &plex_irq;
|
||||
*VIC_CONTROL &=0x7f;
|
||||
*RASTER = 0x0;
|
||||
asm { cli }
|
||||
}
|
||||
|
||||
volatile bool framedone = true;
|
||||
|
||||
interrupt(kernel_min) void plex_irq() {
|
||||
char rasterY;
|
||||
asm { sei }
|
||||
*BORDERCOL = WHITE;
|
||||
char rasterY;
|
||||
do {
|
||||
plexShowSprite();
|
||||
rasterY = plexFreeNextYpos();
|
||||
@ -60,9 +63,11 @@ interrupt(kernel_min) void plex_irq() {
|
||||
if (plex_show_idx<PLEX_COUNT) {
|
||||
*RASTER = rasterY;
|
||||
} else {
|
||||
*RASTER = 0;
|
||||
framedone = true;
|
||||
}
|
||||
*BORDERCOL = 0;
|
||||
asm { cli }
|
||||
}
|
||||
|
||||
// The raster loop
|
||||
@ -84,7 +89,6 @@ void loop() {
|
||||
plexSort();
|
||||
*BORDERCOL = GREEN;
|
||||
framedone = false;
|
||||
*VIC_CONTROL &=0x7f;
|
||||
*RASTER = 0x0;
|
||||
|
||||
}
|
||||
}
|
@ -386,7 +386,7 @@ plexSort: {
|
||||
lda.z nxt_idx
|
||||
sta PLEX_SORTED_IDX,x
|
||||
__b2:
|
||||
// for(byte m: 0..PLEX_COUNT-2)
|
||||
// for(char m: 0..PLEX_COUNT-2)
|
||||
inc.z m
|
||||
lda #PLEX_COUNT-2+1
|
||||
cmp.z m
|
||||
@ -396,7 +396,7 @@ plexSort: {
|
||||
// PLEX_FREE_YPOS[s] = 0
|
||||
lda #0
|
||||
sta PLEX_FREE_YPOS,x
|
||||
// for( byte s: 0..7)
|
||||
// for( char s: 0..7)
|
||||
inx
|
||||
cpx #8
|
||||
bne plexFreePrepare1___b1
|
||||
@ -744,7 +744,7 @@ plexInit: {
|
||||
// PLEX_SORTED_IDX[i] = i
|
||||
txa
|
||||
sta PLEX_SORTED_IDX,x
|
||||
// for(byte i: 0..PLEX_COUNT-1)
|
||||
// for(char i: 0..PLEX_COUNT-1)
|
||||
inx
|
||||
cpx #PLEX_COUNT-1+1
|
||||
bne __b1
|
||||
|
@ -7973,7 +7973,7 @@ plexSort: {
|
||||
sta PLEX_SORTED_IDX,x
|
||||
// plexSort::@2
|
||||
__b2:
|
||||
// for(byte m: 0..PLEX_COUNT-2)
|
||||
// for(char m: 0..PLEX_COUNT-2)
|
||||
// [116] (byte) plexSort::m#1 ← ++ (byte) plexSort::m#2 -- vbuz1=_inc_vbuz1
|
||||
inc.z m
|
||||
// [117] if((byte) plexSort::m#1!=(const nomodify byte) PLEX_COUNT-(byte) 2+(byte) 1) goto plexSort::@1 -- vbuz1_neq_vbuc1_then_la1
|
||||
@ -7993,7 +7993,7 @@ plexSort: {
|
||||
// [120] *((const byte*) PLEX_FREE_YPOS + (byte) plexSort::plexFreePrepare1_s#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2
|
||||
lda #0
|
||||
sta PLEX_FREE_YPOS,x
|
||||
// for( byte s: 0..7)
|
||||
// for( char s: 0..7)
|
||||
// [121] (byte) plexSort::plexFreePrepare1_s#1 ← ++ (byte) plexSort::plexFreePrepare1_s#2 -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
// [122] if((byte) plexSort::plexFreePrepare1_s#1!=(byte) 8) goto plexSort::plexFreePrepare1_@1 -- vbuxx_neq_vbuc1_then_la1
|
||||
@ -8516,7 +8516,7 @@ plexInit: {
|
||||
// [215] *((const byte*) PLEX_SORTED_IDX + (byte) plexInit::i#2) ← (byte) plexInit::i#2 -- pbuc1_derefidx_vbuxx=vbuxx
|
||||
txa
|
||||
sta PLEX_SORTED_IDX,x
|
||||
// for(byte i: 0..PLEX_COUNT-1)
|
||||
// for(char i: 0..PLEX_COUNT-1)
|
||||
// [216] (byte) plexInit::i#1 ← ++ (byte) plexInit::i#2 -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
// [217] if((byte) plexInit::i#1!=(const nomodify byte) PLEX_COUNT-(byte) 1+(byte) 1) goto plexInit::@1 -- vbuxx_neq_vbuc1_then_la1
|
||||
|
758
src/test/ref/complex/spritescroller/spritescroller.asm
Normal file
758
src/test/ref/complex/spritescroller/spritescroller.asm
Normal file
@ -0,0 +1,758 @@
|
||||
// Put a 2x2 font into sprites and show it on screen
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(__bbegin)
|
||||
.pc = $80d "Program"
|
||||
// Processor Port Register controlling RAM/ROM configuration and the datasette
|
||||
.label PROCPORT = 1
|
||||
// RAM in $A000, $E000 CHAR ROM in $D000
|
||||
.const PROCPORT_RAM_CHARROM = 1
|
||||
// BASIC in $A000, I/O in $D000, KERNEL in $E000
|
||||
.const PROCPORT_BASIC_KERNEL_IO = 7
|
||||
// The address of the CHARGEN character set
|
||||
.label CHARGEN = $d000
|
||||
.label SPRITES_XPOS = $d000
|
||||
.label SPRITES_YPOS = $d001
|
||||
.label SPRITES_XMSB = $d010
|
||||
.label RASTER = $d012
|
||||
.label SPRITES_ENABLE = $d015
|
||||
.label SPRITES_COLS = $d027
|
||||
.label VIC_CONTROL = $d011
|
||||
.label D018 = $d018
|
||||
// VIC II IRQ Status Register
|
||||
.label IRQ_STATUS = $d019
|
||||
// VIC II IRQ Enable Register
|
||||
.label IRQ_ENABLE = $d01a
|
||||
// Bits for the IRQ Status/Enable Registers
|
||||
.const IRQ_RASTER = 1
|
||||
// CIA#1 Interrupt Status & Control Register
|
||||
.label CIA1_INTERRUPT = $dc0d
|
||||
// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
.const CIA_INTERRUPT_CLEAR = $7f
|
||||
// The vector used when the KERNAL serves IRQ interrupts
|
||||
.label KERNEL_IRQ = $314
|
||||
.const WHITE = 1
|
||||
// The number of sprites in the multiplexer
|
||||
.const PLEX_COUNT = $20
|
||||
.label CHARSET_DEFAULT = $1000
|
||||
.label FONT = $2000
|
||||
.label SPRITES = $3000
|
||||
.label SCREEN = $400
|
||||
// The address of the sprite pointers on the current screen (screen+0x3f8).
|
||||
.label PLEX_SCREEN_PTR = $400+$3f8
|
||||
.label plex_show_idx = $11
|
||||
.label plex_sprite_idx = $12
|
||||
.label plex_sprite_msb = $13
|
||||
.label plex_free_next = $14
|
||||
.label framedone = $15
|
||||
// Y-sine index
|
||||
.label sin_idx = 4
|
||||
__bbegin:
|
||||
// plex_show_idx=0
|
||||
// The index in the PLEX tables of the next sprite to show
|
||||
lda #0
|
||||
sta.z plex_show_idx
|
||||
// plex_sprite_idx=0
|
||||
// The index the next sprite to use for showing (sprites are used round-robin)
|
||||
sta.z plex_sprite_idx
|
||||
// plex_sprite_msb=1
|
||||
// The MSB bit of the next sprite to use for showing
|
||||
lda #1
|
||||
sta.z plex_sprite_msb
|
||||
// plex_free_next = 0
|
||||
// The index of the sprite that is free next. Since sprites are used round-robin this moves forward each time a sprite is shown.
|
||||
lda #0
|
||||
sta.z plex_free_next
|
||||
// framedone = false
|
||||
sta.z framedone
|
||||
jsr main
|
||||
rts
|
||||
main: {
|
||||
.const toSpritePtr1_return = SPRITES/$40
|
||||
.const toD0181_return = (>(SCREEN&$3fff)*4)|(>CHARSET_DEFAULT)/4&$f
|
||||
.label sprite = 4
|
||||
// Set the x-positions & pointers
|
||||
.label xp = 2
|
||||
// asm
|
||||
// Create 2x2 font from CHARGEN
|
||||
sei
|
||||
// *PROCPORT = PROCPORT_RAM_CHARROM
|
||||
lda #PROCPORT_RAM_CHARROM
|
||||
sta PROCPORT
|
||||
// font_2x2(CHARGEN, FONT)
|
||||
jsr font_2x2
|
||||
// *PROCPORT = PROCPORT_BASIC_KERNEL_IO
|
||||
lda #PROCPORT_BASIC_KERNEL_IO
|
||||
sta PROCPORT
|
||||
// asm
|
||||
cli
|
||||
// font_2x2_to_sprites(FONT, SPRITES, 64)
|
||||
// Convert font to sprites
|
||||
jsr font_2x2_to_sprites
|
||||
// plexInit(SCREEN)
|
||||
// Initialize the multiplexer
|
||||
jsr plexInit
|
||||
// *D018 = toD018(SCREEN, CHARSET_DEFAULT)
|
||||
// Show screen
|
||||
lda #toD0181_return
|
||||
sta D018
|
||||
lda #<$18
|
||||
sta.z xp
|
||||
lda #>$18
|
||||
sta.z xp+1
|
||||
ldx #0
|
||||
lda #toSpritePtr1_return
|
||||
sta.z sprite
|
||||
__b1:
|
||||
// PLEX_PTR[s] = sprite++
|
||||
lda.z sprite
|
||||
sta PLEX_PTR,x
|
||||
// PLEX_PTR[s] = sprite++;
|
||||
inc.z sprite
|
||||
// PLEX_XPOS[s] = xp
|
||||
txa
|
||||
asl
|
||||
tay
|
||||
lda.z xp
|
||||
sta PLEX_XPOS,y
|
||||
lda.z xp+1
|
||||
sta PLEX_XPOS+1,y
|
||||
// xp += 10
|
||||
lda #$a
|
||||
clc
|
||||
adc.z xp
|
||||
sta.z xp
|
||||
bcc !+
|
||||
inc.z xp+1
|
||||
!:
|
||||
// for(char s: 0..PLEX_COUNT-1)
|
||||
inx
|
||||
cpx #PLEX_COUNT-1+1
|
||||
bne __b1
|
||||
// *SPRITES_ENABLE = 0xff
|
||||
// Enable & initialize sprites
|
||||
lda #$ff
|
||||
sta SPRITES_ENABLE
|
||||
ldx #0
|
||||
__b3:
|
||||
// SPRITES_COLS[s] = WHITE
|
||||
lda #WHITE
|
||||
sta SPRITES_COLS,x
|
||||
// for(char s: 0..7)
|
||||
inx
|
||||
cpx #8
|
||||
bne __b3
|
||||
// plexSine()
|
||||
// Move the sprites
|
||||
lda #0
|
||||
sta.z sin_idx
|
||||
jsr plexSine
|
||||
// plexSort()
|
||||
// Sort the sprites by y-position
|
||||
jsr plexSort
|
||||
// asm
|
||||
// Enable the plex IRQ
|
||||
sei
|
||||
// *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR
|
||||
// Disable CIA 1 Timer IRQ
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
sta CIA1_INTERRUPT
|
||||
// *VIC_CONTROL &=0x7f
|
||||
// Set raster line to 0x00
|
||||
lda #$7f
|
||||
and VIC_CONTROL
|
||||
sta VIC_CONTROL
|
||||
// *RASTER = 0x28
|
||||
lda #$28
|
||||
sta RASTER
|
||||
// *IRQ_ENABLE = IRQ_RASTER
|
||||
// Enable Raster Interrupt
|
||||
lda #IRQ_RASTER
|
||||
sta IRQ_ENABLE
|
||||
// *IRQ_STATUS = IRQ_RASTER
|
||||
// Acknowledge any IRQ
|
||||
sta IRQ_STATUS
|
||||
// *KERNEL_IRQ = &plex_irq
|
||||
// Set the IRQ routine
|
||||
lda #<plex_irq
|
||||
sta KERNEL_IRQ
|
||||
lda #>plex_irq
|
||||
sta KERNEL_IRQ+1
|
||||
// asm
|
||||
cli
|
||||
__b5:
|
||||
// while(!framedone)
|
||||
lda.z framedone
|
||||
cmp #0
|
||||
bne __b6
|
||||
jmp __b5
|
||||
__b6:
|
||||
// plexSine()
|
||||
//*BORDERCOL = RED;
|
||||
// Move the sprites
|
||||
jsr plexSine
|
||||
// plexSort()
|
||||
// Sort the sprites by y-position
|
||||
jsr plexSort
|
||||
// framedone = false
|
||||
//*BORDERCOL = GREEN;
|
||||
lda #0
|
||||
sta.z framedone
|
||||
jmp __b5
|
||||
}
|
||||
// Ensure that the indices in PLEX_SORTED_IDX is sorted based on the y-positions in PLEX_YPOS
|
||||
// Assumes that the positions are nearly sorted already (as each sprite just moves a bit)
|
||||
// Uses an insertion sort:
|
||||
// 1. Moves a marker (m) from the start to end of the array. Every time the marker moves forward all elements before the marker are sorted correctly.
|
||||
// 2a. If the next element after the marker is larger that the current element
|
||||
// the marker can be moved forwards (as the sorting is correct).
|
||||
// 2b. If the next element after the marker is smaller than the current element:
|
||||
// elements before the marker are shifted right one at a time until encountering one smaller than the current one.
|
||||
// It is then inserted at the spot. Now the marker can move forward.
|
||||
plexSort: {
|
||||
.label nxt_idx = $16
|
||||
.label nxt_y = $17
|
||||
.label m = 5
|
||||
lda #0
|
||||
sta.z m
|
||||
__b1:
|
||||
// nxt_idx = PLEX_SORTED_IDX[m+1]
|
||||
ldy.z m
|
||||
lda PLEX_SORTED_IDX+1,y
|
||||
sta.z nxt_idx
|
||||
// nxt_y = PLEX_YPOS[nxt_idx]
|
||||
tay
|
||||
lda PLEX_YPOS,y
|
||||
sta.z nxt_y
|
||||
// if(nxt_y<PLEX_YPOS[PLEX_SORTED_IDX[m]])
|
||||
ldx.z m
|
||||
ldy PLEX_SORTED_IDX,x
|
||||
cmp PLEX_YPOS,y
|
||||
bcs __b2
|
||||
__b3:
|
||||
// PLEX_SORTED_IDX[s+1] = PLEX_SORTED_IDX[s]
|
||||
lda PLEX_SORTED_IDX,x
|
||||
sta PLEX_SORTED_IDX+1,x
|
||||
// s--;
|
||||
dex
|
||||
// while((s!=0xff) && (nxt_y<PLEX_YPOS[PLEX_SORTED_IDX[s]]))
|
||||
cpx #$ff
|
||||
beq __b4
|
||||
lda.z nxt_y
|
||||
ldy PLEX_SORTED_IDX,x
|
||||
cmp PLEX_YPOS,y
|
||||
bcc __b3
|
||||
__b4:
|
||||
// s++;
|
||||
inx
|
||||
// PLEX_SORTED_IDX[s] = nxt_idx
|
||||
lda.z nxt_idx
|
||||
sta PLEX_SORTED_IDX,x
|
||||
__b2:
|
||||
// for(char m: 0..PLEX_COUNT-2)
|
||||
inc.z m
|
||||
lda #PLEX_COUNT-2+1
|
||||
cmp.z m
|
||||
bne __b1
|
||||
// plex_show_idx = 0
|
||||
// Prepare for showing the sprites
|
||||
lda #0
|
||||
sta.z plex_show_idx
|
||||
// plex_sprite_idx = 0
|
||||
sta.z plex_sprite_idx
|
||||
// plex_sprite_msb = 1
|
||||
lda #1
|
||||
sta.z plex_sprite_msb
|
||||
ldx #0
|
||||
plexFreePrepare1___b1:
|
||||
// PLEX_FREE_YPOS[s] = 0
|
||||
lda #0
|
||||
sta PLEX_FREE_YPOS,x
|
||||
// for( char s: 0..7)
|
||||
inx
|
||||
cpx #8
|
||||
bne plexFreePrepare1___b1
|
||||
// plex_free_next = 0
|
||||
sta.z plex_free_next
|
||||
// }
|
||||
rts
|
||||
}
|
||||
// Move the plex sprites in an Y-sine
|
||||
plexSine: {
|
||||
// y_idx = sin_idx
|
||||
// Assign sinus positions
|
||||
ldx.z sin_idx
|
||||
ldy #0
|
||||
__b1:
|
||||
// PLEX_YPOS[sy] = YSIN[y_idx]
|
||||
lda YSIN,x
|
||||
sta PLEX_YPOS,y
|
||||
// y_idx += 8
|
||||
txa
|
||||
axs #-[8]
|
||||
// for(char sy: 0..PLEX_COUNT-1)
|
||||
iny
|
||||
cpy #PLEX_COUNT-1+1
|
||||
bne __b1
|
||||
// sin_idx +=1
|
||||
inc.z sin_idx
|
||||
// }
|
||||
rts
|
||||
}
|
||||
// Initialize the multiplexer data structures
|
||||
plexInit: {
|
||||
ldx #0
|
||||
__b1:
|
||||
// PLEX_SORTED_IDX[i] = i
|
||||
txa
|
||||
sta PLEX_SORTED_IDX,x
|
||||
// for(char i: 0..PLEX_COUNT-1)
|
||||
inx
|
||||
cpx #PLEX_COUNT-1+1
|
||||
bne __b1
|
||||
// }
|
||||
rts
|
||||
}
|
||||
// Convert a 2x2-font to sprites
|
||||
// - font_2x2 The source 2x2-font
|
||||
// - sprites The destination sprites
|
||||
// - num_chars The number of chars to convert
|
||||
font_2x2_to_sprites: {
|
||||
.const num_chars = $40
|
||||
.label __3 = $18
|
||||
.label char_right = $d
|
||||
.label sprite_idx = $a
|
||||
.label char_left = $b
|
||||
.label char_current = 6
|
||||
.label sprite = 8
|
||||
.label c = 5
|
||||
lda #<SPRITES
|
||||
sta.z sprite
|
||||
lda #>SPRITES
|
||||
sta.z sprite+1
|
||||
lda #<FONT
|
||||
sta.z char_current
|
||||
lda #>FONT
|
||||
sta.z char_current+1
|
||||
lda #0
|
||||
sta.z c
|
||||
__b1:
|
||||
// for(char c=0;c<num_chars;c++)
|
||||
lda.z c
|
||||
cmp #num_chars
|
||||
bcc __b2
|
||||
// }
|
||||
rts
|
||||
__b2:
|
||||
// char_right = char_current + 0x40*8
|
||||
lda.z char_current
|
||||
clc
|
||||
adc #<$40*8
|
||||
sta.z char_right
|
||||
lda.z char_current+1
|
||||
adc #>$40*8
|
||||
sta.z char_right+1
|
||||
lda.z char_current
|
||||
sta.z char_left
|
||||
lda.z char_current+1
|
||||
sta.z char_left+1
|
||||
lda #0
|
||||
sta.z sprite_idx
|
||||
tax
|
||||
__b3:
|
||||
// i&7
|
||||
lda #7
|
||||
sax.z __3
|
||||
// sprite[sprite_idx++] = char_left[i&7]
|
||||
ldy.z __3
|
||||
lda (char_left),y
|
||||
ldy.z sprite_idx
|
||||
sta (sprite),y
|
||||
// sprite[sprite_idx++] = char_left[i&7];
|
||||
inc.z sprite_idx
|
||||
// sprite[sprite_idx++] = char_right[i&7]
|
||||
ldy.z __3
|
||||
lda (char_right),y
|
||||
ldy.z sprite_idx
|
||||
sta (sprite),y
|
||||
// sprite[sprite_idx++] = char_right[i&7];
|
||||
iny
|
||||
// sprite[sprite_idx++] = 0x00
|
||||
lda #0
|
||||
sta (sprite),y
|
||||
// sprite[sprite_idx++] = 0x00;
|
||||
iny
|
||||
sty.z sprite_idx
|
||||
// if(i==7)
|
||||
cpx #7
|
||||
beq __b4
|
||||
// if(i==15)
|
||||
cpx #$f
|
||||
bne __b5
|
||||
lda #<FONT+' '*8
|
||||
sta.z char_right
|
||||
lda #>FONT+' '*8
|
||||
sta.z char_right+1
|
||||
lda #<FONT+' '*8
|
||||
sta.z char_left
|
||||
lda #>FONT+' '*8
|
||||
sta.z char_left+1
|
||||
__b5:
|
||||
// for(char i: 0..20)
|
||||
inx
|
||||
cpx #$15
|
||||
bne __b3
|
||||
// char_current += 8
|
||||
lda #8
|
||||
clc
|
||||
adc.z char_current
|
||||
sta.z char_current
|
||||
bcc !+
|
||||
inc.z char_current+1
|
||||
!:
|
||||
// sprite += 0x40
|
||||
lda #$40
|
||||
clc
|
||||
adc.z sprite
|
||||
sta.z sprite
|
||||
bcc !+
|
||||
inc.z sprite+1
|
||||
!:
|
||||
// for(char c=0;c<num_chars;c++)
|
||||
inc.z c
|
||||
jmp __b1
|
||||
__b4:
|
||||
// char_left = char_current + 0x80*8
|
||||
lda.z char_current
|
||||
clc
|
||||
adc #<$80*8
|
||||
sta.z char_left
|
||||
lda.z char_current+1
|
||||
adc #>$80*8
|
||||
sta.z char_left+1
|
||||
// char_right = char_current + 0xc0*8
|
||||
lda.z char_current
|
||||
clc
|
||||
adc #<$c0*8
|
||||
sta.z char_right
|
||||
lda.z char_current+1
|
||||
adc #>$c0*8
|
||||
sta.z char_right+1
|
||||
jmp __b5
|
||||
}
|
||||
// Create a 2x2-font by doubling all pixels of the 64 first chars
|
||||
// The font layout is:
|
||||
// - 0x00 - 0x3f Upper left glyphs
|
||||
// - 0x40 - 0x7f Upper right glyphs
|
||||
// - 0x80 - 0xbf Lower left glyphs
|
||||
// - 0xc0 - 0xff Lower right glyphs
|
||||
font_2x2: {
|
||||
.label __5 = $f
|
||||
.label __7 = $f
|
||||
.label next_2x2_left = 6
|
||||
.label next_2x2_right = $d
|
||||
.label glyph_bits = $18
|
||||
.label glyph_bits_2x2 = $f
|
||||
.label l2 = $17
|
||||
.label l = $16
|
||||
.label next_2x2_left_1 = $b
|
||||
.label next_2x2 = 6
|
||||
.label next_original = 8
|
||||
.label c = $a
|
||||
lda #0
|
||||
sta.z c
|
||||
lda #<CHARGEN
|
||||
sta.z next_original
|
||||
lda #>CHARGEN
|
||||
sta.z next_original+1
|
||||
lda #<FONT
|
||||
sta.z next_2x2_left
|
||||
lda #>FONT
|
||||
sta.z next_2x2_left+1
|
||||
__b1:
|
||||
// next_2x2_right = next_2x2 + 0x40*8
|
||||
lda.z next_2x2_left
|
||||
clc
|
||||
adc #<$40*8
|
||||
sta.z next_2x2_right
|
||||
lda.z next_2x2_left+1
|
||||
adc #>$40*8
|
||||
sta.z next_2x2_right+1
|
||||
lda.z next_2x2_left
|
||||
sta.z next_2x2_left_1
|
||||
lda.z next_2x2_left+1
|
||||
sta.z next_2x2_left_1+1
|
||||
lda #0
|
||||
sta.z l2
|
||||
sta.z l
|
||||
__b2:
|
||||
// glyph_bits = next_original[l]
|
||||
ldy.z l
|
||||
lda (next_original),y
|
||||
sta.z glyph_bits
|
||||
ldy #0
|
||||
tya
|
||||
sta.z glyph_bits_2x2
|
||||
sta.z glyph_bits_2x2+1
|
||||
__b3:
|
||||
// glyph_bits&0x80
|
||||
lda #$80
|
||||
and.z glyph_bits
|
||||
// (glyph_bits&0x80)?1uc:0uc
|
||||
cmp #0
|
||||
bne __b4
|
||||
ldx #0
|
||||
jmp __b5
|
||||
__b4:
|
||||
// (glyph_bits&0x80)?1uc:0uc
|
||||
ldx #1
|
||||
__b5:
|
||||
// glyph_bits_2x2<<1
|
||||
asl.z __5
|
||||
rol.z __5+1
|
||||
// glyph_bits_2x2 = glyph_bits_2x2<<1|glyph_bit
|
||||
txa
|
||||
ora.z glyph_bits_2x2
|
||||
sta.z glyph_bits_2x2
|
||||
// glyph_bits_2x2<<1
|
||||
asl.z __7
|
||||
rol.z __7+1
|
||||
// glyph_bits_2x2 = glyph_bits_2x2<<1|glyph_bit
|
||||
txa
|
||||
ora.z glyph_bits_2x2
|
||||
sta.z glyph_bits_2x2
|
||||
// glyph_bits <<= 1
|
||||
// Move to next bit
|
||||
asl.z glyph_bits
|
||||
// for(char b: 0..7)
|
||||
iny
|
||||
cpy #8
|
||||
bne __b3
|
||||
// >glyph_bits_2x2
|
||||
lda.z glyph_bits_2x2+1
|
||||
// next_2x2_left[l2] = >glyph_bits_2x2
|
||||
// Put the generated 2x2-line into the 2x2-font twice
|
||||
ldy.z l2
|
||||
sta (next_2x2_left_1),y
|
||||
// l2+1
|
||||
iny
|
||||
// next_2x2_left[l2+1] = >glyph_bits_2x2
|
||||
sta (next_2x2_left_1),y
|
||||
// <glyph_bits_2x2
|
||||
lda.z glyph_bits_2x2
|
||||
// next_2x2_right[l2] = <glyph_bits_2x2
|
||||
ldy.z l2
|
||||
sta (next_2x2_right),y
|
||||
// l2+1
|
||||
iny
|
||||
// next_2x2_right[l2+1] = <glyph_bits_2x2
|
||||
sta (next_2x2_right),y
|
||||
// l2 += 2
|
||||
lda.z l2
|
||||
clc
|
||||
adc #2
|
||||
sta.z l2
|
||||
// if(l2==8)
|
||||
lda #8
|
||||
cmp.z l2
|
||||
bne __b8
|
||||
// next_2x2_left = next_2x2 + 0x80*8
|
||||
lda.z next_2x2_left
|
||||
clc
|
||||
adc #<$80*8
|
||||
sta.z next_2x2_left_1
|
||||
lda.z next_2x2_left+1
|
||||
adc #>$80*8
|
||||
sta.z next_2x2_left_1+1
|
||||
// next_2x2_right = next_2x2 + 0xc0*8
|
||||
lda.z next_2x2_left
|
||||
clc
|
||||
adc #<$c0*8
|
||||
sta.z next_2x2_right
|
||||
lda.z next_2x2_left+1
|
||||
adc #>$c0*8
|
||||
sta.z next_2x2_right+1
|
||||
lda #0
|
||||
sta.z l2
|
||||
__b8:
|
||||
// for(char l: 0..7)
|
||||
inc.z l
|
||||
lda #8
|
||||
cmp.z l
|
||||
bne __b2
|
||||
// next_2x2 += 8
|
||||
clc
|
||||
adc.z next_2x2
|
||||
sta.z next_2x2
|
||||
bcc !+
|
||||
inc.z next_2x2+1
|
||||
!:
|
||||
// next_original += 8
|
||||
lda #8
|
||||
clc
|
||||
adc.z next_original
|
||||
sta.z next_original
|
||||
bcc !+
|
||||
inc.z next_original+1
|
||||
!:
|
||||
// for(char c: 0..0x3f)
|
||||
inc.z c
|
||||
lda #$40
|
||||
cmp.z c
|
||||
beq !__b1+
|
||||
jmp __b1
|
||||
!__b1:
|
||||
// }
|
||||
rts
|
||||
}
|
||||
// Show sprites from the multiplexer, rescheduling the IRQ as many times as needed
|
||||
plex_irq: {
|
||||
.label __4 = $19
|
||||
// asm
|
||||
sei
|
||||
__b3:
|
||||
// plexShowSprite()
|
||||
jsr plexShowSprite
|
||||
// return PLEX_FREE_YPOS[plex_free_next];
|
||||
ldy.z plex_free_next
|
||||
ldx PLEX_FREE_YPOS,y
|
||||
// *RASTER+3
|
||||
lda #3
|
||||
clc
|
||||
adc RASTER
|
||||
sta.z __4
|
||||
// while (plex_show_idx < PLEX_COUNT && rasterY < *RASTER+3)
|
||||
lda.z plex_show_idx
|
||||
cmp #PLEX_COUNT
|
||||
bcs __b4
|
||||
cpx.z __4
|
||||
bcc __b3
|
||||
__b4:
|
||||
// if (plex_show_idx<PLEX_COUNT)
|
||||
lda.z plex_show_idx
|
||||
cmp #PLEX_COUNT
|
||||
bcc __b1
|
||||
// *RASTER = 0x28
|
||||
// Reset the raster IRQ to the top of the screen
|
||||
lda #$28
|
||||
sta RASTER
|
||||
// framedone = true
|
||||
lda #1
|
||||
sta.z framedone
|
||||
__b2:
|
||||
// *IRQ_STATUS = IRQ_RASTER
|
||||
// Acknowledge the IRQ
|
||||
lda #IRQ_RASTER
|
||||
sta IRQ_STATUS
|
||||
// asm
|
||||
//*BORDERCOL = 0;
|
||||
cli
|
||||
// }
|
||||
jmp $ea81
|
||||
__b1:
|
||||
// *RASTER = rasterY
|
||||
// Set raster IRQ line to the next sprite Y-position
|
||||
stx RASTER
|
||||
jmp __b2
|
||||
}
|
||||
// Show the next sprite.
|
||||
// plexSort() prepares showing the sprites
|
||||
plexShowSprite: {
|
||||
.label plex_sprite_idx2 = $1a
|
||||
// plex_sprite_idx2 = plex_sprite_idx*2
|
||||
lda.z plex_sprite_idx
|
||||
asl
|
||||
sta.z plex_sprite_idx2
|
||||
// ypos = PLEX_YPOS[PLEX_SORTED_IDX[plex_show_idx]]
|
||||
ldx.z plex_show_idx
|
||||
ldy PLEX_SORTED_IDX,x
|
||||
lda PLEX_YPOS,y
|
||||
// SPRITES_YPOS[plex_sprite_idx2] = ypos
|
||||
ldy.z plex_sprite_idx2
|
||||
sta SPRITES_YPOS,y
|
||||
// ypos+21
|
||||
clc
|
||||
adc #$15
|
||||
// PLEX_FREE_YPOS[plex_free_next] = ypos+21
|
||||
ldy.z plex_free_next
|
||||
sta PLEX_FREE_YPOS,y
|
||||
// plex_free_next+1
|
||||
tya
|
||||
clc
|
||||
adc #1
|
||||
// (plex_free_next+1)&7
|
||||
and #7
|
||||
// plex_free_next = (plex_free_next+1)&7
|
||||
sta.z plex_free_next
|
||||
// PLEX_SCREEN_PTR[plex_sprite_idx] = PLEX_PTR[PLEX_SORTED_IDX[plex_show_idx]]
|
||||
ldy PLEX_SORTED_IDX,x
|
||||
lda PLEX_PTR,y
|
||||
ldx.z plex_sprite_idx
|
||||
sta PLEX_SCREEN_PTR,x
|
||||
// xpos_idx = PLEX_SORTED_IDX[plex_show_idx]
|
||||
ldy.z plex_show_idx
|
||||
lda PLEX_SORTED_IDX,y
|
||||
// <PLEX_XPOS[xpos_idx]
|
||||
asl
|
||||
tax
|
||||
lda PLEX_XPOS,x
|
||||
// SPRITES_XPOS[plex_sprite_idx2] = <PLEX_XPOS[xpos_idx]
|
||||
ldy.z plex_sprite_idx2
|
||||
sta SPRITES_XPOS,y
|
||||
// >PLEX_XPOS[xpos_idx]
|
||||
lda PLEX_XPOS+1,x
|
||||
// if(>PLEX_XPOS[xpos_idx]!=0)
|
||||
cmp #0
|
||||
bne __b1
|
||||
// 0xff^plex_sprite_msb
|
||||
lda #$ff
|
||||
eor.z plex_sprite_msb
|
||||
// *SPRITES_XMSB &= (0xff^plex_sprite_msb)
|
||||
and SPRITES_XMSB
|
||||
sta SPRITES_XMSB
|
||||
__b2:
|
||||
// plex_sprite_idx+1
|
||||
ldx.z plex_sprite_idx
|
||||
inx
|
||||
// (plex_sprite_idx+1)&7
|
||||
txa
|
||||
and #7
|
||||
// plex_sprite_idx = (plex_sprite_idx+1)&7
|
||||
sta.z plex_sprite_idx
|
||||
// plex_show_idx++;
|
||||
inc.z plex_show_idx
|
||||
// plex_sprite_msb <<=1
|
||||
asl.z plex_sprite_msb
|
||||
// if(plex_sprite_msb==0)
|
||||
lda.z plex_sprite_msb
|
||||
cmp #0
|
||||
bne __breturn
|
||||
// plex_sprite_msb = 1
|
||||
lda #1
|
||||
sta.z plex_sprite_msb
|
||||
__breturn:
|
||||
// }
|
||||
rts
|
||||
__b1:
|
||||
// *SPRITES_XMSB |= plex_sprite_msb
|
||||
lda SPRITES_XMSB
|
||||
ora.z plex_sprite_msb
|
||||
sta SPRITES_XMSB
|
||||
jmp __b2
|
||||
}
|
||||
// The x-positions of the multiplexer sprites (0x000-0x1ff)
|
||||
PLEX_XPOS: .fill 2*PLEX_COUNT, 0
|
||||
// The y-positions of the multiplexer sprites.
|
||||
PLEX_YPOS: .fill PLEX_COUNT, 0
|
||||
// The sprite pointers for the multiplexed sprites
|
||||
PLEX_PTR: .fill PLEX_COUNT, 0
|
||||
// Indexes of the plex-sprites sorted by sprite y-position. Each call to plexSort() will fix the sorting if changes to the Y-positions have ruined it.
|
||||
PLEX_SORTED_IDX: .fill PLEX_COUNT, 0
|
||||
// Contains the Y-position where each sprite is free again. PLEX_FREE_YPOS[s] holds the Y-position where sprite s is free to use again.
|
||||
PLEX_FREE_YPOS: .fill 8, 0
|
||||
//kickasm(pc FONT, resource "elefont.bin") {{
|
||||
// .import binary "elefont.bin"
|
||||
//}}
|
||||
.align $100
|
||||
YSIN:
|
||||
.fill $100, round(142+89.5*sin(toRadians(360*i/256)))
|
||||
|
390
src/test/ref/complex/spritescroller/spritescroller.cfg
Normal file
390
src/test/ref/complex/spritescroller/spritescroller.cfg
Normal file
@ -0,0 +1,390 @@
|
||||
@begin: scope:[] from
|
||||
[0] phi()
|
||||
to:@1
|
||||
@1: scope:[] from @begin
|
||||
[1] (volatile byte) plex_show_idx ← (byte) 0
|
||||
[2] (volatile byte) plex_sprite_idx ← (byte) 0
|
||||
[3] (volatile byte) plex_sprite_msb ← (byte) 1
|
||||
to:@2
|
||||
@2: scope:[] from @1
|
||||
[4] (volatile byte) plex_free_next ← (byte) 0
|
||||
to:@3
|
||||
@3: scope:[] from @2
|
||||
[5] (volatile bool) framedone ← false
|
||||
to:@4
|
||||
@4: scope:[] from @3
|
||||
[6] phi()
|
||||
[7] call main
|
||||
to:@end
|
||||
@end: scope:[] from @4
|
||||
[8] phi()
|
||||
|
||||
(void()) main()
|
||||
main: scope:[main] from @4
|
||||
asm { sei }
|
||||
[10] *((const nomodify byte*) PROCPORT) ← (const nomodify byte) PROCPORT_RAM_CHARROM
|
||||
[11] call font_2x2
|
||||
to:main::@8
|
||||
main::@8: scope:[main] from main
|
||||
[12] *((const nomodify byte*) PROCPORT) ← (const nomodify byte) PROCPORT_BASIC_KERNEL_IO
|
||||
asm { cli }
|
||||
[14] call font_2x2_to_sprites
|
||||
to:main::@9
|
||||
main::@9: scope:[main] from main::@8
|
||||
[15] phi()
|
||||
[16] call plexInit
|
||||
to:main::toD0181
|
||||
main::toD0181: scope:[main] from main::@9
|
||||
[17] phi()
|
||||
to:main::@7
|
||||
main::@7: scope:[main] from main::toD0181
|
||||
[18] *((const nomodify byte*) D018) ← (const byte) main::toD0181_return#0
|
||||
to:main::toSpritePtr1
|
||||
main::toSpritePtr1: scope:[main] from main::@7
|
||||
[19] phi()
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main::@1 main::toSpritePtr1
|
||||
[20] (word) main::xp#2 ← phi( main::@1/(word) main::xp#1 main::toSpritePtr1/(word) $18 )
|
||||
[20] (byte) main::s#2 ← phi( main::@1/(byte) main::s#1 main::toSpritePtr1/(byte) 0 )
|
||||
[20] (byte) main::sprite#2 ← phi( main::@1/(byte) main::sprite#1 main::toSpritePtr1/(const byte) main::toSpritePtr1_return#0 )
|
||||
[21] *((const byte*) PLEX_PTR + (byte) main::s#2) ← (byte) main::sprite#2
|
||||
[22] (byte) main::sprite#1 ← ++ (byte) main::sprite#2
|
||||
[23] (byte~) main::$12 ← (byte) main::s#2 << (byte) 1
|
||||
[24] *((const word*) PLEX_XPOS + (byte~) main::$12) ← (word) main::xp#2
|
||||
[25] (word) main::xp#1 ← (word) main::xp#2 + (byte) $a
|
||||
[26] (byte) main::s#1 ← ++ (byte) main::s#2
|
||||
[27] if((byte) main::s#1!=(const nomodify byte) PLEX_COUNT-(byte) 1+(byte) 1) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
[28] *((const nomodify byte*) SPRITES_ENABLE) ← (byte) $ff
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@2 main::@3
|
||||
[29] (byte) main::s1#2 ← phi( main::@2/(byte) 0 main::@3/(byte) main::s1#1 )
|
||||
[30] *((const nomodify byte*) SPRITES_COLS + (byte) main::s1#2) ← (const nomodify byte) WHITE
|
||||
[31] (byte) main::s1#1 ← ++ (byte) main::s1#2
|
||||
[32] if((byte) main::s1#1!=(byte) 8) goto main::@3
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@3
|
||||
[33] phi()
|
||||
[34] call plexSine
|
||||
to:main::@10
|
||||
main::@10: scope:[main] from main::@4
|
||||
[35] phi()
|
||||
[36] call plexSort
|
||||
to:main::@11
|
||||
main::@11: scope:[main] from main::@10
|
||||
asm { sei }
|
||||
[38] *((const nomodify byte*) CIA1_INTERRUPT) ← (const nomodify byte) CIA_INTERRUPT_CLEAR
|
||||
[39] *((const nomodify byte*) VIC_CONTROL) ← *((const nomodify byte*) VIC_CONTROL) & (byte) $7f
|
||||
[40] *((const nomodify byte*) RASTER) ← (byte) $28
|
||||
[41] *((const nomodify byte*) IRQ_ENABLE) ← (const nomodify byte) IRQ_RASTER
|
||||
[42] *((const nomodify byte*) IRQ_STATUS) ← (const nomodify byte) IRQ_RASTER
|
||||
[43] *((const nomodify void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) plex_irq()
|
||||
asm { cli }
|
||||
to:main::@5
|
||||
main::@5: scope:[main] from main::@11 main::@13 main::@5
|
||||
[45] if((volatile bool) framedone) goto main::@6
|
||||
to:main::@5
|
||||
main::@6: scope:[main] from main::@5
|
||||
[46] phi()
|
||||
[47] call plexSine
|
||||
to:main::@12
|
||||
main::@12: scope:[main] from main::@6
|
||||
[48] phi()
|
||||
[49] call plexSort
|
||||
to:main::@13
|
||||
main::@13: scope:[main] from main::@12
|
||||
[50] (volatile bool) framedone ← false
|
||||
to:main::@5
|
||||
|
||||
(void()) plexSort()
|
||||
plexSort: scope:[plexSort] from main::@10 main::@12
|
||||
[51] phi()
|
||||
to:plexSort::@1
|
||||
plexSort::@1: scope:[plexSort] from plexSort plexSort::@2
|
||||
[52] (byte) plexSort::m#2 ← phi( plexSort/(byte) 0 plexSort::@2/(byte) plexSort::m#1 )
|
||||
[53] (byte) plexSort::nxt_idx#0 ← *((const byte*) PLEX_SORTED_IDX+(byte) 1 + (byte) plexSort::m#2)
|
||||
[54] (byte) plexSort::nxt_y#0 ← *((const byte*) PLEX_YPOS + (byte) plexSort::nxt_idx#0)
|
||||
[55] if((byte) plexSort::nxt_y#0>=*((const byte*) PLEX_YPOS + *((const byte*) PLEX_SORTED_IDX + (byte) plexSort::m#2))) goto plexSort::@2
|
||||
to:plexSort::@5
|
||||
plexSort::@5: scope:[plexSort] from plexSort::@1
|
||||
[56] (byte) plexSort::s#6 ← (byte) plexSort::m#2
|
||||
to:plexSort::@3
|
||||
plexSort::@3: scope:[plexSort] from plexSort::@5 plexSort::@7
|
||||
[57] (byte) plexSort::s#3 ← phi( plexSort::@7/(byte) plexSort::s#1 plexSort::@5/(byte) plexSort::s#6 )
|
||||
[58] *((const byte*) PLEX_SORTED_IDX+(byte) 1 + (byte) plexSort::s#3) ← *((const byte*) PLEX_SORTED_IDX + (byte) plexSort::s#3)
|
||||
[59] (byte) plexSort::s#1 ← -- (byte) plexSort::s#3
|
||||
[60] if((byte) plexSort::s#1==(byte) $ff) goto plexSort::@4
|
||||
to:plexSort::@7
|
||||
plexSort::@7: scope:[plexSort] from plexSort::@3
|
||||
[61] if((byte) plexSort::nxt_y#0<*((const byte*) PLEX_YPOS + *((const byte*) PLEX_SORTED_IDX + (byte) plexSort::s#1))) goto plexSort::@3
|
||||
to:plexSort::@4
|
||||
plexSort::@4: scope:[plexSort] from plexSort::@3 plexSort::@7
|
||||
[62] (byte) plexSort::s#2 ← ++ (byte) plexSort::s#1
|
||||
[63] *((const byte*) PLEX_SORTED_IDX + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0
|
||||
to:plexSort::@2
|
||||
plexSort::@2: scope:[plexSort] from plexSort::@1 plexSort::@4
|
||||
[64] (byte) plexSort::m#1 ← ++ (byte) plexSort::m#2
|
||||
[65] if((byte) plexSort::m#1!=(const nomodify byte) PLEX_COUNT-(byte) 2+(byte) 1) goto plexSort::@1
|
||||
to:plexSort::@6
|
||||
plexSort::@6: scope:[plexSort] from plexSort::@2
|
||||
[66] (volatile byte) plex_show_idx ← (byte) 0
|
||||
[67] (volatile byte) plex_sprite_idx ← (byte) 0
|
||||
[68] (volatile byte) plex_sprite_msb ← (byte) 1
|
||||
to:plexSort::plexFreePrepare1
|
||||
plexSort::plexFreePrepare1: scope:[plexSort] from plexSort::@6
|
||||
[69] phi()
|
||||
to:plexSort::plexFreePrepare1_@1
|
||||
plexSort::plexFreePrepare1_@1: scope:[plexSort] from plexSort::plexFreePrepare1 plexSort::plexFreePrepare1_@1
|
||||
[70] (byte) plexSort::plexFreePrepare1_s#2 ← phi( plexSort::plexFreePrepare1/(byte) 0 plexSort::plexFreePrepare1_@1/(byte) plexSort::plexFreePrepare1_s#1 )
|
||||
[71] *((const byte*) PLEX_FREE_YPOS + (byte) plexSort::plexFreePrepare1_s#2) ← (byte) 0
|
||||
[72] (byte) plexSort::plexFreePrepare1_s#1 ← ++ (byte) plexSort::plexFreePrepare1_s#2
|
||||
[73] if((byte) plexSort::plexFreePrepare1_s#1!=(byte) 8) goto plexSort::plexFreePrepare1_@1
|
||||
to:plexSort::plexFreePrepare1_@2
|
||||
plexSort::plexFreePrepare1_@2: scope:[plexSort] from plexSort::plexFreePrepare1_@1
|
||||
[74] (volatile byte) plex_free_next ← (byte) 0
|
||||
to:plexSort::@return
|
||||
plexSort::@return: scope:[plexSort] from plexSort::plexFreePrepare1_@2
|
||||
[75] return
|
||||
to:@return
|
||||
|
||||
(void()) plexSine()
|
||||
plexSine: scope:[plexSine] from main::@4 main::@6
|
||||
[76] (byte) sin_idx#10 ← phi( main::@6/(byte) sin_idx#12 main::@4/(byte) 0 )
|
||||
[77] (byte) plexSine::y_idx#0 ← (byte) sin_idx#10
|
||||
to:plexSine::@1
|
||||
plexSine::@1: scope:[plexSine] from plexSine plexSine::@1
|
||||
[78] (byte) plexSine::sy#2 ← phi( plexSine/(byte) 0 plexSine::@1/(byte) plexSine::sy#1 )
|
||||
[78] (byte) plexSine::y_idx#2 ← phi( plexSine/(byte) plexSine::y_idx#0 plexSine::@1/(byte) plexSine::y_idx#1 )
|
||||
[79] *((const byte*) PLEX_YPOS + (byte) plexSine::sy#2) ← *((const byte*) YSIN + (byte) plexSine::y_idx#2)
|
||||
[80] (byte) plexSine::y_idx#1 ← (byte) plexSine::y_idx#2 + (byte) 8
|
||||
[81] (byte) plexSine::sy#1 ← ++ (byte) plexSine::sy#2
|
||||
[82] if((byte) plexSine::sy#1!=(const nomodify byte) PLEX_COUNT-(byte) 1+(byte) 1) goto plexSine::@1
|
||||
to:plexSine::@2
|
||||
plexSine::@2: scope:[plexSine] from plexSine::@1
|
||||
[83] (byte) sin_idx#12 ← (byte) sin_idx#10 + (byte) 1
|
||||
to:plexSine::@return
|
||||
plexSine::@return: scope:[plexSine] from plexSine::@2
|
||||
[84] return
|
||||
to:@return
|
||||
|
||||
(void()) plexInit((byte*) plexInit::screen)
|
||||
plexInit: scope:[plexInit] from main::@9
|
||||
[85] phi()
|
||||
to:plexInit::plexSetScreen1
|
||||
plexInit::plexSetScreen1: scope:[plexInit] from plexInit
|
||||
[86] phi()
|
||||
to:plexInit::@1
|
||||
plexInit::@1: scope:[plexInit] from plexInit::@1 plexInit::plexSetScreen1
|
||||
[87] (byte) plexInit::i#2 ← phi( plexInit::@1/(byte) plexInit::i#1 plexInit::plexSetScreen1/(byte) 0 )
|
||||
[88] *((const byte*) PLEX_SORTED_IDX + (byte) plexInit::i#2) ← (byte) plexInit::i#2
|
||||
[89] (byte) plexInit::i#1 ← ++ (byte) plexInit::i#2
|
||||
[90] if((byte) plexInit::i#1!=(const nomodify byte) PLEX_COUNT-(byte) 1+(byte) 1) goto plexInit::@1
|
||||
to:plexInit::@return
|
||||
plexInit::@return: scope:[plexInit] from plexInit::@1
|
||||
[91] return
|
||||
to:@return
|
||||
|
||||
(void()) font_2x2_to_sprites((byte*) font_2x2_to_sprites::font_2x2 , (byte*) font_2x2_to_sprites::sprites , (byte) font_2x2_to_sprites::num_chars)
|
||||
font_2x2_to_sprites: scope:[font_2x2_to_sprites] from main::@8
|
||||
[92] phi()
|
||||
to:font_2x2_to_sprites::@1
|
||||
font_2x2_to_sprites::@1: scope:[font_2x2_to_sprites] from font_2x2_to_sprites font_2x2_to_sprites::@7
|
||||
[93] (byte*) font_2x2_to_sprites::sprite#4 ← phi( font_2x2_to_sprites/(const nomodify byte*) SPRITES font_2x2_to_sprites::@7/(byte*) font_2x2_to_sprites::sprite#1 )
|
||||
[93] (byte*) font_2x2_to_sprites::char_current#2 ← phi( font_2x2_to_sprites/(const nomodify byte*) FONT font_2x2_to_sprites::@7/(byte*) font_2x2_to_sprites::char_current#1 )
|
||||
[93] (byte) font_2x2_to_sprites::c#2 ← phi( font_2x2_to_sprites/(byte) 0 font_2x2_to_sprites::@7/(byte) font_2x2_to_sprites::c#1 )
|
||||
[94] if((byte) font_2x2_to_sprites::c#2<(const byte) font_2x2_to_sprites::num_chars#0) goto font_2x2_to_sprites::@2
|
||||
to:font_2x2_to_sprites::@return
|
||||
font_2x2_to_sprites::@return: scope:[font_2x2_to_sprites] from font_2x2_to_sprites::@1
|
||||
[95] return
|
||||
to:@return
|
||||
font_2x2_to_sprites::@2: scope:[font_2x2_to_sprites] from font_2x2_to_sprites::@1
|
||||
[96] (byte*) font_2x2_to_sprites::char_right#0 ← (byte*) font_2x2_to_sprites::char_current#2 + (word)(number) $40*(number) 8
|
||||
[97] (byte*) font_2x2_to_sprites::char_left#6 ← (byte*) font_2x2_to_sprites::char_current#2
|
||||
to:font_2x2_to_sprites::@3
|
||||
font_2x2_to_sprites::@3: scope:[font_2x2_to_sprites] from font_2x2_to_sprites::@2 font_2x2_to_sprites::@5
|
||||
[98] (byte*) font_2x2_to_sprites::char_right#3 ← phi( font_2x2_to_sprites::@2/(byte*) font_2x2_to_sprites::char_right#0 font_2x2_to_sprites::@5/(byte*) font_2x2_to_sprites::char_right#4 )
|
||||
[98] (byte) font_2x2_to_sprites::sprite_idx#4 ← phi( font_2x2_to_sprites::@2/(byte) 0 font_2x2_to_sprites::@5/(byte) font_2x2_to_sprites::sprite_idx#3 )
|
||||
[98] (byte*) font_2x2_to_sprites::char_left#3 ← phi( font_2x2_to_sprites::@2/(byte*) font_2x2_to_sprites::char_left#6 font_2x2_to_sprites::@5/(byte*) font_2x2_to_sprites::char_left#4 )
|
||||
[98] (byte) font_2x2_to_sprites::i#2 ← phi( font_2x2_to_sprites::@2/(byte) 0 font_2x2_to_sprites::@5/(byte) font_2x2_to_sprites::i#1 )
|
||||
[99] (byte~) font_2x2_to_sprites::$3 ← (byte) font_2x2_to_sprites::i#2 & (byte) 7
|
||||
[100] *((byte*) font_2x2_to_sprites::sprite#4 + (byte) font_2x2_to_sprites::sprite_idx#4) ← *((byte*) font_2x2_to_sprites::char_left#3 + (byte~) font_2x2_to_sprites::$3)
|
||||
[101] (byte) font_2x2_to_sprites::sprite_idx#1 ← ++ (byte) font_2x2_to_sprites::sprite_idx#4
|
||||
[102] *((byte*) font_2x2_to_sprites::sprite#4 + (byte) font_2x2_to_sprites::sprite_idx#1) ← *((byte*) font_2x2_to_sprites::char_right#3 + (byte~) font_2x2_to_sprites::$3)
|
||||
[103] (byte) font_2x2_to_sprites::sprite_idx#2 ← ++ (byte) font_2x2_to_sprites::sprite_idx#1
|
||||
[104] *((byte*) font_2x2_to_sprites::sprite#4 + (byte) font_2x2_to_sprites::sprite_idx#2) ← (byte) 0
|
||||
[105] (byte) font_2x2_to_sprites::sprite_idx#3 ← ++ (byte) font_2x2_to_sprites::sprite_idx#2
|
||||
[106] if((byte) font_2x2_to_sprites::i#2==(byte) 7) goto font_2x2_to_sprites::@4
|
||||
to:font_2x2_to_sprites::@6
|
||||
font_2x2_to_sprites::@6: scope:[font_2x2_to_sprites] from font_2x2_to_sprites::@3
|
||||
[107] if((byte) font_2x2_to_sprites::i#2!=(byte) $f) goto font_2x2_to_sprites::@8
|
||||
to:font_2x2_to_sprites::@5
|
||||
font_2x2_to_sprites::@8: scope:[font_2x2_to_sprites] from font_2x2_to_sprites::@6
|
||||
[108] phi()
|
||||
to:font_2x2_to_sprites::@5
|
||||
font_2x2_to_sprites::@5: scope:[font_2x2_to_sprites] from font_2x2_to_sprites::@4 font_2x2_to_sprites::@6 font_2x2_to_sprites::@8
|
||||
[109] (byte*) font_2x2_to_sprites::char_right#4 ← phi( font_2x2_to_sprites::@4/(byte*) font_2x2_to_sprites::char_right#1 font_2x2_to_sprites::@8/(byte*) font_2x2_to_sprites::char_right#3 font_2x2_to_sprites::@6/(const nomodify byte*) FONT+(byte) ' '*(byte) 8 )
|
||||
[109] (byte*) font_2x2_to_sprites::char_left#4 ← phi( font_2x2_to_sprites::@4/(byte*) font_2x2_to_sprites::char_left#1 font_2x2_to_sprites::@8/(byte*) font_2x2_to_sprites::char_left#3 font_2x2_to_sprites::@6/(const nomodify byte*) FONT+(byte) ' '*(byte) 8 )
|
||||
[110] (byte) font_2x2_to_sprites::i#1 ← ++ (byte) font_2x2_to_sprites::i#2
|
||||
[111] if((byte) font_2x2_to_sprites::i#1!=(byte) $15) goto font_2x2_to_sprites::@3
|
||||
to:font_2x2_to_sprites::@7
|
||||
font_2x2_to_sprites::@7: scope:[font_2x2_to_sprites] from font_2x2_to_sprites::@5
|
||||
[112] (byte*) font_2x2_to_sprites::char_current#1 ← (byte*) font_2x2_to_sprites::char_current#2 + (byte) 8
|
||||
[113] (byte*) font_2x2_to_sprites::sprite#1 ← (byte*) font_2x2_to_sprites::sprite#4 + (byte) $40
|
||||
[114] (byte) font_2x2_to_sprites::c#1 ← ++ (byte) font_2x2_to_sprites::c#2
|
||||
to:font_2x2_to_sprites::@1
|
||||
font_2x2_to_sprites::@4: scope:[font_2x2_to_sprites] from font_2x2_to_sprites::@3
|
||||
[115] (byte*) font_2x2_to_sprites::char_left#1 ← (byte*) font_2x2_to_sprites::char_current#2 + (word)(number) $80*(number) 8
|
||||
[116] (byte*) font_2x2_to_sprites::char_right#1 ← (byte*) font_2x2_to_sprites::char_current#2 + (word)(number) $c0*(number) 8
|
||||
to:font_2x2_to_sprites::@5
|
||||
|
||||
(void()) font_2x2((byte*) font_2x2::font_original , (byte*) font_2x2::font_2x2)
|
||||
font_2x2: scope:[font_2x2] from main
|
||||
[117] phi()
|
||||
to:font_2x2::@1
|
||||
font_2x2::@1: scope:[font_2x2] from font_2x2 font_2x2::@9
|
||||
[118] (byte) font_2x2::c#11 ← phi( font_2x2/(byte) 0 font_2x2::@9/(byte) font_2x2::c#1 )
|
||||
[118] (byte*) font_2x2::next_original#4 ← phi( font_2x2/(const nomodify byte*) CHARGEN font_2x2::@9/(byte*) font_2x2::next_original#1 )
|
||||
[118] (byte*) font_2x2::next_2x2_left#0 ← phi( font_2x2/(const nomodify byte*) FONT font_2x2::@9/(byte*) font_2x2::next_2x2#1 )
|
||||
[119] (byte*) font_2x2::next_2x2_right#0 ← (byte*) font_2x2::next_2x2_left#0 + (word)(number) $40*(number) 8
|
||||
[120] (byte*) font_2x2::next_2x2_left#10 ← (byte*) font_2x2::next_2x2_left#0
|
||||
to:font_2x2::@2
|
||||
font_2x2::@2: scope:[font_2x2] from font_2x2::@1 font_2x2::@8
|
||||
[121] (byte*) font_2x2::next_2x2_right#7 ← phi( font_2x2::@1/(byte*) font_2x2::next_2x2_right#0 font_2x2::@8/(byte*) font_2x2::next_2x2_right#8 )
|
||||
[121] (byte) font_2x2::l2#8 ← phi( font_2x2::@1/(byte) 0 font_2x2::@8/(byte) font_2x2::l2#9 )
|
||||
[121] (byte*) font_2x2::next_2x2_left#7 ← phi( font_2x2::@1/(byte*) font_2x2::next_2x2_left#10 font_2x2::@8/(byte*) font_2x2::next_2x2_left#8 )
|
||||
[121] (byte) font_2x2::l#2 ← phi( font_2x2::@1/(byte) 0 font_2x2::@8/(byte) font_2x2::l#1 )
|
||||
[122] (byte) font_2x2::glyph_bits#0 ← *((byte*) font_2x2::next_original#4 + (byte) font_2x2::l#2)
|
||||
to:font_2x2::@3
|
||||
font_2x2::@3: scope:[font_2x2] from font_2x2::@2 font_2x2::@5
|
||||
[123] (byte) font_2x2::b#2 ← phi( font_2x2::@2/(byte) 0 font_2x2::@5/(byte) font_2x2::b#1 )
|
||||
[123] (word) font_2x2::glyph_bits_2x2#3 ← phi( font_2x2::@2/(word) 0 font_2x2::@5/(word) font_2x2::glyph_bits_2x2#2 )
|
||||
[123] (byte) font_2x2::glyph_bits#2 ← phi( font_2x2::@2/(byte) font_2x2::glyph_bits#0 font_2x2::@5/(byte) font_2x2::glyph_bits#1 )
|
||||
[124] (byte~) font_2x2::$1 ← (byte) font_2x2::glyph_bits#2 & (byte) $80
|
||||
[125] if((byte) 0!=(byte~) font_2x2::$1) goto font_2x2::@4
|
||||
to:font_2x2::@5
|
||||
font_2x2::@4: scope:[font_2x2] from font_2x2::@3
|
||||
[126] phi()
|
||||
to:font_2x2::@5
|
||||
font_2x2::@5: scope:[font_2x2] from font_2x2::@3 font_2x2::@4
|
||||
[127] (byte) font_2x2::glyph_bit#0 ← phi( font_2x2::@4/(byte) 1 font_2x2::@3/(byte) 0 )
|
||||
[128] (word~) font_2x2::$5 ← (word) font_2x2::glyph_bits_2x2#3 << (byte) 1
|
||||
[129] (word) font_2x2::glyph_bits_2x2#1 ← (word~) font_2x2::$5 | (byte) font_2x2::glyph_bit#0
|
||||
[130] (word~) font_2x2::$7 ← (word) font_2x2::glyph_bits_2x2#1 << (byte) 1
|
||||
[131] (word) font_2x2::glyph_bits_2x2#2 ← (word~) font_2x2::$7 | (byte) font_2x2::glyph_bit#0
|
||||
[132] (byte) font_2x2::glyph_bits#1 ← (byte) font_2x2::glyph_bits#2 << (byte) 1
|
||||
[133] (byte) font_2x2::b#1 ← ++ (byte) font_2x2::b#2
|
||||
[134] if((byte) font_2x2::b#1!=(byte) 8) goto font_2x2::@3
|
||||
to:font_2x2::@6
|
||||
font_2x2::@6: scope:[font_2x2] from font_2x2::@5
|
||||
[135] (byte~) font_2x2::$12 ← > (word) font_2x2::glyph_bits_2x2#2
|
||||
[136] *((byte*) font_2x2::next_2x2_left#7 + (byte) font_2x2::l2#8) ← (byte~) font_2x2::$12
|
||||
[137] (byte~) font_2x2::$11 ← (byte) font_2x2::l2#8 + (byte) 1
|
||||
[138] *((byte*) font_2x2::next_2x2_left#7 + (byte~) font_2x2::$11) ← (byte~) font_2x2::$12
|
||||
[139] (byte~) font_2x2::$15 ← < (word) font_2x2::glyph_bits_2x2#2
|
||||
[140] *((byte*) font_2x2::next_2x2_right#7 + (byte) font_2x2::l2#8) ← (byte~) font_2x2::$15
|
||||
[141] (byte~) font_2x2::$14 ← (byte) font_2x2::l2#8 + (byte) 1
|
||||
[142] *((byte*) font_2x2::next_2x2_right#7 + (byte~) font_2x2::$14) ← (byte~) font_2x2::$15
|
||||
[143] (byte) font_2x2::l2#1 ← (byte) font_2x2::l2#8 + (byte) 2
|
||||
[144] if((byte) font_2x2::l2#1!=(byte) 8) goto font_2x2::@8
|
||||
to:font_2x2::@7
|
||||
font_2x2::@7: scope:[font_2x2] from font_2x2::@6
|
||||
[145] (byte*) font_2x2::next_2x2_left#1 ← (byte*) font_2x2::next_2x2_left#0 + (word)(number) $80*(number) 8
|
||||
[146] (byte*) font_2x2::next_2x2_right#1 ← (byte*) font_2x2::next_2x2_left#0 + (word)(number) $c0*(number) 8
|
||||
to:font_2x2::@8
|
||||
font_2x2::@8: scope:[font_2x2] from font_2x2::@6 font_2x2::@7
|
||||
[147] (byte*) font_2x2::next_2x2_right#8 ← phi( font_2x2::@7/(byte*) font_2x2::next_2x2_right#1 font_2x2::@6/(byte*) font_2x2::next_2x2_right#7 )
|
||||
[147] (byte) font_2x2::l2#9 ← phi( font_2x2::@7/(byte) 0 font_2x2::@6/(byte) font_2x2::l2#1 )
|
||||
[147] (byte*) font_2x2::next_2x2_left#8 ← phi( font_2x2::@7/(byte*) font_2x2::next_2x2_left#1 font_2x2::@6/(byte*) font_2x2::next_2x2_left#7 )
|
||||
[148] (byte) font_2x2::l#1 ← ++ (byte) font_2x2::l#2
|
||||
[149] if((byte) font_2x2::l#1!=(byte) 8) goto font_2x2::@2
|
||||
to:font_2x2::@9
|
||||
font_2x2::@9: scope:[font_2x2] from font_2x2::@8
|
||||
[150] (byte*) font_2x2::next_2x2#1 ← (byte*) font_2x2::next_2x2_left#0 + (byte) 8
|
||||
[151] (byte*) font_2x2::next_original#1 ← (byte*) font_2x2::next_original#4 + (byte) 8
|
||||
[152] (byte) font_2x2::c#1 ← ++ (byte) font_2x2::c#11
|
||||
[153] if((byte) font_2x2::c#1!=(byte) $40) goto font_2x2::@1
|
||||
to:font_2x2::@return
|
||||
font_2x2::@return: scope:[font_2x2] from font_2x2::@9
|
||||
[154] return
|
||||
to:@return
|
||||
|
||||
interrupt(KERNEL_MIN)(void()) plex_irq()
|
||||
plex_irq: scope:[plex_irq] from
|
||||
asm { sei }
|
||||
to:plex_irq::@3
|
||||
plex_irq::@3: scope:[plex_irq] from plex_irq plex_irq::@7
|
||||
[156] phi()
|
||||
[157] call plexShowSprite
|
||||
to:plex_irq::plexFreeNextYpos1
|
||||
plex_irq::plexFreeNextYpos1: scope:[plex_irq] from plex_irq::@3
|
||||
[158] (byte) plex_irq::plexFreeNextYpos1_return#0 ← *((const byte*) PLEX_FREE_YPOS + (volatile byte) plex_free_next)
|
||||
to:plex_irq::@6
|
||||
plex_irq::@6: scope:[plex_irq] from plex_irq::plexFreeNextYpos1
|
||||
[159] (byte~) plex_irq::$4 ← *((const nomodify byte*) RASTER) + (byte) 3
|
||||
[160] if((volatile byte) plex_show_idx>=(const nomodify byte) PLEX_COUNT) goto plex_irq::@4
|
||||
to:plex_irq::@7
|
||||
plex_irq::@7: scope:[plex_irq] from plex_irq::@6
|
||||
[161] if((byte) plex_irq::plexFreeNextYpos1_return#0<(byte~) plex_irq::$4) goto plex_irq::@3
|
||||
to:plex_irq::@4
|
||||
plex_irq::@4: scope:[plex_irq] from plex_irq::@6 plex_irq::@7
|
||||
[162] if((volatile byte) plex_show_idx<(const nomodify byte) PLEX_COUNT) goto plex_irq::@1
|
||||
to:plex_irq::@5
|
||||
plex_irq::@5: scope:[plex_irq] from plex_irq::@4
|
||||
[163] *((const nomodify byte*) RASTER) ← (byte) $28
|
||||
[164] (volatile bool) framedone ← true
|
||||
to:plex_irq::@2
|
||||
plex_irq::@2: scope:[plex_irq] from plex_irq::@1 plex_irq::@5
|
||||
[165] *((const nomodify byte*) IRQ_STATUS) ← (const nomodify byte) IRQ_RASTER
|
||||
asm { cli }
|
||||
to:plex_irq::@return
|
||||
plex_irq::@return: scope:[plex_irq] from plex_irq::@2
|
||||
[167] return
|
||||
to:@return
|
||||
plex_irq::@1: scope:[plex_irq] from plex_irq::@4
|
||||
[168] *((const nomodify byte*) RASTER) ← (byte) plex_irq::plexFreeNextYpos1_return#0
|
||||
to:plex_irq::@2
|
||||
|
||||
(void()) plexShowSprite()
|
||||
plexShowSprite: scope:[plexShowSprite] from plex_irq::@3
|
||||
[169] (byte) plexShowSprite::plex_sprite_idx2#0 ← (volatile byte) plex_sprite_idx << (byte) 1
|
||||
[170] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte*) PLEX_YPOS + *((const byte*) PLEX_SORTED_IDX + (volatile byte) plex_show_idx))
|
||||
[171] *((const nomodify byte*) SPRITES_YPOS + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::plexFreeAdd1_ypos#0
|
||||
to:plexShowSprite::plexFreeAdd1
|
||||
plexShowSprite::plexFreeAdd1: scope:[plexShowSprite] from plexShowSprite
|
||||
[172] (byte~) plexShowSprite::plexFreeAdd1_$0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 + (byte) $15
|
||||
[173] *((const byte*) PLEX_FREE_YPOS + (volatile byte) plex_free_next) ← (byte~) plexShowSprite::plexFreeAdd1_$0
|
||||
[174] (byte~) plexShowSprite::plexFreeAdd1_$1 ← (volatile byte) plex_free_next + (byte) 1
|
||||
[175] (byte~) plexShowSprite::plexFreeAdd1_$2 ← (byte~) plexShowSprite::plexFreeAdd1_$1 & (byte) 7
|
||||
[176] (volatile byte) plex_free_next ← (byte~) plexShowSprite::plexFreeAdd1_$2
|
||||
to:plexShowSprite::@5
|
||||
plexShowSprite::@5: scope:[plexShowSprite] from plexShowSprite::plexFreeAdd1
|
||||
[177] *((const byte*) PLEX_SCREEN_PTR#0 + (volatile byte) plex_sprite_idx) ← *((const byte*) PLEX_PTR + *((const byte*) PLEX_SORTED_IDX + (volatile byte) plex_show_idx))
|
||||
[178] (byte) plexShowSprite::xpos_idx#0 ← *((const byte*) PLEX_SORTED_IDX + (volatile byte) plex_show_idx)
|
||||
[179] (byte~) plexShowSprite::$11 ← (byte) plexShowSprite::xpos_idx#0 << (byte) 1
|
||||
[180] (byte~) plexShowSprite::$2 ← < *((const word*) PLEX_XPOS + (byte~) plexShowSprite::$11)
|
||||
[181] *((const nomodify byte*) SPRITES_XPOS + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte~) plexShowSprite::$2
|
||||
[182] (byte~) plexShowSprite::$3 ← > *((const word*) PLEX_XPOS + (byte~) plexShowSprite::$11)
|
||||
[183] if((byte~) plexShowSprite::$3!=(byte) 0) goto plexShowSprite::@1
|
||||
to:plexShowSprite::@3
|
||||
plexShowSprite::@3: scope:[plexShowSprite] from plexShowSprite::@5
|
||||
[184] (byte~) plexShowSprite::$9 ← (byte) $ff ^ (volatile byte) plex_sprite_msb
|
||||
[185] *((const nomodify byte*) SPRITES_XMSB) ← *((const nomodify byte*) SPRITES_XMSB) & (byte~) plexShowSprite::$9
|
||||
to:plexShowSprite::@2
|
||||
plexShowSprite::@2: scope:[plexShowSprite] from plexShowSprite::@1 plexShowSprite::@3
|
||||
[186] (byte~) plexShowSprite::$5 ← (volatile byte) plex_sprite_idx + (byte) 1
|
||||
[187] (byte~) plexShowSprite::$6 ← (byte~) plexShowSprite::$5 & (byte) 7
|
||||
[188] (volatile byte) plex_sprite_idx ← (byte~) plexShowSprite::$6
|
||||
[189] (volatile byte) plex_show_idx ← ++ (volatile byte) plex_show_idx
|
||||
[190] (volatile byte) plex_sprite_msb ← (volatile byte) plex_sprite_msb << (byte) 1
|
||||
[191] if((volatile byte) plex_sprite_msb!=(byte) 0) goto plexShowSprite::@return
|
||||
to:plexShowSprite::@4
|
||||
plexShowSprite::@4: scope:[plexShowSprite] from plexShowSprite::@2
|
||||
[192] (volatile byte) plex_sprite_msb ← (byte) 1
|
||||
to:plexShowSprite::@return
|
||||
plexShowSprite::@return: scope:[plexShowSprite] from plexShowSprite::@2 plexShowSprite::@4
|
||||
[193] return
|
||||
to:@return
|
||||
plexShowSprite::@1: scope:[plexShowSprite] from plexShowSprite::@5
|
||||
[194] *((const nomodify byte*) SPRITES_XMSB) ← *((const nomodify byte*) SPRITES_XMSB) | (volatile byte) plex_sprite_msb
|
||||
to:plexShowSprite::@2
|
7567
src/test/ref/complex/spritescroller/spritescroller.log
Normal file
7567
src/test/ref/complex/spritescroller/spritescroller.log
Normal file
File diff suppressed because it is too large
Load Diff
319
src/test/ref/complex/spritescroller/spritescroller.sym
Normal file
319
src/test/ref/complex/spritescroller/spritescroller.sym
Normal file
@ -0,0 +1,319 @@
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @4
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(const nomodify byte*) CHARGEN = (byte*) 53248
|
||||
(const nomodify byte*) CHARSET_DEFAULT = (byte*) 4096
|
||||
(const nomodify byte*) CIA1_INTERRUPT = (byte*) 56333
|
||||
(const nomodify byte) CIA_INTERRUPT_CLEAR = (byte) $7f
|
||||
(const nomodify byte*) D018 = (byte*) 53272
|
||||
(const nomodify byte*) FONT = (byte*) 8192
|
||||
(const nomodify byte*) IRQ_ENABLE = (byte*) 53274
|
||||
(const nomodify byte) IRQ_RASTER = (byte) 1
|
||||
(const nomodify byte*) IRQ_STATUS = (byte*) 53273
|
||||
(const nomodify void()**) KERNEL_IRQ = (void()**) 788
|
||||
(const nomodify byte) PLEX_COUNT = (byte) $20
|
||||
(const byte*) PLEX_FREE_YPOS[(number) 8] = { fill( 8, 0) }
|
||||
(const byte*) PLEX_PTR[(const nomodify byte) PLEX_COUNT] = { fill( PLEX_COUNT, 0) }
|
||||
(byte*) PLEX_SCREEN_PTR
|
||||
(const byte*) PLEX_SCREEN_PTR#0 PLEX_SCREEN_PTR = (byte*)(number) $400+(number) $3f8
|
||||
(const byte*) PLEX_SORTED_IDX[(const nomodify byte) PLEX_COUNT] = { fill( PLEX_COUNT, 0) }
|
||||
(const word*) PLEX_XPOS[(const nomodify byte) PLEX_COUNT] = { fill( PLEX_COUNT, 0) }
|
||||
(const byte*) PLEX_YPOS[(const nomodify byte) PLEX_COUNT] = { fill( PLEX_COUNT, 0) }
|
||||
(const nomodify byte*) PROCPORT = (byte*) 1
|
||||
(const nomodify byte) PROCPORT_BASIC_KERNEL_IO = (byte) 7
|
||||
(const nomodify byte) PROCPORT_RAM_CHARROM = (byte) 1
|
||||
(const nomodify byte*) RASTER = (byte*) 53266
|
||||
(const nomodify byte*) SCREEN = (byte*) 1024
|
||||
(const nomodify byte*) SPRITES = (byte*) 12288
|
||||
(const nomodify byte*) SPRITES_COLS = (byte*) 53287
|
||||
(const nomodify byte*) SPRITES_ENABLE = (byte*) 53269
|
||||
(const nomodify byte*) SPRITES_XMSB = (byte*) 53264
|
||||
(const nomodify byte*) SPRITES_XPOS = (byte*) 53248
|
||||
(const nomodify byte*) SPRITES_YPOS = (byte*) 53249
|
||||
(const nomodify byte*) VIC_CONTROL = (byte*) 53265
|
||||
(const nomodify byte) WHITE = (byte) 1
|
||||
(const byte*) YSIN[(number) $100] = kickasm {{ .fill $100, round(142+89.5*sin(toRadians(360*i/256)))
|
||||
}}
|
||||
(void()) font_2x2((byte*) font_2x2::font_original , (byte*) font_2x2::font_2x2)
|
||||
(byte~) font_2x2::$1 reg byte a 200002.0
|
||||
(byte~) font_2x2::$11 reg byte y 20002.0
|
||||
(byte~) font_2x2::$12 reg byte a 10001.0
|
||||
(byte~) font_2x2::$14 reg byte y 20002.0
|
||||
(byte~) font_2x2::$15 reg byte a 10001.0
|
||||
(word~) font_2x2::$5 zp[2]:15 200002.0
|
||||
(word~) font_2x2::$7 zp[2]:15 200002.0
|
||||
(label) font_2x2::@1
|
||||
(label) font_2x2::@2
|
||||
(label) font_2x2::@3
|
||||
(label) font_2x2::@4
|
||||
(label) font_2x2::@5
|
||||
(label) font_2x2::@6
|
||||
(label) font_2x2::@7
|
||||
(label) font_2x2::@8
|
||||
(label) font_2x2::@9
|
||||
(label) font_2x2::@return
|
||||
(byte) font_2x2::b
|
||||
(byte) font_2x2::b#1 reg byte y 150001.5
|
||||
(byte) font_2x2::b#2 reg byte y 20000.2
|
||||
(byte) font_2x2::c
|
||||
(byte) font_2x2::c#1 c zp[1]:10 1501.5
|
||||
(byte) font_2x2::c#11 c zp[1]:10 58.88235294117647
|
||||
(byte*) font_2x2::font_2x2
|
||||
(byte*) font_2x2::font_original
|
||||
(byte) font_2x2::glyph_bit
|
||||
(byte) font_2x2::glyph_bit#0 reg byte x 50000.5
|
||||
(byte) font_2x2::glyph_bits
|
||||
(byte) font_2x2::glyph_bits#0 glyph_bits zp[1]:24 20002.0
|
||||
(byte) font_2x2::glyph_bits#1 glyph_bits zp[1]:24 66667.33333333333
|
||||
(byte) font_2x2::glyph_bits#2 glyph_bits zp[1]:24 34444.88888888889
|
||||
(word) font_2x2::glyph_bits_2x2
|
||||
(word) font_2x2::glyph_bits_2x2#1 glyph_bits_2x2 zp[2]:15 200002.0
|
||||
(word) font_2x2::glyph_bits_2x2#2 glyph_bits_2x2 zp[2]:15 27500.5
|
||||
(word) font_2x2::glyph_bits_2x2#3 glyph_bits_2x2 zp[2]:15 40000.4
|
||||
(byte) font_2x2::l
|
||||
(byte) font_2x2::l#1 l zp[1]:22 15001.5
|
||||
(byte) font_2x2::l#2 l zp[1]:22 1111.2222222222222
|
||||
(byte) font_2x2::l2
|
||||
(byte) font_2x2::l2#1 l2 zp[1]:23 15001.5
|
||||
(byte) font_2x2::l2#8 l2 zp[1]:23 2727.5454545454545
|
||||
(byte) font_2x2::l2#9 l2 zp[1]:23 6667.333333333333
|
||||
(byte*) font_2x2::next_2x2
|
||||
(byte*) font_2x2::next_2x2#1 next_2x2 zp[2]:6 500.5
|
||||
(byte*) font_2x2::next_2x2_left
|
||||
(byte*) font_2x2::next_2x2_left#0 next_2x2_left zp[2]:6 750.1875
|
||||
(byte*) font_2x2::next_2x2_left#1 next_2x2_left_1 zp[2]:11 10001.0
|
||||
(byte*) font_2x2::next_2x2_left#10 next_2x2_left_1 zp[2]:11 2002.0
|
||||
(byte*) font_2x2::next_2x2_left#7 next_2x2_left_1 zp[2]:11 1708.5416666666665
|
||||
(byte*) font_2x2::next_2x2_left#8 next_2x2_left_1 zp[2]:11 10001.0
|
||||
(byte*) font_2x2::next_2x2_right
|
||||
(byte*) font_2x2::next_2x2_right#0 next_2x2_right zp[2]:13 1001.0
|
||||
(byte*) font_2x2::next_2x2_right#1 next_2x2_right zp[2]:13 20002.0
|
||||
(byte*) font_2x2::next_2x2_right#7 next_2x2_right zp[2]:13 1708.5416666666665
|
||||
(byte*) font_2x2::next_2x2_right#8 next_2x2_right zp[2]:13 10001.0
|
||||
(byte*) font_2x2::next_original
|
||||
(byte*) font_2x2::next_original#1 next_original zp[2]:8 667.3333333333334
|
||||
(byte*) font_2x2::next_original#4 next_original zp[2]:8 363.7272727272727
|
||||
(void()) font_2x2_to_sprites((byte*) font_2x2_to_sprites::font_2x2 , (byte*) font_2x2_to_sprites::sprites , (byte) font_2x2_to_sprites::num_chars)
|
||||
(byte~) font_2x2_to_sprites::$3 zp[1]:24 10001.0
|
||||
(label) font_2x2_to_sprites::@1
|
||||
(label) font_2x2_to_sprites::@2
|
||||
(label) font_2x2_to_sprites::@3
|
||||
(label) font_2x2_to_sprites::@4
|
||||
(label) font_2x2_to_sprites::@5
|
||||
(label) font_2x2_to_sprites::@6
|
||||
(label) font_2x2_to_sprites::@7
|
||||
(label) font_2x2_to_sprites::@8
|
||||
(label) font_2x2_to_sprites::@return
|
||||
(byte) font_2x2_to_sprites::c
|
||||
(byte) font_2x2_to_sprites::c#1 c zp[1]:5 2002.0
|
||||
(byte) font_2x2_to_sprites::c#2 c zp[1]:5 136.5
|
||||
(byte*) font_2x2_to_sprites::char_current
|
||||
(byte*) font_2x2_to_sprites::char_current#1 char_current zp[2]:6 667.3333333333334
|
||||
(byte*) font_2x2_to_sprites::char_current#2 char_current zp[2]:6 1200.3
|
||||
(byte*) font_2x2_to_sprites::char_left
|
||||
(byte*) font_2x2_to_sprites::char_left#1 char_left zp[2]:11 10001.0
|
||||
(byte*) font_2x2_to_sprites::char_left#3 char_left zp[2]:11 2818.5454545454545
|
||||
(byte*) font_2x2_to_sprites::char_left#4 char_left zp[2]:11 10001.0
|
||||
(byte*) font_2x2_to_sprites::char_left#6 char_left zp[2]:11 2002.0
|
||||
(byte*) font_2x2_to_sprites::char_right
|
||||
(byte*) font_2x2_to_sprites::char_right#0 char_right zp[2]:13 1001.0
|
||||
(byte*) font_2x2_to_sprites::char_right#1 char_right zp[2]:13 20002.0
|
||||
(byte*) font_2x2_to_sprites::char_right#3 char_right zp[2]:13 2818.5454545454545
|
||||
(byte*) font_2x2_to_sprites::char_right#4 char_right zp[2]:13 10001.0
|
||||
(byte*) font_2x2_to_sprites::font_2x2
|
||||
(byte) font_2x2_to_sprites::i
|
||||
(byte) font_2x2_to_sprites::i#1 reg byte x 15001.5
|
||||
(byte) font_2x2_to_sprites::i#2 reg byte x 3571.7857142857147
|
||||
(byte) font_2x2_to_sprites::num_chars
|
||||
(const byte) font_2x2_to_sprites::num_chars#0 num_chars = (byte) $40
|
||||
(byte*) font_2x2_to_sprites::sprite
|
||||
(byte*) font_2x2_to_sprites::sprite#1 sprite zp[2]:8 1001.0
|
||||
(byte*) font_2x2_to_sprites::sprite#4 sprite zp[2]:8 1524.047619047619
|
||||
(byte) font_2x2_to_sprites::sprite_idx
|
||||
(byte) font_2x2_to_sprites::sprite_idx#1 sprite_idx zp[1]:10 15001.5
|
||||
(byte) font_2x2_to_sprites::sprite_idx#2 reg byte y 15001.5
|
||||
(byte) font_2x2_to_sprites::sprite_idx#3 sprite_idx zp[1]:10 2222.4444444444443
|
||||
(byte) font_2x2_to_sprites::sprite_idx#4 sprite_idx zp[1]:10 10001.0
|
||||
(byte*) font_2x2_to_sprites::sprites
|
||||
(volatile bool) framedone loadstore zp[1]:21 27.65
|
||||
(void()) main()
|
||||
(byte~) main::$12 reg byte a 202.0
|
||||
(label) main::@1
|
||||
(label) main::@10
|
||||
(label) main::@11
|
||||
(label) main::@12
|
||||
(label) main::@13
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@7
|
||||
(label) main::@8
|
||||
(label) main::@9
|
||||
(byte) main::s
|
||||
(byte) main::s#1 reg byte x 151.5
|
||||
(byte) main::s#2 reg byte x 67.33333333333333
|
||||
(byte) main::s1
|
||||
(byte) main::s1#1 reg byte x 151.5
|
||||
(byte) main::s1#2 reg byte x 151.5
|
||||
(byte) main::sprite
|
||||
(byte) main::sprite#1 sprite zp[1]:4 33.666666666666664
|
||||
(byte) main::sprite#2 sprite zp[1]:4 151.5
|
||||
(label) main::toD0181
|
||||
(byte*) main::toD0181_gfx
|
||||
(byte) main::toD0181_return
|
||||
(const byte) main::toD0181_return#0 toD0181_return = >(word)(const nomodify byte*) SCREEN&(word) $3fff*(byte) 4|>(word)(const nomodify byte*) CHARSET_DEFAULT/(byte) 4&(byte) $f
|
||||
(byte*) main::toD0181_screen
|
||||
(label) main::toSpritePtr1
|
||||
(byte) main::toSpritePtr1_return
|
||||
(const byte) main::toSpritePtr1_return#0 toSpritePtr1_return = (byte)(word)(const nomodify byte*) SPRITES/(byte) $40
|
||||
(byte*) main::toSpritePtr1_sprite
|
||||
(word) main::xp
|
||||
(word) main::xp#1 xp zp[2]:2 67.33333333333333
|
||||
(word) main::xp#2 xp zp[2]:2 60.599999999999994
|
||||
(void()) plexInit((byte*) plexInit::screen)
|
||||
(label) plexInit::@1
|
||||
(label) plexInit::@return
|
||||
(byte) plexInit::i
|
||||
(byte) plexInit::i#1 reg byte x 1501.5
|
||||
(byte) plexInit::i#2 reg byte x 2002.0
|
||||
(label) plexInit::plexSetScreen1
|
||||
(byte*) plexInit::plexSetScreen1_screen
|
||||
(byte*) plexInit::screen
|
||||
(void()) plexShowSprite()
|
||||
(byte~) plexShowSprite::$11 reg byte x 101.0
|
||||
(byte~) plexShowSprite::$2 reg byte a 202.0
|
||||
(byte~) plexShowSprite::$3 reg byte a 202.0
|
||||
(byte~) plexShowSprite::$5 reg byte x 202.0
|
||||
(byte~) plexShowSprite::$6 reg byte a 202.0
|
||||
(byte~) plexShowSprite::$9 reg byte a 202.0
|
||||
(label) plexShowSprite::@1
|
||||
(label) plexShowSprite::@2
|
||||
(label) plexShowSprite::@3
|
||||
(label) plexShowSprite::@4
|
||||
(label) plexShowSprite::@5
|
||||
(label) plexShowSprite::@return
|
||||
(label) plexShowSprite::plexFreeAdd1
|
||||
(byte~) plexShowSprite::plexFreeAdd1_$0 reg byte a 202.0
|
||||
(byte~) plexShowSprite::plexFreeAdd1_$1 reg byte a 202.0
|
||||
(byte~) plexShowSprite::plexFreeAdd1_$2 reg byte a 202.0
|
||||
(byte) plexShowSprite::plexFreeAdd1_ypos
|
||||
(byte) plexShowSprite::plexFreeAdd1_ypos#0 reg byte a 151.5
|
||||
(byte) plexShowSprite::plex_sprite_idx2
|
||||
(byte) plexShowSprite::plex_sprite_idx2#0 plex_sprite_idx2 zp[1]:26 25.25
|
||||
(byte) plexShowSprite::xpos_idx
|
||||
(byte) plexShowSprite::xpos_idx#0 reg byte a 202.0
|
||||
(byte) plexShowSprite::ypos
|
||||
(void()) plexSine()
|
||||
(label) plexSine::@1
|
||||
(label) plexSine::@2
|
||||
(label) plexSine::@return
|
||||
(byte) plexSine::sy
|
||||
(byte) plexSine::sy#1 reg byte y 150001.5
|
||||
(byte) plexSine::sy#2 reg byte y 100001.0
|
||||
(byte) plexSine::y_idx
|
||||
(byte) plexSine::y_idx#0 reg byte x 2002.0
|
||||
(byte) plexSine::y_idx#1 reg byte x 66667.33333333333
|
||||
(byte) plexSine::y_idx#2 reg byte x 150502.0
|
||||
(void()) plexSort()
|
||||
(label) plexSort::@1
|
||||
(label) plexSort::@2
|
||||
(label) plexSort::@3
|
||||
(label) plexSort::@4
|
||||
(label) plexSort::@5
|
||||
(label) plexSort::@6
|
||||
(label) plexSort::@7
|
||||
(label) plexSort::@return
|
||||
(byte) plexSort::m
|
||||
(byte) plexSort::m#1 m zp[1]:5 150001.5
|
||||
(byte) plexSort::m#2 m zp[1]:5 41667.08333333333
|
||||
(byte) plexSort::nxt_idx
|
||||
(byte) plexSort::nxt_idx#0 nxt_idx zp[1]:22 30000.300000000003
|
||||
(byte) plexSort::nxt_y
|
||||
(byte) plexSort::nxt_y#0 nxt_y zp[1]:23 150000.375
|
||||
(label) plexSort::plexFreePrepare1
|
||||
(label) plexSort::plexFreePrepare1_@1
|
||||
(label) plexSort::plexFreePrepare1_@2
|
||||
(byte) plexSort::plexFreePrepare1_s
|
||||
(byte) plexSort::plexFreePrepare1_s#1 reg byte x 150001.5
|
||||
(byte) plexSort::plexFreePrepare1_s#2 reg byte x 150001.5
|
||||
(byte) plexSort::s
|
||||
(byte) plexSort::s#1 reg byte x 1366668.3333333335
|
||||
(byte) plexSort::s#2 reg byte x 200002.0
|
||||
(byte) plexSort::s#3 reg byte x 2050002.5
|
||||
(byte) plexSort::s#6 reg byte x 200002.0
|
||||
(volatile byte) plex_free_next loadstore zp[1]:20 42.48387096774193
|
||||
interrupt(KERNEL_MIN)(void()) plex_irq()
|
||||
(byte~) plex_irq::$4 zp[1]:25 11.0
|
||||
(label) plex_irq::@1
|
||||
(label) plex_irq::@2
|
||||
(label) plex_irq::@3
|
||||
(label) plex_irq::@4
|
||||
(label) plex_irq::@5
|
||||
(label) plex_irq::@6
|
||||
(label) plex_irq::@7
|
||||
(label) plex_irq::@return
|
||||
(label) plex_irq::plexFreeNextYpos1
|
||||
(byte) plex_irq::plexFreeNextYpos1_return
|
||||
(byte) plex_irq::plexFreeNextYpos1_return#0 reg byte x 4.800000000000001
|
||||
(byte) plex_irq::rasterY
|
||||
(volatile byte) plex_show_idx loadstore zp[1]:17 46.0909090909091
|
||||
(volatile byte) plex_sprite_idx loadstore zp[1]:18 45.387096774193544
|
||||
(volatile byte) plex_sprite_msb loadstore zp[1]:19 48.757575757575765
|
||||
(byte) sin_idx
|
||||
(byte) sin_idx#10 sin_idx zp[1]:4 300.42857142857144
|
||||
(byte) sin_idx#12 sin_idx zp[1]:4 58.0
|
||||
|
||||
reg byte x [ main::s#2 main::s#1 ]
|
||||
zp[2]:2 [ main::xp#2 main::xp#1 ]
|
||||
reg byte x [ main::s1#2 main::s1#1 ]
|
||||
reg byte x [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
|
||||
reg byte x [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
|
||||
zp[1]:4 [ sin_idx#10 sin_idx#12 main::sprite#2 main::sprite#1 ]
|
||||
reg byte x [ plexSine::y_idx#2 plexSine::y_idx#0 plexSine::y_idx#1 ]
|
||||
reg byte y [ plexSine::sy#2 plexSine::sy#1 ]
|
||||
reg byte x [ plexInit::i#2 plexInit::i#1 ]
|
||||
zp[1]:5 [ font_2x2_to_sprites::c#2 font_2x2_to_sprites::c#1 plexSort::m#2 plexSort::m#1 ]
|
||||
reg byte x [ font_2x2_to_sprites::i#2 font_2x2_to_sprites::i#1 ]
|
||||
zp[2]:6 [ font_2x2::next_2x2_left#0 font_2x2::next_2x2#1 font_2x2_to_sprites::char_current#2 font_2x2_to_sprites::char_current#1 ]
|
||||
zp[2]:8 [ font_2x2::next_original#4 font_2x2::next_original#1 font_2x2_to_sprites::sprite#4 font_2x2_to_sprites::sprite#1 ]
|
||||
zp[1]:10 [ font_2x2::c#11 font_2x2::c#1 font_2x2_to_sprites::sprite_idx#4 font_2x2_to_sprites::sprite_idx#3 font_2x2_to_sprites::sprite_idx#1 ]
|
||||
zp[2]:11 [ font_2x2::next_2x2_left#7 font_2x2::next_2x2_left#10 font_2x2::next_2x2_left#8 font_2x2::next_2x2_left#1 font_2x2_to_sprites::char_left#3 font_2x2_to_sprites::char_left#6 font_2x2_to_sprites::char_left#4 font_2x2_to_sprites::char_left#1 ]
|
||||
zp[2]:13 [ font_2x2::next_2x2_right#7 font_2x2::next_2x2_right#0 font_2x2::next_2x2_right#8 font_2x2::next_2x2_right#1 font_2x2_to_sprites::char_right#3 font_2x2_to_sprites::char_right#0 font_2x2_to_sprites::char_right#4 font_2x2_to_sprites::char_right#1 ]
|
||||
zp[2]:15 [ font_2x2::glyph_bits_2x2#3 font_2x2::glyph_bits_2x2#2 font_2x2::$5 font_2x2::$7 font_2x2::glyph_bits_2x2#1 ]
|
||||
reg byte y [ font_2x2::b#2 font_2x2::b#1 ]
|
||||
reg byte x [ font_2x2::glyph_bit#0 ]
|
||||
zp[1]:17 [ plex_show_idx ]
|
||||
zp[1]:18 [ plex_sprite_idx ]
|
||||
zp[1]:19 [ plex_sprite_msb ]
|
||||
zp[1]:20 [ plex_free_next ]
|
||||
zp[1]:21 [ framedone ]
|
||||
reg byte a [ main::$12 ]
|
||||
zp[1]:22 [ plexSort::nxt_idx#0 font_2x2::l#2 font_2x2::l#1 ]
|
||||
zp[1]:23 [ plexSort::nxt_y#0 font_2x2::l2#8 font_2x2::l2#9 font_2x2::l2#1 ]
|
||||
reg byte x [ plexSort::s#2 ]
|
||||
zp[1]:24 [ font_2x2_to_sprites::$3 font_2x2::glyph_bits#2 font_2x2::glyph_bits#0 font_2x2::glyph_bits#1 ]
|
||||
reg byte y [ font_2x2_to_sprites::sprite_idx#2 ]
|
||||
reg byte a [ font_2x2::$1 ]
|
||||
reg byte a [ font_2x2::$12 ]
|
||||
reg byte y [ font_2x2::$11 ]
|
||||
reg byte a [ font_2x2::$15 ]
|
||||
reg byte y [ font_2x2::$14 ]
|
||||
reg byte x [ plex_irq::plexFreeNextYpos1_return#0 ]
|
||||
zp[1]:25 [ plex_irq::$4 ]
|
||||
zp[1]:26 [ plexShowSprite::plex_sprite_idx2#0 ]
|
||||
reg byte a [ plexShowSprite::plexFreeAdd1_ypos#0 ]
|
||||
reg byte a [ plexShowSprite::plexFreeAdd1_$0 ]
|
||||
reg byte a [ plexShowSprite::plexFreeAdd1_$1 ]
|
||||
reg byte a [ plexShowSprite::plexFreeAdd1_$2 ]
|
||||
reg byte a [ plexShowSprite::xpos_idx#0 ]
|
||||
reg byte x [ plexShowSprite::$11 ]
|
||||
reg byte a [ plexShowSprite::$2 ]
|
||||
reg byte a [ plexShowSprite::$3 ]
|
||||
reg byte a [ plexShowSprite::$9 ]
|
||||
reg byte x [ plexShowSprite::$5 ]
|
||||
reg byte a [ plexShowSprite::$6 ]
|
@ -254,7 +254,7 @@ plexSort: {
|
||||
lda.z nxt_idx
|
||||
sta PLEX_SORTED_IDX,x
|
||||
__b2:
|
||||
// for(byte m: 0..PLEX_COUNT-2)
|
||||
// for(char m: 0..PLEX_COUNT-2)
|
||||
inc.z m
|
||||
lda #PLEX_COUNT-2+1
|
||||
cmp.z m
|
||||
@ -264,7 +264,7 @@ plexSort: {
|
||||
// PLEX_FREE_YPOS[s] = 0
|
||||
lda #0
|
||||
sta PLEX_FREE_YPOS,x
|
||||
// for( byte s: 0..7)
|
||||
// for( char s: 0..7)
|
||||
inx
|
||||
cpx #8
|
||||
bne plexFreePrepare1___b1
|
||||
@ -333,7 +333,7 @@ plexInit: {
|
||||
// PLEX_SORTED_IDX[i] = i
|
||||
txa
|
||||
sta PLEX_SORTED_IDX,x
|
||||
// for(byte i: 0..PLEX_COUNT-1)
|
||||
// for(char i: 0..PLEX_COUNT-1)
|
||||
inx
|
||||
cpx #PLEX_COUNT-1+1
|
||||
bne __b1
|
||||
|
@ -4218,7 +4218,7 @@ plexSort: {
|
||||
sta PLEX_SORTED_IDX,x
|
||||
// plexSort::@2
|
||||
__b2:
|
||||
// for(byte m: 0..PLEX_COUNT-2)
|
||||
// for(char m: 0..PLEX_COUNT-2)
|
||||
// [73] (byte) plexSort::m#1 ← ++ (byte) plexSort::m#2 -- vbuz1=_inc_vbuz1
|
||||
inc.z m
|
||||
// [74] if((byte) plexSort::m#1!=(const nomodify byte) PLEX_COUNT-(byte) 2+(byte) 1) goto plexSort::@1 -- vbuz1_neq_vbuc1_then_la1
|
||||
@ -4238,7 +4238,7 @@ plexSort: {
|
||||
// [77] *((const byte*) PLEX_FREE_YPOS + (byte) plexSort::plexFreePrepare1_s#2) ← (byte) 0 -- pbuc1_derefidx_vbuxx=vbuc2
|
||||
lda #0
|
||||
sta PLEX_FREE_YPOS,x
|
||||
// for( byte s: 0..7)
|
||||
// for( char s: 0..7)
|
||||
// [78] (byte) plexSort::plexFreePrepare1_s#1 ← ++ (byte) plexSort::plexFreePrepare1_s#2 -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
// [79] if((byte) plexSort::plexFreePrepare1_s#1!=(byte) 8) goto plexSort::plexFreePrepare1_@1 -- vbuxx_neq_vbuc1_then_la1
|
||||
@ -4349,7 +4349,7 @@ plexInit: {
|
||||
// [99] *((const byte*) PLEX_SORTED_IDX + (byte) plexInit::i#2) ← (byte) plexInit::i#2 -- pbuc1_derefidx_vbuxx=vbuxx
|
||||
txa
|
||||
sta PLEX_SORTED_IDX,x
|
||||
// for(byte i: 0..PLEX_COUNT-1)
|
||||
// for(char i: 0..PLEX_COUNT-1)
|
||||
// [100] (byte) plexInit::i#1 ← ++ (byte) plexInit::i#2 -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
// [101] if((byte) plexInit::i#1!=(const nomodify byte) PLEX_COUNT-(byte) 1+(byte) 1) goto plexInit::@1 -- vbuxx_neq_vbuc1_then_la1
|
||||
|
@ -109,13 +109,6 @@ loop: {
|
||||
// framedone = false
|
||||
lda #0
|
||||
sta.z framedone
|
||||
// *VIC_CONTROL &=0x7f
|
||||
lda #$7f
|
||||
and VIC_CONTROL
|
||||
sta VIC_CONTROL
|
||||
// *RASTER = 0x0
|
||||
lda #0
|
||||
sta RASTER
|
||||
jmp __b2
|
||||
}
|
||||
// Ensure that the indices in PLEX_SORTED_IDX is sorted based on the y-positions in PLEX_YPOS
|
||||
@ -263,6 +256,13 @@ init: {
|
||||
sta KERNEL_IRQ
|
||||
lda #>plex_irq
|
||||
sta KERNEL_IRQ+1
|
||||
// *VIC_CONTROL &=0x7f
|
||||
lda #$7f
|
||||
and VIC_CONTROL
|
||||
sta VIC_CONTROL
|
||||
// *RASTER = 0x0
|
||||
lda #0
|
||||
sta RASTER
|
||||
// asm
|
||||
cli
|
||||
// }
|
||||
@ -284,6 +284,8 @@ plexInit: {
|
||||
}
|
||||
plex_irq: {
|
||||
.label __4 = $d
|
||||
// asm
|
||||
sei
|
||||
// *BORDERCOL = WHITE
|
||||
lda #WHITE
|
||||
sta BORDERCOL
|
||||
@ -312,6 +314,9 @@ plex_irq: {
|
||||
lda.z plex_show_idx
|
||||
cmp #PLEX_COUNT
|
||||
bcc __b1
|
||||
// *RASTER = 0
|
||||
lda #0
|
||||
sta RASTER
|
||||
// framedone = true
|
||||
lda #1
|
||||
sta.z framedone
|
||||
@ -319,6 +324,8 @@ plex_irq: {
|
||||
// *BORDERCOL = 0
|
||||
lda #0
|
||||
sta BORDERCOL
|
||||
// asm
|
||||
cli
|
||||
// }
|
||||
jmp $ea81
|
||||
__b1:
|
||||
|
@ -62,91 +62,91 @@ loop::@5: scope:[loop] from loop::@4
|
||||
loop::@6: scope:[loop] from loop::@5
|
||||
[27] *((const nomodify byte*) BORDERCOL) ← (const nomodify byte) GREEN
|
||||
[28] (volatile bool) framedone ← false
|
||||
[29] *((const nomodify byte*) VIC_CONTROL) ← *((const nomodify byte*) VIC_CONTROL) & (byte) $7f
|
||||
[30] *((const nomodify byte*) RASTER) ← (byte) 0
|
||||
to:loop::@1
|
||||
|
||||
(void()) plexSort()
|
||||
plexSort: scope:[plexSort] from loop::@5
|
||||
[31] phi()
|
||||
[29] phi()
|
||||
to:plexSort::@1
|
||||
plexSort::@1: scope:[plexSort] from plexSort plexSort::@2
|
||||
[32] (byte) plexSort::m#2 ← phi( plexSort/(byte) 0 plexSort::@2/(byte) plexSort::m#1 )
|
||||
[33] (byte) plexSort::nxt_idx#0 ← *((const byte*) PLEX_SORTED_IDX+(byte) 1 + (byte) plexSort::m#2)
|
||||
[34] (byte) plexSort::nxt_y#0 ← *((const byte*) PLEX_YPOS + (byte) plexSort::nxt_idx#0)
|
||||
[35] if((byte) plexSort::nxt_y#0>=*((const byte*) PLEX_YPOS + *((const byte*) PLEX_SORTED_IDX + (byte) plexSort::m#2))) goto plexSort::@2
|
||||
[30] (byte) plexSort::m#2 ← phi( plexSort/(byte) 0 plexSort::@2/(byte) plexSort::m#1 )
|
||||
[31] (byte) plexSort::nxt_idx#0 ← *((const byte*) PLEX_SORTED_IDX+(byte) 1 + (byte) plexSort::m#2)
|
||||
[32] (byte) plexSort::nxt_y#0 ← *((const byte*) PLEX_YPOS + (byte) plexSort::nxt_idx#0)
|
||||
[33] if((byte) plexSort::nxt_y#0>=*((const byte*) PLEX_YPOS + *((const byte*) PLEX_SORTED_IDX + (byte) plexSort::m#2))) goto plexSort::@2
|
||||
to:plexSort::@5
|
||||
plexSort::@5: scope:[plexSort] from plexSort::@1
|
||||
[36] (byte) plexSort::s#6 ← (byte) plexSort::m#2
|
||||
[34] (byte) plexSort::s#6 ← (byte) plexSort::m#2
|
||||
to:plexSort::@3
|
||||
plexSort::@3: scope:[plexSort] from plexSort::@5 plexSort::@7
|
||||
[37] (byte) plexSort::s#3 ← phi( plexSort::@7/(byte) plexSort::s#1 plexSort::@5/(byte) plexSort::s#6 )
|
||||
[38] *((const byte*) PLEX_SORTED_IDX+(byte) 1 + (byte) plexSort::s#3) ← *((const byte*) PLEX_SORTED_IDX + (byte) plexSort::s#3)
|
||||
[39] (byte) plexSort::s#1 ← -- (byte) plexSort::s#3
|
||||
[40] if((byte) plexSort::s#1==(byte) $ff) goto plexSort::@4
|
||||
[35] (byte) plexSort::s#3 ← phi( plexSort::@7/(byte) plexSort::s#1 plexSort::@5/(byte) plexSort::s#6 )
|
||||
[36] *((const byte*) PLEX_SORTED_IDX+(byte) 1 + (byte) plexSort::s#3) ← *((const byte*) PLEX_SORTED_IDX + (byte) plexSort::s#3)
|
||||
[37] (byte) plexSort::s#1 ← -- (byte) plexSort::s#3
|
||||
[38] if((byte) plexSort::s#1==(byte) $ff) goto plexSort::@4
|
||||
to:plexSort::@7
|
||||
plexSort::@7: scope:[plexSort] from plexSort::@3
|
||||
[41] if((byte) plexSort::nxt_y#0<*((const byte*) PLEX_YPOS + *((const byte*) PLEX_SORTED_IDX + (byte) plexSort::s#1))) goto plexSort::@3
|
||||
[39] if((byte) plexSort::nxt_y#0<*((const byte*) PLEX_YPOS + *((const byte*) PLEX_SORTED_IDX + (byte) plexSort::s#1))) goto plexSort::@3
|
||||
to:plexSort::@4
|
||||
plexSort::@4: scope:[plexSort] from plexSort::@3 plexSort::@7
|
||||
[42] (byte) plexSort::s#2 ← ++ (byte) plexSort::s#1
|
||||
[43] *((const byte*) PLEX_SORTED_IDX + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0
|
||||
[40] (byte) plexSort::s#2 ← ++ (byte) plexSort::s#1
|
||||
[41] *((const byte*) PLEX_SORTED_IDX + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0
|
||||
to:plexSort::@2
|
||||
plexSort::@2: scope:[plexSort] from plexSort::@1 plexSort::@4
|
||||
[44] (byte) plexSort::m#1 ← ++ (byte) plexSort::m#2
|
||||
[45] if((byte) plexSort::m#1!=(const nomodify byte) PLEX_COUNT-(byte) 2+(byte) 1) goto plexSort::@1
|
||||
[42] (byte) plexSort::m#1 ← ++ (byte) plexSort::m#2
|
||||
[43] if((byte) plexSort::m#1!=(const nomodify byte) PLEX_COUNT-(byte) 2+(byte) 1) goto plexSort::@1
|
||||
to:plexSort::@6
|
||||
plexSort::@6: scope:[plexSort] from plexSort::@2
|
||||
[46] (volatile byte) plex_show_idx ← (byte) 0
|
||||
[47] (volatile byte) plex_sprite_idx ← (byte) 0
|
||||
[48] (volatile byte) plex_sprite_msb ← (byte) 1
|
||||
[44] (volatile byte) plex_show_idx ← (byte) 0
|
||||
[45] (volatile byte) plex_sprite_idx ← (byte) 0
|
||||
[46] (volatile byte) plex_sprite_msb ← (byte) 1
|
||||
to:plexSort::plexFreePrepare1
|
||||
plexSort::plexFreePrepare1: scope:[plexSort] from plexSort::@6
|
||||
[49] phi()
|
||||
[47] phi()
|
||||
to:plexSort::plexFreePrepare1_@1
|
||||
plexSort::plexFreePrepare1_@1: scope:[plexSort] from plexSort::plexFreePrepare1 plexSort::plexFreePrepare1_@1
|
||||
[50] (byte) plexSort::plexFreePrepare1_s#2 ← phi( plexSort::plexFreePrepare1/(byte) 0 plexSort::plexFreePrepare1_@1/(byte) plexSort::plexFreePrepare1_s#1 )
|
||||
[51] *((const byte*) PLEX_FREE_YPOS + (byte) plexSort::plexFreePrepare1_s#2) ← (byte) 0
|
||||
[52] (byte) plexSort::plexFreePrepare1_s#1 ← ++ (byte) plexSort::plexFreePrepare1_s#2
|
||||
[53] if((byte) plexSort::plexFreePrepare1_s#1!=(byte) 8) goto plexSort::plexFreePrepare1_@1
|
||||
[48] (byte) plexSort::plexFreePrepare1_s#2 ← phi( plexSort::plexFreePrepare1/(byte) 0 plexSort::plexFreePrepare1_@1/(byte) plexSort::plexFreePrepare1_s#1 )
|
||||
[49] *((const byte*) PLEX_FREE_YPOS + (byte) plexSort::plexFreePrepare1_s#2) ← (byte) 0
|
||||
[50] (byte) plexSort::plexFreePrepare1_s#1 ← ++ (byte) plexSort::plexFreePrepare1_s#2
|
||||
[51] if((byte) plexSort::plexFreePrepare1_s#1!=(byte) 8) goto plexSort::plexFreePrepare1_@1
|
||||
to:plexSort::plexFreePrepare1_@2
|
||||
plexSort::plexFreePrepare1_@2: scope:[plexSort] from plexSort::plexFreePrepare1_@1
|
||||
[54] (volatile byte) plex_free_next ← (byte) 0
|
||||
[52] (volatile byte) plex_free_next ← (byte) 0
|
||||
to:plexSort::@return
|
||||
plexSort::@return: scope:[plexSort] from plexSort::plexFreePrepare1_@2
|
||||
[55] return
|
||||
[53] return
|
||||
to:@return
|
||||
|
||||
(void()) init()
|
||||
init: scope:[init] from main
|
||||
[56] *((const nomodify byte*) D011) ← (const nomodify byte) VIC_DEN|(const nomodify byte) VIC_RSEL|(byte) 3
|
||||
[57] call plexInit
|
||||
[54] *((const nomodify byte*) D011) ← (const nomodify byte) VIC_DEN|(const nomodify byte) VIC_RSEL|(byte) 3
|
||||
[55] call plexInit
|
||||
to:init::@1
|
||||
init::@1: scope:[init] from init init::@1
|
||||
[58] (word) init::xp#2 ← phi( init::@1/(word) init::xp#1 init/(word) $20 )
|
||||
[58] (byte) init::sx#2 ← phi( init::@1/(byte) init::sx#1 init/(byte) 0 )
|
||||
[59] *((const byte*) PLEX_PTR + (byte) init::sx#2) ← (byte)(const byte*) SPRITE/(byte) $40
|
||||
[60] (byte~) init::$3 ← (byte) init::sx#2 << (byte) 1
|
||||
[61] *((const word*) PLEX_XPOS + (byte~) init::$3) ← (word) init::xp#2
|
||||
[62] (word) init::xp#1 ← (word) init::xp#2 + (byte) 9
|
||||
[63] (byte) init::sx#1 ← ++ (byte) init::sx#2
|
||||
[64] if((byte) init::sx#1!=(const nomodify byte) PLEX_COUNT-(byte) 1+(byte) 1) goto init::@1
|
||||
[56] (word) init::xp#2 ← phi( init::@1/(word) init::xp#1 init/(word) $20 )
|
||||
[56] (byte) init::sx#2 ← phi( init::@1/(byte) init::sx#1 init/(byte) 0 )
|
||||
[57] *((const byte*) PLEX_PTR + (byte) init::sx#2) ← (byte)(const byte*) SPRITE/(byte) $40
|
||||
[58] (byte~) init::$3 ← (byte) init::sx#2 << (byte) 1
|
||||
[59] *((const word*) PLEX_XPOS + (byte~) init::$3) ← (word) init::xp#2
|
||||
[60] (word) init::xp#1 ← (word) init::xp#2 + (byte) 9
|
||||
[61] (byte) init::sx#1 ← ++ (byte) init::sx#2
|
||||
[62] if((byte) init::sx#1!=(const nomodify byte) PLEX_COUNT-(byte) 1+(byte) 1) goto init::@1
|
||||
to:init::@2
|
||||
init::@2: scope:[init] from init::@1
|
||||
[65] *((const nomodify byte*) SPRITES_ENABLE) ← (byte) $ff
|
||||
[63] *((const nomodify byte*) SPRITES_ENABLE) ← (byte) $ff
|
||||
to:init::@3
|
||||
init::@3: scope:[init] from init::@2 init::@3
|
||||
[66] (byte) init::ss#2 ← phi( init::@2/(byte) 0 init::@3/(byte) init::ss#1 )
|
||||
[67] *((const nomodify byte*) SPRITES_COLS + (byte) init::ss#2) ← (const nomodify byte) GREEN
|
||||
[68] (byte) init::ss#1 ← ++ (byte) init::ss#2
|
||||
[69] if((byte) init::ss#1!=(byte) 8) goto init::@3
|
||||
[64] (byte) init::ss#2 ← phi( init::@2/(byte) 0 init::@3/(byte) init::ss#1 )
|
||||
[65] *((const nomodify byte*) SPRITES_COLS + (byte) init::ss#2) ← (const nomodify byte) GREEN
|
||||
[66] (byte) init::ss#1 ← ++ (byte) init::ss#2
|
||||
[67] if((byte) init::ss#1!=(byte) 8) goto init::@3
|
||||
to:init::@4
|
||||
init::@4: scope:[init] from init::@3
|
||||
asm { sei }
|
||||
[71] *((const nomodify byte*) CIA1_INTERRUPT) ← (const nomodify byte) CIA_INTERRUPT_CLEAR
|
||||
[72] *((const nomodify byte*) IRQ_ENABLE) ← (const nomodify byte) IRQ_RASTER
|
||||
[73] *((const nomodify byte*) IRQ_STATUS) ← (const nomodify byte) IRQ_RASTER
|
||||
[74] *((const nomodify void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) plex_irq()
|
||||
[69] *((const nomodify byte*) CIA1_INTERRUPT) ← (const nomodify byte) CIA_INTERRUPT_CLEAR
|
||||
[70] *((const nomodify byte*) IRQ_ENABLE) ← (const nomodify byte) IRQ_RASTER
|
||||
[71] *((const nomodify byte*) IRQ_STATUS) ← (const nomodify byte) IRQ_RASTER
|
||||
[72] *((const nomodify void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) plex_irq()
|
||||
[73] *((const nomodify byte*) VIC_CONTROL) ← *((const nomodify byte*) VIC_CONTROL) & (byte) $7f
|
||||
[74] *((const nomodify byte*) RASTER) ← (byte) 0
|
||||
asm { cli }
|
||||
to:init::@return
|
||||
init::@return: scope:[init] from init::@4
|
||||
@ -172,79 +172,82 @@ plexInit::@return: scope:[plexInit] from plexInit::@1
|
||||
|
||||
interrupt(KERNEL_MIN)(void()) plex_irq()
|
||||
plex_irq: scope:[plex_irq] from
|
||||
[84] *((const nomodify byte*) BORDERCOL) ← (const nomodify byte) WHITE
|
||||
asm { sei }
|
||||
[85] *((const nomodify byte*) BORDERCOL) ← (const nomodify byte) WHITE
|
||||
to:plex_irq::@3
|
||||
plex_irq::@3: scope:[plex_irq] from plex_irq plex_irq::@7
|
||||
[85] phi()
|
||||
[86] call plexShowSprite
|
||||
[86] phi()
|
||||
[87] call plexShowSprite
|
||||
to:plex_irq::plexFreeNextYpos1
|
||||
plex_irq::plexFreeNextYpos1: scope:[plex_irq] from plex_irq::@3
|
||||
[87] (byte) plex_irq::plexFreeNextYpos1_return#0 ← *((const byte*) PLEX_FREE_YPOS + (volatile byte) plex_free_next)
|
||||
[88] (byte) plex_irq::plexFreeNextYpos1_return#0 ← *((const byte*) PLEX_FREE_YPOS + (volatile byte) plex_free_next)
|
||||
to:plex_irq::@6
|
||||
plex_irq::@6: scope:[plex_irq] from plex_irq::plexFreeNextYpos1
|
||||
[88] (byte~) plex_irq::$4 ← *((const nomodify byte*) RASTER) + (byte) 2
|
||||
[89] if((volatile byte) plex_show_idx>=(const nomodify byte) PLEX_COUNT) goto plex_irq::@4
|
||||
[89] (byte~) plex_irq::$4 ← *((const nomodify byte*) RASTER) + (byte) 2
|
||||
[90] if((volatile byte) plex_show_idx>=(const nomodify byte) PLEX_COUNT) goto plex_irq::@4
|
||||
to:plex_irq::@7
|
||||
plex_irq::@7: scope:[plex_irq] from plex_irq::@6
|
||||
[90] if((byte) plex_irq::plexFreeNextYpos1_return#0<(byte~) plex_irq::$4) goto plex_irq::@3
|
||||
[91] if((byte) plex_irq::plexFreeNextYpos1_return#0<(byte~) plex_irq::$4) goto plex_irq::@3
|
||||
to:plex_irq::@4
|
||||
plex_irq::@4: scope:[plex_irq] from plex_irq::@6 plex_irq::@7
|
||||
[91] *((const nomodify byte*) IRQ_STATUS) ← (const nomodify byte) IRQ_RASTER
|
||||
[92] if((volatile byte) plex_show_idx<(const nomodify byte) PLEX_COUNT) goto plex_irq::@1
|
||||
[92] *((const nomodify byte*) IRQ_STATUS) ← (const nomodify byte) IRQ_RASTER
|
||||
[93] if((volatile byte) plex_show_idx<(const nomodify byte) PLEX_COUNT) goto plex_irq::@1
|
||||
to:plex_irq::@5
|
||||
plex_irq::@5: scope:[plex_irq] from plex_irq::@4
|
||||
[93] (volatile bool) framedone ← true
|
||||
[94] *((const nomodify byte*) RASTER) ← (byte) 0
|
||||
[95] (volatile bool) framedone ← true
|
||||
to:plex_irq::@2
|
||||
plex_irq::@2: scope:[plex_irq] from plex_irq::@1 plex_irq::@5
|
||||
[94] *((const nomodify byte*) BORDERCOL) ← (byte) 0
|
||||
[96] *((const nomodify byte*) BORDERCOL) ← (byte) 0
|
||||
asm { cli }
|
||||
to:plex_irq::@return
|
||||
plex_irq::@return: scope:[plex_irq] from plex_irq::@2
|
||||
[95] return
|
||||
[98] return
|
||||
to:@return
|
||||
plex_irq::@1: scope:[plex_irq] from plex_irq::@4
|
||||
[96] *((const nomodify byte*) RASTER) ← (byte) plex_irq::plexFreeNextYpos1_return#0
|
||||
[99] *((const nomodify byte*) RASTER) ← (byte) plex_irq::plexFreeNextYpos1_return#0
|
||||
to:plex_irq::@2
|
||||
|
||||
(void()) plexShowSprite()
|
||||
plexShowSprite: scope:[plexShowSprite] from plex_irq::@3
|
||||
[97] (byte) plexShowSprite::plex_sprite_idx2#0 ← (volatile byte) plex_sprite_idx << (byte) 1
|
||||
[98] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte*) PLEX_YPOS + *((const byte*) PLEX_SORTED_IDX + (volatile byte) plex_show_idx))
|
||||
[99] *((const nomodify byte*) SPRITES_YPOS + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::plexFreeAdd1_ypos#0
|
||||
[100] (byte) plexShowSprite::plex_sprite_idx2#0 ← (volatile byte) plex_sprite_idx << (byte) 1
|
||||
[101] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte*) PLEX_YPOS + *((const byte*) PLEX_SORTED_IDX + (volatile byte) plex_show_idx))
|
||||
[102] *((const nomodify byte*) SPRITES_YPOS + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::plexFreeAdd1_ypos#0
|
||||
to:plexShowSprite::plexFreeAdd1
|
||||
plexShowSprite::plexFreeAdd1: scope:[plexShowSprite] from plexShowSprite
|
||||
[100] (byte~) plexShowSprite::plexFreeAdd1_$0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 + (byte) $15
|
||||
[101] *((const byte*) PLEX_FREE_YPOS + (volatile byte) plex_free_next) ← (byte~) plexShowSprite::plexFreeAdd1_$0
|
||||
[102] (byte~) plexShowSprite::plexFreeAdd1_$1 ← (volatile byte) plex_free_next + (byte) 1
|
||||
[103] (byte~) plexShowSprite::plexFreeAdd1_$2 ← (byte~) plexShowSprite::plexFreeAdd1_$1 & (byte) 7
|
||||
[104] (volatile byte) plex_free_next ← (byte~) plexShowSprite::plexFreeAdd1_$2
|
||||
[103] (byte~) plexShowSprite::plexFreeAdd1_$0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 + (byte) $15
|
||||
[104] *((const byte*) PLEX_FREE_YPOS + (volatile byte) plex_free_next) ← (byte~) plexShowSprite::plexFreeAdd1_$0
|
||||
[105] (byte~) plexShowSprite::plexFreeAdd1_$1 ← (volatile byte) plex_free_next + (byte) 1
|
||||
[106] (byte~) plexShowSprite::plexFreeAdd1_$2 ← (byte~) plexShowSprite::plexFreeAdd1_$1 & (byte) 7
|
||||
[107] (volatile byte) plex_free_next ← (byte~) plexShowSprite::plexFreeAdd1_$2
|
||||
to:plexShowSprite::@5
|
||||
plexShowSprite::@5: scope:[plexShowSprite] from plexShowSprite::plexFreeAdd1
|
||||
[105] *((const byte*) PLEX_SCREEN_PTR#0 + (volatile byte) plex_sprite_idx) ← *((const byte*) PLEX_PTR + *((const byte*) PLEX_SORTED_IDX + (volatile byte) plex_show_idx))
|
||||
[106] (byte) plexShowSprite::xpos_idx#0 ← *((const byte*) PLEX_SORTED_IDX + (volatile byte) plex_show_idx)
|
||||
[107] (byte~) plexShowSprite::$11 ← (byte) plexShowSprite::xpos_idx#0 << (byte) 1
|
||||
[108] (byte~) plexShowSprite::$2 ← < *((const word*) PLEX_XPOS + (byte~) plexShowSprite::$11)
|
||||
[109] *((const nomodify byte*) SPRITES_XPOS + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte~) plexShowSprite::$2
|
||||
[110] (byte~) plexShowSprite::$3 ← > *((const word*) PLEX_XPOS + (byte~) plexShowSprite::$11)
|
||||
[111] if((byte~) plexShowSprite::$3!=(byte) 0) goto plexShowSprite::@1
|
||||
[108] *((const byte*) PLEX_SCREEN_PTR#0 + (volatile byte) plex_sprite_idx) ← *((const byte*) PLEX_PTR + *((const byte*) PLEX_SORTED_IDX + (volatile byte) plex_show_idx))
|
||||
[109] (byte) plexShowSprite::xpos_idx#0 ← *((const byte*) PLEX_SORTED_IDX + (volatile byte) plex_show_idx)
|
||||
[110] (byte~) plexShowSprite::$11 ← (byte) plexShowSprite::xpos_idx#0 << (byte) 1
|
||||
[111] (byte~) plexShowSprite::$2 ← < *((const word*) PLEX_XPOS + (byte~) plexShowSprite::$11)
|
||||
[112] *((const nomodify byte*) SPRITES_XPOS + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte~) plexShowSprite::$2
|
||||
[113] (byte~) plexShowSprite::$3 ← > *((const word*) PLEX_XPOS + (byte~) plexShowSprite::$11)
|
||||
[114] if((byte~) plexShowSprite::$3!=(byte) 0) goto plexShowSprite::@1
|
||||
to:plexShowSprite::@3
|
||||
plexShowSprite::@3: scope:[plexShowSprite] from plexShowSprite::@5
|
||||
[112] (byte~) plexShowSprite::$9 ← (byte) $ff ^ (volatile byte) plex_sprite_msb
|
||||
[113] *((const nomodify byte*) SPRITES_XMSB) ← *((const nomodify byte*) SPRITES_XMSB) & (byte~) plexShowSprite::$9
|
||||
[115] (byte~) plexShowSprite::$9 ← (byte) $ff ^ (volatile byte) plex_sprite_msb
|
||||
[116] *((const nomodify byte*) SPRITES_XMSB) ← *((const nomodify byte*) SPRITES_XMSB) & (byte~) plexShowSprite::$9
|
||||
to:plexShowSprite::@2
|
||||
plexShowSprite::@2: scope:[plexShowSprite] from plexShowSprite::@1 plexShowSprite::@3
|
||||
[114] (byte~) plexShowSprite::$5 ← (volatile byte) plex_sprite_idx + (byte) 1
|
||||
[115] (byte~) plexShowSprite::$6 ← (byte~) plexShowSprite::$5 & (byte) 7
|
||||
[116] (volatile byte) plex_sprite_idx ← (byte~) plexShowSprite::$6
|
||||
[117] (volatile byte) plex_show_idx ← ++ (volatile byte) plex_show_idx
|
||||
[118] (volatile byte) plex_sprite_msb ← (volatile byte) plex_sprite_msb << (byte) 1
|
||||
[119] if((volatile byte) plex_sprite_msb!=(byte) 0) goto plexShowSprite::@return
|
||||
[117] (byte~) plexShowSprite::$5 ← (volatile byte) plex_sprite_idx + (byte) 1
|
||||
[118] (byte~) plexShowSprite::$6 ← (byte~) plexShowSprite::$5 & (byte) 7
|
||||
[119] (volatile byte) plex_sprite_idx ← (byte~) plexShowSprite::$6
|
||||
[120] (volatile byte) plex_show_idx ← ++ (volatile byte) plex_show_idx
|
||||
[121] (volatile byte) plex_sprite_msb ← (volatile byte) plex_sprite_msb << (byte) 1
|
||||
[122] if((volatile byte) plex_sprite_msb!=(byte) 0) goto plexShowSprite::@return
|
||||
to:plexShowSprite::@4
|
||||
plexShowSprite::@4: scope:[plexShowSprite] from plexShowSprite::@2
|
||||
[120] (volatile byte) plex_sprite_msb ← (byte) 1
|
||||
[123] (volatile byte) plex_sprite_msb ← (byte) 1
|
||||
to:plexShowSprite::@return
|
||||
plexShowSprite::@return: scope:[plexShowSprite] from plexShowSprite::@2 plexShowSprite::@4
|
||||
[121] return
|
||||
[124] return
|
||||
to:@return
|
||||
plexShowSprite::@1: scope:[plexShowSprite] from plexShowSprite::@5
|
||||
[122] *((const nomodify byte*) SPRITES_XMSB) ← *((const nomodify byte*) SPRITES_XMSB) | (volatile byte) plex_sprite_msb
|
||||
[125] *((const nomodify byte*) SPRITES_XMSB) ← *((const nomodify byte*) SPRITES_XMSB) | (volatile byte) plex_sprite_msb
|
||||
to:plexShowSprite::@2
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -39,7 +39,7 @@
|
||||
(const nomodify byte) WHITE = (byte) 1
|
||||
(const byte*) YSIN[(number) $100] = kickasm {{ .fill $100, round(139.5+89.5*sin(toRadians(360*i/256)))
|
||||
}}
|
||||
(volatile bool) framedone loadstore zp[1]:10 1000.5454545454544
|
||||
(volatile bool) framedone loadstore zp[1]:10 1222.8888888888887
|
||||
(void()) init()
|
||||
(byte~) init::$3 reg byte a 2002.0
|
||||
(label) init::@1
|
||||
@ -64,7 +64,7 @@
|
||||
(label) loop::@5
|
||||
(label) loop::@6
|
||||
(byte) loop::sin_idx
|
||||
(byte) loop::sin_idx#1 sin_idx zp[1]:2 286.0
|
||||
(byte) loop::sin_idx#1 sin_idx zp[1]:2 400.4
|
||||
(byte) loop::sin_idx#6 sin_idx zp[1]:2 333.6666666666667
|
||||
(byte) loop::sy
|
||||
(byte) loop::sy#1 reg byte y 15001.5
|
||||
@ -136,7 +136,7 @@
|
||||
(byte) plexSort::s#2 reg byte x 2000002.0
|
||||
(byte) plexSort::s#3 reg byte x 2.05000025E7
|
||||
(byte) plexSort::s#6 reg byte x 2000002.0
|
||||
(volatile byte) plex_free_next loadstore zp[1]:9 332.80645161290323
|
||||
(volatile byte) plex_free_next loadstore zp[1]:9 322.40625
|
||||
interrupt(KERNEL_MIN)(void()) plex_irq()
|
||||
(byte~) plex_irq::$4 zp[1]:13 11.0
|
||||
(label) plex_irq::@1
|
||||
@ -151,9 +151,9 @@ interrupt(KERNEL_MIN)(void()) plex_irq()
|
||||
(byte) plex_irq::plexFreeNextYpos1_return
|
||||
(byte) plex_irq::plexFreeNextYpos1_return#0 reg byte x 4.0
|
||||
(byte) plex_irq::rasterY
|
||||
(volatile byte) plex_show_idx loadstore zp[1]:6 309.44117647058835
|
||||
(volatile byte) plex_sprite_idx loadstore zp[1]:7 335.7096774193548
|
||||
(volatile byte) plex_sprite_msb loadstore zp[1]:8 321.4848484848485
|
||||
(volatile byte) plex_show_idx loadstore zp[1]:6 300.6000000000001
|
||||
(volatile byte) plex_sprite_idx loadstore zp[1]:7 325.21875
|
||||
(volatile byte) plex_sprite_msb loadstore zp[1]:8 312.029411764706
|
||||
|
||||
zp[1]:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
|
||||
reg byte x [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
|
||||
|
Loading…
Reference in New Issue
Block a user