2017-12-21 13:52:30 +00:00
|
|
|
; source IL file
|
|
|
|
; these are comments
|
2017-12-21 22:05:35 +00:00
|
|
|
; line 2 comment
|
|
|
|
; line 3 comment
|
|
|
|
|
2017-12-21 13:52:30 +00:00
|
|
|
|
2018-01-11 23:55:47 +00:00
|
|
|
%output basic ; create a c-64 program with basic SYS call to launch it
|
2018-07-01 21:24:32 +00:00
|
|
|
%zp restore , clobber ; clobber over the zp memory normally used by basic/kernal rom, frees up more zp
|
|
|
|
|
|
|
|
options
|
|
|
|
|
|
|
|
|
|
|
|
%blocks
|
2017-12-21 13:52:30 +00:00
|
|
|
|
|
|
|
|
2018-01-12 22:25:00 +00:00
|
|
|
~ main
|
2017-12-21 13:52:30 +00:00
|
|
|
{
|
2017-12-21 22:05:35 +00:00
|
|
|
; this is the main block with the start routine.
|
|
|
|
|
2017-12-21 13:52:30 +00:00
|
|
|
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
|
2018-07-01 21:24:32 +00:00
|
|
|
]
|
2017-12-21 13:52:30 +00:00
|
|
|
|
|
|
|
|
2018-01-03 20:43:19 +00:00
|
|
|
start: ;foo
|
2017-12-21 13:52:30 +00:00
|
|
|
X = 55
|
|
|
|
Y = $77
|
|
|
|
Y = X
|
|
|
|
Y = X
|
|
|
|
X = 66
|
|
|
|
screen = 0
|
2018-02-20 00:16:16 +00:00
|
|
|
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
|
2017-12-21 13:52:30 +00:00
|
|
|
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
|
2018-02-20 00:16:16 +00:00
|
|
|
A = 0
|
|
|
|
Y = 0
|
|
|
|
X = 0
|
2017-12-21 13:52:30 +00:00
|
|
|
|
|
|
|
; [646,Y] = [$d020,X]
|
|
|
|
|
|
|
|
|
2018-01-03 20:43:19 +00:00
|
|
|
_loop: block2.zpw1 ++
|
2017-12-21 21:16:46 +00:00
|
|
|
A ++
|
2017-12-21 13:52:30 +00:00
|
|
|
X ++
|
|
|
|
Y ++
|
|
|
|
[$d020] ++
|
|
|
|
A --
|
|
|
|
X --
|
|
|
|
Y--
|
|
|
|
[$d020]--
|
2017-12-24 23:15:04 +00:00
|
|
|
block2.zpw2 = 99
|
2017-12-23 13:36:23 +00:00
|
|
|
fidget.subroutine()
|
|
|
|
goto _loop
|
2017-12-21 13:52:30 +00:00
|
|
|
return 155,2,%00000101 ; will end up in A, X, Y
|
|
|
|
}
|
|
|
|
|
2017-12-23 23:58:55 +00:00
|
|
|
|
|
|
|
|
2017-12-21 13:52:30 +00:00
|
|
|
~ block2 {
|
2017-12-23 23:58:55 +00:00
|
|
|
|
|
|
|
return
|
|
|
|
|
2017-12-24 23:15:04 +00:00
|
|
|
sub memsub () -> () = $fff2
|
2017-12-23 23:58:55 +00:00
|
|
|
|
2017-12-24 23:15:04 +00:00
|
|
|
sub customsub (Y)->() {
|
2017-12-23 23:58:55 +00:00
|
|
|
|
2018-01-01 22:24:39 +00:00
|
|
|
%asm {
|
2017-12-23 23:58:55 +00:00
|
|
|
nop
|
|
|
|
nop
|
|
|
|
lda #99
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
}
|
|
|
|
|
|
|
|
A=2
|
|
|
|
X=33
|
2018-01-05 21:52:23 +00:00
|
|
|
return fidget.subroutine()
|
2017-12-23 23:58:55 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-01-03 20:43:19 +00:00
|
|
|
somelabel1222:
|
2018-01-07 01:36:27 +00:00
|
|
|
|
2017-12-23 23:58:55 +00:00
|
|
|
customsub(2)
|
2017-12-21 13:52:30 +00:00
|
|
|
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
|
2018-01-14 23:20:36 +00:00
|
|
|
return
|
2017-12-21 13:52:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
~ block3 {
|
2018-01-03 20:43:19 +00:00
|
|
|
somelabel1:
|
2018-01-01 22:24:39 +00:00
|
|
|
%asm {
|
2017-12-21 13:52:30 +00:00
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
}
|
|
|
|
|
2017-12-23 13:36:23 +00:00
|
|
|
goto somelabel1
|
|
|
|
goto block2.somelabel1222
|
2018-02-20 00:16:16 +00:00
|
|
|
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
|
2017-12-21 13:52:30 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2017-12-21 22:05:35 +00:00
|
|
|
; comments before block 4
|
|
|
|
|
2017-12-21 13:52:30 +00:00
|
|
|
~ 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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-01-12 22:25:00 +00:00
|
|
|
~ fidget $0c00
|
2017-12-21 13:52:30 +00:00
|
|
|
{
|
|
|
|
|
2018-01-03 20:43:19 +00:00
|
|
|
subroutine:
|
|
|
|
|
2017-12-21 13:52:30 +00:00
|
|
|
; subroutine (A, X, Y)
|
|
|
|
;[border2] = red
|
|
|
|
;[screen2] = white
|
|
|
|
return $99
|
|
|
|
|
|
|
|
}
|
2017-12-21 22:05:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
; comment at end
|
|
|
|
; another one
|