1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-19 11:31:57 +00:00

Added half-asses halfscii.

This commit is contained in:
jespergravgaard 2017-10-21 12:36:37 +02:00
parent c569ce8de9
commit 774e909a20
10 changed files with 6177 additions and 10 deletions

View File

@ -108,7 +108,7 @@ public class AsmFragmentManager {
}
}
if (signature.startsWith("zpby1=")) {
String subSignature = "aby=" + signature.substring(6).replace("zpby2", "zpby1").replace("zpby3", "zpby2");
String subSignature = "aby=" + signature.substring(6).replace("zpby1", "aby").replace("zpby2", "zpby1").replace("zpby3", "zpby2");
CharStream subCharStream = loadOrSynthesizeFragment(subSignature);
if (subCharStream != null) {
CharStream result = CharStreams.fromString(subCharStream.toString().replace("zpby2", "zpby3").replace("zpby1", "zpby2") + "\nsta {zpby1}\n");

View File

@ -0,0 +1 @@
asl

View File

@ -0,0 +1,2 @@
asl
asl

View File

@ -0,0 +1 @@
lsr

View File

@ -0,0 +1,7 @@
lda {zpptrby2}
clc
adc #1
sta {zpptrby1}
lda {zpptrby2}+1
adc #0
sta {zpptrby1}+1

View File

@ -5,22 +5,38 @@ byte* PROCPORT = $01;
byte* D018 = $d018;
byte* CHARSET4 = $2800;
byte[] bits_count = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
main();
void main() {
*PROCPORT = $32;
byte* chargen = CHARGEN;
byte* charset4 = CHARSET4;
byte* chargen1 = chargen+1;
byte bits = (*chargen & %11000000) >>2 | (*chargen1 & %11000000);
*SCREEN = bits;
do {
byte bits_gen = 0;
byte* chargen1 = chargen+1;
byte bits = bits_count[((*chargen & %01100000) | (*chargen1 & %01100000)>>2)>>1>>2];
if(bits>=2) { bits_gen = bits_gen + 1; }
bits_gen = bits_gen<<1;
bits = bits_count[((*chargen & %00011000) | (*chargen1 & %00011000)>>2)>>1];
if(bits>=2) { bits_gen = bits_gen + 1; }
bits_gen = bits_gen<<1;
bits = bits_count[((*chargen & %00000110)<<1 | (*chargen1 & %00000110)>>1)];
if(bits>=2) { bits_gen = bits_gen + 1; }
bits_gen = bits_gen<<1;
bits = bits_count[((*chargen & %00000001)<<2 | (*chargen1 & %00000001))];
if(bits>=2) { bits_gen = bits_gen + 1; }
bits_gen = bits_gen<<1;
*charset4 = bits_gen;
charset4++;
chargen = chargen+2;
} while (chargen<CHARGEN+$800)
*PROCPORT = $37;
//*D018 = $18;
//for(byte i : 0..255) {
// SCREEN[i] = i;
//}
for(byte i : 0..255) {
SCREEN[i] = i;
}
*D018 = $19;
}

View File

@ -0,0 +1,144 @@
.const SCREEN = $400
.const CHARSET = $2000
.const CHARGEN = $d000
.const PROCPORT = 1
.const D018 = $d018
.const CHARSET4 = $2800
bits_count: .byte 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4
jsr main
main: {
.label _2 = 6
.label _15 = 9
.label _28 = 9
.label _40 = 9
.label chargen1 = 7
.label bits_gen = 6
.label charset4 = 4
.label chargen = 2
lda #$32
sta PROCPORT
lda #<CHARSET4
sta charset4
lda #>CHARSET4
sta charset4+1
lda #<CHARGEN
sta chargen
lda #>CHARGEN
sta chargen+1
b1:
lda chargen
clc
adc #1
sta chargen1
lda chargen+1
adc #0
sta chargen1+1
ldy #0
lda (chargen),y
and #$60
sta _2
lda (chargen1),y
and #$60
lsr
lsr
ora _2
lsr
lsr
lsr
tax
lda bits_count,x
cmp #2
bcc b2_from_b1
lda #0+1
jmp b2
b2_from_b1:
lda #0
b2:
asl
sta bits_gen
ldy #0
lda (chargen),y
and #$18
sta _15
lda (chargen1),y
and #$18
lsr
lsr
ora _15
lsr
tax
lda bits_count,x
cmp #2
bcc b3
inc bits_gen
b3:
asl
sta bits_gen
ldy #0
lda (chargen),y
and #6
asl
sta _28
lda (chargen1),y
and #6
lsr
ora _28
tax
lda bits_count,x
cmp #2
bcc b4
inc bits_gen
b4:
asl
sta bits_gen
ldy #0
lda (chargen),y
and #1
asl
asl
sta _40
lda (chargen1),y
and #1
ora _40
tax
lda bits_count,x
cmp #2
bcc b5
inc bits_gen
b5:
lda bits_gen
asl
ldy #0
sta (charset4),y
inc charset4
bne !+
inc charset4+1
!:
lda chargen
clc
adc #2
sta chargen
bcc !+
inc chargen+1
!:
lda chargen+1
cmp #>CHARGEN+$800
bcc b1
bne !+
lda chargen
cmp #<CHARGEN+$800
bcc b1
!:
lda #$37
sta PROCPORT
ldx #0
b6:
txa
sta SCREEN,x
inx
cpx #0
bne b6
lda #$19
sta D018
rts
}

View File

@ -0,0 +1,94 @@
@begin: scope:[] from
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] *((const byte*) PROCPORT#0) ← (byte) 50 [ ]
to:main::@1
main::@1: scope:[main] from main main::@5
[2] (byte*) main::charset4#10 ← phi( main/(const byte*) CHARSET4#0 main::@5/(byte*) main::charset4#1 ) [ main::chargen#2 main::charset4#10 ]
[2] (byte*) main::chargen#2 ← phi( main/(const byte*) CHARGEN#0 main::@5/(byte*) main::chargen#1 ) [ main::chargen#2 main::charset4#10 ]
[3] (byte*) main::chargen1#0 ← (byte*) main::chargen#2 + (byte) 1 [ main::chargen#2 main::charset4#10 main::chargen1#0 ]
[4] (byte~) main::$1 ← * (byte*) main::chargen#2 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::$1 ]
[5] (byte~) main::$2 ← (byte~) main::$1 & (byte) 96 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::$2 ]
[6] (byte~) main::$3 ← * (byte*) main::chargen1#0 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::$2 main::$3 ]
[7] (byte~) main::$4 ← (byte~) main::$3 & (byte) 96 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::$2 main::$4 ]
[8] (byte~) main::$5 ← (byte~) main::$4 >> (byte) 2 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::$2 main::$5 ]
[9] (byte~) main::$6 ← (byte~) main::$2 | (byte~) main::$5 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::$6 ]
[10] (byte~) main::$7 ← (byte~) main::$6 >> (byte) 1 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::$7 ]
[11] (byte~) main::$8 ← (byte~) main::$7 >> (byte) 2 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::$8 ]
[12] (byte) main::bits#0 ← (const byte[]) bits_count#0 *idx (byte~) main::$8 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits#0 ]
[13] if((byte) main::bits#0<(byte) 2) goto main::@2 [ main::chargen#2 main::charset4#10 main::chargen1#0 ]
to:main::@7
main::@7: scope:[main] from main::@1
to:main::@2
main::@2: scope:[main] from main::@1 main::@7
[14] (byte) main::bits_gen#9 ← phi( main::@1/(byte) 0 main::@7/(byte) 0+(byte) 1 ) [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#9 ]
[15] (byte) main::bits_gen#1 ← (byte) main::bits_gen#9 << (byte) 1 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#1 ]
[16] (byte~) main::$14 ← * (byte*) main::chargen#2 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#1 main::$14 ]
[17] (byte~) main::$15 ← (byte~) main::$14 & (byte) 24 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#1 main::$15 ]
[18] (byte~) main::$16 ← * (byte*) main::chargen1#0 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#1 main::$15 main::$16 ]
[19] (byte~) main::$17 ← (byte~) main::$16 & (byte) 24 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#1 main::$15 main::$17 ]
[20] (byte~) main::$18 ← (byte~) main::$17 >> (byte) 2 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#1 main::$15 main::$18 ]
[21] (byte~) main::$19 ← (byte~) main::$15 | (byte~) main::$18 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#1 main::$19 ]
[22] (byte~) main::$20 ← (byte~) main::$19 >> (byte) 1 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#1 main::$20 ]
[23] (byte) main::bits#1 ← (const byte[]) bits_count#0 *idx (byte~) main::$20 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#1 main::bits#1 ]
[24] if((byte) main::bits#1<(byte) 2) goto main::@3 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#1 ]
to:main::@8
main::@8: scope:[main] from main::@2
[25] (byte) main::bits_gen#4 ← (byte) main::bits_gen#1 + (byte) 1 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#4 ]
to:main::@3
main::@3: scope:[main] from main::@2 main::@8
[26] (byte) main::bits_gen#11 ← phi( main::@2/(byte) main::bits_gen#1 main::@8/(byte) main::bits_gen#4 ) [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#11 ]
[27] (byte) main::bits_gen#14 ← (byte) main::bits_gen#11 << (byte) 1 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#14 ]
[28] (byte~) main::$26 ← * (byte*) main::chargen#2 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#14 main::$26 ]
[29] (byte~) main::$27 ← (byte~) main::$26 & (byte) 6 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#14 main::$27 ]
[30] (byte~) main::$28 ← (byte~) main::$27 << (byte) 1 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#14 main::$28 ]
[31] (byte~) main::$29 ← * (byte*) main::chargen1#0 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#14 main::$28 main::$29 ]
[32] (byte~) main::$30 ← (byte~) main::$29 & (byte) 6 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#14 main::$28 main::$30 ]
[33] (byte~) main::$31 ← (byte~) main::$30 >> (byte) 1 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#14 main::$28 main::$31 ]
[34] (byte~) main::$32 ← (byte~) main::$28 | (byte~) main::$31 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#14 main::$32 ]
[35] (byte) main::bits#2 ← (const byte[]) bits_count#0 *idx (byte~) main::$32 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#14 main::bits#2 ]
[36] if((byte) main::bits#2<(byte) 2) goto main::@4 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#14 ]
to:main::@9
main::@9: scope:[main] from main::@3
[37] (byte) main::bits_gen#6 ← (byte) main::bits_gen#14 + (byte) 1 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#6 ]
to:main::@4
main::@4: scope:[main] from main::@3 main::@9
[38] (byte) main::bits_gen#13 ← phi( main::@3/(byte) main::bits_gen#14 main::@9/(byte) main::bits_gen#6 ) [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#13 ]
[39] (byte) main::bits_gen#16 ← (byte) main::bits_gen#13 << (byte) 1 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#16 ]
[40] (byte~) main::$38 ← * (byte*) main::chargen#2 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#16 main::$38 ]
[41] (byte~) main::$39 ← (byte~) main::$38 & (byte) 1 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#16 main::$39 ]
[42] (byte~) main::$40 ← (byte~) main::$39 << (byte) 2 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::bits_gen#16 main::$40 ]
[43] (byte~) main::$41 ← * (byte*) main::chargen1#0 [ main::chargen#2 main::charset4#10 main::bits_gen#16 main::$40 main::$41 ]
[44] (byte~) main::$42 ← (byte~) main::$41 & (byte) 1 [ main::chargen#2 main::charset4#10 main::bits_gen#16 main::$40 main::$42 ]
[45] (byte~) main::$43 ← (byte~) main::$40 | (byte~) main::$42 [ main::chargen#2 main::charset4#10 main::bits_gen#16 main::$43 ]
[46] (byte) main::bits#3 ← (const byte[]) bits_count#0 *idx (byte~) main::$43 [ main::chargen#2 main::charset4#10 main::bits_gen#16 main::bits#3 ]
[47] if((byte) main::bits#3<(byte) 2) goto main::@5 [ main::chargen#2 main::charset4#10 main::bits_gen#16 ]
to:main::@10
main::@10: scope:[main] from main::@4
[48] (byte) main::bits_gen#8 ← (byte) main::bits_gen#16 + (byte) 1 [ main::chargen#2 main::charset4#10 main::bits_gen#8 ]
to:main::@5
main::@5: scope:[main] from main::@10 main::@4
[49] (byte) main::bits_gen#15 ← phi( main::@10/(byte) main::bits_gen#8 main::@4/(byte) main::bits_gen#16 ) [ main::chargen#2 main::charset4#10 main::bits_gen#15 ]
[50] (byte) main::bits_gen#7 ← (byte) main::bits_gen#15 << (byte) 1 [ main::chargen#2 main::charset4#10 main::bits_gen#7 ]
[51] *((byte*) main::charset4#10) ← (byte) main::bits_gen#7 [ main::chargen#2 main::charset4#10 ]
[52] (byte*) main::charset4#1 ← ++ (byte*) main::charset4#10 [ main::chargen#2 main::charset4#1 ]
[53] (byte*) main::chargen#1 ← (byte*) main::chargen#2 + (byte) 2 [ main::chargen#1 main::charset4#1 ]
[54] if((byte*) main::chargen#1<(const byte*) CHARGEN#0+(word) 2048) goto main::@1 [ main::chargen#1 main::charset4#1 ]
to:main::@11
main::@11: scope:[main] from main::@5
[55] *((const byte*) PROCPORT#0) ← (byte) 55 [ ]
to:main::@6
main::@6: scope:[main] from main::@11 main::@6
[56] (byte) main::i#2 ← phi( main::@11/(byte) 0 main::@6/(byte) main::i#1 ) [ main::i#2 ]
[57] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[58] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[59] if((byte) main::i#1!=(byte) 0) goto main::@6 [ main::i#1 ]
to:main::@12
main::@12: scope:[main] from main::@6
[60] *((const byte*) D018#0) ← (byte) 25 [ ]
to:main::@return
main::@return: scope:[main] from main::@12
[61] return [ ]
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,123 @@
(label) @begin
(label) @end
(byte*) CHARGEN
(const byte*) CHARGEN#0 CHARGEN = (word) 53248
(byte*) CHARSET
(const byte*) CHARSET#0 CHARSET = (word) 8192
(byte*) CHARSET4
(const byte*) CHARSET4#0 CHARSET4 = (word) 10240
(byte*) D018
(const byte*) D018#0 D018 = (word) 53272
(byte*) PROCPORT
(const byte*) PROCPORT#0 PROCPORT = (byte) 1
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = (word) 1024
(byte[]) bits_count
(const byte[]) bits_count#0 bits_count = { (byte) 0, (byte) 1, (byte) 1, (byte) 2, (byte) 1, (byte) 2, (byte) 2, (byte) 3, (byte) 1, (byte) 2, (byte) 2, (byte) 3, (byte) 2, (byte) 3, (byte) 3, (byte) 4 }
(void()) main()
(byte~) main::$1 reg byte a 22.0
(byte~) main::$14 reg byte a 22.0
(byte~) main::$15 $15 zp ZP_BYTE:9 5.5
(byte~) main::$16 reg byte a 22.0
(byte~) main::$17 reg byte a 22.0
(byte~) main::$18 reg byte a 22.0
(byte~) main::$19 reg byte a 22.0
(byte~) main::$2 $2 zp ZP_BYTE:6 5.5
(byte~) main::$20 reg byte a 22.0
(byte~) main::$26 reg byte a 22.0
(byte~) main::$27 reg byte a 22.0
(byte~) main::$28 $28 zp ZP_BYTE:9 5.5
(byte~) main::$29 reg byte a 22.0
(byte~) main::$3 reg byte a 22.0
(byte~) main::$30 reg byte a 22.0
(byte~) main::$31 reg byte a 22.0
(byte~) main::$32 reg byte a 22.0
(byte~) main::$38 reg byte a 22.0
(byte~) main::$39 reg byte a 22.0
(byte~) main::$4 reg byte a 22.0
(byte~) main::$40 $40 zp ZP_BYTE:9 7.333333333333333
(byte~) main::$41 reg byte a 22.0
(byte~) main::$42 reg byte a 22.0
(byte~) main::$43 reg byte a 22.0
(byte~) main::$5 reg byte a 22.0
(byte~) main::$6 reg byte a 22.0
(byte~) main::$7 reg byte a 22.0
(byte~) main::$8 reg byte a 22.0
(label) main::@1
(label) main::@10
(label) main::@11
(label) main::@12
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@7
(label) main::@8
(label) main::@9
(label) main::@return
(byte) main::bits
(byte) main::bits#0 reg byte a 22.0
(byte) main::bits#1 reg byte a 22.0
(byte) main::bits#2 reg byte a 22.0
(byte) main::bits#3 reg byte a 22.0
(byte) main::bits_gen
(byte) main::bits_gen#1 bits_gen zp ZP_BYTE:6 3.3000000000000003
(byte) main::bits_gen#11 bits_gen zp ZP_BYTE:6 33.0
(byte) main::bits_gen#13 bits_gen zp ZP_BYTE:6 33.0
(byte) main::bits_gen#14 bits_gen zp ZP_BYTE:6 3.3000000000000003
(byte) main::bits_gen#15 bits_gen zp ZP_BYTE:6 33.0
(byte) main::bits_gen#16 bits_gen zp ZP_BYTE:6 3.666666666666667
(byte) main::bits_gen#4 bits_gen zp ZP_BYTE:6 22.0
(byte) main::bits_gen#6 bits_gen zp ZP_BYTE:6 22.0
(byte) main::bits_gen#7 reg byte a 22.0
(byte) main::bits_gen#8 bits_gen zp ZP_BYTE:6 22.0
(byte) main::bits_gen#9 reg byte a 11.0
(byte*) main::chargen
(byte*) main::chargen#1 chargen zp ZP_PTR_BYTE:2 16.5
(byte*) main::chargen#2 chargen zp ZP_PTR_BYTE:2 1.5098039215686279
(byte*) main::chargen1
(byte*) main::chargen1#0 chargen1 zp ZP_PTR_BYTE:7 1.375
(byte*) main::charset4
(byte*) main::charset4#1 charset4 zp ZP_PTR_BYTE:4 7.333333333333333
(byte*) main::charset4#10 charset4 zp ZP_PTR_BYTE:4 0.66
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 22.0
zp ZP_PTR_BYTE:2 [ main::chargen#2 main::chargen#1 ]
zp ZP_PTR_BYTE:4 [ main::charset4#10 main::charset4#1 ]
reg byte a [ main::bits_gen#9 ]
zp ZP_BYTE:6 [ main::bits_gen#11 main::bits_gen#1 main::bits_gen#4 main::bits_gen#13 main::bits_gen#14 main::bits_gen#6 main::bits_gen#15 main::bits_gen#8 main::bits_gen#16 main::$2 ]
reg byte x [ main::i#2 main::i#1 ]
zp ZP_PTR_BYTE:7 [ main::chargen1#0 ]
reg byte a [ main::$1 ]
reg byte a [ main::$3 ]
reg byte a [ main::$4 ]
reg byte a [ main::$5 ]
reg byte a [ main::$6 ]
reg byte a [ main::$7 ]
reg byte a [ main::$8 ]
reg byte a [ main::bits#0 ]
reg byte a [ main::$14 ]
zp ZP_BYTE:9 [ main::$15 main::$28 main::$40 ]
reg byte a [ main::$16 ]
reg byte a [ main::$17 ]
reg byte a [ main::$18 ]
reg byte a [ main::$19 ]
reg byte a [ main::$20 ]
reg byte a [ main::bits#1 ]
reg byte a [ main::$26 ]
reg byte a [ main::$27 ]
reg byte a [ main::$29 ]
reg byte a [ main::$30 ]
reg byte a [ main::$31 ]
reg byte a [ main::$32 ]
reg byte a [ main::bits#2 ]
reg byte a [ main::$38 ]
reg byte a [ main::$39 ]
reg byte a [ main::$41 ]
reg byte a [ main::$42 ]
reg byte a [ main::$43 ]
reg byte a [ main::bits#3 ]
reg byte a [ main::bits_gen#7 ]