This commit is contained in:
Irmen de Jong 2018-11-09 23:42:17 +01:00
parent 886464d94a
commit 171d5b0a35
9 changed files with 896 additions and 867 deletions

View File

@ -0,0 +1,833 @@
; %import c64utils
%option enable_floats
%output raw
%launcher none
~ main {
sub start() {
byte b = 99
byte b2 = 100
ubyte ub = 255
ubyte ub2 = 0
word w = 999
word w2 = 3
uword uw = 40000
uword uw2 = 3434
float fl1 = 1.1
float fl2 = 2.2
byte[5] barr1
byte[5] barr2
ubyte[5] ubarr1
ubyte[5] ubarr2
word[5] warr1
word[5] warr2
uword[5] uwarr1
uword[5] uwarr2
float[5] farr1
float[5] farr2
memory byte mbyte = $c000
memory byte mbyte2 = $d000
memory ubyte mubyte = $c001
memory ubyte mubyte2 = $d001
memory word mword = $c002
memory word mword2 = $d002
memory uword muword = $c004
memory uword muword2 = $d004
memory float mfloat = $c006
memory float mfloat2 = $d006
memory byte[mubyte2] mbarr1 = $e000
memory ubyte[mubyte2] mubarr1 = $e100
memory word[mubyte2] mwarr1 = $e100
memory uword[mubyte2] muwarr1 = $e100
str string = "hello"
str_p stringp = "hello"
; all possible assignments to a BYTE VARIABLE (not array)
ubyte_assignment_to_register:
A = 42
A = X
A = ub2
A = mubyte2
A = string[4]
A = string[X]
A = string[b]
A = string[ub]
A = string[mbyte2]
A = string[mubyte2]
A = ubarr1[2]
A = ubarr1[X]
A = ubarr1[b]
A = ubarr1[ub]
A = ubarr1[mbyte2]
A = ubarr1[mubyte2]
ubyte_assignment_to_ubytevar:
ub = 42
ub = X
ub = ub2
ub = mubyte2
ub = string[4]
ub = string[X]
ub = string[b]
ub = string[ub]
ub = string[mbyte2]
ub = string[mubyte2]
ub = ubarr1[2]
ub = ubarr1[X]
ub = ubarr1[b]
ub = ubarr1[ub]
ub = ubarr1[mbyte2]
ub = ubarr1[mubyte2]
ubyte_assignment_to_ubytemem:
mubyte = 42
mubyte = X
mubyte = ub2
mubyte = mubyte2
mubyte = string[4]
mubyte = string[X]
mubyte = string[b]
mubyte = string[ub]
mubyte = string[mbyte2]
mubyte = string[mubyte2]
mubyte = ubarr1[2]
mubyte = ubarr1[X]
mubyte = ubarr1[b]
mubyte = ubarr1[ub]
mubyte = ubarr1[mbyte2]
mubyte = ubarr1[mubyte2]
byte_assignment_to_bytevar:
b = -42
b = b2
b = mbyte2
b = barr1[2]
b = barr1[X]
b = barr1[b]
b = barr1[ub]
b = barr1[mbyte2]
b = barr1[mubyte2]
byte_assignment_to_bytemem:
mbyte = -42
mbyte = b2
mbyte = mbyte2
mbyte = barr1[2]
mbyte = barr1[X]
mbyte = barr1[b]
mbyte = barr1[ub]
mbyte = barr1[mbyte2]
mbyte = barr1[mubyte2]
ubyte_assignment_to_ubytearray:
ubarr2[3] = 42
ubarr2[3] = X
ubarr2[3] = ub2
ubarr2[3] = mubyte2
ubarr2[3] = string[4]
ubarr2[3] = string[X]
ubarr2[3] = string[b]
ubarr2[3] = string[ub]
ubarr2[3] = string[mbyte2]
ubarr2[3] = string[mubyte2]
ubarr2[3] = ubarr1[2]
ubarr2[3] = ubarr1[X]
ubarr2[3] = ubarr1[b]
ubarr2[3] = ubarr1[ub]
ubarr2[3] = ubarr1[mbyte2]
ubarr2[3] = ubarr1[mubyte2]
string[4] = 42
string[4] = 'B'
string[4] = X
string[4] = ub2
string[4] = mubyte2
string[4] = ubarr1[2]
string[4] = ubarr1[X]
string[4] = ubarr1[ub]
string[4] = ubarr1[mubyte2]
string[4] = string[3]
string[4] = string[Y]
string[4] = string[ub2]
string[4] = string[mbyte2]
string[4] = string[mubyte2]
ubarr2[Y] = 42
ubarr2[Y] = X
ubarr2[Y] = ub2
ubarr2[Y] = mubyte2
ubarr2[Y] = string[4]
ubarr2[Y] = string[X]
ubarr2[Y] = string[b]
ubarr2[Y] = string[ub]
ubarr2[Y] = string[mbyte2]
ubarr2[Y] = string[mubyte2]
ubarr2[Y] = ubarr1[2]
ubarr2[Y] = ubarr1[X]
ubarr2[Y] = ubarr1[b]
ubarr2[Y] = ubarr1[ub]
ubarr2[Y] = ubarr1[mbyte2]
ubarr2[Y] = ubarr1[mubyte2]
string[Y] = 42
string[Y] = 'B'
string[Y] = X
string[Y] = ub2
string[Y] = mubyte2
string[Y] = ubarr1[2]
string[Y] = ubarr1[Y]
string[Y] = ubarr1[ub2]
string[Y] = ubarr1[mubyte2]
string[Y] = string[Y]
string[Y] = string[ub2]
string[Y] = string[mbyte2]
string[Y] = string[mubyte2]
ubarr2[ub2] = 42
ubarr2[ub2] = X
ubarr2[ub2] = ub2
ubarr2[ub2] = mubyte2
ubarr2[ub2] = string[4]
ubarr2[ub2] = string[X]
ubarr2[ub2] = string[b]
ubarr2[ub2] = string[ub]
ubarr2[ub2] = string[mbyte2]
ubarr2[ub2] = string[mubyte2]
ubarr2[ub2] = ubarr1[2]
ubarr2[ub2] = ubarr1[X]
ubarr2[ub2] = ubarr1[b]
ubarr2[ub2] = ubarr1[ub]
ubarr2[ub2] = ubarr1[mbyte2]
ubarr2[ub2] = ubarr1[mubyte2]
string[ub2] = 42
string[ub2] = 'B'
string[ub2] = X
string[ub2] = ub2
string[ub2] = mubyte2
string[ub2] = ubarr1[2]
string[ub2] = ubarr1[Y]
string[ub2] = ubarr1[ub2]
string[ub2] = ubarr1[mubyte2]
string[ub2] = string[Y]
string[ub2] = string[ub2]
string[ub2] = string[mbyte2]
string[ub2] = string[mubyte2]
ubarr2[b2] = 42
ubarr2[b2] = X
ubarr2[b2] = ub2
ubarr2[b2] = mubyte2
ubarr2[b2] = string[4]
ubarr2[b2] = string[X]
ubarr2[b2] = string[b]
ubarr2[b2] = string[ub]
ubarr2[b2] = string[mbyte2]
ubarr2[b2] = string[mubyte2]
ubarr2[b2] = ubarr1[2]
ubarr2[b2] = ubarr1[X]
ubarr2[b2] = ubarr1[b]
ubarr2[b2] = ubarr1[ub]
ubarr2[b2] = ubarr1[mbyte2]
ubarr2[b2] = ubarr1[mubyte2]
string[b2] = 42
string[b2] = 'B'
string[b2] = X
string[b2] = ub2
string[b2] = mubyte2
string[b2] = ubarr1[2]
string[b2] = ubarr1[Y]
string[b2] = ubarr1[ub2]
string[b2] = ubarr1[mubyte2]
string[b2] = string[Y]
string[b2] = string[ub2]
string[b2] = string[mbyte2]
string[b2] = string[mubyte2]
ubarr2[mubyte2] = 42
ubarr2[mubyte2] = X
ubarr2[mubyte2] = ub2
ubarr2[mubyte2] = mubyte2
ubarr2[mubyte2] = string[4]
ubarr2[mubyte2] = ubarr1[2]
string[mubyte2] = 42
string[mubyte2] = 'B'
string[mubyte2] = X
string[mubyte2] = ub2
string[mubyte2] = mubyte2
string[mubyte2] = ubarr1[2]
ubarr2[mubyte2] = string[Y] ; via evaluation
ubarr2[mubyte2] = string[b] ; via evaluation
ubarr2[mubyte2] = string[ub] ; via evaluation
ubarr2[mubyte2] = string[mbyte2] ; via evaluation
ubarr2[mubyte2] = string[mubyte2] ; via evaluation
ubarr2[mubyte2] = ubarr1[Y] ; via evaluation
ubarr2[mubyte2] = ubarr1[b] ; via evaluation
ubarr2[mubyte2] = ubarr1[ub] ; via evaluation
ubarr2[mubyte2] = ubarr1[mbyte2] ; via evaluation
ubarr2[mubyte2] = ubarr1[mubyte2] ; via evaluation
string[mubyte2] = ubarr1[Y] ; via evaluation
string[mubyte2] = ubarr1[b] ; via evaluation
string[mubyte2] = ubarr1[ub2] ; via evaluation
string[mubyte2] = ubarr1[mbyte2] ; via evaluation
string[mubyte2] = ubarr1[mubyte2] ; via evaluation
string[mubyte2] = string[mubyte2] ; via evaluation
ubarr1[ubarr2[A]] = ubarr2[ubarr1[Y]] ; via evaluation-- todo check generated asm...
byte_assignment_to_bytearray:
barr2[3] = 42
barr2[3] = b2
barr2[3] = mbyte2
barr2[3] = barr1[2]
barr2[3] = barr1[X]
barr2[3] = barr1[b]
barr2[3] = barr1[ub]
barr2[3] = barr1[mbyte2]
barr2[3] = barr1[mubyte2]
barr2[Y] = 42
barr2[Y] = b2
barr2[Y] = mbyte2
barr2[Y] = barr1[2]
barr2[Y] = barr1[X]
barr2[Y] = barr1[b]
barr2[Y] = barr1[ub]
barr2[Y] = barr1[mbyte2]
barr2[Y] = barr1[mubyte2]
barr2[b2] = 42
barr2[b2] = b2
barr2[b2] = mbyte2
barr2[b2] = barr1[2]
barr2[b2] = barr1[X]
barr2[b2] = barr1[b]
barr2[b2] = barr1[ub]
barr2[b2] = barr1[mbyte2]
barr2[b2] = barr1[mubyte2]
barr2[ub2] = 42
barr2[ub2] = b2
barr2[ub2] = mbyte2
barr2[ub2] = barr1[2]
barr2[ub2] = barr1[X]
barr2[ub2] = barr1[b]
barr2[ub2] = barr1[ub]
barr2[ub2] = barr1[mbyte2]
barr2[ub2] = barr1[mubyte2]
barr2[mubyte2] = 42
barr2[mubyte2] = b2
barr2[mubyte2] = mbyte2
barr2[mubyte2] = barr1[2]
barr2[mubyte2] = barr1[Y] ; via evaluation
barr2[mubyte2] = barr1[b] ; via evaluation
barr2[mubyte2] = barr1[ub] ; via evaluation
barr2[mubyte2] = barr1[mbyte2] ; via evaluation
barr2[mubyte2] = barr1[mubyte2] ; via evaluation
barr1[ubarr2[A]] = barr2[ubarr1[Y]] ; via evaluation-- todo check generated asm...
byte_assignment_to_membytearray:
mbarr1[3] = 42
mbarr1[3] = b2
mbarr1[3] = mbyte2
mbarr1[3] = barr1[2]
mbarr1[3] = barr1[X]
mbarr1[3] = barr1[b]
mbarr1[3] = barr1[ub]
mbarr1[3] = barr1[mbyte2]
mbarr1[3] = barr1[mubyte2]
mbarr1[Y] = 42
mbarr1[Y] = b2
mbarr1[Y] = mbyte2
mbarr1[Y] = barr1[2]
mbarr1[Y] = barr1[X]
mbarr1[Y] = barr1[b]
mbarr1[Y] = barr1[ub]
mbarr1[Y] = barr1[mbyte2]
mbarr1[Y] = barr1[mubyte2]
mbarr1[b2] = 42
mbarr1[b2] = b2
mbarr1[b2] = mbyte2
mbarr1[b2] = barr1[2]
mbarr1[b2] = barr1[X]
mbarr1[b2] = barr1[b]
mbarr1[b2] = barr1[ub]
mbarr1[b2] = barr1[mbyte2]
mbarr1[b2] = barr1[mubyte2]
mbarr1[ub2] = 42
mbarr1[ub2] = b2
mbarr1[ub2] = mbyte2
mbarr1[ub2] = barr1[2]
mbarr1[ub2] = barr1[X]
mbarr1[ub2] = barr1[b]
mbarr1[ub2] = barr1[ub]
mbarr1[ub2] = barr1[mbyte2]
mbarr1[ub2] = barr1[mubyte2]
mbarr1[mubyte2] = 42
mbarr1[mubyte2] = b2
mbarr1[mubyte2] = mbyte2
mbarr1[mubyte2] = barr1[2]
mbarr1[mubyte2] = barr1[Y] ; via evaluation
mbarr1[mubyte2] = barr1[b] ; via evaluation
mbarr1[mubyte2] = barr1[ub] ; via evaluation
mbarr1[mubyte2] = barr1[mbyte2] ; via evaluation
mbarr1[mubyte2] = barr1[mubyte2] ; via evaluation
mbarr1[ubarr2[A]] = barr2[ubarr1[Y]] ; via evaluation-- todo check generated asm...
; all possible assignments to a UWORD VARIABLE (not array)
uword_assignment_to_uwordvar:
uw = 42
uw = 42.w
uw = 42555
uw = X
uw = ub2
uw = uw2
uw = mubyte2
uw = muword2
uw = string[4]
uw = ubarr1[2]
uw = uwarr1[2]
uw = string[X]
uw = string[b]
uw = string[ub]
uw = string[mbyte2]
uw = string[mubyte2]
uw = ubarr1[X]
uw = ubarr1[b]
uw = ubarr1[ub]
uw = ubarr1[mbyte2]
uw = ubarr1[mubyte2]
uw = uwarr1[X]
uw = uwarr1[b]
uw = uwarr1[ub]
uw = uwarr1[mbyte2]
uw = uwarr1[mubyte2]
uword_assignment_to_uwordmem:
muword = 42
muword = 42.w
muword = 42555
muword = X
muword = ub2
muword = uw2
muword = mubyte2
muword = muword2
muword = string[4]
muword = ubarr1[2]
muword = uwarr1[2]
muword = string[X]
muword = string[b]
muword = string[ub]
muword = string[mbyte2]
muword = string[mubyte2]
muword = ubarr1[X]
muword = ubarr1[b]
muword = ubarr1[ub]
muword = ubarr1[mbyte2]
muword = ubarr1[mubyte2]
muword = uwarr1[X]
muword = uwarr1[b]
muword = uwarr1[ub]
muword = uwarr1[mbyte2]
muword = uwarr1[mubyte2]
uword_assignment_to_uwordarray:
uwarr1[2] = 42
uwarr1[2] = 42.w
uwarr1[2] = 42555
uwarr1[2] = X
uwarr1[2] = ub2
uwarr1[2] = uw2
uwarr1[2] = mubyte2
uwarr1[2] = muword2
uwarr1[2] = string[4]
uwarr1[2] = ubarr1[2]
uwarr1[2] = uwarr1[2]
uwarr1[Y] = 42
uwarr1[Y] = 42.w
uwarr1[Y] = 42555
uwarr1[Y] = X
uwarr1[Y] = ub2
uwarr1[Y] = uw2
uwarr1[Y] = mubyte2
uwarr1[Y] = muword2
uwarr1[Y] = string[4]
uwarr1[Y] = ubarr1[2]
uwarr1[Y] = uwarr1[2]
uwarr1[b] = 42
uwarr1[b] = 42.w
uwarr1[b] = 42555
uwarr1[b] = X
uwarr1[b] = ub2
uwarr1[b] = uw2
uwarr1[b] = mubyte2
uwarr1[b] = muword2
uwarr1[b] = string[4]
uwarr1[b] = ubarr1[2]
uwarr1[b] = uwarr1[2]
uwarr1[ub] = 42
uwarr1[ub] = 42.w
uwarr1[ub] = 42555
uwarr1[ub] = X
uwarr1[ub] = ub2
uwarr1[ub] = uw2
uwarr1[ub] = mubyte2
uwarr1[ub] = muword2
uwarr1[ub] = string[4]
uwarr1[ub] = ubarr1[2]
uwarr1[ub] = uwarr1[2]
uwarr1[mbyte2] = 42
uwarr1[mbyte2] = 42.w
uwarr1[mbyte2] = 42555
uwarr1[mbyte2] = X
uwarr1[mbyte2] = ub2
uwarr1[mbyte2] = uw2
uwarr1[mbyte2] = mubyte2
uwarr1[mbyte2] = muword2
uwarr1[mbyte2] = string[4]
uwarr1[mbyte2] = ubarr1[2]
uwarr1[mbyte2] = uwarr1[2]
uwarr1[mubyte2] = 42
uwarr1[mubyte2] = 42.w
uwarr1[mubyte2] = 42555
uwarr1[mubyte2] = X
uwarr1[mubyte2] = ub2
uwarr1[mubyte2] = uw2
uwarr1[mubyte2] = mubyte2
uwarr1[mubyte2] = muword2
uwarr1[mubyte2] = string[4]
uwarr1[mubyte2] = ubarr1[2]
uwarr1[mubyte2] = uwarr1[2]
uwarr1[2] = string[Y] ; via evaluation
uwarr1[2] = string[b] ; via evaluation
uwarr1[2] = string[ub] ; via evaluation
uwarr1[2] = string[mbyte2] ; via evaluation
uwarr1[2] = string[mubyte2] ; via evaluation
uwarr1[2] = ubarr1[Y] ; via evaluation
uwarr1[2] = ubarr1[b] ; via evaluation
uwarr1[2] = ubarr1[ub] ; via evaluation
uwarr1[2] = ubarr1[mbyte2] ; via evaluation
uwarr1[2] = ubarr1[mubyte2] ; via evaluation
uwarr1[2] = uwarr1[Y] ; via evaluation
uwarr1[2] = uwarr1[b] ; via evaluation
uwarr1[2] = uwarr1[ub] ; via evaluation
uwarr1[2] = uwarr1[mbyte2] ; via evaluation
uwarr1[2] = uwarr1[mubyte2] ; via evaluation
word_assignment_to_wordvar:
w = -42
w = -42.w
w = 12555
w = X
w = ub2
w = b2
w = w2
w = mubyte2
w = mbyte2
w = mword2
w = string[4]
w = ubarr1[2]
w = barr1[2]
w = warr1[2]
w = string[X]
w = string[b]
w = string[ub]
w = string[mbyte2]
w = string[mubyte2]
w = barr1[X]
w = ubarr1[X]
w = barr1[b]
w = ubarr1[b]
w = barr1[ub]
w = ubarr1[ub]
w = barr1[mbyte2]
w = ubarr1[mbyte2]
w = barr1[mubyte2]
w = ubarr1[mubyte2]
w = warr1[X]
w = warr1[b]
w = warr1[ub]
w = warr1[mbyte2]
w = warr1[mubyte2]
word_assignment_to_wordmem:
mword = -42
mword = -42.w
mword = 12555
mword = X
mword = ub2
mword = b2
mword = w2
mword = mubyte2
mword = mbyte2
mword = mword2
mword = string[4]
mword = ubarr1[2]
mword = barr1[2]
mword = warr1[2]
mword = string[X]
mword = string[b]
mword = string[ub]
mword = string[mbyte2]
mword = string[mubyte2]
mword = barr1[X]
mword = ubarr1[X]
mword = barr1[b]
mword = ubarr1[b]
mword = barr1[ub]
mword = ubarr1[ub]
mword = barr1[mbyte2]
mword = ubarr1[mbyte2]
mword = barr1[mubyte2]
mword = ubarr1[mubyte2]
mword = warr1[X]
mword = warr1[b]
mword = warr1[ub]
mword = warr1[mbyte2]
mword = warr1[mubyte2]
word_assignment_to_wordarray:
warr2[2] = -42
warr2[2] = -42.w
warr2[2] = 12555
warr2[2] = X
warr2[2] = ub2
warr2[2] = b2
warr2[2] = w2
warr2[2] = mubyte2
warr2[2] = mbyte2
warr2[2] = mword2
warr2[2] = string[4]
warr2[2] = ubarr1[2]
warr2[2] = barr1[2]
warr2[2] = warr1[2]
warr2[Y] = -42
warr2[Y] = -42.w
warr2[Y] = 12555
warr2[Y] = X
warr2[Y] = ub2
warr2[Y] = b2
warr2[Y] = w2
warr2[Y] = mubyte2
warr2[Y] = mbyte2
warr2[Y] = mword2
warr2[Y] = string[4]
warr2[Y] = ubarr1[2]
warr2[Y] = barr1[2]
warr2[Y] = warr1[2]
warr2[b] = -42
warr2[b] = -42.w
warr2[b] = 12555
warr2[b] = X
warr2[b] = ub2
warr2[b] = b2
warr2[b] = w2
warr2[b] = mubyte2
warr2[b] = mbyte2
warr2[b] = mword2
warr2[b] = string[4]
warr2[b] = ubarr1[2]
warr2[b] = barr1[2]
warr2[b] = warr1[2]
warr2[ub] = -42
warr2[ub] = -42.w
warr2[ub] = 14255
warr2[ub] = X
warr2[ub] = ub2
warr2[ub] = b2
warr2[ub] = w2
warr2[ub] = mubyte2
warr2[ub] = mbyte2
warr2[ub] = mword2
warr2[ub] = string[4]
warr2[ub] = ubarr1[2]
warr2[ub] = barr1[2]
warr2[ub] = warr1[2]
warr2[mbyte2] = -42
warr2[mbyte2] = -42.w
warr2[mbyte2] = 12555
warr2[mbyte2] = X
warr2[mbyte2] = ub2
warr2[mbyte2] = b2
warr2[mbyte2] = w2
warr2[mbyte2] = mubyte2
warr2[mbyte2] = mbyte2
warr2[mbyte2] = mword2
warr2[mbyte2] = string[4]
warr2[mbyte2] = ubarr1[2]
warr2[mbyte2] = barr1[2]
warr2[mbyte2] = warr1[2]
warr2[mubyte2] = -42
warr2[mubyte2] = -42.w
warr2[mubyte2] = 12555
warr2[mubyte2] = X
warr2[mubyte2] = ub2
warr2[mubyte2] = b2
warr2[mubyte2] = w2
warr2[mubyte2] = mubyte2
warr2[mubyte2] = mbyte2
warr2[mubyte2] = mword2
warr2[mubyte2] = string[4]
warr2[mubyte2] = ubarr1[2]
warr2[mubyte2] = barr1[2]
warr2[mubyte2] = warr1[2]
warr1[2] = string[Y] ; via evaluation
warr1[2] = string[b] ; via evaluation
warr1[2] = string[ub] ; via evaluation
warr1[2] = string[mbyte2] ; via evaluation
warr1[2] = string[mubyte2] ; via evaluation
warr1[2] = barr1[Y] ; via evaluation
warr1[2] = barr1[b] ; via evaluation
warr1[2] = barr1[ub] ; via evaluation
warr1[2] = barr1[mbyte2] ; via evaluation
warr1[2] = barr1[mubyte2] ; via evaluation
warr1[2] = warr1[Y] ; via evaluation
warr1[2] = warr1[b] ; via evaluation
warr1[2] = warr1[ub] ; via evaluation
warr1[2] = warr1[mbyte2] ; via evaluation
warr1[2] = warr1[mubyte2] ; via evaluation
;; all possible assignments to a FLOAT VARIABLE
float_assignment_to_floatvar:
fl1 = 34
fl1 = 34555.w
fl1 = 3.33e22
fl1 = X
fl1 = b2
fl1 = ub2
fl1 = w2
fl1 = uw2
fl1 = mbyte
fl1 = mubyte
fl1 = mword
fl1 = muword
fl1 = fl2
fl1 = mfloat2
fl1 = barr1[2]
fl1 = ubarr1[2]
fl1 = warr1[2]
fl1 = uwarr1[2]
fl1 = string[4]
fl1 = farr1[4]
fl1 = string[Y] ; via evaluation
fl1 = string[b] ; via evaluation
fl1 = string[ub] ; via evaluation
fl1 = string[mbyte2] ; via evaluation
fl1 = string[mubyte2] ; via evaluation
fl1 = barr1[Y] ; via evaluation
fl1 = ubarr1[Y] ; via evaluation
fl1 = barr1[b] ; via evaluation
fl1 = ubarr1[b] ; via evaluation
fl1 = barr1[ub] ; via evaluation
fl1 = ubarr1[ub] ; via evaluation
fl1 = barr1[mbyte2] ; via evaluation
fl1 = ubarr1[mbyte2] ; via evaluation
fl1 = barr1[mubyte2] ; via evaluation
fl1 = ubarr1[mubyte2] ; via evaluation
fl1 = warr1[Y] ; via evaluation
fl1 = warr1[b] ; via evaluation
fl1 = warr1[ub] ; via evaluation
fl1 = warr1[mbyte2] ; via evaluation
fl1 = warr1[mubyte2] ; via evaluation
float_assignment_to_floatmem:
mfloat = 34
mfloat = 34555.w
mfloat = 3.33e22
mfloat = X
mfloat = b2
mfloat = ub2
mfloat = w2
mfloat = uw2
mfloat = mbyte
mfloat = mubyte
mfloat = mword
mfloat = muword
mfloat = fl2
mfloat = mfloat2
mfloat = barr1[2]
mfloat = ubarr1[2]
mfloat = warr1[2]
mfloat = uwarr1[2]
mfloat = string[4]
mfloat = farr1[4]
mfloat = string[Y] ; via evaluation
mfloat = string[b] ; via evaluation
mfloat = string[ub] ; via evaluation
mfloat = string[mbyte2] ; via evaluation
mfloat = string[mubyte2] ; via evaluation
mfloat = barr1[Y] ; via evaluation
mfloat = ubarr1[Y] ; via evaluation
mfloat = barr1[b] ; via evaluation
mfloat = ubarr1[b] ; via evaluation
mfloat = barr1[ub] ; via evaluation
mfloat = ubarr1[ub] ; via evaluation
mfloat = barr1[mbyte2] ; via evaluation
mfloat = ubarr1[mbyte2] ; via evaluation
mfloat = barr1[mubyte2] ; via evaluation
mfloat = ubarr1[mubyte2] ; via evaluation
mfloat = warr1[Y] ; via evaluation
mfloat = warr1[b] ; via evaluation
mfloat = warr1[ub] ; via evaluation
mfloat = warr1[mbyte2] ; via evaluation
mfloat = warr1[mubyte2] ; via evaluation
return
}
}

View File

@ -1,832 +1,13 @@
; %import c64utils
%option enable_floats
%output raw
%launcher none
; @todo find new syntax to specify register pair arguments to subroutines
%import mathlib
%import c64lib
%import c64utils
~ main {
sub start() {
byte b = 99
byte b2 = 100
ubyte ub = 255
ubyte ub2 = 0
word w = 999
word w2 = 3
uword uw = 40000
uword uw2 = 3434
float fl1 = 1.1
float fl2 = 2.2
byte[5] barr1
byte[5] barr2
ubyte[5] ubarr1
ubyte[5] ubarr2
word[5] warr1
word[5] warr2
uword[5] uwarr1
uword[5] uwarr2
float[5] farr1
float[5] farr2
memory byte mbyte = $c000
memory byte mbyte2 = $d000
memory ubyte mubyte = $c001
memory ubyte mubyte2 = $d001
memory word mword = $c002
memory word mword2 = $d002
memory uword muword = $c004
memory uword muword2 = $d004
memory float mfloat = $c006
memory float mfloat2 = $d006
memory byte[mubyte2] mbarr1 = $e000
memory ubyte[mubyte2] mubarr1 = $e100
memory word[mubyte2] mwarr1 = $e100
memory uword[mubyte2] muwarr1 = $e100
str string = "hello"
str_p stringp = "hello"
; all possible assignments to a BYTE VARIABLE (not array)
ubyte_assignment_to_register:
A = 42
A = X
A = ub2
A = mubyte2
A = string[4]
A = string[X]
A = string[b]
A = string[ub]
A = string[mbyte2]
A = string[mubyte2]
A = ubarr1[2]
A = ubarr1[X]
A = ubarr1[b]
A = ubarr1[ub]
A = ubarr1[mbyte2]
A = ubarr1[mubyte2]
ubyte_assignment_to_ubytevar:
ub = 42
ub = X
ub = ub2
ub = mubyte2
ub = string[4]
ub = string[X]
ub = string[b]
ub = string[ub]
ub = string[mbyte2]
ub = string[mubyte2]
ub = ubarr1[2]
ub = ubarr1[X]
ub = ubarr1[b]
ub = ubarr1[ub]
ub = ubarr1[mbyte2]
ub = ubarr1[mubyte2]
ubyte_assignment_to_ubytemem:
mubyte = 42
mubyte = X
mubyte = ub2
mubyte = mubyte2
mubyte = string[4]
mubyte = string[X]
mubyte = string[b]
mubyte = string[ub]
mubyte = string[mbyte2]
mubyte = string[mubyte2]
mubyte = ubarr1[2]
mubyte = ubarr1[X]
mubyte = ubarr1[b]
mubyte = ubarr1[ub]
mubyte = ubarr1[mbyte2]
mubyte = ubarr1[mubyte2]
byte_assignment_to_bytevar:
b = -42
b = b2
b = mbyte2
b = barr1[2]
b = barr1[X]
b = barr1[b]
b = barr1[ub]
b = barr1[mbyte2]
b = barr1[mubyte2]
byte_assignment_to_bytemem:
mbyte = -42
mbyte = b2
mbyte = mbyte2
mbyte = barr1[2]
mbyte = barr1[X]
mbyte = barr1[b]
mbyte = barr1[ub]
mbyte = barr1[mbyte2]
mbyte = barr1[mubyte2]
ubyte_assignment_to_ubytearray:
ubarr2[3] = 42
ubarr2[3] = X
ubarr2[3] = ub2
ubarr2[3] = mubyte2
ubarr2[3] = string[4]
ubarr2[3] = string[X]
ubarr2[3] = string[b]
ubarr2[3] = string[ub]
ubarr2[3] = string[mbyte2]
ubarr2[3] = string[mubyte2]
ubarr2[3] = ubarr1[2]
ubarr2[3] = ubarr1[X]
ubarr2[3] = ubarr1[b]
ubarr2[3] = ubarr1[ub]
ubarr2[3] = ubarr1[mbyte2]
ubarr2[3] = ubarr1[mubyte2]
string[4] = 42
string[4] = 'B'
string[4] = X
string[4] = ub2
string[4] = mubyte2
string[4] = ubarr1[2]
string[4] = ubarr1[X]
string[4] = ubarr1[ub]
string[4] = ubarr1[mubyte2]
string[4] = string[3]
string[4] = string[Y]
string[4] = string[ub2]
string[4] = string[mbyte2]
string[4] = string[mubyte2]
ubarr2[Y] = 42
ubarr2[Y] = X
ubarr2[Y] = ub2
ubarr2[Y] = mubyte2
ubarr2[Y] = string[4]
ubarr2[Y] = string[X]
ubarr2[Y] = string[b]
ubarr2[Y] = string[ub]
ubarr2[Y] = string[mbyte2]
ubarr2[Y] = string[mubyte2]
ubarr2[Y] = ubarr1[2]
ubarr2[Y] = ubarr1[X]
ubarr2[Y] = ubarr1[b]
ubarr2[Y] = ubarr1[ub]
ubarr2[Y] = ubarr1[mbyte2]
ubarr2[Y] = ubarr1[mubyte2]
string[Y] = 42
string[Y] = 'B'
string[Y] = X
string[Y] = ub2
string[Y] = mubyte2
string[Y] = ubarr1[2]
string[Y] = ubarr1[Y]
string[Y] = ubarr1[ub2]
string[Y] = ubarr1[mubyte2]
string[Y] = string[Y]
string[Y] = string[ub2]
string[Y] = string[mbyte2]
string[Y] = string[mubyte2]
ubarr2[ub2] = 42
ubarr2[ub2] = X
ubarr2[ub2] = ub2
ubarr2[ub2] = mubyte2
ubarr2[ub2] = string[4]
ubarr2[ub2] = string[X]
ubarr2[ub2] = string[b]
ubarr2[ub2] = string[ub]
ubarr2[ub2] = string[mbyte2]
ubarr2[ub2] = string[mubyte2]
ubarr2[ub2] = ubarr1[2]
ubarr2[ub2] = ubarr1[X]
ubarr2[ub2] = ubarr1[b]
ubarr2[ub2] = ubarr1[ub]
ubarr2[ub2] = ubarr1[mbyte2]
ubarr2[ub2] = ubarr1[mubyte2]
string[ub2] = 42
string[ub2] = 'B'
string[ub2] = X
string[ub2] = ub2
string[ub2] = mubyte2
string[ub2] = ubarr1[2]
string[ub2] = ubarr1[Y]
string[ub2] = ubarr1[ub2]
string[ub2] = ubarr1[mubyte2]
string[ub2] = string[Y]
string[ub2] = string[ub2]
string[ub2] = string[mbyte2]
string[ub2] = string[mubyte2]
ubarr2[b2] = 42
ubarr2[b2] = X
ubarr2[b2] = ub2
ubarr2[b2] = mubyte2
ubarr2[b2] = string[4]
ubarr2[b2] = string[X]
ubarr2[b2] = string[b]
ubarr2[b2] = string[ub]
ubarr2[b2] = string[mbyte2]
ubarr2[b2] = string[mubyte2]
ubarr2[b2] = ubarr1[2]
ubarr2[b2] = ubarr1[X]
ubarr2[b2] = ubarr1[b]
ubarr2[b2] = ubarr1[ub]
ubarr2[b2] = ubarr1[mbyte2]
ubarr2[b2] = ubarr1[mubyte2]
string[b2] = 42
string[b2] = 'B'
string[b2] = X
string[b2] = ub2
string[b2] = mubyte2
string[b2] = ubarr1[2]
string[b2] = ubarr1[Y]
string[b2] = ubarr1[ub2]
string[b2] = ubarr1[mubyte2]
string[b2] = string[Y]
string[b2] = string[ub2]
string[b2] = string[mbyte2]
string[b2] = string[mubyte2]
ubarr2[mubyte2] = 42
ubarr2[mubyte2] = X
ubarr2[mubyte2] = ub2
ubarr2[mubyte2] = mubyte2
ubarr2[mubyte2] = string[4]
ubarr2[mubyte2] = ubarr1[2]
string[mubyte2] = 42
string[mubyte2] = 'B'
string[mubyte2] = X
string[mubyte2] = ub2
string[mubyte2] = mubyte2
string[mubyte2] = ubarr1[2]
ubarr2[mubyte2] = string[Y] ; via evaluation
ubarr2[mubyte2] = string[b] ; via evaluation
ubarr2[mubyte2] = string[ub] ; via evaluation
ubarr2[mubyte2] = string[mbyte2] ; via evaluation
ubarr2[mubyte2] = string[mubyte2] ; via evaluation
ubarr2[mubyte2] = ubarr1[Y] ; via evaluation
ubarr2[mubyte2] = ubarr1[b] ; via evaluation
ubarr2[mubyte2] = ubarr1[ub] ; via evaluation
ubarr2[mubyte2] = ubarr1[mbyte2] ; via evaluation
ubarr2[mubyte2] = ubarr1[mubyte2] ; via evaluation
string[mubyte2] = ubarr1[Y] ; via evaluation
string[mubyte2] = ubarr1[b] ; via evaluation
string[mubyte2] = ubarr1[ub2] ; via evaluation
string[mubyte2] = ubarr1[mbyte2] ; via evaluation
string[mubyte2] = ubarr1[mubyte2] ; via evaluation
string[mubyte2] = string[mubyte2] ; via evaluation
ubarr1[ubarr2[A]] = ubarr2[ubarr1[Y]] ; via evaluation-- todo check generated asm...
byte_assignment_to_bytearray:
barr2[3] = 42
barr2[3] = b2
barr2[3] = mbyte2
barr2[3] = barr1[2]
barr2[3] = barr1[X]
barr2[3] = barr1[b]
barr2[3] = barr1[ub]
barr2[3] = barr1[mbyte2]
barr2[3] = barr1[mubyte2]
barr2[Y] = 42
barr2[Y] = b2
barr2[Y] = mbyte2
barr2[Y] = barr1[2]
barr2[Y] = barr1[X]
barr2[Y] = barr1[b]
barr2[Y] = barr1[ub]
barr2[Y] = barr1[mbyte2]
barr2[Y] = barr1[mubyte2]
barr2[b2] = 42
barr2[b2] = b2
barr2[b2] = mbyte2
barr2[b2] = barr1[2]
barr2[b2] = barr1[X]
barr2[b2] = barr1[b]
barr2[b2] = barr1[ub]
barr2[b2] = barr1[mbyte2]
barr2[b2] = barr1[mubyte2]
barr2[ub2] = 42
barr2[ub2] = b2
barr2[ub2] = mbyte2
barr2[ub2] = barr1[2]
barr2[ub2] = barr1[X]
barr2[ub2] = barr1[b]
barr2[ub2] = barr1[ub]
barr2[ub2] = barr1[mbyte2]
barr2[ub2] = barr1[mubyte2]
barr2[mubyte2] = 42
barr2[mubyte2] = b2
barr2[mubyte2] = mbyte2
barr2[mubyte2] = barr1[2]
barr2[mubyte2] = barr1[Y] ; via evaluation
barr2[mubyte2] = barr1[b] ; via evaluation
barr2[mubyte2] = barr1[ub] ; via evaluation
barr2[mubyte2] = barr1[mbyte2] ; via evaluation
barr2[mubyte2] = barr1[mubyte2] ; via evaluation
barr1[ubarr2[A]] = barr2[ubarr1[Y]] ; via evaluation-- todo check generated asm...
byte_assignment_to_membytearray:
mbarr1[3] = 42
mbarr1[3] = b2
mbarr1[3] = mbyte2
mbarr1[3] = barr1[2]
mbarr1[3] = barr1[X]
mbarr1[3] = barr1[b]
mbarr1[3] = barr1[ub]
mbarr1[3] = barr1[mbyte2]
mbarr1[3] = barr1[mubyte2]
mbarr1[Y] = 42
mbarr1[Y] = b2
mbarr1[Y] = mbyte2
mbarr1[Y] = barr1[2]
mbarr1[Y] = barr1[X]
mbarr1[Y] = barr1[b]
mbarr1[Y] = barr1[ub]
mbarr1[Y] = barr1[mbyte2]
mbarr1[Y] = barr1[mubyte2]
mbarr1[b2] = 42
mbarr1[b2] = b2
mbarr1[b2] = mbyte2
mbarr1[b2] = barr1[2]
mbarr1[b2] = barr1[X]
mbarr1[b2] = barr1[b]
mbarr1[b2] = barr1[ub]
mbarr1[b2] = barr1[mbyte2]
mbarr1[b2] = barr1[mubyte2]
mbarr1[ub2] = 42
mbarr1[ub2] = b2
mbarr1[ub2] = mbyte2
mbarr1[ub2] = barr1[2]
mbarr1[ub2] = barr1[X]
mbarr1[ub2] = barr1[b]
mbarr1[ub2] = barr1[ub]
mbarr1[ub2] = barr1[mbyte2]
mbarr1[ub2] = barr1[mubyte2]
mbarr1[mubyte2] = 42
mbarr1[mubyte2] = b2
mbarr1[mubyte2] = mbyte2
mbarr1[mubyte2] = barr1[2]
mbarr1[mubyte2] = barr1[Y] ; via evaluation
mbarr1[mubyte2] = barr1[b] ; via evaluation
mbarr1[mubyte2] = barr1[ub] ; via evaluation
mbarr1[mubyte2] = barr1[mbyte2] ; via evaluation
mbarr1[mubyte2] = barr1[mubyte2] ; via evaluation
mbarr1[ubarr2[A]] = barr2[ubarr1[Y]] ; via evaluation-- todo check generated asm...
; all possible assignments to a UWORD VARIABLE (not array)
uword_assignment_to_uwordvar:
uw = 42
uw = 42.w
uw = 42555
uw = X
uw = ub2
uw = uw2
uw = mubyte2
uw = muword2
uw = string[4]
uw = ubarr1[2]
uw = uwarr1[2]
uw = string[X]
uw = string[b]
uw = string[ub]
uw = string[mbyte2]
uw = string[mubyte2]
uw = ubarr1[X]
uw = ubarr1[b]
uw = ubarr1[ub]
uw = ubarr1[mbyte2]
uw = ubarr1[mubyte2]
uw = uwarr1[X]
uw = uwarr1[b]
uw = uwarr1[ub]
uw = uwarr1[mbyte2]
uw = uwarr1[mubyte2]
uword_assignment_to_uwordmem:
muword = 42
muword = 42.w
muword = 42555
muword = X
muword = ub2
muword = uw2
muword = mubyte2
muword = muword2
muword = string[4]
muword = ubarr1[2]
muword = uwarr1[2]
muword = string[X]
muword = string[b]
muword = string[ub]
muword = string[mbyte2]
muword = string[mubyte2]
muword = ubarr1[X]
muword = ubarr1[b]
muword = ubarr1[ub]
muword = ubarr1[mbyte2]
muword = ubarr1[mubyte2]
muword = uwarr1[X]
muword = uwarr1[b]
muword = uwarr1[ub]
muword = uwarr1[mbyte2]
muword = uwarr1[mubyte2]
uword_assignment_to_uwordarray:
uwarr1[2] = 42
uwarr1[2] = 42.w
uwarr1[2] = 42555
uwarr1[2] = X
uwarr1[2] = ub2
uwarr1[2] = uw2
uwarr1[2] = mubyte2
uwarr1[2] = muword2
uwarr1[2] = string[4]
uwarr1[2] = ubarr1[2]
uwarr1[2] = uwarr1[2]
uwarr1[Y] = 42
uwarr1[Y] = 42.w
uwarr1[Y] = 42555
uwarr1[Y] = X
uwarr1[Y] = ub2
uwarr1[Y] = uw2
uwarr1[Y] = mubyte2
uwarr1[Y] = muword2
uwarr1[Y] = string[4]
uwarr1[Y] = ubarr1[2]
uwarr1[Y] = uwarr1[2]
uwarr1[b] = 42
uwarr1[b] = 42.w
uwarr1[b] = 42555
uwarr1[b] = X
uwarr1[b] = ub2
uwarr1[b] = uw2
uwarr1[b] = mubyte2
uwarr1[b] = muword2
uwarr1[b] = string[4]
uwarr1[b] = ubarr1[2]
uwarr1[b] = uwarr1[2]
uwarr1[ub] = 42
uwarr1[ub] = 42.w
uwarr1[ub] = 42555
uwarr1[ub] = X
uwarr1[ub] = ub2
uwarr1[ub] = uw2
uwarr1[ub] = mubyte2
uwarr1[ub] = muword2
uwarr1[ub] = string[4]
uwarr1[ub] = ubarr1[2]
uwarr1[ub] = uwarr1[2]
uwarr1[mbyte2] = 42
uwarr1[mbyte2] = 42.w
uwarr1[mbyte2] = 42555
uwarr1[mbyte2] = X
uwarr1[mbyte2] = ub2
uwarr1[mbyte2] = uw2
uwarr1[mbyte2] = mubyte2
uwarr1[mbyte2] = muword2
uwarr1[mbyte2] = string[4]
uwarr1[mbyte2] = ubarr1[2]
uwarr1[mbyte2] = uwarr1[2]
uwarr1[mubyte2] = 42
uwarr1[mubyte2] = 42.w
uwarr1[mubyte2] = 42555
uwarr1[mubyte2] = X
uwarr1[mubyte2] = ub2
uwarr1[mubyte2] = uw2
uwarr1[mubyte2] = mubyte2
uwarr1[mubyte2] = muword2
uwarr1[mubyte2] = string[4]
uwarr1[mubyte2] = ubarr1[2]
uwarr1[mubyte2] = uwarr1[2]
uwarr1[2] = string[Y] ; via evaluation
uwarr1[2] = string[b] ; via evaluation
uwarr1[2] = string[ub] ; via evaluation
uwarr1[2] = string[mbyte2] ; via evaluation
uwarr1[2] = string[mubyte2] ; via evaluation
uwarr1[2] = ubarr1[Y] ; via evaluation
uwarr1[2] = ubarr1[b] ; via evaluation
uwarr1[2] = ubarr1[ub] ; via evaluation
uwarr1[2] = ubarr1[mbyte2] ; via evaluation
uwarr1[2] = ubarr1[mubyte2] ; via evaluation
uwarr1[2] = uwarr1[Y] ; via evaluation
uwarr1[2] = uwarr1[b] ; via evaluation
uwarr1[2] = uwarr1[ub] ; via evaluation
uwarr1[2] = uwarr1[mbyte2] ; via evaluation
uwarr1[2] = uwarr1[mubyte2] ; via evaluation
word_assignment_to_wordvar:
w = -42
w = -42.w
w = 12555
w = X
w = ub2
w = b2
w = w2
w = mubyte2
w = mbyte2
w = mword2
w = string[4]
w = ubarr1[2]
w = barr1[2]
w = warr1[2]
w = string[X]
w = string[b]
w = string[ub]
w = string[mbyte2]
w = string[mubyte2]
w = barr1[X]
w = ubarr1[X]
w = barr1[b]
w = ubarr1[b]
w = barr1[ub]
w = ubarr1[ub]
w = barr1[mbyte2]
w = ubarr1[mbyte2]
w = barr1[mubyte2]
w = ubarr1[mubyte2]
w = warr1[X]
w = warr1[b]
w = warr1[ub]
w = warr1[mbyte2]
w = warr1[mubyte2]
word_assignment_to_wordmem:
mword = -42
mword = -42.w
mword = 12555
mword = X
mword = ub2
mword = b2
mword = w2
mword = mubyte2
mword = mbyte2
mword = mword2
mword = string[4]
mword = ubarr1[2]
mword = barr1[2]
mword = warr1[2]
mword = string[X]
mword = string[b]
mword = string[ub]
mword = string[mbyte2]
mword = string[mubyte2]
mword = barr1[X]
mword = ubarr1[X]
mword = barr1[b]
mword = ubarr1[b]
mword = barr1[ub]
mword = ubarr1[ub]
mword = barr1[mbyte2]
mword = ubarr1[mbyte2]
mword = barr1[mubyte2]
mword = ubarr1[mubyte2]
mword = warr1[X]
mword = warr1[b]
mword = warr1[ub]
mword = warr1[mbyte2]
mword = warr1[mubyte2]
word_assignment_to_wordarray:
warr2[2] = -42
warr2[2] = -42.w
warr2[2] = 12555
warr2[2] = X
warr2[2] = ub2
warr2[2] = b2
warr2[2] = w2
warr2[2] = mubyte2
warr2[2] = mbyte2
warr2[2] = mword2
warr2[2] = string[4]
warr2[2] = ubarr1[2]
warr2[2] = barr1[2]
warr2[2] = warr1[2]
warr2[Y] = -42
warr2[Y] = -42.w
warr2[Y] = 12555
warr2[Y] = X
warr2[Y] = ub2
warr2[Y] = b2
warr2[Y] = w2
warr2[Y] = mubyte2
warr2[Y] = mbyte2
warr2[Y] = mword2
warr2[Y] = string[4]
warr2[Y] = ubarr1[2]
warr2[Y] = barr1[2]
warr2[Y] = warr1[2]
warr2[b] = -42
warr2[b] = -42.w
warr2[b] = 12555
warr2[b] = X
warr2[b] = ub2
warr2[b] = b2
warr2[b] = w2
warr2[b] = mubyte2
warr2[b] = mbyte2
warr2[b] = mword2
warr2[b] = string[4]
warr2[b] = ubarr1[2]
warr2[b] = barr1[2]
warr2[b] = warr1[2]
warr2[ub] = -42
warr2[ub] = -42.w
warr2[ub] = 14255
warr2[ub] = X
warr2[ub] = ub2
warr2[ub] = b2
warr2[ub] = w2
warr2[ub] = mubyte2
warr2[ub] = mbyte2
warr2[ub] = mword2
warr2[ub] = string[4]
warr2[ub] = ubarr1[2]
warr2[ub] = barr1[2]
warr2[ub] = warr1[2]
warr2[mbyte2] = -42
warr2[mbyte2] = -42.w
warr2[mbyte2] = 12555
warr2[mbyte2] = X
warr2[mbyte2] = ub2
warr2[mbyte2] = b2
warr2[mbyte2] = w2
warr2[mbyte2] = mubyte2
warr2[mbyte2] = mbyte2
warr2[mbyte2] = mword2
warr2[mbyte2] = string[4]
warr2[mbyte2] = ubarr1[2]
warr2[mbyte2] = barr1[2]
warr2[mbyte2] = warr1[2]
warr2[mubyte2] = -42
warr2[mubyte2] = -42.w
warr2[mubyte2] = 12555
warr2[mubyte2] = X
warr2[mubyte2] = ub2
warr2[mubyte2] = b2
warr2[mubyte2] = w2
warr2[mubyte2] = mubyte2
warr2[mubyte2] = mbyte2
warr2[mubyte2] = mword2
warr2[mubyte2] = string[4]
warr2[mubyte2] = ubarr1[2]
warr2[mubyte2] = barr1[2]
warr2[mubyte2] = warr1[2]
warr1[2] = string[Y] ; via evaluation
warr1[2] = string[b] ; via evaluation
warr1[2] = string[ub] ; via evaluation
warr1[2] = string[mbyte2] ; via evaluation
warr1[2] = string[mubyte2] ; via evaluation
warr1[2] = barr1[Y] ; via evaluation
warr1[2] = barr1[b] ; via evaluation
warr1[2] = barr1[ub] ; via evaluation
warr1[2] = barr1[mbyte2] ; via evaluation
warr1[2] = barr1[mubyte2] ; via evaluation
warr1[2] = warr1[Y] ; via evaluation
warr1[2] = warr1[b] ; via evaluation
warr1[2] = warr1[ub] ; via evaluation
warr1[2] = warr1[mbyte2] ; via evaluation
warr1[2] = warr1[mubyte2] ; via evaluation
;; all possible assignments to a FLOAT VARIABLE
float_assignment_to_floatvar:
fl1 = 34
fl1 = 34555.w
fl1 = 3.33e22
fl1 = X
fl1 = b2
fl1 = ub2
fl1 = w2
fl1 = uw2
fl1 = mbyte
fl1 = mubyte
fl1 = mword
fl1 = muword
fl1 = fl2
fl1 = mfloat2
fl1 = barr1[2]
fl1 = ubarr1[2]
fl1 = warr1[2]
fl1 = uwarr1[2]
fl1 = string[4]
fl1 = farr1[4]
fl1 = string[Y] ; via evaluation
fl1 = string[b] ; via evaluation
fl1 = string[ub] ; via evaluation
fl1 = string[mbyte2] ; via evaluation
fl1 = string[mubyte2] ; via evaluation
fl1 = barr1[Y] ; via evaluation
fl1 = ubarr1[Y] ; via evaluation
fl1 = barr1[b] ; via evaluation
fl1 = ubarr1[b] ; via evaluation
fl1 = barr1[ub] ; via evaluation
fl1 = ubarr1[ub] ; via evaluation
fl1 = barr1[mbyte2] ; via evaluation
fl1 = ubarr1[mbyte2] ; via evaluation
fl1 = barr1[mubyte2] ; via evaluation
fl1 = ubarr1[mubyte2] ; via evaluation
fl1 = warr1[Y] ; via evaluation
fl1 = warr1[b] ; via evaluation
fl1 = warr1[ub] ; via evaluation
fl1 = warr1[mbyte2] ; via evaluation
fl1 = warr1[mubyte2] ; via evaluation
float_assignment_to_floatmem:
mfloat = 34
mfloat = 34555.w
mfloat = 3.33e22
mfloat = X
mfloat = b2
mfloat = ub2
mfloat = w2
mfloat = uw2
mfloat = mbyte
mfloat = mubyte
mfloat = mword
mfloat = muword
mfloat = fl2
mfloat = mfloat2
mfloat = barr1[2]
mfloat = ubarr1[2]
mfloat = warr1[2]
mfloat = uwarr1[2]
mfloat = string[4]
mfloat = farr1[4]
mfloat = string[Y] ; via evaluation
mfloat = string[b] ; via evaluation
mfloat = string[ub] ; via evaluation
mfloat = string[mbyte2] ; via evaluation
mfloat = string[mubyte2] ; via evaluation
mfloat = barr1[Y] ; via evaluation
mfloat = ubarr1[Y] ; via evaluation
mfloat = barr1[b] ; via evaluation
mfloat = ubarr1[b] ; via evaluation
mfloat = barr1[ub] ; via evaluation
mfloat = ubarr1[ub] ; via evaluation
mfloat = barr1[mbyte2] ; via evaluation
mfloat = ubarr1[mbyte2] ; via evaluation
mfloat = barr1[mubyte2] ; via evaluation
mfloat = ubarr1[mubyte2] ; via evaluation
mfloat = warr1[Y] ; via evaluation
mfloat = warr1[b] ; via evaluation
mfloat = warr1[ub] ; via evaluation
mfloat = warr1[mbyte2] ; via evaluation
mfloat = warr1[mubyte2] ; via evaluation
return
}

View File

@ -20,13 +20,22 @@ fun main(args: Array<String>) {
// println("This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html\n")
println("**** This is a prerelease version. Please do not distribute! ****\n")
if(args.size != 1) {
System.err.println("requires one argument: name of module file")
exitProcess(1)
if(args.isEmpty() || args.size >2)
usage()
var startEmu = false
var moduleFile = ""
for (arg in args) {
if(arg=="--emu")
startEmu = true
else if(!arg.startsWith("--"))
moduleFile = arg
}
if(moduleFile.isNullOrBlank())
usage()
val startTime = System.currentTimeMillis()
val filepath = Paths.get(args[0]).normalize()
val filepath = Paths.get(moduleFile).normalize()
try {
// import main module and process additional imports
@ -85,7 +94,7 @@ fun main(args: Array<String>) {
// optimize the parse tree
println("Optimizing...")
val allScopedSymbolDefinitions = moduleAst.checkIdentifiers()
val allScopedSymbolDefinitions = moduleAst.checkIdentifiers() // useful for checking symbol usage later?
while(true) {
// keep optimizing expressions and statements until no more steps remain
val optsDone1 = moduleAst.simplifyExpressions(namespace, heap)
@ -120,14 +129,25 @@ fun main(args: Array<String>) {
val endTime = System.currentTimeMillis()
println("\nTotal compilation+assemble time: ${(endTime-startTime)/1000.0} sec.")
// // todo start the vice emulator
// val program = "foo"
// val cmdline = listOf("x64", "-moncommands", monitorfile,
// "-autostartprgmode", "1", "-autostart-warp", "-autostart", program)
// ProcessBuilder(cmdline).inheritIO().start()
} catch (px: ParsingFailedError) {
System.err.println(px.message)
exitProcess(1)
}
if(startEmu) {
println("\nStarting C64 emulator...")
val program = "foo"
val monitorfile = "foo.mon_list"
val cmdline = listOf("x64", "-moncommands", monitorfile,
"-autostartprgmode", "1", "-autostart-warp", "-autostart", program)
ProcessBuilder(cmdline).inheritIO().start()
}
}
private fun usage() {
System.err.println("Missing argument(s):")
System.err.println(" [--emu] auto-start the C64 emulator after successful compilation")
System.err.println(" modulefile main module file to compile")
exitProcess(1)
}

View File

@ -110,7 +110,7 @@ class AstChecker(private val namespace: INameScope,
printWarning("for loop body is empty", forLoop.position)
if(forLoop.iterable is LiteralValue)
checkResult.add(SyntaxError("currently not possible to loop over a literal value directly, use a variable instead", forLoop.position)) // todo loop over literals
checkResult.add(SyntaxError("currently not possible to loop over a literal value directly, use a variable instead", forLoop.position)) // todo loop over literals (by creating a generated variable)
if(!forLoop.iterable.isIterable(namespace, heap)) {
checkResult.add(ExpressionError("can only loop over an iterable type", forLoop.position))
@ -689,7 +689,6 @@ class AstChecker(private val namespace: INameScope,
checkResult.add(SyntaxError("indexing requires a variable to act upon", arrayIndexedExpression.position))
// check index value 0..255
val regx = (arrayIndexedExpression.arrayspec.x as? RegisterExpr)?.register
val dtx = arrayIndexedExpression.arrayspec.x.resultingDatatype(namespace, heap)
if(dtx!=DataType.UBYTE && dtx!=DataType.BYTE)
checkResult.add(SyntaxError("array indexing is limited to byte size 0..255", arrayIndexedExpression.position))

View File

@ -180,7 +180,7 @@ private class StatementTranslator(private val prog: IntermediateProgram,
override fun process(block: Block): IStatement {
prog.newBlock(block.scopedname, block.name, block.address)
processVariables(block)
processVariables(block) // @todo optimize initializations with same value: load the value only once
prog.label(block.scopedname)
prog.line(block.position)
translate(block.statements)
@ -698,7 +698,7 @@ private class StatementTranslator(private val prog: IntermediateProgram,
// some functions are implemented as vm opcodes
args.forEach { translate(it) } // place function argument(s) on the stack
when (funcname) {
"flt" -> { // todo: this is translated ok!
"flt" -> {
// 1 argument, type determines the exact opcode to use
val arg = args.single()
when (arg.resultingDatatype(namespace, heap)) {
@ -710,10 +710,10 @@ private class StatementTranslator(private val prog: IntermediateProgram,
else -> throw CompilerException("wrong datatype for flt()")
}
}
"msb" -> prog.instr(Opcode.MSB) // todo: is translated ok!
"lsb" -> prog.instr(Opcode.LSB) // todo: is translated ok!
"b2ub" -> prog.instr(Opcode.B2UB) // todo: is translated ok!
"ub2b" -> prog.instr(Opcode.UB2B) // todo: is translated ok!
"msb" -> prog.instr(Opcode.MSB)
"lsb" -> prog.instr(Opcode.LSB)
"b2ub" -> prog.instr(Opcode.B2UB)
"ub2b" -> prog.instr(Opcode.UB2B)
"lsl" -> {
val arg = args.single()
val dt = arg.resultingDatatype(namespace, heap)
@ -780,12 +780,12 @@ private class StatementTranslator(private val prog: IntermediateProgram,
// this function doesn't return a value on the stack so we pop it directly into the argument register/variable again
popValueIntoTarget(AssignTarget.fromExpr(arg), dt)
}
"set_carry" -> prog.instr(Opcode.SEC) // todo: compiled ok!!
"clear_carry" -> prog.instr(Opcode.CLC)// todo: compiled ok!!
"set_irqd" -> prog.instr(Opcode.SEI)// todo: compiled ok!!
"clear_irqd" -> prog.instr(Opcode.CLI)// todo: compiled ok!!
"rsave" -> prog.instr(Opcode.RSAVE)// todo: compiled ok!!
"rrestore" -> prog.instr(Opcode.RRESTORE)// todo: compiled ok!!
"set_carry" -> prog.instr(Opcode.SEC)
"clear_carry" -> prog.instr(Opcode.CLC)
"set_irqd" -> prog.instr(Opcode.SEI)
"clear_irqd" -> prog.instr(Opcode.CLI)
"rsave" -> prog.instr(Opcode.RSAVE)
"rrestore" -> prog.instr(Opcode.RRESTORE)
else -> createSyscall(funcname) // call builtin function
}
}
@ -1556,7 +1556,7 @@ private class StatementTranslator(private val prog: IntermediateProgram,
translate(ifstmt)
} else {
// Step is a variable. We can't optimize anything...
TODO("for loop with non-constant step comparison of LV")
TODO("for loop with non-constant step comparison of LV, at: ${range.position}")
}
translate(body)

View File

@ -20,12 +20,6 @@ class IntermediateProgram(val name: String, var loadAddress: Int, val heap: Heap
get() { return variables.size }
val numInstructions: Int
get() { return instructions.filter { it.opcode!= Opcode.LINE }.size }
fun getIns(idx: Int): Instruction {
if(idx>=0 && idx <instructions.size)
return instructions[idx]
return Instruction(Opcode.NOP)
}
}
val blocks = mutableListOf<ProgramBlock>()

View File

@ -147,7 +147,7 @@ enum class Opcode {
DEC_VAR_F,
// comparisons
// @todo the comparisons now push the result back on the stack. Optimize this to work with processor flags exclusively. This does mean you can no longer use a logical boolean result as a byte 0/1 value ?
// @todo the comparisons (apart from TEST) push the result back on the stack. Optimize this to work with processor flags exclusively. This does mean you can no longer use a logical boolean result as a byte 0/1 value ?
TEST, // pop top value from stack and test it. Sets cpu flags (zero, negative, overflow) accordingly.
LESS_B,
LESS_UB,

View File

@ -15,8 +15,6 @@ import java.util.*
import kotlin.math.abs
private val registerStrings = Register.values().map{it.toString()}.toSet()
class AssemblyError(msg: String) : RuntimeException(msg)
@ -780,7 +778,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
}
private fun sameIndexedVarOperation(variable: String, indexVar: String, ins: Instruction): AsmFragment? {
val saveX = " stx ${C64Zeropage.SCRATCH_B1} |" // todo optimize to TXA when possible
val saveX = " stx ${C64Zeropage.SCRATCH_B1} |"
val restoreX = " | ldx ${C64Zeropage.SCRATCH_B1}"
val loadXWord: String
val loadX: String
@ -806,17 +804,17 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
}
return when (ins.opcode) {
Opcode.SHL_BYTE -> AsmFragment("$saveX $loadX asl $variable,x $restoreX", 10)
Opcode.SHR_BYTE -> AsmFragment("$saveX $loadX lsr $variable,x $restoreX", 10)
Opcode.SHL_BYTE -> AsmFragment(" txa | $loadX asl $variable,x | tax", 10)
Opcode.SHR_BYTE -> AsmFragment(" txa | $loadX lsr $variable,x | tax", 10)
Opcode.SHL_WORD -> AsmFragment("$saveX $loadXWord asl $variable,x | rol $variable+1,x $restoreX", 10)
Opcode.SHR_WORD -> AsmFragment("$saveX $loadXWord lsr $variable+1,x | ror $variable,x $restoreX", 10)
Opcode.ROL_BYTE -> AsmFragment("$saveX $loadX rol $variable,x $restoreX", 10)
Opcode.ROR_BYTE -> AsmFragment("$saveX $loadX ror $variable,x $restoreX", 10)
Opcode.ROL_BYTE -> AsmFragment(" txa | $loadX rol $variable,x | tax", 10)
Opcode.ROR_BYTE -> AsmFragment(" txa | $loadX ror $variable,x | tax", 10)
Opcode.ROL_WORD -> AsmFragment("$saveX $loadXWord rol $variable,x | rol $variable+1,x $restoreX", 10)
Opcode.ROR_WORD -> AsmFragment("$saveX $loadXWord ror $variable+1,x | ror $variable,x $restoreX", 10)
Opcode.ROL2_BYTE -> AsmFragment("$saveX $loadX lda $variable,x | cmp #\$80 | rol $variable,x $restoreX", 10)
Opcode.ROR2_BYTE -> AsmFragment("$saveX $loadX lda $variable,x | lsr a | bcc + | ora #\$80 |+ | sta $variable,x $restoreX", 10)
Opcode.ROL2_WORD -> AsmFragment("$saveX $loadXWord asl $variable,x | rol $variable+1,x | bcc + | inc $variable,x |+ $restoreX", 30)
Opcode.ROL2_WORD -> AsmFragment(" txa | $loadXWord asl $variable,x | rol $variable+1,x | bcc + | inc $variable,x |+ | tax", 30)
Opcode.ROR2_WORD -> AsmFragment("$saveX $loadXWord lsr $variable+1,x | ror $variable,x | bcc + | lda $variable+1,x | ora #\$80 | sta $variable+1,x |+ $restoreX", 30)
else -> null
}

View File

@ -15,7 +15,11 @@ private val importedModules : HashMap<String, Module> = hashMapOf()
fun importModule(filePath: Path) : Module {
println("importing '${filePath.fileName}' (from '${filePath.parent}')")
print("importing '${filePath.fileName}'")
if(filePath.parent!=null)
println(" (from '${filePath.parent}')")
else
println("")
if(!Files.isReadable(filePath))
throw ParsingFailedError("No such file: $filePath")
@ -28,7 +32,7 @@ fun importModule(filePath: Path) : Module {
if(parser.numberOfSyntaxErrors > 0)
throw ParsingFailedError("There are ${parser.numberOfSyntaxErrors} syntax errors in '${filePath.fileName}'.")
// TODO the comments:
// You can do something with the parsed comments:
// tokens.commentTokens().forEach { println(it) }
// convert to Ast