This commit is contained in:
parent
bb08e1f94c
commit
efe1a1db52
cli/uxncore/src
|
@ -2,16 +2,65 @@
|
|||
|
||||
@on-reset ( -> )
|
||||
( | generate )
|
||||
;dict/int <pstr-ln>
|
||||
;dict/fn-name <pstr-ln>
|
||||
[ LIT2 "{ 18 ] DEO
|
||||
#0a18 DEO
|
||||
#0918 DEO
|
||||
;dict/ram-var <pstr-ln>
|
||||
[ LIT2 "} 18 ] DEO
|
||||
#0a18 DEO
|
||||
;dict/start <pstr-ln>
|
||||
<body>
|
||||
;dict/end <pstr-ln>
|
||||
BRK
|
||||
|
||||
@<body> ( -- )
|
||||
#00
|
||||
&>l ( -- )
|
||||
DUP <opcode>
|
||||
INC DUP ?&>l
|
||||
POP JMP2r
|
||||
|
||||
@<opcode> ( byte -- )
|
||||
;dict/case <pstr>
|
||||
DUP <cbyte>
|
||||
[ LIT2 ": 18 ] DEO
|
||||
#2018 DEO
|
||||
( | name )
|
||||
[ LIT2 "/ 18 ] DEO
|
||||
[ LIT2 "* 18 ] DEO
|
||||
#2018 DEO
|
||||
DUP <name>
|
||||
#2018 DEO
|
||||
[ LIT2 "* 18 ] DEO
|
||||
[ LIT2 "/ 18 ] DEO
|
||||
( | body )
|
||||
;dict/break <pstr>
|
||||
#0a18 DEO
|
||||
POP JMP2r
|
||||
|
||||
@<name> ( byte -- )
|
||||
( | main )
|
||||
DUP #1f AND #00 SWP #0004 MUL2 ;opcodes ADD2 <pstr>
|
||||
( | modes )
|
||||
DUP #20 AND #00 EQU ?{
|
||||
[ LIT2 "2 18 ] DEO }
|
||||
DUP #40 AND #00 EQU ?{
|
||||
[ LIT2 "r 18 ] DEO }
|
||||
DUP #80 AND #00 EQU ?{
|
||||
[ LIT2 "k 18 ] DEO }
|
||||
POP JMP2r
|
||||
|
||||
@<cbyte> ( byte -- )
|
||||
[ LIT2 "0 18 ] DEO
|
||||
[ LIT2 "x 18 ] DEO
|
||||
!<phex>/b
|
||||
|
||||
@<phex> ( short* -: )
|
||||
SWP /b
|
||||
&b ( byte -: )
|
||||
DUP #04 SFT /c
|
||||
&c ( byte -: )
|
||||
#0f AND DUP #09 GTH #27 MUL ADD
|
||||
( >> )
|
||||
|
||||
@<pnum> ( num -- )
|
||||
[ LIT "0 ] ADD #18 DEO
|
||||
JMP2r
|
||||
|
||||
(
|
||||
@|utils )
|
||||
|
||||
|
@ -28,7 +77,21 @@
|
|||
(
|
||||
@|assets )
|
||||
|
||||
@dict &int "int $1
|
||||
&fn-name "uxn_eval(Uxn 20 "*u, 20 "Uint16 20 "pc) $1
|
||||
&ram-var "Uint8 20 "*ram 20 "= 20 "u->ram; $1
|
||||
@opcodes [
|
||||
"LIT 00 "INC 00 "POP 00 "NIP 00
|
||||
"SWP 00 "ROT 00 "DUP 00 "OVR 00
|
||||
"EQU 00 "NEQ 00 "GTH 00 "LTH 00
|
||||
"JMP 00 "JCN 00 "JSR 00 "STH 00
|
||||
"LDZ 00 "STZ 00 "LDR 00 "STR 00
|
||||
"LDA 00 "STA 00 "DEI 00 "DEO 00
|
||||
"ADD 00 "SUB 00 "MUL 00 "DIV 00
|
||||
"AND 00 "ORA 00 "EOR 00 "SFT 00
|
||||
&brk "BRK 00 &jci "JCI 00 &jmi "JMI
|
||||
00 &jsi "JSI 00 ]
|
||||
|
||||
@dict ( strings )
|
||||
&start "int 0a "uxn_eval(Uxn 20 "*u, 20 "Uint16 20 "pc) 20 "{ 0a 09 "Uint8 20 "*ram 20 "= 20 "u->ram; 0a 09 "switch(ram[pc]) 20 "{ $1
|
||||
&end 09 "} 0a "} 0a $1
|
||||
&case 09 "case 20 $1
|
||||
&break "break; $1
|
||||
|
||||
|
|
Loading…
Reference in New Issue