Starting Tal port

This commit is contained in:
neauoire 2021-07-10 09:22:43 -07:00
parent b1a47f98aa
commit 388da79078
7 changed files with 131 additions and 20 deletions

7
.gitignore vendored
View File

@ -1,3 +1,6 @@
parade
.DS*
*jpg~
*jpg
*png
*bmp
/bin
*.chr

View File

@ -2,6 +2,22 @@
In Paradise, you are but a force acting upon places, objects, words — vessels. [Parade](https://wiki.xxiivv.com/site/parade.html) is a subset of the Paradise interactive fiction engine designed explicitly to explore the possible interactions available within the primitives. This is simply a toy implementation, written in [ANSI C](https://wiki.xxiivv.com/site/ansi_c.html).
## Build
You must have the [Uxn](https://git.sr.ht/~rabbits/uxn/) assembler and emulator.
```
uxnasm parade.tal parade.rom && uxnemu parade.rom
```
To build the C version(deprecated).
```
tcc parade.c -o parade
```
## Getting Started
### Basic commands
- **create** a teapot

View File

@ -1,22 +1,18 @@
#!/bin/bash
#!/usr/bin/env bash
# Lint
clang-format -i parade.c
echo "Cleaning.."
rm -rf bin
mkdir bin
# Cleanup
rm -f ./parade
echo "Assembling.."
uxnasm parade.tal bin/parade.rom
# Linux
cc -std=c89 -DDEBUG -Wall -Wpedantic -Wno-unknown-pragmas -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined -o parade parade.c
echo "Installing.."
if [ -d "$HOME/roms" ] && [ -e ./bin/parade.rom ]
then
cp ./bin/parade.rom $HOME/roms
echo "Installed in $HOME/roms"
fi
# Plan9
# pcc parade.c -o parade
# Load external world
# curl --silent https://wiki.xxiivv.com/links/teapot.txt
# file mode
./parade
# spawn mode
# ./parade teapot.txt
echo "Running.."
uxnemu bin/parade.rom

96
parade.tal Normal file
View File

@ -0,0 +1,96 @@
(
Parade
)
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%8** { #30 SFT2 } %8// { #03 SFT2 }
%RTN { JMP2r }
%SFL { #40 SFT SFT }
%TOS { #00 SWP } %TOB { SWP POP }
%ABS2 { DUP2 #0f SFT2 = #04 JCN #ffff ** }
%LTS2 { #8000 ++ SWP2 #8000 ++ >> }
%GTS2 { #8000 ++ SWP2 #8000 ++ << }
%MOD8 { #0007 AND2 }
%INCR { SWP #01 + SWP }
%INCR2 { SWP2 #0001 ++ SWP2 }
%GET-ITERATORS { SWP2k POP SWP POP }
%ADD-POSITIONS { ROT2 ++ ROT2 ROT2 ++ SWP2 }
%TOGGLE { LDZk #00 = SWP STZ }
%FILESIZE { .canvas/w LDZ2 .canvas/h LDZ2 ** 8** }
%RELEASE-MOUSE { #00 .Mouse/state DEO }
%SIZE-TO-RECT {
STH2 STH2 OVR2 STH2r ++ OVR2 STH2r ++
} ( x y w h -- x1 y1 x2 y2 )
( devices )
|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
|10 @Console &vector $2 &read $1 &pad $5 &write $1
|20 @Screen &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1
|80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1
|a0 @File &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2
( variables )
|0000
@color $1
@pointer
&x $2
&y $2
@canvas
&x1 $2 &y1 $2
&x2 $2 &y2 $2
( program )
|0100
( vectors )
;on-mouse .Mouse/vector DEO2
( colors )
#70fe .System/r DEO2
#c0f3 .System/g DEO2
#90f3 .System/b DEO2
BRK
@on-mouse ( -> )
;draw-cursor JSR2
BRK
@draw-cursor ( -- )
( clear last cursor )
;cursor-icn .Screen/addr DEO2
.pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO
( record pointer positions )
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
( colorize on state )
#31 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/color DEO
RTN
@cursor-icn
80c0 e0f0 f8e0 1000

BIN
src/newyork12.uf2 Normal file

Binary file not shown.

BIN
src/newyork14.uf2 Normal file

Binary file not shown.

BIN
src/newyork24.uf3 Normal file

Binary file not shown.