From 3d14583f74ac21b100561525baa2eb7b54cb99f9 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sat, 29 Jun 2024 16:55:04 -0800 Subject: [PATCH] (uxncore) starting opcodes --- cli/uxncore/src/uxncore.tal | 97 +++++++++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 5 deletions(-) diff --git a/cli/uxncore/src/uxncore.tal b/cli/uxncore/src/uxncore.tal index 1c30061..a19e9b3 100644 --- a/cli/uxncore/src/uxncore.tal +++ b/cli/uxncore/src/uxncore.tal @@ -28,9 +28,10 @@ [ LIT2 "/ 18 ] DEO #2018 DEO ( | body ) - ;dict/break + #00 OVR #1f AND DUP ADD ;opc-lut ADD2 LDA2 JSR2 + ( ) ;dict/break #0a18 DEO - POP JMP2r + JMP2r @ ( byte -- ) ( | special ) @@ -75,6 +76,90 @@ [ LIT2 "x 18 ] DEO !/b +( +@|body ) + +@opc-lut [ + =op-brk =op-inc =op-pop =op-brk + =op-brk =op-brk =op-brk =op-brk + =op-brk =op-brk =op-brk =op-brk + =op-brk =op-brk =op-brk =op-brk + =op-brk =op-brk =op-brk =op-brk + =op-brk =op-brk =op-brk =op-brk + =op-brk =op-brk =op-brk =op-brk + =op-brk =op-brk =op-brk =op-brk ] + +@op-brk ( byte -- ) + ;dict/return + #2018 DEO + POP JMP2r + +@op-inc ( byte -- ) + + [ LIT2 "[ 18 ] DEO + + #01 + [ LIT2 "] 18 ] DEO + + [ LIT2 "; 18 ] DEO + #2018 DEO + POP JMP2r + +@op-pop ( byte -- ) + + + [ LIT2 "; 18 ] DEO + #2018 DEO + POP JMP2r + +@ ( -- ) + [ LIT2 "+ 18 ] DEOk DEO + JMP2r + +@ ( -- ) + [ LIT2 "- 18 ] DEOk DEO + JMP2r + +@ ( -- ) + [ LIT2 "t 18 ] DEO + + + #01 + [ LIT2 "; 18 ] DEO + #2018 DEO + JMP2r + +@ ( -- ) + #2018 DEO + [ LIT2 "= 18 ] DEO + #2018 DEO + JMP2r + +@ ( numchar -- ) + #2018 DEO + [ LIT2 "- 18 ] DEO + #2018 DEO + [ LIT "0 ] ADD #18 DEO + JMP2r + +@ ( numchar -- ) + #2018 DEO + [ LIT2 "+ 18 ] DEO + #2018 DEO + [ LIT "0 ] ADD #18 DEO + JMP2r + +@ ( -- ) + ;dict/uxn-wst-dat + JMP2r + +@ ( -- ) + ;dict/uxn-wst-ptr + JMP2r + +( +@|utils ) + @ ( short* -: ) SWP /b &b ( byte -: ) @@ -83,9 +168,6 @@ #0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO JMP2r -( -@|utils ) - @ ( str* -- ) LDAk #18 DEO INC2 LDAk ? @@ -116,4 +198,9 @@ &end 09 "} 0a "} 0a $1 &case 09 "case 20 $1 &break "break; $1 + &return "return 20 "1; $1 + &uxn-wst-dat "uxn.wst.dat $1 + &uxn-wst-ptr "uxn.wst.ptr $1 + &uxn-rst-dat "uxn.rst.dat $1 + &uxn-rst-ptr "uxn.rst.ptr $1