Xenix IBM PC v1.0 Exploration: Difference between revisions
Line 92: | Line 92: | ||
== For DOS == | == For DOS == | ||
Making a simple Hello World application in C for DOS is relatively simple. Say the source code is in doshello.c, to compile it, you would use the following: | |||
<pre> | |||
cc doshello.c -dos -o doshello.exe | |||
</pre> | |||
== Makefile == | == Makefile == |
Revision as of 00:04, 12 March 2023
Setting up our VM
This specific version of Xenix is apparently only for the IBM PC AT, which uses a 80286. Let's first set up a VM for this, I'll be using 86Box.
I created a virtual machine with the following (stuff that I didn't mention were simply left blank):
Setting type | Configuration |
---|---|
Machine |
|
Display |
|
Storage controllers |
|
Hard disks |
|
Floppy disks |
|
Using this configuration, try starting up the VM -- without any floppy disks in the drive, or anything like that. You might get a 161. It mentions to run SETUP.
How do you run SETUP, you may ask? IBM provided a diskette which would boot into special software that could configure your IBM AT. Luckily, people have archived this diskette -- it's available on WinWorld. Go ahead and download 2.07.
Then, insert the diskette. Simply continue where it said to run SETUP. It may ask you if you have finished connecting the battery. It'll throw a 0151. Press the Enter key a few times (there might be another way to bypass this error, but this is all I know). If you skip the time and date, it'll ask you to confirm -- press N and type the following:
For time, just use the current time.
For date, the current date, but replace the current year with 1985.
When it asks for a fixed disk, say that type 2 is installed -- if you used my 20MB disk configuration. This list is very useful for hard disk geometry when dealing with the IBM/PC AT.
That's all I have to say really -- SETUP is easy to follow along, so just follow along I guess. When it's done, remove the diskette.
Setting up Xenix
If you want to download this version, please check it out on WinWorld.
Now, back on topic. We'll install Xenix now.
First, insert the BOOT diskette. Then, type 'fd /etc/badtrack'. Once that is done, boot the Xenix kernel by entering 'fd /xenix.fd' (not /xenix, /xenix.fd)
Now, type 'xinstall base'. Insert the base floppies. This will install the base system. The script doesn't really check the product type, so you can use the same command but different floppies -- like you can use 'xinstall base' but insert the SDK floppies to install the SDK.
That's really about it when installing Xenix. Once the installation is done, you can remove the floppies and boot into the hard drive. However, the only available user is root. You can add one later, however.
Adding a user is simple. Once in the root account, just type 'mkuser' to create a user. Once you've logged into the user, you will get a welcome mail message. To read it, simply type 'mail'. To quit it, IIRC, you can type 'q'. Home directories are in the /usr folder. If you created a user by the name 'test', then it would be at /usr/test.
More information may be in the manuals, which are available at Bitsavers.
Developing software
For Xenix
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.
For DOS
Making a simple Hello World application in C for DOS is relatively simple. Say the source code is in doshello.c, to compile it, you would use the following:
cc doshello.c -dos -o doshello.exe
Makefile
Interestingly, there is a make implementation in the SDK. I didn't try it out much, but for the "hello, world!" application under Xenix, you can write this extremely simple 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.