mirror of
https://gitlab.com/jusax23/raspberry-pi-pico-machine-code-emulator.git
synced 2024-11-22 14:46:37 +01:00
130 lines
1.4 KiB
ActionScript
130 lines
1.4 KiB
ActionScript
|
|
||
|
arg0 = 0;4
|
||
|
return2 = 4;4
|
||
|
SHS 8
|
||
|
;code
|
||
|
|
||
|
LIA .faculty
|
||
|
|
||
|
;print: executing value:
|
||
|
|
||
|
;1 Argument
|
||
|
|
||
|
;num: Loading num
|
||
|
LIA 10
|
||
|
|
||
|
STA 4 arg0
|
||
|
|
||
|
;excute function
|
||
|
JSR .faculty
|
||
|
;loading return value
|
||
|
LDA 4 return2
|
||
|
|
||
|
;print Value
|
||
|
OUT 0
|
||
|
|
||
|
HLT
|
||
|
;functions
|
||
|
faculty:
|
||
|
|
||
|
;function reserve Stackspace
|
||
|
|
||
|
PSH 4
|
||
|
;function place variable pointers
|
||
|
arg1 = 0;4
|
||
|
|
||
|
|
||
|
;function copy args
|
||
|
LDA 4 arg0
|
||
|
STA 20 arg1
|
||
|
|
||
|
;function code:
|
||
|
|
||
|
;if: executing value:
|
||
|
|
||
|
;<: execute first
|
||
|
|
||
|
;var: load Variable
|
||
|
LDA 20 arg1
|
||
|
|
||
|
PSH 4
|
||
|
;<: execute secound
|
||
|
|
||
|
;num: Loading num
|
||
|
LIA 2
|
||
|
|
||
|
CAB
|
||
|
PUL 4
|
||
|
CMP 0 0
|
||
|
LIA 1
|
||
|
JS .endcompare3
|
||
|
LIA 0
|
||
|
endcompare3:
|
||
|
|
||
|
;if:
|
||
|
LIB 1
|
||
|
CMP 0 0
|
||
|
JNE .else4
|
||
|
;then code
|
||
|
|
||
|
;num: Loading num
|
||
|
LIA 1
|
||
|
|
||
|
JMP .afterif4
|
||
|
else4:
|
||
|
;else code
|
||
|
|
||
|
;*: next value
|
||
|
|
||
|
;var: load Variable
|
||
|
LDA 20 arg1
|
||
|
|
||
|
|
||
|
PSH 4
|
||
|
|
||
|
;*: next value
|
||
|
|
||
|
;1 Argument
|
||
|
|
||
|
;-: next value
|
||
|
|
||
|
;num: Loading num
|
||
|
LIA 1
|
||
|
|
||
|
|
||
|
PSH 4
|
||
|
|
||
|
;-: next value
|
||
|
|
||
|
;var: load Variable
|
||
|
LDA 20 arg1
|
||
|
|
||
|
|
||
|
;-: Pull/Add next
|
||
|
CAC
|
||
|
PUL 4
|
||
|
CAB
|
||
|
CCA
|
||
|
SUB 0 0 0
|
||
|
|
||
|
STA 4 arg0
|
||
|
|
||
|
;excute function
|
||
|
JSR .faculty
|
||
|
;loading return value
|
||
|
LDA 4 return2
|
||
|
|
||
|
|
||
|
;*: Pull/Add next
|
||
|
CAB
|
||
|
PUL 4
|
||
|
MUL 0 0 0
|
||
|
|
||
|
afterif4:
|
||
|
|
||
|
;return from subrutine
|
||
|
STA 4 return2
|
||
|
RSR
|
||
|
|
||
|
|