This commit is contained in:
Irmen de Jong
2018-09-30 23:13:35 +02:00
parent 623b42cc14
commit 6d343bd75d
59 changed files with 4 additions and 3 deletions

View File

@@ -0,0 +1,159 @@
; call tests
~ foo {
var word var1 = 99
memory word mem1 = $cff0
var byte varb1 = 99
memory byte memb1 = $cff0
const word constw = $2355
const byte constb = $23
const float constf = 3.4556677
const str constt = "derp"
sub sub1 () -> (X?) = $ffdd
sub sub2 (A) -> (Y?) = $eecc
sub sub3 (XY) -> (Y?) = $ddaa
sub sub4 (string: XY, other : A) -> (Y?) = $dd22
bar2:
bar: goto $c000
goto var1 ; jumps to the address in var1
goto mem1 ; jumps to the address in mem1
goto [var1]
goto [$c000.word]
goto [var1]
goto [mem1]
; ----
goto sub1
return sub2 (1 )
return sub3 (3)
return sub3 ("hello")
return sub3 ("hello, there")
return sub4 (string="hello, there", other = 42)
return sub4 ("hello", 42)
return sub4 ("hello", other= 42)
return sub4 (string="hello", other = 42)
return bar ()
goto [AX]
goto [var1]
goto [mem1] ; comment
goto $c000
goto 64738
64738(1,2) ; @todo should be jsr $64738
return 9999() ; @todo should be jmp 9999 ?
return [AX]()
return [var1] () ; comment
return [mem1] ()
goto $c000
return $c000 ( )
goto $c2
return $c2()
goto [$c2.word]
return 33
return [$c2.word]
return [$c2.word] (4)
return [$c2.word] (4)
return [$c2.word] (4)
return [$c2.word] (4)
return [$c2dd.word] ( )
goto [$c2dd.word]
%asm {
nop
nop
nop
nop
}
sub1!()
sub2!(11)
sub3 !(3)
sub3! ("hello")
sub3! ("hello, there")
sub4! ("hello", 42)
sub4! ("hello", other=42)
sub4! (string="hello", other = 42)
sub4! (string="hello, there", other = 42)
sub3 (81)
sub3 !(81)
sub3 !A (81)
sub3 !X (81)
sub3 !Y (81)
sub3 !XY (81)
sub3 !AXY (81)
bar!()
bar !()
[XY]! ()
[XY] ! ()
[var1]!()
[mem1]!()
[$c2.word]!()
[$c2dd.word]!()
$c000!()
$c2!()
%asm {
nop
nop
nop
nop
}
sub1()
sub2(11)
sub3 (3)
sub3 ("hello")
sub3 ("hello, there")
sub4 ("hello", 42)
sub4 ("hello", other= 42)
sub4 (string="hello", other = 42)
sub4 (string="hello, there", other = 42)
bar ()
[AX]()
[var1] ( )
[mem1] ()
A= [$c2.word]
A= [$c2dd.word ]
$c000()
$c2()
%asm {
nop
nop
nop
nop
}
constw()
sub1()
main.start()
return
}
~ main {
start:
foo.bar()
return
sub unused_sub ()->() {
A=X
X=Y
Y=A
return
}
}

View File

@@ -0,0 +1,141 @@
%output basic
%import c64lib
~ main {
var word value
memory word memvalue = $8000
start:
A = 100
; conditional if, without conditional expression. needs explicit if status.
if_not goto label
if_true goto label
if_zero goto label
if_cc goto label
if_lt goto label
if_le goto label
if_ge goto label
if_gt goto label
if_cc goto value
;if_cc goto memvalue
;if_cc goto #memvalue
if_cc goto [value]
;if_cc goto [memvalue]
;if_cc goto $c000
;if_cc goto [$c000.word]
label:
; conditional if with a single 'truth' value (register)
if_true A goto label2
if_not A goto label2
if_zero A goto label2
if A goto label2
if_true X goto label2
if_not X goto label2
if_zero X goto label2
if X goto label2
if_true Y goto label2
if_not Y goto label2
if_zero Y goto label2
if Y goto label2
if_true XY goto label2
if_not XY goto label2
if_zero XY goto label2
if XY goto label2
label2:
; conditional if with a single 'truth' value (variable)
if_true value goto label3
if_not value goto label3
if_zero value goto label3
if value goto label3
if_true memvalue goto label3
if_not memvalue goto label3
if_zero memvalue goto label3
if memvalue goto label3
label3:
; conditional if with a single 'truth' value (indirect address)
if_true [$c000] goto label4
if_not [$c000] goto label4
if_zero [$c000] goto label4
if [$c000] goto label4
if_true [XY] goto label4
if_true [AY] goto label4
if_true [AX] goto label4
label4:
return
}
~ conditionals {
var bytevar = 22 + 23
var str name = "?"*80
var bytevar2 = 23
var word wordvar = 22345
start:
c64.init_system()
A = 0
printloop:
c64scr.print_byte_decimal(A)
c64.CHROUT('\n')
A++
if A <20 goto printloop
return
label1:
if_true A==123 goto label1
if_true A == 123 goto label1
if_true A!=0 goto label1
if_not X!=0 goto label1
if_true A <= 1 goto label1
if_true A==1 goto label1
if_true A!=1 goto label1
if_not X < 1 goto label1
if_not Y>1 goto label1
if_not X!=1 goto label1
if_true 22<=Y goto label1
if_true A<=22 goto label1
if_true A<X goto label1
if_true X>Y goto label1
if_true X>A goto label1
if A<=22 goto label1
if A <= 22 goto label1
if_zero A goto label1
if_zero X goto label1
if Y goto label1
if_true XY goto label1
if_not XY goto label1
if A goto label1
if_not goto label1
if_true bytevar<=A goto label2
if_true bytevar<=22 goto label2
if bytevar<=22 goto label2
if bytevar<=22 goto label2
if bytevar goto label2
if bytevar>bytevar2 goto label2
if_zero bytevar goto label2
if_not wordvar goto label2
if_zero wordvar goto label2
if_true wordvar goto label2
label2:
return
}

View File

@@ -0,0 +1,311 @@
; var definitions and immediate primitive data type tests
%output raw
%zp clobber
%import c64lib
~ ZP {
; ZeroPage block definition:
; base address is set to $04 (because $00 and $01 are used by the hardware, and $02/$03 are scratch)
; everything here ends up in the zeropage, as long as there is space.
; you can NOT put subroutines in here (yet).
}
~ ZP {
var zpvar1
var zpvar2
memory zpmem1 = $f0
const zpconst = 1.234
var word zpvarw1
var word zpvarw2
var float zpvarflt1 = 11.11
var float zpvarflt2 = 22.22
var float zpvarflt3
}
~ ZP {
; will be merged with other ZP blocks!
var zpvar1b = $88
}
~ foo {
var foovar1
memory foomem1 = $f0f0
const fooconst = 1.234
return
}
~ main {
; variables
var uninitbyte1
var byte uninitbyte2
var initbyte1 = $12
var initbyte1b = true
var byte initbyte2 = $12
var byte initbyte2b = false
var byte initbyte3 = 99.876
var initchar1 = '@'
var byte initchar2 = '@'
var word uninitword
var word initword1 = $1234
var word initword1b = true
var word initword2 = false
var word initword3 = 9876.554321
var word initword5 = 20
var float uninitfloat
var float initfloat1 = 0
var float initfloat1b = true
var float initfloat2 = -1.234e-14
var float initfloat3 = 9.87e+14
var float initfloat4 = 1.70141183e+38
var float initfloat5 = -1.70141183e+38
var float initfloat6 = 1.234
var wordarray( 256 ) uninit_wordarray
var wordarray(10) init_wordarray = $1234
var wordarray(10) init_wordarrayb = true
var array( 256) uninit_bytearray
var array(10 ) init_bytearray =$12
var array(10 ) init_bytearrayb =true
var array(10 ) init_bytearrayc ='@'
var str text = "hello-null"
var strp ptext = 'hello-pascal'
var strs stext = 'screencodes-null'
var strps pstext = "screencodes-pascal"
var matrix( 2, 128 ) uninitmatrix
var matrix(10, 20) initmatrix1 = $12
var matrix(10, 20) initmatrix1b = true
var matrix(10, 20) initmatrix1c = '@'
var matrix(10, 20) initmatrix1d = 123.456
; memory-mapped variables
memory membyte1 = $cf01
memory byte membyte2 = $c222
memory word memword1 = $cf03
memory float memfloat = $cf04
memory array(10 ) membytes = $cf05
memory wordarray( 10) memwords = $cf06
memory matrix( 10, 20 ) memmatrix = $cf07
; constants (= names for constant values, can never occur as lvalue)
const cbyte1 = 1
const cbyte1b = false
const byte cbyte2 = 1
const byte cbyte3 = '@'
const byte cbyte4 = true
const word cword1 = false
const word cword2 = $1234
const word cword5 = 9876.5432
const cfloat1 = 1.2345
const float cfloat2 = 2.3456
const float cfloat2b = cfloat2*3.44
const float cfloat3 = true
const str ctext3 = "constant-text"
const strp ctext4 = "constant-ptext"
const strs ctext5 = "constant-stext"
const strps ctext6 = "constant-pstext"
; taking the address of various things:
var word vmemaddr1 = &membyte1
var word vmemaddr2 = &memword1
var word vmemaddr3 = &memfloat
var word vmemaddr4 = &membytes
var word vmemaddr5 = &memwords
var word vmemaddr6 = &memmatrix
var word vmemaddr8 = 100*sin(cbyte1)
var word vmemaddr9 = cword2+$5432
var word vmemaddr10 = cfloat2b
; taking the address of things from the ZP will work even when it is a var
; because zp-vars get assigned a specific address (from a pool). Also, it's a byte.
var word initword0a = &ZP.zpmem1
var initbytea0 = &ZP.zpmem1
; (constant) expressions
var word expr_byte1b = -1-2-3-4-$22+$80+ZP.zpconst
var byte expr_fault2 = 1 + (8/3)+sin(33) + len("abc")
sin:
return
max:
return
start:
; --- immediate primitive value assignments ----
A = [$99]
A = [$aabb]
A = $99
A = [cbyte3]
A = 0
A = '@'
A = 1.2345
A = false
A = 255
A = X
A = [$99]
A = [$c020.byte]
A = [$c020]
A = cbyte3
A = membyte2
A = uninitbyte1
XY = 0
XY = '@'
XY = 1.2345
XY = 456.66
XY = 65535
XY = true
XY = false
XY = text
XY = cbyte3
XY = [cbyte3]
XY = [cword2]
XY = uninitbyte1
XY = "text-immediate"
AY = "text-immediate"
AX = ctext3
AX = ""
AX = XY
AX = Y
XY = membyte2
XY = membyte2
XY = memword1
XY = sin
XY = &sin ; @todo not yet implemented
[$c000] = A
[$c000] = 255
[$c000] = '@'
[$c000] = true
[$c000] = false
[$c000] = cbyte3
[$c000] = uninitbyte1
[$c000] = membyte2
[$c000] = cbyte2
[$c000] = [cword2]
[$c000.word] = A
[$c000.word] = AX
[$c000.word] = cbyte3
[$c000.word] = cword2
[$c000.word] = ctext3
[$c000.word] = 65535
[$c000.word] = "text"
[$c000.word] = ""
[$c000.word] = uninitbyte1
[$c000.word] = membyte2
[$c000.word] = &membyte2 ; @todo not yet implemented
[$c000.word] = [cword2]
[$c000.word] = memword1
[$c000.float] = 65535
[$c000.float] = 456.66
[$c000.float] = 1.70141183e+38
[$c000.float] = cbyte3
[$c000.float] = cword2
[$c001] = [$c002]
[$c111.word] = [$c222]
[$c112.word] = [$c223.byte]
[$c222.word] = [$c333.word]
[$c333.word] = sin
[$c333.word] = &sin ; @todo not yet implemented
SC = 0
SC = 1
SC = false
SI = 1
SI = 0
SI = false
uninitbyte1 = 99
uninitbyte1 = 1.234
uninitbyte1 = '@'
initbyte1 = 99
initbyte1 = 1.234
initbyte1 = '@'
initbyte1 = A
initbyte1 = cbyte3
uninitword = 99
uninitword = 5.6778
uninitword = "test"
uninitword = '@'
uninitword = A
uninitword = XY
uninitword = ctext3
initword1 = cbyte3
initword1 = cword2
initfloat1 = 99
initfloat1 = 9.8765
initfloat1 = '@'
initfloat1 = cbyte3
initfloat1 = cword2
uninitfloat = 99
uninitfloat = 9.8765
uninitfloat = '@'
initword1 = sin
initword1 = &sin ; @todo not yet implemented
membyte1 = A
membyte1 = cbyte3
memword1 = A
memword1 = AX
memword1 = cbyte3
memword1 = cword2
memword1 = ctext3
membyte1 = 22
memword1 = 2233
memfloat = 3.4567
memword1 = sin
memword1 = &sin ; @todo not yet implemented
membyte1 = A
memword1 = A
memword1 = XY
memfloat = cbyte3
memfloat = cword2
; float assignments that require ROM functions from c64lib:
memfloat = Y
memfloat = XY
uninitfloat = Y
uninitfloat = XY
initfloat2 = Y
initfloat2 = XY
initfloat2 = initbyte2
initfloat2 = initword2
initfloat1 = uninitfloat
initfloat1 = initfloat2
return
}
~ footer {
XY = "text-immediate" ; reuses existing
AY = "text-immediate" ; reuses existing
AX = "another"
AX = ""
[$c000.word] = "another" ; must reuse string
[$c100.word] = "text-immediate" ; must reuse string
[$c200.word] = "" ; must reuse string
return
}

View File

@@ -0,0 +1,148 @@
; floating point tests
%output basic
%import c64lib
~ main_testing {
start:
var float myfloat1 = 1234.56789
var float myfloat2 = 9876.54321
var float myfloatneg1 = -555.666
var float myfloat_large1 = 987654.1111
var float myfloat_large2 = -123456.2222
var str myfloatstr = "1234.998877"
var float myfloatzero = 0
var float myfloatsmall1 = 1.234
var float myfloatsmall2 = 2.6677
return
}
~ main {
byte bbvar
float@
var float flt_pi = 3.141592653589793
var float flt_minus32768 = -32768
var float flt_1 = 1
var float flt_half_sqr2 = 0.7071067811865476
var float flt_sqr2 = 1.4142135623730951
var float flt_minus_half = -.5
var float flt_log_2 = 0.6931471805599453
var float flt_10 = 10
var float flt_1e9 = 1000000000
var float flt_half = .5
var float flt_one_over_log_2 = 1.4426950408889634
var float flt_half_pi = 1.5707963267948966
var float flt_double_pi = 6.283185307179586
var float flt_point25 = .25
var float my_float
memory .word some_address = $ccdd
memory .byte some_addressb = $ccee
var .byte bytevar = $cc
var .word wordvar = $cdef
sub printflt (float: AY) -> (?) {
c64.MOVFM!(AY)
goto c64.FPRINTLN
; c64.FOUT!()
; c64scr.print_string!(AY)
;goto c64.CHROUT('\n')
}
start:
; assign some float values to the memory
AY = &flt_pi
some_address = & flt_pi
some_address = 4123.2342342222
[$c000.word] = & flt_pi
my_float ++
my_float += 1
my_float += 0.5
my_float += 999.222
my_float --
my_float -= 1
my_float -= 0.5
my_float -= 999.222
; print some floating points from source and compare them with ROM
printflt(&flt_pi)
printflt(&c64.FL_PIVAL)
printflt(&flt_minus32768)
printflt(&c64.FL_N32768)
printflt(&flt_1)
printflt(&c64.FL_FONE)
printflt(&flt_half_sqr2)
printflt( & c64.FL_SQRHLF)
printflt(&flt_sqr2)
printflt(&c64.FL_SQRTWO)
printflt(&flt_minus_half)
printflt(&c64.FL_NEGHLF)
printflt(&flt_log_2)
printflt(&c64.FL_LOG2)
printflt(&flt_10)
printflt(&c64.FL_TENC)
printflt(&flt_1e9)
printflt(&c64.FL_NZMIL)
printflt(&flt_half)
printflt(&c64.FL_FHALF)
printflt(&flt_one_over_log_2)
printflt(&c64.FL_LOGEB2)
printflt(&flt_half_pi)
printflt(&c64.FL_PIHALF)
printflt(&flt_double_pi)
printflt(&c64.FL_TWOPI)
printflt(& flt_point25)
printflt(&c64.FL_FR4)
reg_to_float:
c64.CHROUT!('\n')
A=33
X=44
Y=55
my_float = A
printflt(&my_float)
my_float = X
printflt(&my_float)
my_float = Y
printflt(&my_float)
XY = 11122
my_float = XY
printflt(&my_float)
AX = 33344
my_float = AX
printflt(&my_float)
AY = 55566
my_float = AY
printflt(&my_float)
return
}

Binary file not shown.

View File

@@ -0,0 +1,2 @@
; this assembly code is included as-is
nop

View File

@@ -0,0 +1,51 @@
%output basic
%import c64lib
~ main {
var .str name = "????????????????????????????????????????????????????????????????????????????????" ; 80
var .word orig_irq
start:
c64.init_system()
orig_irq = c64.CINV
SI = 1
c64.CINV = &irq_handler
SI = 0
c64scr.print_string("enter your name: ")
c64scr.input_chars(name)
c64.CHROUT('\n')
blop:
return
%breakpoint
return
; yeah!
c64scr.print_string("thank you, mr or mrs: ")
c64scr.print_string(name)
c64.CHROUT('\n')
SI = 1
c64.CINV = orig_irq
SI = 0
return
irq_handler:
%asm {
lda c64.SFDX
cmp #$40 ; nothing pressed?
beq +
inc c64.EXTCOL ; otherwise change color
+ jmp c64.IRQDFRT
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,106 @@
%output basic
%import c64lib
%import mathlib
~ main {
var .str name = '?' * 80
var .str guess = '?' * 80
var secretnumber
var attempts_left = 10
start:
c64.init_system()
A = c64.VMCSB
A |= 2
c64.VMCSB = A
c64.VMCSB |= 2 ; @todo when this works it replaces the three lines above
; greeting
c64scr.print_string("Enter your name: ")
Y = c64scr.input_chars(name)
c64.CHROUT('\n')
c64.CHROUT('\n')
c64scr.print_string("Hello, ")
c64scr.print_string(name)
c64.CHROUT('.')
c64.CHROUT('\n')
; create a secret random number from 1-100
c64.RNDA(0) ; fac = rnd(0)
c64.MUL10() ; fac *= 10
c64.MUL10() ; .. and now *100
c64.FADDH() ; add 0.5..
c64.FADDH() ; and again, so +1 total
AY = c64flt.GETADRAY()
secretnumber=A
;A=math.randbyte()
;A+=c64.RASTER
;A-=c64.TIME_LO
;X,secretnumber=math.divmod_bytes(A, 99)
c64scr.print_string("I am thinking of a number from 1 to 100!You'll have to guess it!\n")
printloop:
c64scr.print_string("\nYou have ")
c64scr.print_byte_decimal(attempts_left)
c64scr.print_string(" guess")
; @todo comparison expression so we can do if attempts_left>0 ...
A = attempts_left
A--
if_zero A goto ask_guess
c64scr.print_string("es")
ask_guess:
c64scr.print_string(" left.\nWhat is your next guess? ")
Y = c64scr.input_chars(guess)
c64.CHROUT('\n')
[$22.word] = guess
c64.FREADSTR(A)
AY = c64flt.GETADRAY()
A -= secretnumber ; @todo condition so we can do if guess > secretnumber.... # @todo "removed statement that has no effect" is WRONG!!
A -= secretnumber ; # @todo "removed statement that has no effect" is WRONG!!
if_zero goto correct_guess
if_gt goto too_high
c64scr.print_string("That is too ")
c64scr.print_string("low!\n")
goto continue
correct_guess:
c64scr.print_string("\nThat's my number, impressive!\n")
goodbye()
return
too_high:
c64scr.print_string("That is too ")
c64scr.print_string("high!\n")
continue:
attempts_left--
if_zero attempts_left goto game_over
goto printloop
game_over:
c64scr.print_string("\nToo bad! It was: ")
c64scr.print_byte_decimal(secretnumber)
c64.CHROUT('\n')
return goodbye()
goodbye() ; @todo fix subroutine usage tracking, it doesn't register this one
return
return
return
return
return
return
return
return
return
return
sub goodbye ()->() {
c64scr.print_string("\nThanks for playing. Bye!\n")
return
}
}

View File

@@ -0,0 +1,227 @@
; source IL file
; these are comments
; line 2 comment
; line 3 comment
%output basic ; create a c-64 program with basic SYS call to launch it
%zp restore , clobber ; clobber over the zp memory normally used by basic/kernal rom, frees up more zp
options
%blocks
~ main
{
; this is the main block with the start routine.
memory screen = $d021
memory border = $d020
memory cursor = 646
const cyan = 3
const .word redw = $2002
var uninitbyte1
var .byte uninitbyte2
var .word uninitword1
var .byte initbyte33 = 33
var .word initword9876 = $9876
var .array(10) bytes2 = $44
var .wordarray(10) words2 = $bbcc
]
start: ;foo
X = 55
Y = $77
Y = X
Y = X
X = 66
screen = 0
screen = 66
border = 66
cursor = 66
X = 66
Y = 66
A = 66
X = 66
Y = 66
A = 66
border = 66
cursor = 66
border = 66
cursor = 66
border = false
border = true
border = 0
border = 0
[$d020] = 0
screen = X
cursor = Y
[646] = Y
uninitbyte1 = 123
uninitword1 = 12345
uninitword1 = A
initbyte33 = 133
initword9876 = 9999
initword9876 = 1
initword9876 = Y
initbyte33 ++
initword9876 ++
Y = 0
Y = 1
Y = 2
Y = true
Y = false
A = 0
Y = 0
X = 0
; [646,Y] = [$d020,X]
_loop: block2.zpw1 ++
A ++
X ++
Y ++
[$d020] ++
A --
X --
Y--
[$d020]--
block2.zpw2 = 99
fidget.subroutine()
goto _loop
return 155,2,%00000101 ; will end up in A, X, Y
}
~ block2 {
return
sub memsub () -> () = $fff2
sub customsub (Y)->() {
%asm {
nop
nop
lda #99
nop
nop
}
A=2
X=33
return fidget.subroutine()
}
somelabel1222:
customsub(2)
return
var zp1
var zp2
var .word zpw1
var .word zpw2
var .array(100) some_array1 = $aa ; initialized with $aa bytes
const white = 1
const red = 2
const .word border2 = $d020
const .word screen2 = $d021
return
}
~ block3 {
somelabel1:
%asm {
nop
nop
nop
}
goto somelabel1
goto block2.somelabel1222
A=99
X=99
Y=99
A=99
X=99
Y=99
A=99
X=99
Y=99
[$d020]=55
[$d021]=55
[$d020]=55
[$d021]=55
A=1
X=1
[$d020]=1
[$aa]=1
[$bb]=1
Y=1
X=1
A=1
[$d021]=1
A=2
[$cc]=1
[$cd]=1
[$ce]=1
[$cf]=1
[$cf00]=1
[$cf01]=2
[$cf02]=1
Y=2
A=2
X=1
return
}
; comments before block 4
~ block4 {
A=1
A=2
A=3
A=4
A=5
X=8
X=9
Y=10
[$cc]=1
[$cc]=2
[$cc]=3
[$cc]=4
[$dd]=A
[$dd]=X
[$dd]=Y
return
}
~ fidget $0c00
{
subroutine:
; subroutine (A, X, Y)
;[border2] = red
;[screen2] = white
return $99
}
; comment at end
; another one

View File

@@ -0,0 +1,27 @@
%output prg
%address $c000
~ test {
var .byte localvar = 33
return
}
~ main {
start:
;A=0
;[$d020]=A
;X=false
;Y=true
;return
;included_assembly
;%asminclude " included.sourcelynx walla derp ", test_include
;%asminclude " included.sourcelynx walla derp ", "test_include"
;included_binary
;%asmbinary " included.binary 234 "
;%asmbinary " included.binary", $40
%asmbinary "included.binary", $40, $200
return
}

View File

@@ -0,0 +1,76 @@
%output basic ; create a c-64 program with basic SYS call to launch it
%import c64lib ; searched in several locations and with .ill file extension added
~ main
{
memory screen2 = $0401
memory screen3 = $0402
memory .word screenw = $0500
; ascii to petscii, 0 terminated
var .str hello = "hello everyone out there."
; ascii to petscii, with length as first byte
var .strp hellopascalstr = "Hello!\0x00\x01\x02d ag\0x01."
; ascii to screen codes, 0 terminated
var .strs hello_screen = "Hello!\n guys123."
; ascii to screen codes, length as first byte
var .strps hellopascal_screen = "Hello! \n."
var .str hello2 = "@@\f\b\n\r\t@@"
start:
global2.make_screen_black()
A='?'
[$d020] = '?'
[$d021] = '?'
[$d022] = '?'
[$d023] = 'q'
c64.BGCOL0 = 'a'
screen2 = 'a'
screen3 = 'a'
screenw = '2'
A='?'
X='?'
Y='?'
A='\002'
X=A
A='\xf2'
X=A
c64.CHROUT('A')
A='\f'
X=A
A='\b'
X=A
A='\n'
X=A
A='\r'
X=A
A='\t'
A='0'
c64.CHROUT('0')
c64.CHROUT('1')
c64.CHROUT('2')
c64scr.print_string(hello)
return c64.CHROUT('!')
return
}
~ global2 {
make_screen_black:
c64.EXTCOL = 0
c64.BGCOL0 = 0
c64.COLOR = 3
Y = true
return
}

View File

@@ -0,0 +1,61 @@
%output basic ; create a c-64 program with basic SYS to() launch it
%import "c64lib.ill"
~ main
{
var .str greeting = "hello world!\r12345678 is a big number.\r"
var .strp p_greeting = "hello world!\r12345678 is a big number.\r"
const .word BORDER = $d020
start:
c64scr.print_pimmediate() ; this prints the pstring immediately following it
%asm {
.strp "hello-pimmediate!{cr}"
}
c64scr.print_byte_decimal0 (19)
c64.CHROUT (13)
c64scr.print_byte_decimal (19)
c64.CHROUT (13)
c64scr.print_word_decimal0 ($0102)
c64.CHROUT (13)
c64scr.print_word_decimal ($0102)
c64.CHROUT (13)
return
start2:
global2.make_screen_black()
c64.CLEARSCR()
c64scr.print_string(greeting)
c64scr.print_pstring(p_greeting)
c64scr.print_byte_decimal(0)
c64scr.print_byte_hex(0, 0)
c64.CHROUT(13)
c64scr.print_byte_decimal(13)
c64scr.print_byte_hex(0, 13)
c64.CHROUT(13)
c64scr.print_byte_decimal(255)
c64scr.print_byte_hex(0, 254)
c64scr.print_byte_hex(0, 129)
c64.CHROUT(13)
c64.CHROUT(13)
c64scr.print_word_decimal($0100)
c64.CHROUT(13)
return
}
~ global2 {
make_screen_black:
c64.EXTCOL = 0
c64.BGCOL0 = 0
c64.COLOR = 3
return
}

View File

@@ -0,0 +1,59 @@
~ main {
var .float flt1 = 9.87e-21
var .float flt = -9.87e-21
const .word border = $0099
var counter = 1
start:
counter ++
main.counter ++
; @todo float augassign
flt += 1000.1
flt *= 2.34
flt *= flt
;[border] &= 2 ; @todo augassign on dereference
flt = flt+ 1 ; @todo optimize into augassign
XY*=3 ; @todo operator
XY=XY/0 ; @todo zerodiv (during expression to code generation) @todo operator
XY=XY//0 ; @todo zerodiv (during expression to code generation) @todo operator
; @todo incr by more than 1
[AX]++
[AX]++
A=0
; @todo decr by more than 1
[AX]--
[AX]--
block2.b2var++
block2.start()
return 44.123
sub goodbye ()->() {
var xxxxxx ; @todo vars in sub?
memory y = $c000 ; @todo memvars in sub?
const q = 22 ; @todo const in sub?
y++
return
}
sub derp ()->() {
const q = 22
A = q *4 ; @todo fix scope not found error
return
}
}
~ block2 {
var b2var = 0
start:
return
}

View File

@@ -0,0 +1,87 @@
~ main {
var b1
var .word w1
var .float f1
memory .byte border = $d020
start:
X++
X++
return ; dummy
X+=2
return ; dummy
X+=255
return ; dummy
X--
X--
return ; dummy
X-=2
return ; dummy
X-=255
return ; dummy
XY++
XY++
return ; dummy
XY+=2
return ; dummy
XY+=255
return ; dummy
XY--
XY--
return ; dummy
XY-=2
return ; dummy
XY-=255
return ; dummy
b1++
b1++
w1++
w1++
f1++
f1++
b1--
b1--
w1--
w1--
f1--
f1--
b1+=255
w1+=255
f1+=255
b1-=255
w1-=255
f1-=255
[$c000]++
[$c000]++
[$c000]--
[$c000]--
[border]++
[border]++
[border]--
[border]--
X ++
X ++
X += 255
Y--
Y--
Y-=255
XY ++
XY ++
XY += 255
;[$c000]+=2
;[$c000]+=255
;[$c000]+=255
;[$c000 .word]+=255
;[$c000]-=2
;[$c000]-=255
;[$c000 .word]-=255
;[border]+=2
;[border]+=255
;[border]-=2
;[border]-=255
%noreturn
}