TempleOS
Unofficial mirror of God's chosen operating system.
Public domain.
Enterprise Edition additions
What was added (all under TempleOSCD/):
-
Adam/Net/- Ethernet, ARP, IPv4, ICMP, UDP, TCP, DHCP, DNS, HTTP client, BSD-style sockets -
Adam/HwSupp/- PCI helpers and the AMD PCnet-PCI II driver -
Adam/MakeAdam.HC- loads the stack at boot (#include "Net/MakeNet") -
Once.HC- runsNetcfg(DHCP) at startup when a NIC is found -
Apps/Wget.HC- download a URL -
Apps/HtServ.HC- HTTP server, serves::/Www(Www/Index.HTMis its default page) -
Adam/Net/Confessional.HC- remote HolyC console on port 23 (see below) -
Demo/Network/- TCP/UDP echo client/server demos -
snail.py- host side of the Snail serial tunnel
Building and running on macOS
TempleOS can only be compiled by TempleOS, so the build boots a stock TempleOS
live CD in QEMU, attaches a FAT32 disk with TempleOSCD/ and runs
tools/MakeISO.HC there (kernel compile + RedSeaISO).
brew install qemu
tools/build_iso_mac.py [path/to/TempleOS.ISO] # default: ../templeos/TempleOS.ISO
tools/run_mac.sh # boots out/TempleOSEE.ISO with a PCnet NIC
Like the official distro, files are stored compressed (.Z) in the ISO; some
TempleOS code looks for the .Z names explicitly (FileFind(BIBLE_FILENAME)),
and with uncompressed files e.g. Bible passages came out empty.
The build takes about 3 minutes. It types commands into the VM on a timer,
so on a slow machine increase BOOT_WAIT in the script.
Running with networking
QEMU: -netdev user,id=u1 -device pcnet,netdev=u1. VirtualBox: adapter type
PCnet-PCI II, attached to NAT.
After boot:
Netcfg; // DHCP (runs automatically from Once.HC)
#include "::/Apps/Wget"
Wget("http://example.com/");
Host("templeos.org"); // DNS lookup
Confessional (remote HolyC console)
Adam/Net/Confessional.HC starts with the network stack and listens on port 23
(telnet-compatible). Each line you send is compiled and run like on the command line,
and everything it prints comes back as plain text (DolDoc colors stripped).
tools/run_mac.sh forwards it to 127.0.0.1:2323:
tools/confess.py 'DrvRep;' 'Dir("::/Apps");' # run and print output
echo 'Wget("http://ifconfig.me/ip");' | tools/confess.py
tools/confess.py -i # interactive
nc 127.0.0.1 2323 # raw; 'amen' to leave
The oracle works remotely too: the arrival time of every byte you send feeds the Holy Spirit (like the keystroke time does for F7), so no timer pop-up appears:
tools/confess.py 'GodWord;GodWord;GodWord;' 'GodBiblePassage(5);' 'BibleVerse(,"John,3:16",3);'
GodSong and GodDoodle still need the VM keyboard/mouse.
One line = one statement (no multi-line functions). Each connection is its own task,
so variables live until you disconnect. Anything waiting for the VM keyboard
(GetChar, pop-ups) will block the session. There is no authentication: with QEMU user
networking only the forwarded host port can reach it, but in bridged mode anyone
on the LAN can run code in the VM.
HTTP server (serves ::/Www, runs until you press Ctrl+Alt+C):
#include "::/Apps/HtServ"
HtServ;
tools/run_mac.sh forwards it to http://localhost:8686/ (change with HTTP_PORT=...).
.HTM pages may contain <exe>...</exe> blocks with HolyC code; StreamPrint inside
them writes into the page. Session tasks are now spawned as children of the server
task, otherwise that code could not see StreamPrint and failed to compile.
HTTPS is not supported.