1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-23 08:32:39 +00:00

Added 2x2 font compression example. Improved chargen example.

This commit is contained in:
Jesper Gravgaard 2020-03-25 17:51:45 +01:00
parent 81202b676a
commit 253263983e
14 changed files with 7036 additions and 1505 deletions

View File

@ -0,0 +1,2 @@
ora {m1}
sta {m1}

View File

@ -722,6 +722,11 @@ public class TestPrograms {
compileAndCompare("problem-negative-word-const"); compileAndCompare("problem-negative-word-const");
} }
//@Test
//public void testProblemConstAddition() throws IOException, URISyntaxException {
// compileAndCompare("problem-const-addition", log());
//}
@Test @Test
public void testInnerIncrementProblem() throws IOException, URISyntaxException { public void testInnerIncrementProblem() throws IOException, URISyntaxException {
compileAndCompare("inner-increment-problem"); compileAndCompare("inner-increment-problem");
@ -968,16 +973,23 @@ public class TestPrograms {
compileAndCompare("unused-irq"); compileAndCompare("unused-irq");
} }
/**
/*
* TODO: Fix error with number resolving * TODO: Fix error with number resolving
*
* @Test public void testNumberTernaryFail2() throws IOException, URISyntaxException { @Test public void testNumberTernaryFail2() throws IOException, URISyntaxException {
* compileAndCompare("number-ternary-fail-2"); compileAndCompare("number-ternary-fail-2");
* } }
* @Test public void testNumberTernaryFail() throws IOException, URISyntaxException { @Test public void testNumberTernaryFail() throws IOException, URISyntaxException {
* compileAndCompare("number-ternary-fail"); compileAndCompare("number-ternary-fail");
* } }
*/
@Test public void testNumberTernaryFail3() throws IOException, URISyntaxException {
compileAndCompare("number-ternary-fail-3");
}
*/
@Test @Test
public void testTextbox() throws IOException, URISyntaxException { public void testTextbox() throws IOException, URISyntaxException {
@ -2016,6 +2028,11 @@ public class TestPrograms {
compileAndCompare("examples/fire/fire"); compileAndCompare("examples/fire/fire");
} }
@Test
public void testFont2x2() throws IOException, URISyntaxException {
compileAndCompare("examples/font-2x2/font-2x2");
}
@Test @Test
public void testCTypes() throws IOException, URISyntaxException { public void testCTypes() throws IOException, URISyntaxException {
compileAndCompare("c-types"); compileAndCompare("c-types");

View File

@ -1,85 +0,0 @@
// Snabel Elefont Compression testing
import "c64"
import "string"
const byte* SCREEN = 0x0400;
const byte* ELEFONT = 0x2000;
const byte* ELEFONT2 = 0x2800;
byte[0x100] align(0x100) ELEFONT2_MAP;
kickasm(pc ELEFONT, resource "elefont.bin" ) {{
.var fontFile = LoadBinary("elefont.bin")
.fill fontFile.getSize(), fontFile.get(i)
}}
void main() {
// Compress the font finding identical characters
char size = font_compress(ELEFONT, ELEFONT2, ELEFONT2_MAP);
// Show compressed font
*D018 = toD018(SCREEN, ELEFONT2);
// Clear the screen
memset(SCREEN, ELEFONT2_MAP[' '], 0x0400);
// Show the font
char* cursor = SCREEN;
char c = 0;
for(char y:0..7) {
for(char x:0..7) {
out(c++, x, y, ELEFONT2_MAP);
}
}
}
// Show a 2x2 char on the screen at 2x2-position (x, y) using a font compress mapping
void out(char c, char x, char y, char* font_mapping) {
char* ptr = SCREEN + (unsigned int)y*80 + x*2;
ptr[0] = font_mapping[c];
ptr[1] = font_mapping[c+0x40];
ptr[40] = font_mapping[c+0x80];
ptr[41] = font_mapping[c+0xc0];
}
// Compress a font finding identical characters
// The compressed font is put into font_compressed and the compress_mapping is updated
// so that compress_mapping[c] points to the char in font_compressed that is identical to char c in font_original
// Returns the size of the compressed font (in chars)
char font_compress(char* font_original, char* font_compressed, char* compress_mapping) {
char font_size = 0;
char* next_original = font_original;
char* next_compressed = font_compressed;
for(char i: 0..0xff) {
// Look for the char in font_compressed
char found = font_find(next_original, font_compressed, font_size);
if(found==0xff) {
// Glyph not found - create it
for(char l:0..7)
next_compressed[l] = next_original[l];
next_compressed += 8;
found = font_size;
font_size++;
}
compress_mapping[i] = found;
next_original += 8;
}
return font_size;
}
// Look for a glyph within a font
// Only looks at the first font_size glyphs
// Returns the index of the glyph within the font. Returns 0xff if the glyph is not found.
char font_find(char* glyph, char* font, char font_size) {
for(char i=0;i<font_size;i++) {
char found = 1;
for(char l:0..7) {
if(glyph[l]!=font[l]) {
found = 0;
break;
}
}
if(found)
return i;
font += 8;
}
// Not found
return 0xff;
}

View File

@ -1,6 +1,5 @@
// Allows analysis of the CHARGEN ROM font // Allows analysis of the CHARGEN ROM font
import "c64.kc" import "c64.kc"
import "multiply.kc"
import "keyboard.kc" import "keyboard.kc"
byte* SCREEN = $400; byte* SCREEN = $400;
@ -74,7 +73,7 @@ void plot_chargen(byte pos, byte ch, byte shift) {
chargen = chargen + $0800; chargen = chargen + $0800;
} }
*PROCPORT = $32; *PROCPORT = $32;
byte* sc = SCREEN+40+1+mul8u(pos, 10); byte* sc = SCREEN + 41 + pos*10;
for(byte y:0..7) { for(byte y:0..7) {
byte bits = chargen[y]; byte bits = chargen[y];
for(byte x:0..7) { for(byte x:0..7) {

View File

@ -0,0 +1,127 @@
// Creates a 2x2 font from the system CHARGEN font and compress it by identifying identical chars
import "c64"
import "string"
const byte* SCREEN = 0x0400;
const byte* FONT_ORIGINAL = 0x2000;
const byte* FONT_COMPRESSED = 0x2800;
byte[0x100] align(0x100) FONT_COMPRESSED_MAP;
void main() {
// Create 2x2 font from CHARGEN
asm { sei }
*PROCPORT = PROCPORT_RAM_CHARROM;
font_2x2(CHARGEN, FONT_ORIGINAL);
*PROCPORT = PROCPORT_BASIC_KERNEL_IO;
asm { cli }
// Compress the font finding identical characters
char size = font_compress(FONT_ORIGINAL, FONT_COMPRESSED, FONT_COMPRESSED_MAP);
// Show compressed font
*D018 = toD018(SCREEN, FONT_COMPRESSED);
// Clear the screen
memset(SCREEN, FONT_COMPRESSED_MAP[' '], 0x0400);
// Show the font
char* cursor = SCREEN;
char c = 0;
for(char y:0..7) {
for(char x:0..7) {
show(c++, x, y, FONT_COMPRESSED_MAP);
}
}
while(true)
(*(SCREEN+999))++;
}
// Show a 2x2 char on the screen at 2x2-position (x, y) using a font compress mapping
void show(char c, char x, char y, char* font_mapping) {
char* ptr = SCREEN + (unsigned int)y*80 + x*2;
ptr[0] = font_mapping[c];
ptr[1] = font_mapping[c+0x40];
ptr[40] = font_mapping[c+0x80];
ptr[41] = font_mapping[c+0xc0];
}
// Create a 2x2-font by doubling all pixels of the 64 first chars
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;
}
}
// Compress a font finding identical characters
// The compressed font is put into font_compressed and the compress_mapping is updated
// so that compress_mapping[c] points to the char in font_compressed that is identical to char c in font_original
// Returns the size of the compressed font (in chars)
char font_compress(char* font_original, char* font_compressed, char* compress_mapping) {
char font_size = 0;
char* next_original = font_original;
char* next_compressed = font_compressed;
for(char i: 0..0xff) {
// Look for the char in font_compressed
char found = font_find(next_original, font_compressed, font_size);
if(found==0xff) {
// Glyph not found - create it
for(char l:0..7)
next_compressed[l] = next_original[l];
next_compressed += 8;
found = font_size;
font_size++;
}
compress_mapping[i] = found;
next_original += 8;
}
return font_size;
}
// Look for a glyph within a font
// Only looks at the first font_size glyphs
// Returns the index of the glyph within the font. Returns 0xff if the glyph is not found.
char font_find(char* glyph, char* font, char font_size) {
for(char i=0;i<font_size;i++) {
char found = 1;
for(char l:0..7) {
if(glyph[l]!=font[l]) {
found = 0;
break;
}
}
if(found)
return i;
font += 8;
}
// Not found
return 0xff;
}

View File

@ -0,0 +1,17 @@
// Illustrates problem with constant addition not handling mixed types properly
char* SCREEN = $400;
char* CHARGEN = 0xd000;
char* PROCPORT = 0x01;
void main() {
for(char pos: 0..3)
plot_chargen(pos);
}
// Render 8x8 char (ch) as pixels on char canvas #pos
void plot_chargen(byte pos) {
byte* sc = SCREEN + pos*10 + 41;
for(byte x:0..7)
*sc++ = '*';
}

View File

@ -262,11 +262,10 @@ main: {
// Render 8x8 char (ch) as pixels on char canvas #pos // Render 8x8 char (ch) as pixels on char canvas #pos
// plot_chargen(byte register(Y) pos, byte register(A) ch, byte register(X) shift) // plot_chargen(byte register(Y) pos, byte register(A) ch, byte register(X) shift)
plot_chargen: { plot_chargen: {
.label __0 = $c .label __0 = $a
.label __1 = $c .label __1 = $a
.label __7 = $e .label chargen = $a
.label chargen = $c .label sc = $c
.label sc = $e
.label bits = 9 .label bits = 9
.label y = 8 .label y = 8
// asm // asm
@ -305,18 +304,20 @@ plot_chargen: {
// *PROCPORT = $32 // *PROCPORT = $32
lda #$32 lda #$32
sta PROCPORT sta PROCPORT
// mul8u(pos, 10) // pos*10
tya tya
tax asl
jsr mul8u asl
// mul8u(pos, 10) sty.z $ff
// sc = SCREEN+40+1+mul8u(pos, 10)
clc clc
lda.z sc adc.z $ff
adc #<SCREEN+$28+1 asl
// sc = SCREEN + 41 + pos*10
clc
adc #<SCREEN+$29
sta.z sc sta.z sc
lda.z sc+1 lda #>SCREEN+$29
adc #>SCREEN+$28+1 adc #0
sta.z sc+1 sta.z sc+1
lda #0 lda #0
sta.z y sta.z y
@ -373,51 +374,6 @@ plot_chargen: {
// } // }
rts rts
} }
// Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word
// mul8u(byte register(X) a)
mul8u: {
.const b = $a
.label mb = $a
.label res = $e
.label return = $e
lda #<b
sta.z mb
lda #>b
sta.z mb+1
lda #<0
sta.z res
sta.z res+1
__b1:
// while(a!=0)
cpx #0
bne __b2
// }
rts
__b2:
// a&1
txa
and #1
// if( (a&1) != 0)
cmp #0
beq __b3
// res = res + mb
lda.z res
clc
adc.z mb
sta.z res
lda.z res+1
adc.z mb+1
sta.z res+1
__b3:
// a = a>>1
txa
lsr
tax
// mb = mb<<1
asl.z mb
rol.z mb+1
jmp __b1
}
// Determines whether a specific key is currently pressed by accessing the matrix directly // Determines whether a specific key is currently pressed by accessing the matrix directly
// The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7)
// All keys exist as as KEY_XXX constants. // All keys exist as as KEY_XXX constants.
@ -469,10 +425,10 @@ keyboard_get_keycode: {
rts rts
} }
// Print a string at a specific screen position // Print a string at a specific screen position
// print_str_at(byte* zp($c) str, byte* zp($e) at) // print_str_at(byte* zp($a) str, byte* zp($c) at)
print_str_at: { print_str_at: {
.label at = $e .label at = $c
.label str = $c .label str = $a
__b1: __b1:
// while(*str) // while(*str)
ldy #0 ldy #0

View File

@ -156,127 +156,98 @@ plot_chargen::@2: scope:[plot_chargen] from plot_chargen
[77] (byte*) plot_chargen::chargen#1 ← (byte*) plot_chargen::chargen#0 + (word) $800 [77] (byte*) plot_chargen::chargen#1 ← (byte*) plot_chargen::chargen#0 + (word) $800
to:plot_chargen::@1 to:plot_chargen::@1
plot_chargen::@1: scope:[plot_chargen] from plot_chargen plot_chargen::@2 plot_chargen::@1: scope:[plot_chargen] from plot_chargen plot_chargen::@2
[78] (byte*) plot_chargen::chargen#5 ← phi( plot_chargen/(byte*) plot_chargen::chargen#0 plot_chargen::@2/(byte*) plot_chargen::chargen#1 ) [78] (byte*) plot_chargen::chargen#4 ← phi( plot_chargen/(byte*) plot_chargen::chargen#0 plot_chargen::@2/(byte*) plot_chargen::chargen#1 )
[79] *((const byte*) PROCPORT) ← (byte) $32 [79] *((const byte*) PROCPORT) ← (byte) $32
[80] (byte) mul8u::a#1 ← (byte) plot_chargen::pos#2 [80] (byte~) plot_chargen::$16 ← (byte) plot_chargen::pos#2 << (byte) 2
[81] call mul8u [81] (byte~) plot_chargen::$17 ← (byte~) plot_chargen::$16 + (byte) plot_chargen::pos#2
[82] (word) mul8u::return#2 ← (word) mul8u::res#2 [82] (byte~) plot_chargen::$6 ← (byte~) plot_chargen::$17 << (byte) 1
to:plot_chargen::@9 [83] (byte*) plot_chargen::sc#0 ← (const byte*) SCREEN+(byte) $29 + (byte~) plot_chargen::$6
plot_chargen::@9: scope:[plot_chargen] from plot_chargen::@1
[83] (word~) plot_chargen::$7 ← (word) mul8u::return#2
[84] (byte*) plot_chargen::sc#0 ← (const byte*) SCREEN+(byte) $28+(byte) 1 + (word~) plot_chargen::$7
to:plot_chargen::@3 to:plot_chargen::@3
plot_chargen::@3: scope:[plot_chargen] from plot_chargen::@7 plot_chargen::@9 plot_chargen::@3: scope:[plot_chargen] from plot_chargen::@1 plot_chargen::@7
[85] (byte*) plot_chargen::sc#7 ← phi( plot_chargen::@7/(byte*) plot_chargen::sc#2 plot_chargen::@9/(byte*) plot_chargen::sc#0 ) [84] (byte*) plot_chargen::sc#7 ← phi( plot_chargen::@1/(byte*) plot_chargen::sc#0 plot_chargen::@7/(byte*) plot_chargen::sc#2 )
[85] (byte) plot_chargen::y#2 ← phi( plot_chargen::@7/(byte) plot_chargen::y#1 plot_chargen::@9/(byte) 0 ) [84] (byte) plot_chargen::y#2 ← phi( plot_chargen::@1/(byte) 0 plot_chargen::@7/(byte) plot_chargen::y#1 )
[86] (byte) plot_chargen::bits#0 ← *((byte*) plot_chargen::chargen#5 + (byte) plot_chargen::y#2) [85] (byte) plot_chargen::bits#0 ← *((byte*) plot_chargen::chargen#4 + (byte) plot_chargen::y#2)
to:plot_chargen::@4 to:plot_chargen::@4
plot_chargen::@4: scope:[plot_chargen] from plot_chargen::@3 plot_chargen::@5 plot_chargen::@4: scope:[plot_chargen] from plot_chargen::@3 plot_chargen::@5
[87] (byte) plot_chargen::x#2 ← phi( plot_chargen::@3/(byte) 0 plot_chargen::@5/(byte) plot_chargen::x#1 ) [86] (byte) plot_chargen::x#2 ← phi( plot_chargen::@3/(byte) 0 plot_chargen::@5/(byte) plot_chargen::x#1 )
[87] (byte*) plot_chargen::sc#3 ← phi( plot_chargen::@3/(byte*) plot_chargen::sc#7 plot_chargen::@5/(byte*) plot_chargen::sc#1 ) [86] (byte*) plot_chargen::sc#3 ← phi( plot_chargen::@3/(byte*) plot_chargen::sc#7 plot_chargen::@5/(byte*) plot_chargen::sc#1 )
[87] (byte) plot_chargen::bits#2 ← phi( plot_chargen::@3/(byte) plot_chargen::bits#0 plot_chargen::@5/(byte) plot_chargen::bits#1 ) [86] (byte) plot_chargen::bits#2 ← phi( plot_chargen::@3/(byte) plot_chargen::bits#0 plot_chargen::@5/(byte) plot_chargen::bits#1 )
[88] (byte~) plot_chargen::$10 ← (byte) plot_chargen::bits#2 & (byte) $80 [87] (byte~) plot_chargen::$9 ← (byte) plot_chargen::bits#2 & (byte) $80
[89] if((byte~) plot_chargen::$10==(byte) 0) goto plot_chargen::@5 [88] if((byte~) plot_chargen::$9==(byte) 0) goto plot_chargen::@5
to:plot_chargen::@6 to:plot_chargen::@6
plot_chargen::@6: scope:[plot_chargen] from plot_chargen::@4 plot_chargen::@6: scope:[plot_chargen] from plot_chargen::@4
[90] phi() [89] phi()
to:plot_chargen::@5 to:plot_chargen::@5
plot_chargen::@5: scope:[plot_chargen] from plot_chargen::@4 plot_chargen::@6 plot_chargen::@5: scope:[plot_chargen] from plot_chargen::@4 plot_chargen::@6
[91] (byte) plot_chargen::c#2 ← phi( plot_chargen::@4/(byte) '.' plot_chargen::@6/(byte) '*' ) [90] (byte) plot_chargen::c#2 ← phi( plot_chargen::@4/(byte) '.' plot_chargen::@6/(byte) '*' )
[92] *((byte*) plot_chargen::sc#3) ← (byte) plot_chargen::c#2 [91] *((byte*) plot_chargen::sc#3) ← (byte) plot_chargen::c#2
[93] (byte*) plot_chargen::sc#1 ← ++ (byte*) plot_chargen::sc#3 [92] (byte*) plot_chargen::sc#1 ← ++ (byte*) plot_chargen::sc#3
[94] (byte) plot_chargen::bits#1 ← (byte) plot_chargen::bits#2 << (byte) 1 [93] (byte) plot_chargen::bits#1 ← (byte) plot_chargen::bits#2 << (byte) 1
[95] (byte) plot_chargen::x#1 ← ++ (byte) plot_chargen::x#2 [94] (byte) plot_chargen::x#1 ← ++ (byte) plot_chargen::x#2
[96] if((byte) plot_chargen::x#1!=(byte) 8) goto plot_chargen::@4 [95] if((byte) plot_chargen::x#1!=(byte) 8) goto plot_chargen::@4
to:plot_chargen::@7 to:plot_chargen::@7
plot_chargen::@7: scope:[plot_chargen] from plot_chargen::@5 plot_chargen::@7: scope:[plot_chargen] from plot_chargen::@5
[97] (byte*) plot_chargen::sc#2 ← (byte*) plot_chargen::sc#1 + (byte) $20 [96] (byte*) plot_chargen::sc#2 ← (byte*) plot_chargen::sc#1 + (byte) $20
[98] (byte) plot_chargen::y#1 ← ++ (byte) plot_chargen::y#2 [97] (byte) plot_chargen::y#1 ← ++ (byte) plot_chargen::y#2
[99] if((byte) plot_chargen::y#1!=(byte) 8) goto plot_chargen::@3 [98] if((byte) plot_chargen::y#1!=(byte) 8) goto plot_chargen::@3
to:plot_chargen::@8 to:plot_chargen::@8
plot_chargen::@8: scope:[plot_chargen] from plot_chargen::@7 plot_chargen::@8: scope:[plot_chargen] from plot_chargen::@7
[100] *((const byte*) PROCPORT) ← (byte) $37 [99] *((const byte*) PROCPORT) ← (byte) $37
asm { cli } asm { cli }
to:plot_chargen::@return to:plot_chargen::@return
plot_chargen::@return: scope:[plot_chargen] from plot_chargen::@8 plot_chargen::@return: scope:[plot_chargen] from plot_chargen::@8
[102] return [101] return
to:@return to:@return
(word()) mul8u((byte) mul8u::a , (byte) mul8u::b)
mul8u: scope:[mul8u] from plot_chargen::@1
[103] phi()
to:mul8u::@1
mul8u::@1: scope:[mul8u] from mul8u mul8u::@3
[104] (word) mul8u::mb#2 ← phi( mul8u/(word)(const byte) mul8u::b#0 mul8u::@3/(word) mul8u::mb#1 )
[104] (word) mul8u::res#2 ← phi( mul8u/(word) 0 mul8u::@3/(word) mul8u::res#6 )
[104] (byte) mul8u::a#2 ← phi( mul8u/(byte) mul8u::a#1 mul8u::@3/(byte) mul8u::a#0 )
[105] if((byte) mul8u::a#2!=(byte) 0) goto mul8u::@2
to:mul8u::@return
mul8u::@return: scope:[mul8u] from mul8u::@1
[106] return
to:@return
mul8u::@2: scope:[mul8u] from mul8u::@1
[107] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte) 1
[108] if((byte~) mul8u::$1==(byte) 0) goto mul8u::@3
to:mul8u::@4
mul8u::@4: scope:[mul8u] from mul8u::@2
[109] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2
to:mul8u::@3
mul8u::@3: scope:[mul8u] from mul8u::@2 mul8u::@4
[110] (word) mul8u::res#6 ← phi( mul8u::@2/(word) mul8u::res#2 mul8u::@4/(word) mul8u::res#1 )
[111] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte) 1
[112] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte) 1
to:mul8u::@1
(byte()) keyboard_key_pressed((byte) keyboard_key_pressed::key) (byte()) keyboard_key_pressed((byte) keyboard_key_pressed::key)
keyboard_key_pressed: scope:[keyboard_key_pressed] from main::@15 main::@5 main::@6 main::@7 main::@8 main::@9 keyboard_key_pressed: scope:[keyboard_key_pressed] from main::@15 main::@5 main::@6 main::@7 main::@8 main::@9
[113] (byte) keyboard_key_pressed::key#6 ← phi( main::@6/(const byte) KEY_F3 main::@7/(const byte) KEY_F5 main::@8/(const byte) KEY_F7 main::@9/(const byte) KEY_LSHIFT main::@15/(byte) keyboard_key_pressed::key#5 main::@5/(const byte) KEY_F1 ) [102] (byte) keyboard_key_pressed::key#6 ← phi( main::@6/(const byte) KEY_F3 main::@7/(const byte) KEY_F5 main::@8/(const byte) KEY_F7 main::@9/(const byte) KEY_LSHIFT main::@15/(byte) keyboard_key_pressed::key#5 main::@5/(const byte) KEY_F1 )
[114] (byte) keyboard_key_pressed::colidx#0 ← (byte) keyboard_key_pressed::key#6 & (byte) 7 [103] (byte) keyboard_key_pressed::colidx#0 ← (byte) keyboard_key_pressed::key#6 & (byte) 7
[115] (byte) keyboard_key_pressed::rowidx#0 ← (byte) keyboard_key_pressed::key#6 >> (byte) 3 [104] (byte) keyboard_key_pressed::rowidx#0 ← (byte) keyboard_key_pressed::key#6 >> (byte) 3
[116] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::rowidx#0 [105] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::rowidx#0
[117] call keyboard_matrix_read [106] call keyboard_matrix_read
[118] (byte) keyboard_matrix_read::return#2 ← (byte) keyboard_matrix_read::return#0 [107] (byte) keyboard_matrix_read::return#2 ← (byte) keyboard_matrix_read::return#0
to:keyboard_key_pressed::@1 to:keyboard_key_pressed::@1
keyboard_key_pressed::@1: scope:[keyboard_key_pressed] from keyboard_key_pressed keyboard_key_pressed::@1: scope:[keyboard_key_pressed] from keyboard_key_pressed
[119] (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_matrix_read::return#2 [108] (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_matrix_read::return#2
[120] (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$2 & *((const byte*) keyboard_matrix_col_bitmask + (byte) keyboard_key_pressed::colidx#0) [109] (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$2 & *((const byte*) keyboard_matrix_col_bitmask + (byte) keyboard_key_pressed::colidx#0)
to:keyboard_key_pressed::@return to:keyboard_key_pressed::@return
keyboard_key_pressed::@return: scope:[keyboard_key_pressed] from keyboard_key_pressed::@1 keyboard_key_pressed::@return: scope:[keyboard_key_pressed] from keyboard_key_pressed::@1
[121] return [110] return
to:@return to:@return
(byte()) keyboard_matrix_read((byte) keyboard_matrix_read::rowid) (byte()) keyboard_matrix_read((byte) keyboard_matrix_read::rowid)
keyboard_matrix_read: scope:[keyboard_matrix_read] from keyboard_key_pressed keyboard_matrix_read: scope:[keyboard_matrix_read] from keyboard_key_pressed
[122] *((const byte*) CIA1_PORT_A) ← *((const byte*) keyboard_matrix_row_bitmask + (byte) keyboard_matrix_read::rowid#0) [111] *((const byte*) CIA1_PORT_A) ← *((const byte*) keyboard_matrix_row_bitmask + (byte) keyboard_matrix_read::rowid#0)
[123] (byte) keyboard_matrix_read::return#0 ← ~ *((const byte*) CIA1_PORT_B) [112] (byte) keyboard_matrix_read::return#0 ← ~ *((const byte*) CIA1_PORT_B)
to:keyboard_matrix_read::@return to:keyboard_matrix_read::@return
keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matrix_read keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matrix_read
[124] return [113] return
to:@return to:@return
(byte()) keyboard_get_keycode((byte) keyboard_get_keycode::ch) (byte()) keyboard_get_keycode((byte) keyboard_get_keycode::ch)
keyboard_get_keycode: scope:[keyboard_get_keycode] from main::@12 keyboard_get_keycode: scope:[keyboard_get_keycode] from main::@12
[125] (byte) keyboard_get_keycode::return#0 ← *((const byte*) keyboard_char_keycodes + (byte) keyboard_get_keycode::ch#0) [114] (byte) keyboard_get_keycode::return#0 ← *((const byte*) keyboard_char_keycodes + (byte) keyboard_get_keycode::ch#0)
to:keyboard_get_keycode::@return to:keyboard_get_keycode::@return
keyboard_get_keycode::@return: scope:[keyboard_get_keycode] from keyboard_get_keycode keyboard_get_keycode::@return: scope:[keyboard_get_keycode] from keyboard_get_keycode
[126] return [115] return
to:@return to:@return
(void()) print_str_at((byte*) print_str_at::str , (byte*) print_str_at::at) (void()) print_str_at((byte*) print_str_at::str , (byte*) print_str_at::at)
print_str_at: scope:[print_str_at] from main::@17 main::@18 main::@19 main::@3 print_str_at: scope:[print_str_at] from main::@17 main::@18 main::@19 main::@3
[127] (byte*) print_str_at::at#7 ← phi( main::@17/(const byte*) SCREEN+(byte) 1+(byte) $a main::@3/(const byte*) SCREEN+(byte) 1 main::@18/(const byte*) SCREEN+(byte) 1+(byte) $14 main::@19/(const byte*) SCREEN+(byte) 1+(byte) $1e ) [116] (byte*) print_str_at::at#7 ← phi( main::@17/(const byte*) SCREEN+(byte) 1+(byte) $a main::@3/(const byte*) SCREEN+(byte) 1 main::@18/(const byte*) SCREEN+(byte) 1+(byte) $14 main::@19/(const byte*) SCREEN+(byte) 1+(byte) $1e )
[127] (byte*) print_str_at::str#7 ← phi( main::@17/(const byte*) main::str1 main::@3/(const byte*) main::str main::@18/(const byte*) main::str2 main::@19/(const byte*) main::str3 ) [116] (byte*) print_str_at::str#7 ← phi( main::@17/(const byte*) main::str1 main::@3/(const byte*) main::str main::@18/(const byte*) main::str2 main::@19/(const byte*) main::str3 )
to:print_str_at::@1 to:print_str_at::@1
print_str_at::@1: scope:[print_str_at] from print_str_at print_str_at::@2 print_str_at::@1: scope:[print_str_at] from print_str_at print_str_at::@2
[128] (byte*) print_str_at::at#5 ← phi( print_str_at/(byte*) print_str_at::at#7 print_str_at::@2/(byte*) print_str_at::at#4 ) [117] (byte*) print_str_at::at#5 ← phi( print_str_at/(byte*) print_str_at::at#7 print_str_at::@2/(byte*) print_str_at::at#4 )
[128] (byte*) print_str_at::str#5 ← phi( print_str_at/(byte*) print_str_at::str#7 print_str_at::@2/(byte*) print_str_at::str#4 ) [117] (byte*) print_str_at::str#5 ← phi( print_str_at/(byte*) print_str_at::str#7 print_str_at::@2/(byte*) print_str_at::str#4 )
[129] if((byte) 0!=*((byte*) print_str_at::str#5)) goto print_str_at::@2 [118] if((byte) 0!=*((byte*) print_str_at::str#5)) goto print_str_at::@2
to:print_str_at::@return to:print_str_at::@return
print_str_at::@return: scope:[print_str_at] from print_str_at::@1 print_str_at::@return: scope:[print_str_at] from print_str_at::@1
[130] return [119] return
to:@return to:@return
print_str_at::@2: scope:[print_str_at] from print_str_at::@1 print_str_at::@2: scope:[print_str_at] from print_str_at::@1
[131] *((byte*) print_str_at::at#5) ← *((byte*) print_str_at::str#5) [120] *((byte*) print_str_at::at#5) ← *((byte*) print_str_at::str#5)
[132] (byte*) print_str_at::at#4 ← ++ (byte*) print_str_at::at#5 [121] (byte*) print_str_at::at#4 ← ++ (byte*) print_str_at::at#5
[133] (byte*) print_str_at::str#4 ← ++ (byte*) print_str_at::str#5 [122] (byte*) print_str_at::str#4 ← ++ (byte*) print_str_at::str#5
to:print_str_at::@1 to:print_str_at::@1

File diff suppressed because it is too large Load Diff

View File

@ -161,33 +161,13 @@
(const byte*) main::str1[(byte) 3] = (byte*) "f3" (const byte*) main::str1[(byte) 3] = (byte*) "f3"
(const byte*) main::str2[(byte) 3] = (byte*) "f5" (const byte*) main::str2[(byte) 3] = (byte*) "f5"
(const byte*) main::str3[(byte) 3] = (byte*) "f7" (const byte*) main::str3[(byte) 3] = (byte*) "f7"
(word()) mul8u((byte) mul8u::a , (byte) mul8u::b)
(byte~) mul8u::$1 reg byte a 2.00000002E8
(label) mul8u::@1
(label) mul8u::@2
(label) mul8u::@3
(label) mul8u::@4
(label) mul8u::@return
(byte) mul8u::a
(byte) mul8u::a#0 reg byte x 1.00000001E8
(byte) mul8u::a#1 reg byte x 55001.0
(byte) mul8u::a#2 reg byte x 6.668333416666667E7
(byte) mul8u::b
(const byte) mul8u::b#0 b = (byte) $a
(word) mul8u::mb
(word) mul8u::mb#1 mb zp[2]:10 2.00000002E8
(word) mul8u::mb#2 mb zp[2]:10 4.285714328571428E7
(word) mul8u::res
(word) mul8u::res#1 res zp[2]:14 2.00000002E8
(word) mul8u::res#2 res zp[2]:14 5.0001667333333336E7
(word) mul8u::res#6 res zp[2]:14 1.00000001E8
(word) mul8u::return
(word) mul8u::return#2 return zp[2]:14 20002.0
(void()) plot_chargen((byte) plot_chargen::pos , (byte) plot_chargen::ch , (byte) plot_chargen::shift) (void()) plot_chargen((byte) plot_chargen::pos , (byte) plot_chargen::ch , (byte) plot_chargen::shift)
(word~) plot_chargen::$0 zp[2]:12 20002.0 (word~) plot_chargen::$0 zp[2]:10 20002.0
(word~) plot_chargen::$1 zp[2]:12 20002.0 (word~) plot_chargen::$1 zp[2]:10 20002.0
(byte~) plot_chargen::$10 reg byte a 2.00000002E8 (byte~) plot_chargen::$16 reg byte a 20002.0
(word~) plot_chargen::$7 zp[2]:14 20002.0 (byte~) plot_chargen::$17 reg byte a 20002.0
(byte~) plot_chargen::$6 reg byte a 20002.0
(byte~) plot_chargen::$9 reg byte a 2.00000002E8
(label) plot_chargen::@1 (label) plot_chargen::@1
(label) plot_chargen::@2 (label) plot_chargen::@2
(label) plot_chargen::@3 (label) plot_chargen::@3
@ -196,7 +176,6 @@
(label) plot_chargen::@6 (label) plot_chargen::@6
(label) plot_chargen::@7 (label) plot_chargen::@7
(label) plot_chargen::@8 (label) plot_chargen::@8
(label) plot_chargen::@9
(label) plot_chargen::@return (label) plot_chargen::@return
(byte) plot_chargen::bits (byte) plot_chargen::bits
(byte) plot_chargen::bits#0 bits zp[1]:9 2.0000002E7 (byte) plot_chargen::bits#0 bits zp[1]:9 2.0000002E7
@ -208,19 +187,19 @@
(byte) plot_chargen::ch#1 reg byte a 1001.0 (byte) plot_chargen::ch#1 reg byte a 1001.0
(byte) plot_chargen::ch#2 reg byte a 500.5 (byte) plot_chargen::ch#2 reg byte a 500.5
(byte*) plot_chargen::chargen (byte*) plot_chargen::chargen
(byte*) plot_chargen::chargen#0 chargen zp[2]:12 15001.5 (byte*) plot_chargen::chargen#0 chargen zp[2]:10 15001.5
(byte*) plot_chargen::chargen#1 chargen zp[2]:12 20002.0 (byte*) plot_chargen::chargen#1 chargen zp[2]:10 20002.0
(byte*) plot_chargen::chargen#5 chargen zp[2]:12 455454.6818181818 (byte*) plot_chargen::chargen#4 chargen zp[2]:10 477143.0
(byte) plot_chargen::pos (byte) plot_chargen::pos
(byte) plot_chargen::pos#0 reg byte y 202.0 (byte) plot_chargen::pos#0 reg byte y 202.0
(byte) plot_chargen::pos#1 reg byte y 667.3333333333334 (byte) plot_chargen::pos#1 reg byte y 667.3333333333334
(byte) plot_chargen::pos#2 reg byte y 1233.6666666666665 (byte) plot_chargen::pos#2 reg byte y 2110.4
(byte*) plot_chargen::sc (byte*) plot_chargen::sc
(byte*) plot_chargen::sc#0 sc zp[2]:14 20002.0 (byte*) plot_chargen::sc#0 sc zp[2]:12 20002.0
(byte*) plot_chargen::sc#1 sc zp[2]:14 5.250000075E7 (byte*) plot_chargen::sc#1 sc zp[2]:12 5.250000075E7
(byte*) plot_chargen::sc#2 sc zp[2]:14 6666667.333333333 (byte*) plot_chargen::sc#2 sc zp[2]:12 6666667.333333333
(byte*) plot_chargen::sc#3 sc zp[2]:14 5.1666667333333336E7 (byte*) plot_chargen::sc#3 sc zp[2]:12 5.1666667333333336E7
(byte*) plot_chargen::sc#7 sc zp[2]:14 1.00050015E7 (byte*) plot_chargen::sc#7 sc zp[2]:12 1.00050015E7
(byte) plot_chargen::shift (byte) plot_chargen::shift
(byte) plot_chargen::shift#1 reg byte x 2002.0 (byte) plot_chargen::shift#1 reg byte x 2002.0
(byte) plot_chargen::shift#2 reg byte x 2200.4 (byte) plot_chargen::shift#2 reg byte x 2200.4
@ -235,13 +214,13 @@
(label) print_str_at::@2 (label) print_str_at::@2
(label) print_str_at::@return (label) print_str_at::@return
(byte*) print_str_at::at (byte*) print_str_at::at
(byte*) print_str_at::at#4 at zp[2]:14 1001.0 (byte*) print_str_at::at#4 at zp[2]:12 1001.0
(byte*) print_str_at::at#5 at zp[2]:14 1034.6666666666667 (byte*) print_str_at::at#5 at zp[2]:12 1034.6666666666667
(byte*) print_str_at::at#7 at zp[2]:14 101.0 (byte*) print_str_at::at#7 at zp[2]:12 101.0
(byte*) print_str_at::str (byte*) print_str_at::str
(byte*) print_str_at::str#4 str zp[2]:12 2002.0 (byte*) print_str_at::str#4 str zp[2]:10 2002.0
(byte*) print_str_at::str#5 str zp[2]:12 1026.25 (byte*) print_str_at::str#5 str zp[2]:10 1026.25
(byte*) print_str_at::str#7 str zp[2]:12 101.0 (byte*) print_str_at::str#7 str zp[2]:10 101.0
zp[2]:2 [ main::sc#2 main::sc#1 ] zp[2]:2 [ main::sc#2 main::sc#1 ]
zp[1]:4 [ main::i#2 main::i#1 ] zp[1]:4 [ main::i#2 main::i#1 ]
@ -256,11 +235,9 @@ zp[1]:8 [ plot_chargen::y#2 plot_chargen::y#1 ]
zp[1]:9 [ plot_chargen::bits#2 plot_chargen::bits#0 plot_chargen::bits#1 ] zp[1]:9 [ plot_chargen::bits#2 plot_chargen::bits#0 plot_chargen::bits#1 ]
reg byte x [ plot_chargen::x#2 plot_chargen::x#1 ] reg byte x [ plot_chargen::x#2 plot_chargen::x#1 ]
reg byte a [ plot_chargen::c#2 ] reg byte a [ plot_chargen::c#2 ]
reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ]
zp[2]:10 [ mul8u::mb#2 mul8u::mb#1 ]
reg byte x [ keyboard_key_pressed::key#6 keyboard_key_pressed::key#5 ] reg byte x [ keyboard_key_pressed::key#6 keyboard_key_pressed::key#5 ]
zp[2]:12 [ print_str_at::str#5 print_str_at::str#7 print_str_at::str#4 plot_chargen::chargen#5 plot_chargen::chargen#0 plot_chargen::chargen#1 plot_chargen::$1 plot_chargen::$0 ] zp[2]:10 [ print_str_at::str#5 print_str_at::str#7 print_str_at::str#4 plot_chargen::chargen#4 plot_chargen::chargen#0 plot_chargen::chargen#1 plot_chargen::$1 plot_chargen::$0 ]
zp[2]:14 [ print_str_at::at#5 print_str_at::at#7 print_str_at::at#4 plot_chargen::sc#3 plot_chargen::sc#7 plot_chargen::sc#2 plot_chargen::sc#0 plot_chargen::sc#1 plot_chargen::$7 mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 ] zp[2]:12 [ print_str_at::at#5 print_str_at::at#7 print_str_at::at#4 plot_chargen::sc#3 plot_chargen::sc#7 plot_chargen::sc#0 plot_chargen::sc#2 plot_chargen::sc#1 ]
reg byte a [ keyboard_key_pressed::return#2 ] reg byte a [ keyboard_key_pressed::return#2 ]
reg byte a [ main::$15 ] reg byte a [ main::$15 ]
reg byte a [ keyboard_key_pressed::return#10 ] reg byte a [ keyboard_key_pressed::return#10 ]
@ -275,8 +252,10 @@ reg byte x [ keyboard_get_keycode::ch#0 ]
reg byte a [ keyboard_get_keycode::return#2 ] reg byte a [ keyboard_get_keycode::return#2 ]
reg byte a [ main::key#0 ] reg byte a [ main::key#0 ]
reg byte a [ keyboard_key_pressed::return#14 ] reg byte a [ keyboard_key_pressed::return#14 ]
reg byte a [ plot_chargen::$10 ] reg byte a [ plot_chargen::$16 ]
reg byte a [ mul8u::$1 ] reg byte a [ plot_chargen::$17 ]
reg byte a [ plot_chargen::$6 ]
reg byte a [ plot_chargen::$9 ]
reg byte y [ keyboard_key_pressed::colidx#0 ] reg byte y [ keyboard_key_pressed::colidx#0 ]
reg byte a [ keyboard_key_pressed::rowidx#0 ] reg byte a [ keyboard_key_pressed::rowidx#0 ]
reg byte x [ keyboard_matrix_read::rowid#0 ] reg byte x [ keyboard_matrix_read::rowid#0 ]

View File

@ -0,0 +1,480 @@
// Creates a 2x2 font from the system CHARGEN font and compress it by identifying identical chars
.pc = $801 "Basic"
:BasicUpstart(main)
.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 D018 = $d018
.label SCREEN = $400
.label FONT_ORIGINAL = $2000
.label FONT_COMPRESSED = $2800
main: {
.const toD0181_return = (>(SCREEN&$3fff)*4)|(>FONT_COMPRESSED)/4&$f
.label c = 3
.label x = 4
.label y = 2
// asm
// Create 2x2 font from CHARGEN
sei
// *PROCPORT = PROCPORT_RAM_CHARROM
lda #PROCPORT_RAM_CHARROM
sta PROCPORT
// font_2x2(CHARGEN, FONT_ORIGINAL)
jsr font_2x2
// *PROCPORT = PROCPORT_BASIC_KERNEL_IO
lda #PROCPORT_BASIC_KERNEL_IO
sta PROCPORT
// asm
cli
// font_compress(FONT_ORIGINAL, FONT_COMPRESSED, FONT_COMPRESSED_MAP)
jsr font_compress
// *D018 = toD018(SCREEN, FONT_COMPRESSED)
// Show compressed font
lda #toD0181_return
sta D018
// memset(SCREEN, FONT_COMPRESSED_MAP[' '], 0x0400)
ldx FONT_COMPRESSED_MAP+' '
// Clear the screen
jsr memset
lda #0
sta.z y
sta.z c
__b1:
lda #0
sta.z x
__b2:
// show(c++, x, y, FONT_COMPRESSED_MAP)
ldx.z x
lda.z y
jsr show
// show(c++, x, y, FONT_COMPRESSED_MAP);
inc.z c
// for(char x:0..7)
inc.z x
lda #8
cmp.z x
bne __b2
// for(char y:0..7)
inc.z y
cmp.z y
bne __b1
__b4:
// (*(SCREEN+999))++;
inc SCREEN+$3e7
jmp __b4
}
// Show a 2x2 char on the screen at 2x2-position (x, y) using a font compress mapping
// show(byte zp(3) c, byte register(X) x, byte register(A) y)
show: {
.label __0 = $f
.label __1 = $f
.label __2 = $f
.label c = 3
.label ptr = $f
.label __8 = $11
.label __9 = $f
// (unsigned int)y
sta.z __0
lda #0
sta.z __0+1
// (unsigned int)y*80
lda.z __0
asl
sta.z __8
lda.z __0+1
rol
sta.z __8+1
asl.z __8
rol.z __8+1
lda.z __9
clc
adc.z __8
sta.z __9
lda.z __9+1
adc.z __8+1
sta.z __9+1
asl.z __1
rol.z __1+1
asl.z __1
rol.z __1+1
asl.z __1
rol.z __1+1
asl.z __1
rol.z __1+1
// SCREEN + (unsigned int)y*80
clc
lda.z __2
adc #<SCREEN
sta.z __2
lda.z __2+1
adc #>SCREEN
sta.z __2+1
// x*2
txa
asl
// ptr = SCREEN + (unsigned int)y*80 + x*2
clc
adc.z ptr
sta.z ptr
bcc !+
inc.z ptr+1
!:
// ptr[0] = font_mapping[c]
ldy.z c
lda FONT_COMPRESSED_MAP,y
ldy #0
sta (ptr),y
// c+0x40
ldx.z c
// ptr[1] = font_mapping[c+0x40]
lda FONT_COMPRESSED_MAP+$40,x
ldy #1
sta (ptr),y
// c+0x80
txa
// ptr[40] = font_mapping[c+0x80]
tay
lda FONT_COMPRESSED_MAP+$80,y
ldy #$28
sta (ptr),y
// c+0xc0
txa
// ptr[41] = font_mapping[c+0xc0]
tay
lda FONT_COMPRESSED_MAP+$c0,y
ldy #$29
sta (ptr),y
// }
rts
}
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// memset(byte register(X) c)
memset: {
.label str = SCREEN
.const num = $400
.label end = str+num
.label dst = $d
lda #<str
sta.z dst
lda #>str
sta.z dst+1
__b1:
// for(char* dst = str; dst!=end; dst++)
lda.z dst+1
cmp #>end
bne __b2
lda.z dst
cmp #<end
bne __b2
// }
rts
__b2:
// *dst = c
txa
ldy #0
sta (dst),y
// for(char* dst = str; dst!=end; dst++)
inc.z dst
bne !+
inc.z dst+1
!:
jmp __b1
}
// Compress a font finding identical characters
// The compressed font is put into font_compressed and the compress_mapping is updated
// so that compress_mapping[c] points to the char in font_compressed that is identical to char c in font_original
// Returns the size of the compressed font (in chars)
font_compress: {
.label next_original = $d
.label i = $a
.label next_compressed = 5
.label font_size = 9
lda #<FONT_COMPRESSED
sta.z next_compressed
lda #>FONT_COMPRESSED
sta.z next_compressed+1
lda #0
sta.z i
sta.z font_size
lda #<FONT_ORIGINAL
sta.z next_original
lda #>FONT_ORIGINAL
sta.z next_original+1
__b1:
// font_find(next_original, font_compressed, font_size)
jsr font_find
// font_find(next_original, font_compressed, font_size)
txa
// found = font_find(next_original, font_compressed, font_size)
// if(found==0xff)
cmp #$ff
bne __b7
ldy #0
// Glyph not found - create it
__b3:
// next_compressed[l] = next_original[l]
lda (next_original),y
sta (next_compressed),y
// for(char l:0..7)
iny
cpy #8
bne __b3
// next_compressed += 8
lda #8
clc
adc.z next_compressed
sta.z next_compressed
bcc !+
inc.z next_compressed+1
!:
// font_size++;
ldx.z font_size
inx
lda.z font_size
__b2:
// compress_mapping[i] = found
ldy.z i
sta FONT_COMPRESSED_MAP,y
// next_original += 8
lda #8
clc
adc.z next_original
sta.z next_original
bcc !+
inc.z next_original+1
!:
// for(char i: 0..0xff)
inc.z i
lda.z i
cmp #0
bne __b6
// }
rts
__b6:
stx.z font_size
jmp __b1
__b7:
ldx.z font_size
jmp __b2
}
// Look for a glyph within a font
// Only looks at the first font_size glyphs
// Returns the index of the glyph within the font. Returns 0xff if the glyph is not found.
// font_find(byte* zp($d) glyph, byte* zp(7) font, byte zp(9) font_size)
font_find: {
.label glyph = $d
.label font_size = 9
.label font = 7
lda #<FONT_COMPRESSED
sta.z font
lda #>FONT_COMPRESSED
sta.z font+1
ldx #0
__b1:
// for(char i=0;i<font_size;i++)
cpx.z font_size
bcc b1
ldx #$ff
// }
rts
b1:
ldy #0
__b2:
// if(glyph[l]!=font[l])
lda (glyph),y
cmp (font),y
beq __b3
lda #0
jmp __b4
__b3:
// for(char l:0..7)
iny
cpy #8
bne __b2
lda #1
__b4:
// if(found)
cmp #0
beq __b5
rts
__b5:
// font += 8
lda #8
clc
adc.z font
sta.z font
bcc !+
inc.z font+1
!:
// for(char i=0;i<font_size;i++)
inx
jmp __b1
}
// Create a 2x2-font by doubling all pixels of the 64 first chars
font_2x2: {
.label __5 = $d
.label __7 = $d
.label next_2x2_left = 5
.label next_2x2_right = $11
.label glyph_bits = $c
.label glyph_bits_2x2 = $d
.label l2 = $b
.label l = $a
.label next_2x2_left_1 = $f
.label next_2x2 = 5
.label next_original = 7
.label c = 9
lda #0
sta.z c
lda #<CHARGEN
sta.z next_original
lda #>CHARGEN
sta.z next_original+1
lda #<FONT_ORIGINAL
sta.z next_2x2_left
lda #>FONT_ORIGINAL
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
}
.align $100
FONT_COMPRESSED_MAP: .fill $100, 0

View File

@ -0,0 +1,239 @@
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
[1] phi()
[2] call main
to:@end
@end: scope:[] from @1
[3] phi()
(void()) main()
main: scope:[main] from @1
asm { sei }
[5] *((const byte*) PROCPORT) ← (const byte) PROCPORT_RAM_CHARROM
[6] call font_2x2
to:main::@6
main::@6: scope:[main] from main
[7] *((const byte*) PROCPORT) ← (const byte) PROCPORT_BASIC_KERNEL_IO
asm { cli }
[9] call font_compress
to:main::toD0181
main::toD0181: scope:[main] from main::@6
[10] phi()
to:main::@5
main::@5: scope:[main] from main::toD0181
[11] *((const byte*) D018) ← (const byte) main::toD0181_return#0
[12] (byte) memset::c#0 ← *((const byte*) FONT_COMPRESSED_MAP+(byte) ' ')
[13] call memset
to:main::@1
main::@1: scope:[main] from main::@3 main::@5
[14] (byte) main::y#4 ← phi( main::@5/(byte) 0 main::@3/(byte) main::y#1 )
[14] (byte) main::c#4 ← phi( main::@5/(byte) 0 main::@3/(byte) main::c#1 )
to:main::@2
main::@2: scope:[main] from main::@1 main::@7
[15] (byte) main::x#2 ← phi( main::@1/(byte) 0 main::@7/(byte) main::x#1 )
[15] (byte) main::c#2 ← phi( main::@1/(byte) main::c#4 main::@7/(byte) main::c#1 )
[16] (byte) show::c#0 ← (byte) main::c#2
[17] (byte) show::x#0 ← (byte) main::x#2
[18] (byte) show::y#0 ← (byte) main::y#4
[19] call show
to:main::@7
main::@7: scope:[main] from main::@2
[20] (byte) main::c#1 ← ++ (byte) main::c#2
[21] (byte) main::x#1 ← ++ (byte) main::x#2
[22] if((byte) main::x#1!=(byte) 8) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@7
[23] (byte) main::y#1 ← ++ (byte) main::y#4
[24] if((byte) main::y#1!=(byte) 8) goto main::@1
to:main::@4
main::@4: scope:[main] from main::@3 main::@4
[25] *((const byte*) SCREEN+(word) $3e7) ← ++ *((const byte*) SCREEN+(word) $3e7)
to:main::@4
(void()) show((byte) show::c , (byte) show::x , (byte) show::y , (byte*) show::font_mapping)
show: scope:[show] from main::@2
[26] (word~) show::$0 ← (word)(byte) show::y#0
[27] (word~) show::$8 ← (word~) show::$0 << (byte) 2
[28] (word~) show::$9 ← (word~) show::$8 + (word~) show::$0
[29] (word~) show::$1 ← (word~) show::$9 << (byte) 4
[30] (byte*~) show::$2 ← (const byte*) SCREEN + (word~) show::$1
[31] (byte~) show::$3 ← (byte) show::x#0 << (byte) 1
[32] (byte*) show::ptr#0 ← (byte*~) show::$2 + (byte~) show::$3
[33] *((byte*) show::ptr#0) ← *((const byte*) FONT_COMPRESSED_MAP + (byte) show::c#0)
[34] (byte~) show::$5 ← (byte) show::c#0
[35] *((byte*) show::ptr#0 + (byte) 1) ← *((const byte*) FONT_COMPRESSED_MAP+(byte) $40 + (byte~) show::$5)
[36] (byte~) show::$6 ← (byte) show::c#0
[37] *((byte*) show::ptr#0 + (byte) $28) ← *((const byte*) FONT_COMPRESSED_MAP+(byte) $80 + (byte~) show::$6)
[38] (byte~) show::$7 ← (byte) show::c#0
[39] *((byte*) show::ptr#0 + (byte) $29) ← *((const byte*) FONT_COMPRESSED_MAP+(byte) $c0 + (byte~) show::$7)
to:show::@return
show::@return: scope:[show] from show
[40] return
to:@return
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
memset: scope:[memset] from main::@5
[41] phi()
to:memset::@1
memset::@1: scope:[memset] from memset memset::@2
[42] (byte*) memset::dst#2 ← phi( memset/(byte*)(const void*) memset::str#0 memset::@2/(byte*) memset::dst#1 )
[43] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2
to:memset::@return
memset::@return: scope:[memset] from memset::@1
[44] return
to:@return
memset::@2: scope:[memset] from memset::@1
[45] *((byte*) memset::dst#2) ← (byte) memset::c#0
[46] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2
to:memset::@1
(byte()) font_compress((byte*) font_compress::font_original , (byte*) font_compress::font_compressed , (byte*) font_compress::compress_mapping)
font_compress: scope:[font_compress] from main::@6
[47] phi()
to:font_compress::@1
font_compress::@1: scope:[font_compress] from font_compress font_compress::@6
[48] (byte*) font_compress::next_compressed#4 ← phi( font_compress/(const byte*) FONT_COMPRESSED font_compress::@6/(byte*) font_compress::next_compressed#7 )
[48] (byte) font_compress::i#4 ← phi( font_compress/(byte) 0 font_compress::@6/(byte) font_compress::i#1 )
[48] (byte) font_compress::font_size#2 ← phi( font_compress/(byte) 0 font_compress::@6/(byte) font_compress::font_size#9 )
[48] (byte*) font_compress::next_original#2 ← phi( font_compress/(const byte*) FONT_ORIGINAL font_compress::@6/(byte*) font_compress::next_original#1 )
[49] (byte*) font_find::glyph#0 ← (byte*) font_compress::next_original#2
[50] (byte) font_find::font_size#0 ← (byte) font_compress::font_size#2
[51] call font_find
[52] (byte) font_find::return#0 ← (byte) font_find::return#3
to:font_compress::@5
font_compress::@5: scope:[font_compress] from font_compress::@1
[53] (byte) font_compress::found#0 ← (byte) font_find::return#0
[54] if((byte) font_compress::found#0!=(byte) $ff) goto font_compress::@7
to:font_compress::@3
font_compress::@3: scope:[font_compress] from font_compress::@3 font_compress::@5
[55] (byte) font_compress::l#2 ← phi( font_compress::@3/(byte) font_compress::l#1 font_compress::@5/(byte) 0 )
[56] *((byte*) font_compress::next_compressed#4 + (byte) font_compress::l#2) ← *((byte*) font_compress::next_original#2 + (byte) font_compress::l#2)
[57] (byte) font_compress::l#1 ← ++ (byte) font_compress::l#2
[58] if((byte) font_compress::l#1!=(byte) 8) goto font_compress::@3
to:font_compress::@4
font_compress::@4: scope:[font_compress] from font_compress::@3
[59] (byte*) font_compress::next_compressed#1 ← (byte*) font_compress::next_compressed#4 + (byte) 8
[60] (byte) font_compress::font_size#1 ← ++ (byte) font_compress::font_size#2
[61] (byte) font_compress::found#3 ← (byte) font_compress::font_size#2
to:font_compress::@2
font_compress::@2: scope:[font_compress] from font_compress::@4 font_compress::@7
[62] (byte*) font_compress::next_compressed#7 ← phi( font_compress::@4/(byte*) font_compress::next_compressed#1 font_compress::@7/(byte*) font_compress::next_compressed#4 )
[62] (byte) font_compress::return#1 ← phi( font_compress::@4/(byte) font_compress::font_size#1 font_compress::@7/(byte) font_compress::return#5 )
[62] (byte) font_compress::found#2 ← phi( font_compress::@4/(byte) font_compress::found#3 font_compress::@7/(byte) font_compress::found#0 )
[63] *((const byte*) FONT_COMPRESSED_MAP + (byte) font_compress::i#4) ← (byte) font_compress::found#2
[64] (byte*) font_compress::next_original#1 ← (byte*) font_compress::next_original#2 + (byte) 8
[65] (byte) font_compress::i#1 ← ++ (byte) font_compress::i#4
[66] if((byte) font_compress::i#1!=(byte) 0) goto font_compress::@6
to:font_compress::@return
font_compress::@return: scope:[font_compress] from font_compress::@2
[67] return
to:@return
font_compress::@6: scope:[font_compress] from font_compress::@2
[68] (byte) font_compress::font_size#9 ← (byte) font_compress::return#1
to:font_compress::@1
font_compress::@7: scope:[font_compress] from font_compress::@5
[69] (byte) font_compress::return#5 ← (byte) font_compress::font_size#2
to:font_compress::@2
(byte()) font_find((byte*) font_find::glyph , (byte*) font_find::font , (byte) font_find::font_size)
font_find: scope:[font_find] from font_compress::@1
[70] phi()
to:font_find::@1
font_find::@1: scope:[font_find] from font_find font_find::@5
[71] (byte*) font_find::font#4 ← phi( font_find/(const byte*) FONT_COMPRESSED font_find::@5/(byte*) font_find::font#1 )
[71] (byte) font_find::i#2 ← phi( font_find/(byte) 0 font_find::@5/(byte) font_find::i#1 )
[72] if((byte) font_find::i#2<(byte) font_find::font_size#0) goto font_find::@2
to:font_find::@return
font_find::@return: scope:[font_find] from font_find::@1 font_find::@4
[73] (byte) font_find::return#3 ← phi( font_find::@4/(byte) font_find::i#2 font_find::@1/(byte) $ff )
[74] return
to:@return
font_find::@2: scope:[font_find] from font_find::@1 font_find::@3
[75] (byte) font_find::l#2 ← phi( font_find::@1/(byte) 0 font_find::@3/(byte) font_find::l#1 )
[76] if(*((byte*) font_find::glyph#0 + (byte) font_find::l#2)==*((byte*) font_find::font#4 + (byte) font_find::l#2)) goto font_find::@3
to:font_find::@4
font_find::@3: scope:[font_find] from font_find::@2
[77] (byte) font_find::l#1 ← ++ (byte) font_find::l#2
[78] if((byte) font_find::l#1!=(byte) 8) goto font_find::@2
to:font_find::@4
font_find::@4: scope:[font_find] from font_find::@2 font_find::@3
[79] (byte) font_find::found#2 ← phi( font_find::@3/(byte) 1 font_find::@2/(byte) 0 )
[80] if((byte) 0==(byte) font_find::found#2) goto font_find::@5
to:font_find::@return
font_find::@5: scope:[font_find] from font_find::@4
[81] (byte*) font_find::font#1 ← (byte*) font_find::font#4 + (byte) 8
[82] (byte) font_find::i#1 ← ++ (byte) font_find::i#2
to:font_find::@1
(void()) font_2x2((byte*) font_2x2::font_original , (byte*) font_2x2::font_2x2)
font_2x2: scope:[font_2x2] from main
[83] phi()
to:font_2x2::@1
font_2x2::@1: scope:[font_2x2] from font_2x2 font_2x2::@9
[84] (byte) font_2x2::c#11 ← phi( font_2x2/(byte) 0 font_2x2::@9/(byte) font_2x2::c#1 )
[84] (byte*) font_2x2::next_original#4 ← phi( font_2x2/(const byte*) CHARGEN font_2x2::@9/(byte*) font_2x2::next_original#1 )
[84] (byte*) font_2x2::next_2x2_left#0 ← phi( font_2x2/(const byte*) FONT_ORIGINAL font_2x2::@9/(byte*) font_2x2::next_2x2#1 )
[85] (byte*) font_2x2::next_2x2_right#0 ← (byte*) font_2x2::next_2x2_left#0 + (word)(number) $40*(number) 8
[86] (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
[87] (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 )
[87] (byte) font_2x2::l2#8 ← phi( font_2x2::@1/(byte) 0 font_2x2::@8/(byte) font_2x2::l2#9 )
[87] (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 )
[87] (byte) font_2x2::l#2 ← phi( font_2x2::@1/(byte) 0 font_2x2::@8/(byte) font_2x2::l#1 )
[88] (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
[89] (byte) font_2x2::b#2 ← phi( font_2x2::@2/(byte) 0 font_2x2::@5/(byte) font_2x2::b#1 )
[89] (word) font_2x2::glyph_bits_2x2#3 ← phi( font_2x2::@2/(word) 0 font_2x2::@5/(word) font_2x2::glyph_bits_2x2#2 )
[89] (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 )
[90] (byte~) font_2x2::$1 ← (byte) font_2x2::glyph_bits#2 & (byte) $80
[91] 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
[92] phi()
to:font_2x2::@5
font_2x2::@5: scope:[font_2x2] from font_2x2::@3 font_2x2::@4
[93] (byte) font_2x2::glyph_bit#0 ← phi( font_2x2::@4/(byte) 1 font_2x2::@3/(byte) 0 )
[94] (word~) font_2x2::$5 ← (word) font_2x2::glyph_bits_2x2#3 << (byte) 1
[95] (word) font_2x2::glyph_bits_2x2#1 ← (word~) font_2x2::$5 | (byte) font_2x2::glyph_bit#0
[96] (word~) font_2x2::$7 ← (word) font_2x2::glyph_bits_2x2#1 << (byte) 1
[97] (word) font_2x2::glyph_bits_2x2#2 ← (word~) font_2x2::$7 | (byte) font_2x2::glyph_bit#0
[98] (byte) font_2x2::glyph_bits#1 ← (byte) font_2x2::glyph_bits#2 << (byte) 1
[99] (byte) font_2x2::b#1 ← ++ (byte) font_2x2::b#2
[100] 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
[101] (byte~) font_2x2::$12 ← > (word) font_2x2::glyph_bits_2x2#2
[102] *((byte*) font_2x2::next_2x2_left#7 + (byte) font_2x2::l2#8) ← (byte~) font_2x2::$12
[103] (byte~) font_2x2::$11 ← (byte) font_2x2::l2#8 + (byte) 1
[104] *((byte*) font_2x2::next_2x2_left#7 + (byte~) font_2x2::$11) ← (byte~) font_2x2::$12
[105] (byte~) font_2x2::$15 ← < (word) font_2x2::glyph_bits_2x2#2
[106] *((byte*) font_2x2::next_2x2_right#7 + (byte) font_2x2::l2#8) ← (byte~) font_2x2::$15
[107] (byte~) font_2x2::$14 ← (byte) font_2x2::l2#8 + (byte) 1
[108] *((byte*) font_2x2::next_2x2_right#7 + (byte~) font_2x2::$14) ← (byte~) font_2x2::$15
[109] (byte) font_2x2::l2#1 ← (byte) font_2x2::l2#8 + (byte) 2
[110] 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
[111] (byte*) font_2x2::next_2x2_left#1 ← (byte*) font_2x2::next_2x2_left#0 + (word)(number) $80*(number) 8
[112] (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
[113] (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 )
[113] (byte) font_2x2::l2#9 ← phi( font_2x2::@7/(byte) 0 font_2x2::@6/(byte) font_2x2::l2#1 )
[113] (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 )
[114] (byte) font_2x2::l#1 ← ++ (byte) font_2x2::l#2
[115] 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
[116] (byte*) font_2x2::next_2x2#1 ← (byte*) font_2x2::next_2x2_left#0 + (byte) 8
[117] (byte*) font_2x2::next_original#1 ← (byte*) font_2x2::next_original#4 + (byte) 8
[118] (byte) font_2x2::c#1 ← ++ (byte) font_2x2::c#11
[119] 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
[120] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,225 @@
(label) @1
(label) @begin
(label) @end
(const byte*) CHARGEN = (byte*) 53248
(const byte*) D018 = (byte*) 53272
(const byte*) FONT_COMPRESSED = (byte*) 10240
(const byte*) FONT_COMPRESSED_MAP[(number) $100] = { fill( $100, 0) }
(const byte*) FONT_ORIGINAL = (byte*) 8192
(const byte*) PROCPORT = (byte*) 1
(const byte) PROCPORT_BASIC_KERNEL_IO = (byte) 7
(const byte) PROCPORT_RAM_CHARROM = (byte) 1
(const byte*) SCREEN = (byte*) 1024
(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]:13 200002.0
(word~) font_2x2::$7 zp[2]:13 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]:9 1501.5
(byte) font_2x2::c#11 c zp[1]:9 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]:12 20002.0
(byte) font_2x2::glyph_bits#1 glyph_bits zp[1]:12 66667.33333333333
(byte) font_2x2::glyph_bits#2 glyph_bits zp[1]:12 34444.88888888889
(word) font_2x2::glyph_bits_2x2
(word) font_2x2::glyph_bits_2x2#1 glyph_bits_2x2 zp[2]:13 200002.0
(word) font_2x2::glyph_bits_2x2#2 glyph_bits_2x2 zp[2]:13 27500.5
(word) font_2x2::glyph_bits_2x2#3 glyph_bits_2x2 zp[2]:13 40000.4
(byte) font_2x2::l
(byte) font_2x2::l#1 l zp[1]:10 15001.5
(byte) font_2x2::l#2 l zp[1]:10 1111.2222222222222
(byte) font_2x2::l2
(byte) font_2x2::l2#1 l2 zp[1]:11 15001.5
(byte) font_2x2::l2#8 l2 zp[1]:11 2727.5454545454545
(byte) font_2x2::l2#9 l2 zp[1]:11 6667.333333333333
(byte*) font_2x2::next_2x2
(byte*) font_2x2::next_2x2#1 next_2x2 zp[2]:5 500.5
(byte*) font_2x2::next_2x2_left
(byte*) font_2x2::next_2x2_left#0 next_2x2_left zp[2]:5 750.1875
(byte*) font_2x2::next_2x2_left#1 next_2x2_left_1 zp[2]:15 10001.0
(byte*) font_2x2::next_2x2_left#10 next_2x2_left_1 zp[2]:15 2002.0
(byte*) font_2x2::next_2x2_left#7 next_2x2_left_1 zp[2]:15 1708.5416666666665
(byte*) font_2x2::next_2x2_left#8 next_2x2_left_1 zp[2]:15 10001.0
(byte*) font_2x2::next_2x2_right
(byte*) font_2x2::next_2x2_right#0 next_2x2_right zp[2]:17 1001.0
(byte*) font_2x2::next_2x2_right#1 next_2x2_right zp[2]:17 20002.0
(byte*) font_2x2::next_2x2_right#7 next_2x2_right zp[2]:17 1708.5416666666665
(byte*) font_2x2::next_2x2_right#8 next_2x2_right zp[2]:17 10001.0
(byte*) font_2x2::next_original
(byte*) font_2x2::next_original#1 next_original zp[2]:7 667.3333333333334
(byte*) font_2x2::next_original#4 next_original zp[2]:7 363.7272727272727
(byte()) font_compress((byte*) font_compress::font_original , (byte*) font_compress::font_compressed , (byte*) font_compress::compress_mapping)
(label) font_compress::@1
(label) font_compress::@2
(label) font_compress::@3
(label) font_compress::@4
(label) font_compress::@5
(label) font_compress::@6
(label) font_compress::@7
(label) font_compress::@return
(byte*) font_compress::compress_mapping
(byte*) font_compress::font_compressed
(byte*) font_compress::font_original
(byte) font_compress::font_size
(byte) font_compress::font_size#1 reg byte x 1001.0
(byte) font_compress::font_size#2 font_size zp[1]:9 385.0
(byte) font_compress::font_size#9 font_size zp[1]:9 2002.0
(byte) font_compress::found
(byte) font_compress::found#0 reg byte a 1001.0
(byte) font_compress::found#2 reg byte a 3003.0
(byte) font_compress::found#3 reg byte a 2002.0
(byte) font_compress::i
(byte) font_compress::i#1 i zp[1]:10 1001.0
(byte) font_compress::i#4 i zp[1]:10 166.83333333333334
(byte) font_compress::l
(byte) font_compress::l#1 reg byte y 15001.5
(byte) font_compress::l#2 reg byte y 20002.0
(byte*) font_compress::next_compressed
(byte*) font_compress::next_compressed#1 next_compressed zp[2]:5 667.3333333333334
(byte*) font_compress::next_compressed#4 next_compressed zp[2]:5 1083.6666666666665
(byte*) font_compress::next_compressed#7 next_compressed zp[2]:5 500.5
(byte*) font_compress::next_original
(byte*) font_compress::next_original#1 next_original zp[2]:13 500.5
(byte*) font_compress::next_original#2 next_original zp[2]:13 764.9411764705882
(byte) font_compress::return
(byte) font_compress::return#1 reg byte x 600.5999999999999
(byte) font_compress::return#5 reg byte x 2002.0
(byte()) font_find((byte*) font_find::glyph , (byte*) font_find::font , (byte) font_find::font_size)
(label) font_find::@1
(label) font_find::@2
(label) font_find::@3
(label) font_find::@4
(label) font_find::@5
(label) font_find::@return
(byte*) font_find::font
(byte*) font_find::font#1 font zp[2]:7 1000001.0
(byte*) font_find::font#4 font zp[2]:7 1500000.375
(byte) font_find::font_size
(byte) font_find::font_size#0 font_size zp[1]:9 83416.83333333334
(byte) font_find::found
(byte) font_find::found#2 reg byte a 1000001.0
(byte*) font_find::glyph
(byte*) font_find::glyph#0 glyph zp[2]:13 769307.8461538461
(byte) font_find::i
(byte) font_find::i#1 reg byte x 2000002.0
(byte) font_find::i#2 reg byte x 444444.8888888889
(byte) font_find::l
(byte) font_find::l#1 reg byte y 1.50000015E7
(byte) font_find::l#2 reg byte y 2.0000002E7
(byte) font_find::return
(byte) font_find::return#0 reg byte a 2002.0
(byte) font_find::return#3 reg byte x 333667.3333333334
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@7
(byte) main::c
(byte) main::c#1 c zp[1]:3 420.59999999999997
(byte) main::c#2 c zp[1]:3 620.8
(byte) main::c#4 c zp[1]:3 202.0
(label) main::toD0181
(byte*) main::toD0181_gfx
(byte) main::toD0181_return
(const byte) main::toD0181_return#0 toD0181_return = >(word)(const byte*) SCREEN&(word) $3fff*(byte) 4|>(word)(const byte*) FONT_COMPRESSED/(byte) 4&(byte) $f
(byte*) main::toD0181_screen
(byte) main::x
(byte) main::x#1 x zp[1]:4 1501.5
(byte) main::x#2 x zp[1]:4 500.5
(byte) main::y
(byte) main::y#1 y zp[1]:2 151.5
(byte) main::y#4 y zp[1]:2 133.66666666666669
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
(label) memset::@1
(label) memset::@2
(label) memset::@return
(byte) memset::c
(byte) memset::c#0 reg byte x 168.66666666666669
(byte*) memset::dst
(byte*) memset::dst#1 dst zp[2]:13 2002.0
(byte*) memset::dst#2 dst zp[2]:13 1334.6666666666667
(byte*) memset::end
(const byte*) memset::end#0 end = (byte*)(const void*) memset::str#0+(const word) memset::num#0
(word) memset::num
(const word) memset::num#0 num = (word) $400
(void*) memset::return
(void*) memset::str
(const void*) memset::str#0 str = (void*)(const byte*) SCREEN
(void()) show((byte) show::c , (byte) show::x , (byte) show::y , (byte*) show::font_mapping)
(word~) show::$0 zp[2]:15 15001.5
(word~) show::$1 zp[2]:15 20002.0
(byte*~) show::$2 zp[2]:15 10001.0
(byte~) show::$3 reg byte a 20002.0
(byte~) show::$5 reg byte x 20002.0
(byte~) show::$6 reg byte a 20002.0
(byte~) show::$7 reg byte a 20002.0
(word~) show::$8 zp[2]:17 20002.0
(word~) show::$9 zp[2]:15 20002.0
(label) show::@return
(byte) show::c
(byte) show::c#0 c zp[1]:3 2733.666666666667
(byte*) show::font_mapping
(byte*) show::ptr
(byte*) show::ptr#0 ptr zp[2]:15 7143.571428571429
(byte) show::x
(byte) show::x#0 reg byte x 1571.7142857142858
(byte) show::y
(byte) show::y#0 reg byte a 1001.0
zp[1]:2 [ main::y#4 main::y#1 ]
zp[1]:3 [ main::c#2 main::c#4 main::c#1 show::c#0 ]
zp[1]:4 [ main::x#2 main::x#1 ]
reg byte y [ font_compress::l#2 font_compress::l#1 ]
reg byte a [ font_compress::found#2 font_compress::found#3 font_compress::found#0 ]
reg byte x [ font_compress::return#1 font_compress::font_size#1 font_compress::return#5 ]
reg byte x [ font_find::return#3 font_find::i#2 font_find::i#1 ]
reg byte y [ font_find::l#2 font_find::l#1 ]
reg byte a [ font_find::found#2 ]
zp[2]:5 [ font_2x2::next_2x2_left#0 font_2x2::next_2x2#1 font_compress::next_compressed#4 font_compress::next_compressed#7 font_compress::next_compressed#1 ]
zp[2]:7 [ font_2x2::next_original#4 font_2x2::next_original#1 font_find::font#4 font_find::font#1 ]
zp[1]:9 [ font_2x2::c#11 font_2x2::c#1 font_compress::font_size#2 font_compress::font_size#9 font_find::font_size#0 ]
zp[1]:10 [ font_2x2::l#2 font_2x2::l#1 font_compress::i#4 font_compress::i#1 ]
zp[1]:11 [ font_2x2::l2#8 font_2x2::l2#9 font_2x2::l2#1 ]
zp[1]:12 [ font_2x2::glyph_bits#2 font_2x2::glyph_bits#0 font_2x2::glyph_bits#1 ]
zp[2]:13 [ font_2x2::glyph_bits_2x2#3 font_2x2::glyph_bits_2x2#2 font_2x2::$5 font_2x2::$7 font_2x2::glyph_bits_2x2#1 font_compress::next_original#2 font_compress::next_original#1 font_find::glyph#0 memset::dst#2 memset::dst#1 ]
reg byte y [ font_2x2::b#2 font_2x2::b#1 ]
reg byte x [ font_2x2::glyph_bit#0 ]
reg byte x [ memset::c#0 ]
reg byte x [ show::x#0 ]
reg byte a [ show::y#0 ]
zp[2]:15 [ show::$0 show::$9 show::$1 show::$2 show::ptr#0 font_2x2::next_2x2_left#7 font_2x2::next_2x2_left#10 font_2x2::next_2x2_left#8 font_2x2::next_2x2_left#1 ]
zp[2]:17 [ show::$8 font_2x2::next_2x2_right#7 font_2x2::next_2x2_right#0 font_2x2::next_2x2_right#8 font_2x2::next_2x2_right#1 ]
reg byte a [ show::$3 ]
reg byte x [ show::$5 ]
reg byte a [ show::$6 ]
reg byte a [ show::$7 ]
reg byte a [ font_find::return#0 ]
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 ]