TRS-Xenix v01.03.05 Exploration: Difference between revisions
can't figure out how to actually use it so yeet |
finally finished the page |
||
(4 intermediate revisions by the same user not shown) | |||
Line 176: | Line 176: | ||
You can compile it with <code>pc hello.pas -o hellopascal</code> after you install the Pascal compiler and put the hello world program into hello.pas. | You can compile it with <code>pc hello.pas -o hellopascal</code> after you install the Pascal compiler and put the hello world program into hello.pas. | ||
== DT-100 drivers | == DT-100 drivers == | ||
IMPORTANT: While the terminals do indeed get initialized, unless you do a very ugly workaround of connecting a DT100 to a DT100 the keyboard doesn't work due to a bug in trs80gp. I won't document the workaround here as it's very ugly and makes the terminals almost unusable anyways. | |||
After installing the drivers using the usual way, execute the following commands as root: | |||
<pre> | |||
enable tty01 | |||
enable tty02 | |||
</pre> | |||
After that, shut down the emulator and reboot it with the following commandline: | |||
<code>trs80gp.exe -m16 -d0 - -h xenix.cfg -rA :dt1 -rB :dt1 -x1hack</code> | |||
This will enable two additional terminals. Now you can use Xenix as UNIX was intended to be used, as a true multiuser system! | |||
= Shutting down the system = | = Shutting down the system = | ||
In order to shut down Xenix, execute <code>haltsys</code>. | In order to shut down Xenix, execute <code>haltsys</code>. |
Latest revision as of 19:48, 10 April 2023
Obtaining Install Media
A really nice collection of TRS-80 stuff is available here. There's a fair bit of both non-Xenix and Xenix stuff, but for now we only need the Xenix stuff. What we need are all the IMDs (except XNX135FM.IMD) from here.
Setting up our VM
This version of Xenix is for TRS-80 model 16 computers only, thankfully I know an emulator that can run this. Let's set it up by downloading trs80gp.
At first, let's create a hard disk image by simply opening up trs80gp, going to the "Hard Drive" menu and clicking the "unformatted DREM" option in the 4: submenu.
This amount of space may not be enough for all your development and testing needs. In order to get a bigger drive, I replaced the following in the disk config file:
Tracks=256 Sides=4 Sectors=17
with this:
Tracks=1024 Sides=5 Sectors=17
and delete the old DSK file in order to force the emulator to recreate the DSK with the new config.
Now, open up the command prompt as in order to run TRS-Xenix 1.x you need a special command line argument which you can't configure in the GUI. I use this command to run trs80gp provided the DREM config file autogenerated with the DREM disk image is stored as "xenix.cfg" and the Xenix install disk is XNX135D1.IMD:
trs80gp.exe -m16 -d0 XNX135D1.IMD -h xenix.cfg -x1hack
Setting up minimal Xenix
It's Xenix time!
The emulator startup command already inserts the boot floppy into the drive. Once you're starting up the emulator, it will attempt to boot from the blank hard drive which will leave you with a garbled screen. In order to boot off the floppy, during startup spam Ctrl+C in the emulator window. Once you're in the bootloader prompt, type "diskutil". It will ask you if you want to deal with the floppy disk or the hard disk - type "h" for hard disk. The unit number is 0. For the disk information, consult the CFG file created by the emulator for the disk image. For me, it generated 256 tracks, 4 sides and 17 sectors. When you're asked "how many heads", type the amount of sides. Once you've passed the formatting, reset the emulator. It will attempt to boot from the hard drive again and since we don't have anything useful there it'll fill the screen with random bootloader data and gibberish. Boot off the floppy the same way.
After that, just press Enter. When you're asked to "change the rootdisk" just press Enter again, that is not needed.
Now, let's actually install Xenix and not just partition the HD. Once you're asked to initialize the hard disk, answer with "y". Yes, your hard disk has been formatted with diskutil. Use the same way of finding how much space you have on the hard drive as when you were formatting the drive. It will format the hard drive and copy some basic utilities onto there. Wait until the "Normal System Shutdown" message and power down the emulator.
Setting up the rest of Xenix
After the boot floppy is done copying files, use the following command for running Xenix from here on:
trs80gp.exe -m16 -d0 - -h xenix.cfg -x1hack
At the bootloader prompt, press Enter. It will automatically load the second stage of installation. When you are asked "First floppy?" insert the second disk via Diskette -> :0 and press y. Do the same with the third floppy. This will install the base system. After that, type n. Once you get the message "installation complete", press Ctrl+D. Feel free to set the time if you want but it's probably not Y2K compatible. Log in as root, it has no password.
Adding a user is simple. Once in the root account, just type 'mkuser' to create a user. Home directories are in the /usr folder. If you created a user by the name 'test', then it would be at /usr/test.
Some Xenix manuals are available at this site. Look through the page for mentions of "xenix".
Installing additional software
In order to install software, you need to use the "install" command. Let's install the update from Disk 4 using this method. You can also install other Xenix software from the model2archive but make sure to read the README, some may be incompatible due to being for the Model 6000 running XENIX 3.x.
1. Log in as root
2. Type "install"
3. Press 1
4. Press Enter
And we're done! This particular program wants us to reboot, so eject the floppy and restart the emulator.
Tandy-specific shell
TRS-XENIX comes with a Tandy developed shell called "tshell". You can run it by typing "tsh" in the terminal. It's definitely more advanced than the standard /bin/sh but I have no idea what nice features it has besides builtin help. Might be a nice research subject.
Developing software
Installing the Devkit
The aforementioned archive contains the TRS-XENIX development system except it's a bit broken. If you use 1.2.0a, you'll have a broken as program so you won't be able to compile some stuff. 1.2.0b doesn't have disk 7 and has a broken disk 8. In order to get a nice dev system, install 1.2.0a but replacing Disk 2 with the one from 1.2.0b. The install procedure isn't the same as in any other package: run install, insert disk 1, go through the normal install init, eject disk 1, install everything.
For Xenix (pure C)
The process of creating and compiling a C app on TRS-XENIX is the same as on IBM PC Xenix 1.00, so this is mostly copied from Tox's page.
I created a file named 'hello.c' using the following command:
cat >> hello.c << EOF
This will output the contents of stdin into hello.c until you give it the literal string EOF.
And so, here is the source code of hello.c:
main() { printf("hello world\n"); }
Now, we compile it using
cc hello.c -o hello
And then, we simply run it! It gives out the message like we would've expected.
There is also like you might've expected, a linker, by the name of ld -- and a lot of other things, too. There is yacc and lex included, and adb.
For TRSDOS
As far as I know, there is no way to crosscompile TRSDOS apps on Xenix. Maybe someone'll pull out the proper manual which I couldn't find and figure out how to do it, or maybe it's plain impossible without a different compiler. However, an app called "tx" for copying files over to TRSDOS disks is included.
Makefile
The make implementation in TRS-XENIX is the same as in the IBM PC Xenix release, so let's just copy the rest from the IBM PC Xenix page. For the "hello, world!" application under Xenix, you can write this Makefile:
hello: hello.c cc hello.c -o hello
and save it as simply 'Makefile'. Oh yeah, by the way, make sure those 4 spaces in front of 'cc hello.c' is actually a tab when you enter it in.
Interesting extra software
RM/COBOL
A runtime of RM/COBOL from Ryan-McFarland Corporation is included with Xenix, but without anything to run it's pretty useless. Thankfully a copy of the RM/COBOL 01.07.00 compiler has survived! After grabbing it from the same place as I did with the devsys and Xenix itself I found and adapted this Hello World app to test it (put it in a file the same way you did with the C program, also trs80gp has a handy paste feature in the Edit menu):
000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. HELLOWORLD. 000300 000400* 000500 ENVIRONMENT DIVISION. 000600 CONFIGURATION SECTION. 000700 SOURCE-COMPUTER. RM-COBOL. 000800 OBJECT-COMPUTER. RM-COBOL. 000900 001000 DATA DIVISION. 001100 FILE SECTION. 001200 100000 PROCEDURE DIVISION. 100100 100200 MAIN-LOGIC SECTION. 100300 BEGIN. 100400 DISPLAY "Hello world!". 100500 STOP RUN. 100600 MAIN-LOGIC-EXIT. 100700 EXIT.
This program can be compiled with the following command:
rmcobol -l -x hellocobol
Prepare for a lot of text spam from the compiler. Once it's done, you should have a file called "cbl.out" in your current directory. To run it, type the following:
runcobol cbl.out
MAC16 Macro Assembler
An assembler for something called "MAC16 macros" has been preserved, although the documentation is lost. Sadly the programming language has faded into obscurity as there's not a single mention of it on the net, and the fact that Apple's computers are also named Macs and a Lockheed MAC-16 computer being produced in 1969 also doesn't help, so I couldn't find a hello world program to test this.
BASIC
A copy of BASIC has been preserved, grab it from the usual place. After it's installed, execute mbasic
to run it. A Hello World program in BASIC looks like this:
10 PRINT "HELLO WORLD"
You can run it by typing "run" in the interpreter. In order to exit BASIC, type "system".
Pascal
A copy of Pascal-2 has been preserved. Here's a Hello World program I stole off some random website:
program Hello; begin writeln ('Hello, world.'); end.
You can compile it with pc hello.pas -o hellopascal
after you install the Pascal compiler and put the hello world program into hello.pas.
DT-100 drivers
IMPORTANT: While the terminals do indeed get initialized, unless you do a very ugly workaround of connecting a DT100 to a DT100 the keyboard doesn't work due to a bug in trs80gp. I won't document the workaround here as it's very ugly and makes the terminals almost unusable anyways.
After installing the drivers using the usual way, execute the following commands as root:
enable tty01 enable tty02
After that, shut down the emulator and reboot it with the following commandline:
trs80gp.exe -m16 -d0 - -h xenix.cfg -rA :dt1 -rB :dt1 -x1hack
This will enable two additional terminals. Now you can use Xenix as UNIX was intended to be used, as a true multiuser system!
Shutting down the system
In order to shut down Xenix, execute haltsys
.