1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-26 12:49:21 +00:00

Removed unused hi/lo-fragments. Added H-file defining fragment syntax.

This commit is contained in:
jespergravgaard 2021-12-25 23:51:35 +01:00
parent 0152ecd0eb
commit 5fc4c2245f
50 changed files with 173 additions and 10381 deletions

View File

@ -0,0 +1,167 @@
#include <stdint.h>
// Declaration of typed variables used in fragments
uint8_t __register(A) vbuaa;
uint8_t __register(X) vbuxx;
uint8_t __register(Y) vbuyy;
uint8_t __register(Z) vbuzz;
int8_t __register(A) vbsaa;
int8_t __register(X) vbsxx;
int8_t __register(Y) vbsyy;
int8_t __register(Z) vbszz;
uint8_t __zp vbuz1, vbuz2, vbuz3, vbuz4;
uint8_t __mem vbum1, vbum2, vbum3, vbum4;
uint8_t const vbuc1, vbuc2, vbuc3, vbuc4;
int8_t __zp vbsz1, vbsz2, vbsz3, vbsz4;
int8_t __mem vbsm1, vbsm2, vbsm3, vbsm4;
int8_t const vbsc1, vbsc2, vbsc3, vbsc4;
uint16_t __zp vwuz1, vwuz2, vwuz3, vwuz4;
uint16_t __mem vwum1, vwum2, vwum3, vwum4;
uint16_t const vwuc1, vwuc2, vwuc3, vwuc4;
int16_t __zp vwsz1, vwsz2, vwsz3, vwsz4;
int16_t __mem vwsm1, vwsm2, vwsm3, vwsm4;
int16_t const vwsc1, vwsc2, vwsc3, vwsc4;
uint32_t __zp vduz1, vduz2, vduz3, vduz4;
uint32_t __mem vdum1, vdum2, vdum3, vdum4;
uint32_t const vduc1, vduc2, vduc3, vduc4;
int32_t __zp vdsz1, vdsz2, vdsz3, vdsz4;
int32_t __mem vdsm1, vdsm2, vdsm3, vdsm4;
int32_t const vdsc1, vdsc2, vdsc3, vdsc4;
typedef uint8_t * __zp PBUZ;
PBUZ pbuz1, pbuz2, pbuz3, pbuz4;
typedef uint8_t * __mem PBUM;
PBUM pbum1, pbum2, pbum3, pbum4;
typedef uint8_t * const PBUC;
PBUC pbuc1, pbuc2, pbuc3, pbuc4;
typedef int8_t * __zp PBSZ;
PBSZ pbsz1, pbsz2, pbsz3, pbsz4;
typedef int8_t * __mem PBSM;
PBSM pbsm1, pbsm2, pbsm3, pbsm4;
typedef int8_t * const PBSC;
PBSC pbsc1, pbsc2, pbsc3, pbsc4;
typedef uint16_t * __zp PWUZ;
PWUZ pwuz1, pwuz2, pwuz3, pwuz4;
typedef uint16_t * __mem PWUM;
PWUM pwum1, pwum2, pwum3, pwum4;
typedef uint16_t * const PWUC;
PWUC pwuc1, pwuc2, pwuc3, pwuc4;
typedef int16_t * __zp PWSZ;
PWSZ pwsz1, pwsz2, pwsz3, pwsz4;
typedef int16_t * __mem PWSM;
PWSM pwsm1, pwsm2, pwsm3, pwsm4;
typedef int16_t * const PWSC;
PWSC pwsc1, pwsc2, pwsc3, pwsc4;
typedef uint32_t * __zp PDUZ;
PDUZ pwuz1, pwuz2, pwuz3, pwuz4;
typedef uint32_t * __mem PDUM;
PDUM pwum1, pwum2, pwum3, pwum4;
typedef uint32_t * const PDUC;
PDUC pwuc1, pwuc2, pwuc3, pwuc4;
typedef int32_t * __zp PDSZ;
PDSZ pwsz1, pwsz2, pwsz3, pwsz4;
typedef int32_t * __mem PDSM;
PDSM pwsm1, pwsm2, pwsm3, pwsm4;
typedef int32_t * const PDSC;
PDSC pwsc1, pwsc2, pwsc3, pwsc4;
typedef void * __zp PVOZ;
PVOZ pvoz1, pvoz2, pvoz3, pvoz4;
typedef void * __mem PVOM;
PVOM pvom1, pvom2, pvom3, pvom4;
typedef void * const PVOC;
PVOC pvoc1, pvoc2, pvoc3, pvoc4;
typedef uint8_t * __zp QBUZ;
QBUZ qbuz1, qbuz2, qbuz3, qbuz4;
typedef uint8_t * __mem QBUM;
QBUM qbum1, qbum2, qbum3, qbum4;
typedef uint8_t * const QBUC;
QBUC qbuc1, qbuc2, qbuc3, qbuc4;
typedef int8_t * __zp QBSZ;
QBSZ qbsz1, qbsz2, qbsz3, qbsz4;
typedef int8_t * __mem QBSM;
QBSM qbsm1, qbsm2, qbsm3, qbsm4;
typedef int8_t * const QBSC;
QBSC qbsc1, qbsc2, qbsc3, qbsc4;
typedef uint16_t * __zp QWUZ;
QWUZ qwuz1, qwuz2, qwuz3, qwuz4;
typedef uint16_t * __mem QWUM;
QWUM qwum1, qwum2, qwum3, qwum4;
typedef uint16_t * const QWUC;
QWUC qwuc1, qwuc2, qwuc3, qwuc4;
typedef int16_t * __zp QWSZ;
QWSZ qwsz1, qwsz2, qwsz3, qwsz4;
typedef int16_t * __mem QWSM;
QWSM qwsm1, qwsm2, qwsm3, qwsm4;
typedef int16_t * const QWSC;
QWSC qwsc1, qwsc2, qwsc3, qwsc4;
typedef uint32_t * __zp QDUZ;
QDUZ qwuz1, qwuz2, qwuz3, qwuz4;
typedef uint32_t * __mem QDUM;
QDUM qwum1, qwum2, qwum3, qwum4;
typedef uint32_t * const QDUC;
QDUC qwuc1, qwuc2, qwuc3, qwuc4;
typedef int32_t * __zp QDSZ;
QDSZ qwsz1, qwsz2, qwsz3, qwsz4;
typedef int32_t * __mem QDSM;
QDSM qwsm1, qwsm2, qwsm3, qwsm4;
typedef int32_t * const QDSC;
QDSC qwsc1, qwsc2, qwsc3, qwsc4;
typedef void * __zp QVOZ;
QVOZ qvoz1, qvoz2, qvoz3, qvoz4;
typedef void * __mem QVOM;
QVOM qvom1, qvom2, qvom3, qvom4;
typedef void * const QVOC;
QVOC qvoc1, qvoc2, qvoc3, qvoc4;
//vbo - boolean byte.
//ppr - pointer to procedure?
//pss - pointer to struct
//0/1/2/... - constant known number.
// Rewrite rules for creating fragment signature names from expressions
// C-expr => Signature
// A=B => A=B
// (A) => (A)
// *A => _deref_A
// A[B] => A_derefidx_B
// A+B => A_plus_B
// A-B => A_minus_B
// -A => _neg_A
// A-1 => _dec_A
// A+1 => _inc_A
// A|B => A_bor_B
// A&B => A_band_B
// A^B => A_bxor_B
// ~A => _bnot_A
// A<<B => A_rol_B
// A>>B => A_ror_B
// A||B => A_or_B
// A&&B => A_and_B
// A<B => A_lt_B
// A>B => A_gt_B
// A<=B => A_le_B
// A>=B => A_ge_B
// A==B => A_eq_B
// A!=B => A_neq_B
// &A => _ptr_A
// _then_
// isr_
// call_
// _setbyte0_, _setbyte1_, ...
// _setword0_, _setword1_, ...
// _byte0_, _byte1_, ...
// _word0_, _word1_
// _word_ / _sbyte_ / _byte_
// _stackpull
// _stackpush
// _stackidx
// casting?
// pbuz1=pbuz1+pbuc1[vbuxx] => pbuz1=pbuz1_plus_pbuc1_derefidx_vbuxx

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE ce6972ebb ce69753d3
//KICKC FRAGMENT CACHE f139afe63 f139b2357
//FRAGMENT vbuz1=vbuc1
ldz #{c1}
stz {z1}

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE ce6972ebb ce69753d3
//KICKC FRAGMENT CACHE f139afe63 f139b2357
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE ce6972ebb ce69753d3
//KICKC FRAGMENT CACHE f139afe63 f139b2357
//FRAGMENT _deref_pbuc1=_inc__deref_pbuc1
inc {c1}
//FRAGMENT isr_hardware_all_entry
@ -792,401 +792,3 @@ iny
tax
//FRAGMENT vbuyy=vbuaa
tay
//FRAGMENT vbuz1=vbuz2_band_vbuc1
lda #{c1}
and {z2}
sta {z1}
//FRAGMENT _deref_pbuc1=_dec__deref_pbuc1
dec {c1}
//FRAGMENT pbuz1=pbuc1_plus_vbuz2
lda {z2}
clc
adc #<{c1}
sta {z1}
lda #>{c1}
adc #0
sta {z1}+1
//FRAGMENT pvoz1=pvoz2
lda {z2}
sta {z1}
lda {z2}+1
sta {z1}+1
//FRAGMENT vbuz1=vbuz1_plus_2
lda {z1}
clc
adc #2
sta {z1}
//FRAGMENT vbuz1=pbuz2_derefidx_vbuc1
ldy #{c1}
lda ({z2}),y
sta {z1}
//FRAGMENT pbuz1=pbuz2_plus_vbuc1
lda #{c1}
clc
adc {z2}
sta {z1}
lda #0
adc {z2}+1
sta {z1}+1
//FRAGMENT pbuz1_neq_pbuc1_then_la1
lda {z1}+1
cmp #>{c1}
bne {la1}
lda {z1}
cmp #<{c1}
bne {la1}
//FRAGMENT _deref_pbuz1=_deref_pbuz2
ldy #0
lda ({z2}),y
ldy #0
sta ({z1}),y
//FRAGMENT vbuz1=vbuaa_band_vbuc1
and #{c1}
sta {z1}
//FRAGMENT vbuz1=vbuxx_band_vbuc1
lda #{c1}
sax {z1}
//FRAGMENT vbuz1=vbuyy_band_vbuc1
tya
and #{c1}
sta {z1}
//FRAGMENT vbuaa=vbuz1_band_vbuc1
lda #{c1}
and {z1}
//FRAGMENT vbuaa=vbuaa_band_vbuc1
and #{c1}
//FRAGMENT vbuaa=vbuxx_band_vbuc1
txa
and #{c1}
//FRAGMENT vbuaa=vbuyy_band_vbuc1
tya
and #{c1}
//FRAGMENT vbuxx=vbuz1_band_vbuc1
lda #{c1}
and {z1}
tax
//FRAGMENT vbuxx=vbuaa_band_vbuc1
ldx #{c1}
axs #0
//FRAGMENT vbuyy=vbuz1_band_vbuc1
lda #{c1}
and {z1}
tay
//FRAGMENT pbuz1=pbuc1_plus_vbuaa
clc
adc #<{c1}
sta {z1}
lda #>{c1}
adc #0
sta {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vbuxx
txa
clc
adc #<{c1}
sta {z1}
lda #>{c1}
adc #0
sta {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vbuyy
tya
clc
adc #<{c1}
sta {z1}
lda #>{c1}
adc #0
sta {z1}+1
//FRAGMENT vbuxx=vbuxx_plus_2
inx
inx
//FRAGMENT vbuaa=pbuz1_derefidx_vbuc1
ldy #{c1}
lda ({z1}),y
//FRAGMENT vbuxx=pbuz1_derefidx_vbuc1
ldy #{c1}
lda ({z1}),y
tax
//FRAGMENT vbuyy=pbuz1_derefidx_vbuc1
ldy #{c1}
lda ({z1}),y
tay
//FRAGMENT pbuz1=pbuz1_plus_vbuc1
lda #{c1}
clc
adc {z1}
sta {z1}
bcc !+
inc {z1}+1
!:
//FRAGMENT vbuz1=_dec_vbuz1
dec {z1}
//FRAGMENT pbuz1=pbuz2
lda {z2}
sta {z1}
lda {z2}+1
sta {z1}+1
//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuz2
ldy {z2}
lda {c1},y
ldy #0
sta ({z1}),y
//FRAGMENT pbuz1=_inc_pbuz2
clc
lda {z2}
adc #1
sta {z1}
lda {z2}+1
adc #0
sta {z1}+1
//FRAGMENT _deref_pbuz1=vbuc1
lda #{c1}
ldy #0
sta ({z1}),y
//FRAGMENT vbuz1=pbuc1_derefidx_vbuz2
ldy {z2}
lda {c1},y
sta {z1}
//FRAGMENT vbuz1_ge_vbuz2_then_la1
lda {z1}
cmp {z2}
bcs {la1}
//FRAGMENT vbuz1=vbuz1_minus_vbuz2
lda {z1}
sec
sbc {z2}
sta {z1}
//FRAGMENT vwuz1=_word_vbuz2
lda {z2}
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vwuz1=vwuz2_rol_5
lda {z2}
asl
sta {z1}
lda {z2}+1
rol
sta {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vwuz2
lda {z2}
clc
adc #<{c1}
sta {z1}
lda {z2}+1
adc #>{c1}
sta {z1}+1
//FRAGMENT pbuz1=pbuz2_plus_vbuz3
lda {z3}
clc
adc {z2}
sta {z1}
lda #0
adc {z2}+1
sta {z1}+1
//FRAGMENT pbuz1=pbuz1_minus_vbuc1
sec
lda {z1}
sbc #{c1}
sta {z1}
lda {z1}+1
sbc #0
sta {z1}+1
//FRAGMENT vbuz1=_deref_pbuc1
lda {c1}
sta {z1}
//FRAGMENT _deref_pbuz1=vbuz2
lda {z2}
ldy #0
sta ({z1}),y
//FRAGMENT vbuxx=vbuxx_band_vbuc1
lda #{c1}
axs #0
//FRAGMENT vbuyy=vbuxx_band_vbuc1
txa
and #{c1}
tay
//FRAGMENT vbuxx=vbuyy_band_vbuc1
ldx #{c1}
tya
axs #0
//FRAGMENT vbuyy=vbuyy_band_vbuc1
tya
and #{c1}
tay
//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuaa
tay
lda {c1},y
ldy #0
sta ({z1}),y
//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuxx
lda {c1},x
ldy #0
sta ({z1}),y
//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuyy
lda {c1},y
ldy #0
sta ({z1}),y
//FRAGMENT vbuaa=pbuc1_derefidx_vbuz1
ldy {z1}
lda {c1},y
//FRAGMENT vbuxx=pbuc1_derefidx_vbuz1
ldy {z1}
ldx {c1},y
//FRAGMENT vbuyy=pbuc1_derefidx_vbuz1
ldx {z1}
ldy {c1},x
//FRAGMENT vbuz1=pbuc1_derefidx_vbuaa
tay
lda {c1},y
sta {z1}
//FRAGMENT vbuaa=pbuc1_derefidx_vbuaa
tay
lda {c1},y
//FRAGMENT vbuxx=pbuc1_derefidx_vbuaa
tay
ldx {c1},y
//FRAGMENT vbuyy=pbuc1_derefidx_vbuaa
tax
ldy {c1},x
//FRAGMENT vbuz1=pbuc1_derefidx_vbuxx
lda {c1},x
sta {z1}
//FRAGMENT 0_neq_vbuaa_then_la1
cmp #0
bne {la1}
//FRAGMENT vbuaa_ge_vbuz1_then_la1
cmp {z1}
bcs {la1}
//FRAGMENT vbuxx=vbuxx_minus_vbuz1
txa
sec
sbc {z1}
tax
//FRAGMENT vbuz1=vbuz1_minus_vbuaa
eor #$ff
sec
adc {z1}
sta {z1}
//FRAGMENT vbuxx=vbuxx_minus_vbuaa
sta $ff
txa
sec
sbc $ff
tax
//FRAGMENT vbuz1=vbuz1_minus_vbuxx
txa
eor #$ff
sec
adc {z1}
sta {z1}
//FRAGMENT vbuxx=vbuxx_minus_vbuxx
lda #0
tax
//FRAGMENT vbuz1=vbuz1_minus_vbuyy
tya
eor #$ff
sec
adc {z1}
sta {z1}
//FRAGMENT vbuxx=vbuxx_minus_vbuyy
txa
sty $ff
sec
sbc $ff
tax
//FRAGMENT vwuz1=_word_vbuaa
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vwuz1=_word_vbuxx
txa
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vwuz1=_word_vbuyy
tya
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vbuaa_eq_vbuc1_then_la1
cmp #{c1}
beq {la1}
//FRAGMENT vbuaa=_deref_pbuc1
lda {c1}
//FRAGMENT vbuxx=_deref_pbuc1
ldx {c1}
//FRAGMENT _deref_pbuz1=vbuaa
ldy #0
sta ({z1}),y
//FRAGMENT _deref_pbuz1=vbuxx
txa
ldy #0
sta ({z1}),y
//FRAGMENT _deref_pbuz1=vbuyy
tya
ldy #0
sta ({z1}),y
//FRAGMENT vbuxx_ge_vbuz1_then_la1
cpx {z1}
bcs {la1}
//FRAGMENT vbuxx_eq_vbuc1_then_la1
cpx #{c1}
beq {la1}
//FRAGMENT vbuyy=_deref_pbuc1
ldy {c1}
//FRAGMENT vbuz1_ge_vbuxx_then_la1
lda {z1}
stx $ff
cmp $ff
bcs {la1}
//FRAGMENT vbuz1_ge_vbuyy_then_la1
lda {z1}
sty $ff
cmp $ff
bcs {la1}
//FRAGMENT vbuxx_ge_vbuyy_then_la1
sty $ff
cpx $ff
bcs {la1}
//FRAGMENT vbuaa=vbuxx
txa
//FRAGMENT vbuyy=vbuxx
txa
tay
//FRAGMENT vbuyy_eq_vbuc1_then_la1
cpy #{c1}
beq {la1}
//FRAGMENT vbuaa=vbuyy
tya
//FRAGMENT vbuxx=vbuyy
tya
tax
//FRAGMENT vbuyy_ge_vbuz1_then_la1
cpy {z1}
bcs {la1}
//FRAGMENT vwuz1=vwuz1_rol_5
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vwuz1
lda {z1}
clc
adc #<{c1}
sta {z1}
lda {z1}+1
adc #>{c1}
sta {z1}+1

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
ldz {m1}+1

View File

@ -1 +0,0 @@
ldz {m1}+1

View File

@ -1 +0,0 @@
ldz {m1}

View File

@ -1 +0,0 @@
ldz {m1}

View File

@ -1,2 +0,0 @@
ldy #1
lda ({z1}),y

View File

@ -1,2 +0,0 @@
ldy #1
lda ({z1}),y

View File

@ -1,2 +0,0 @@
ldy #1
lda ({z1}),y

View File

@ -1 +0,0 @@
lda {m1}+1

View File

@ -1 +0,0 @@
lda {m1}+1

View File

@ -1,2 +0,0 @@
ldy #{c1}+1
lda ({z1}),y

View File

@ -1,2 +0,0 @@
iny
lda ({z1}),y

View File

@ -1,2 +0,0 @@
ldy #{c1}+1
lda ({z1}),y

View File

@ -1 +0,0 @@
lda {m1}+1

View File

@ -1 +0,0 @@
lda {m1}+1

View File

@ -1,2 +0,0 @@
ldy #0
lda ({z1}),y

View File

@ -1,2 +0,0 @@
ldy #0
lda ({z1}),y

View File

@ -1,2 +0,0 @@
ldy #0
lda ({z1}),y

View File

@ -1 +0,0 @@
lda {m1}

View File

@ -1,2 +0,0 @@
ldy #{c1}
lda ({z1}),y

View File

@ -1 +0,0 @@
lda {m1}

View File

@ -1 +0,0 @@
ldx {m1}+1

View File

@ -1 +0,0 @@
ldx {m1}+1

View File

@ -1 +0,0 @@
ldx {m1}+1

View File

@ -1 +0,0 @@
ldx {m1}

View File

@ -1 +0,0 @@
ldx {m1}

View File

@ -1 +0,0 @@
ldy {m1}+1

View File

@ -1 +0,0 @@
ldy {m1}+1

View File

@ -1 +0,0 @@
ldy {m1}+1

View File

@ -1 +0,0 @@
ldy {m1}

View File

@ -1 +0,0 @@
ldy {m1}

View File

@ -1,4 +0,0 @@
lda {m2}+2
sta {m1}
lda {m2}+3
sta {m1}+1

View File

@ -1,4 +0,0 @@
lda {m2}+2
sta {m1}
lda {m2}+3
sta {m1}+1

View File

@ -1,4 +0,0 @@
lda {m2}
sta {m1}
lda {m2}+1
sta {m1}+1

View File

@ -1,4 +0,0 @@
lda {m2}
sta {m1}
lda {m2}+1
sta {m1}+1