prog8/examples/test.p8
2022-09-19 17:13:46 +02:00

116 lines
2.6 KiB
Lua

main {
sub start() {
%asm {{
loadcpu.b r1,_a
loadcpu.b r1,_x
loadcpu.b r1,_y
loadcpu.w r1,_ax
loadcpu.w r1,_ay
loadcpu.w r1,_xy
loadcpu.b r1,_pc
loadcpu.b r1,_pn
loadcpu.b r1,_pz
loadcpu.w r1,_r0
loadcpu.w r1,_r15
storezcpu.b _a
storezcpu.b _x
storezcpu.b _y
storezcpu.w _ax
storezcpu.w _ay
storezcpu.w _xy
storezcpu.b _pc
storezcpu.b _pn
storezcpu.b _pz
storezcpu.b _r0
storezcpu.w _r15
}}
}
}
; uword @shared global1 = 1234
; str @shared globalstring = "irmen"
;
; %asm {{
; nop
; nop
; return
; }}
;
; romsub $ee33 = myromsub(ubyte arg1 @A) clobbers() -> ubyte @Y
; romsub $ee44 = myromsubmulti(ubyte arg1 @A) clobbers() -> ubyte @Y, ubyte @X, ubyte @Pc
;
; asmsub testasmsub(ubyte arg1 @A) clobbers(Y) -> uword @AX {
; %asm {{
; nop
; return
; }}
; }
;
; sub start() {
; void myromsubmulti(44)
; global1 = myromsub(44)
; sys.wait(1)
;
; cx16.r0 = 11111
; cx16.r0L = 22
; cx16.r0H = 33
;
; %asm {{
; nop
; jump main.start.a_label
; }}
;a_label:
;
; %asmbinary "LICENSE", 200, 513
;
;; TODO add proper memory SLAB support to IR+VM
; uword @shared slab1 = memory("slab 1", 2000, 0)
; uword @shared slab2 = memory("slab 1", 2000, 0)
; uword @shared slab3 = memory("other # slab", 2000, 64)
;
; &uword mapped = $c000
; &ubyte[20] mappedarray = $c100
;
; uword @shared zz
; zz = slab1+slab2+slab3
;
; uword @shared @zp qq = zz
; uword @shared @zp qq2 = &zz
;
; str @shared namestring = "irmen"
; uword[] @shared wordarray1 = [1111,2222,3333,4444]
; uword[4] @shared wordarray2 = 12345
; uword[4] @shared wordzeroarray
;
; qq=4242 ; TODO should generate symbol not allocated address????
; mapped = 99 ; TODO wrong VMASM code generated... should generate mapped memory address?????
; mappedarray[1]=99 ; TODO check code????
;
; qq=global1
; qq=other.global2
; nested(11,22)
; main.start.nested.nested2()
;
; sub nested(ubyte a1, ubyte a2) {
; qq++
; txt.print("zzz")
; nested2()
;
; sub nested2() {
; txt.print("zzz2")
; qq++
; }
; }
; }
;}
;
;other {
;
; uword global2 = 9999
;
;}