From fa52bd7eba993f2c3b14e519914fa1d86452fcff Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sun, 9 Jun 2024 15:27:36 -0800 Subject: [PATCH] Starting uxndis --- cli/uxndis/makefile | 30 ++++++++++++++++++++ cli/uxndis/src/uxndis.tal | 58 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 cli/uxndis/makefile create mode 100644 cli/uxndis/src/uxndis.tal diff --git a/cli/uxndis/makefile b/cli/uxndis/makefile new file mode 100644 index 0000000..2795730 --- /dev/null +++ b/cli/uxndis/makefile @@ -0,0 +1,30 @@ +ID=uxndis +DIR=~/roms +ASM=uxncli ${DIR}/drifblim.rom +LIN=uxncli ${DIR}/uxnlin.rom +BAL=uxncli ${DIR}/uxnbal.rom +EMU=uxncli +ROM=bin/${ID}.rom + +all: ${ROM} + +lint: + @ ${LIN} src/${ID}.tal +bal: + @ ${BAL} src/${ID}.tal +run: all + @ ${EMU} ${ROM} etc/example.tal +clean: + @ rm -f ${ROM} ${ROM}.sym +install: all + @ cp ${ROM} ${DIR} +uninstall: + @ rm -f ${DIR}/${ID}.rom +archive: all + @ cp src/${ID}.tal ../oscean/etc/${ID}.tal.txt + +.PHONY: all clean lint run install uninstall archive + +${ROM}: src/${ID}.tal + @ mkdir -p bin && ${ASM} src/${ID}.tal ${ROM} + diff --git a/cli/uxndis/src/uxndis.tal b/cli/uxndis/src/uxndis.tal new file mode 100644 index 0000000..4fa26bd --- /dev/null +++ b/cli/uxndis/src/uxndis.tal @@ -0,0 +1,58 @@ +|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1 +|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 +|000 + + @src $40 + +|100 + +@on-reset ( -> ) + ;meta #06 DEO2 + ;await-src .Console/vector DEO2 + .Console/type DEI ?{ ;dict/usage + #000f DEO } + BRK + +@meta $1 + ( name ) "Uxndis 0a + ( desc ) "Uxntal 20 "Disassembler 0a + ( auth ) "By 20 "Devine 20 "Lu 20 "Linvega 0a + ( date ) "9 20 "Jun 20 "2024 $2 + +@await-src ( -> ) + [ LIT2 04 -Console/type ] DEI NEQ ?{ + #800f DEO + BRK } + .Console/read DEI [ LIT &ptr -src ] INCk ,&ptr STR + STZ + BRK + +@ ( -- ) + ;src #0a18 DEO + JMP2r + +( +@|stdlib ) + +@ ( short* -: ) + SWP /b + &b ( byte -: ) + DUP #04 SFT /c + &c ( byte -: ) + #0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO + JMP2r + +@ ( str* -- ) + LDAk #18 DEO + INC2 LDAk ? + POP2 JMP2r + +@opcodes [ + "LIT "INC "POP "NIP "SWP "ROT "DUP "OVR + "EQU "NEQ "GTH "LTH "JMP "JCN "JSR "STH + "LDZ "STZ "LDR "STR "LDA "STA "DEI "DEO + "ADD "SUB "MUL "DIV "AND "ORA "EOR "SFT + &brk "BRK ] + +@dict &usage "usage: 20 "uxndis.rom 20 "input.rom 0a $1 +