2021-05-04 19:55:12 +00:00
|
|
|
%import textio
|
|
|
|
%zeropage basicsafe
|
|
|
|
%option no_sysinit
|
|
|
|
; simple line comment; consecutive lines can be folded
|
|
|
|
; TODO: something
|
|
|
|
; FIXME #31
|
|
|
|
main {
|
2021-05-07 13:03:15 +00:00
|
|
|
str input = "string literal\r\n\"\\"
|
2022-07-07 21:27:18 +00:00
|
|
|
bool bb = false
|
2021-05-04 19:55:12 +00:00
|
|
|
ubyte c = 'x' ; character literal in bold
|
|
|
|
ubyte decimal = 0 + 1 - 2 * 3
|
|
|
|
float pi = 3.1415
|
|
|
|
ubyte boolean = true or false and true xor not false
|
|
|
|
str temp = "?"
|
|
|
|
word[] numbers = [$80ea, %0101011, 23]
|
|
|
|
inline asmsub foo(ubyte char @A) clobbers(Y) {
|
|
|
|
asm {{
|
|
|
|
a_label:
|
2021-05-07 13:03:15 +00:00
|
|
|
nop ; comment inside asm
|
2021-05-04 19:55:12 +00:00
|
|
|
bcc _done
|
|
|
|
sec
|
|
|
|
_done: rts
|
|
|
|
}}
|
|
|
|
}
|
|
|
|
inline sub start(ubyte char @A) -> void {
|
|
|
|
ubyte @zp ch = min(max, n, (x, 5))
|
|
|
|
if (true) {
|
|
|
|
goto nirvana
|
|
|
|
} else {
|
|
|
|
return 0
|
|
|
|
}
|
2023-03-14 22:52:07 +00:00
|
|
|
unroll 80 {
|
|
|
|
cx16.r0++
|
|
|
|
}
|
2021-05-04 19:55:12 +00:00
|
|
|
repeat {
|
|
|
|
ch = input[index+5]
|
|
|
|
when ch {
|
|
|
|
0 -> {
|
|
|
|
break
|
2023-11-19 16:52:43 +00:00
|
|
|
continue
|
2021-05-04 19:55:12 +00:00
|
|
|
}
|
|
|
|
else -> {
|
|
|
|
temp[0] = ch
|
|
|
|
txt.print(temp) ; wrongly optimized to
|
|
|
|
; lda #$3f
|
|
|
|
; jsr txt.chrout
|
|
|
|
|
|
|
|
; with -noopt the above line is correctly turned into
|
|
|
|
; ldy #>temp
|
|
|
|
; ldy #<temp
|
|
|
|
; jsr txt.print
|
|
|
|
}
|
|
|
|
}
|
|
|
|
index++
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|