fun-a-day 2023
the goal is to work on determ (aka term.tal) for every day in february.
determ is a (mostly) ANSI-compliant terminal emulator written in uxntal
that runs on the varvara virtual machine.
day 1 day 8 day 15 day 22
day 2 day 9 day 16 day 23
day 3 day 10 day 17 day 24
day 4 day 11 day 18 day 25
day 5 day 12 day 19 day 26
day 6 day 13 day 20 day 27
day 7 day 14 day 21 day 28
screenshots
how do i run it?
here is a very terse and incomplete set of steps:
1. install a uxn emulator (e.g. uxnemu, uxn32, etc.)
2. download the following files to their relative locations:
* term.py
* term.tal
* cp437.tal
3. assemble term.tal to term.rom
4. run python term.py term.rom
what are terminal emulators?
computer terminals were a very early computer interface. people typed
text into a terminal which was sent to the computer, and the computer's
output was printed on paper or display on a screen for the user to read.
over time terminals with video displays gained additional capabilities,
such as erasing and refreshing areas of the screen, moving the cursor to
arbitrary positions, etc. the vt100 is one of the most famous of these.
most unix programs were written assuming the operator was using a
terminal to interact with the computer. today most people don't have
hardware terminals. however, many users' computers still include unix
tools which are run on a "command-line" (i.e. in a terminal).
terminal emulators are programs we can run which speak the same language
as hardware terminals. this allows programs that were written to run on a
hardware terminal in the 1970s to continue working in 2023.
why terminal emulators?
i find terminal text interfaces to be very calming, with fewer distractions.
they also work well on a wide variety of computers, especially those with
fewer resources. the terminal definitions are very stable, so code written
to run in a terminal will likely continue to work for a long time.
some of my favorite programs to run in a terminal:
* cd/ls/cp/mv/rm/mkdir - manipulate the filesystem
* emacs/pmacs/nano/femto - text editors
* mosh/ssh - connect to remote servers
* irssi - IRC client
* mutt - email client
* hg/git - version control programs
* man - read manual pages
* scala/python/uxnrepl - REPLs for programming languages
* awk/find/sed - scripting tools
* rg/grep - text searching tools
* htop - monitor system resources
* screen/tmux - terminal multiplexers
* links/lynx - simple web browsers
* mpv/mplayer/mpycurse - music players
* angband/crawl/nethack - roguelike videogames
* frotz - interactive fiction VM
since i use all these programs in terminals, i want to understand how terminal
emulators work and to be able to implement them myself. my goal is to be able
to run all the programs i care about in determ.
why uxn?
how does this work? what are its limits?
uxn doesn't currently support pipes, networking, or any kind of interprocess
communication. to get around this limitation the term.py script creates a
pseudo-terminal (i.e. a pty) and uses it to connect the uxn emulator with a
bash process. this allows the terminal to communicate with the shell using
standard input and output (i.e. the Console device).
since uxn only supports 4 colors it is not possible to support the 8 colors
required by ANSI. currently colors are used to support the bright, normal,
and dim text attributes. i still use the TERM=ansi environment variable
since that is the most compatible terminfo definition. eventually i may
create a determ terminfo entry to give programs a more accurate view of its
capabilities.