2018-01-01 22:24:39 +00:00
|
|
|
%output prg,basic
|
2017-12-28 00:00:34 +00:00
|
|
|
|
2018-01-03 20:43:19 +00:00
|
|
|
%import c64lib
|
|
|
|
|
2017-12-28 00:00:34 +00:00
|
|
|
|
2017-12-27 18:01:14 +00:00
|
|
|
~ main {
|
2017-12-28 18:08:33 +00:00
|
|
|
var .word value
|
|
|
|
memory .word memvalue = $8000
|
|
|
|
|
|
|
|
|
2018-01-03 20:43:19 +00:00
|
|
|
start:
|
2017-12-28 18:08:33 +00:00
|
|
|
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
|
2017-12-30 12:34:52 +00:00
|
|
|
;if_cc goto memvalue
|
2017-12-28 18:08:33 +00:00
|
|
|
if_cc goto #value
|
2017-12-30 12:34:52 +00:00
|
|
|
;if_cc goto #memvalue
|
2017-12-28 18:08:33 +00:00
|
|
|
if_cc goto [value]
|
2017-12-30 12:34:52 +00:00
|
|
|
;if_cc goto [memvalue]
|
|
|
|
;if_cc goto $c000
|
|
|
|
;if_cc goto [$c000.word]
|
2017-12-28 18:08:33 +00:00
|
|
|
|
2018-01-03 20:43:19 +00:00
|
|
|
label:
|
2017-12-28 18:08:33 +00:00
|
|
|
; 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
|
|
|
|
|
2018-01-03 20:43:19 +00:00
|
|
|
label2:
|
2017-12-28 18:08:33 +00:00
|
|
|
; 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
|
|
|
|
|
2018-01-03 20:43:19 +00:00
|
|
|
label3:
|
2017-12-30 12:34:52 +00:00
|
|
|
; 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
|
2017-12-30 20:36:42 +00:00
|
|
|
if_true [XY] goto label4
|
|
|
|
if_true [AY] goto label4
|
|
|
|
if_true [AX] goto label4
|
|
|
|
if_true [X] goto label4
|
|
|
|
if_true [A] goto label4
|
|
|
|
if_true [Y] goto label4
|
2017-12-30 12:34:52 +00:00
|
|
|
|
2018-01-03 20:43:19 +00:00
|
|
|
label4:
|
2017-12-28 18:08:33 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; @todo temporarily disabled until comparison operators are properly implemented:
|
|
|
|
|
|
|
|
~ {
|
2017-12-27 18:01:14 +00:00
|
|
|
var .text name = "?"*80
|
|
|
|
var bytevar = 22
|
|
|
|
var bytevar2 = 23
|
|
|
|
var .word wordvar = 22345
|
|
|
|
|
|
|
|
|
2018-01-03 20:43:19 +00:00
|
|
|
start:
|
2017-12-31 02:19:06 +00:00
|
|
|
c64.init_system()
|
2017-12-28 00:00:34 +00:00
|
|
|
|
|
|
|
A = 0
|
2018-01-03 20:43:19 +00:00
|
|
|
printloop:
|
2017-12-31 02:19:06 +00:00
|
|
|
c64scr.print_byte_decimal(A)
|
2017-12-28 00:00:34 +00:00
|
|
|
c64.CHROUT('\n')
|
|
|
|
A++
|
|
|
|
if A <20 goto printloop
|
2017-12-27 18:01:14 +00:00
|
|
|
return
|
2017-12-28 00:00:34 +00:00
|
|
|
|
2018-01-03 20:43:19 +00:00
|
|
|
label1:
|
2017-12-28 00:00:34 +00:00
|
|
|
if_true A==123 goto label1
|
|
|
|
if_true A == 123 goto label1
|
2017-12-27 23:44:17 +00:00
|
|
|
if_true A!=0 goto label1
|
|
|
|
if_not X!=0 goto label1
|
|
|
|
|
2017-12-28 00:00:34 +00:00
|
|
|
if_true A <= 1 goto label1
|
2017-12-27 23:44:17 +00:00
|
|
|
if_true A==1 goto label1
|
|
|
|
if_true A!=1 goto label1
|
2017-12-28 00:00:34 +00:00
|
|
|
if_not X < 1 goto label1
|
2017-12-27 23:44:17 +00:00
|
|
|
if_not Y>1 goto label1
|
|
|
|
if_not X!=1 goto label1
|
|
|
|
|
2017-12-27 18:01:14 +00:00
|
|
|
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
|
2017-12-28 00:00:34 +00:00
|
|
|
if A <= 22 goto label1
|
2017-12-28 18:08:33 +00:00
|
|
|
if_zero A goto label1
|
|
|
|
if_zero X goto label1
|
|
|
|
if Y goto label1
|
2017-12-27 18:01:14 +00:00
|
|
|
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
|
2017-12-28 18:08:33 +00:00
|
|
|
if_zero bytevar goto label2
|
2017-12-27 18:01:14 +00:00
|
|
|
if_not wordvar goto label2
|
|
|
|
if_zero wordvar goto label2
|
|
|
|
if_true wordvar goto label2
|
|
|
|
|
|
|
|
|
2018-01-03 20:43:19 +00:00
|
|
|
label2:
|
2017-12-27 18:01:14 +00:00
|
|
|
return
|
2017-12-30 12:34:52 +00:00
|
|
|
}
|