NOW SpinRite 6.1 – Fast and useful for spinning and solid state mass storage!
SBC6120 PDP-8SBC6120 PDP-8
PDP-8 OS/8 Multiboot Sector

A multiboot sector for loading SBC6120 programs from the front panel.
divider

If you have watched any of the three videos within these pages you will have noted multiple references to the custom boot sector that allows either the OS/8 operating system, or code loaded into any other SBC6120 IDE drive “partition”, to be instantly loaded and run by setting the front panel switches to the desired partition number when depressing the BOOT switch twice.

This page provides step-by-step instructions for installing that custom “multiboot” sector onto an IDE-compatible non-volatile drive. For reference, the page also documents the several other very short “mini programs” that are used by these step-by-step instructions to read and write manually-entered data to and from the non-volatile storage drive.

FlexBoot Source Code

For reference, the FlexBoot source code is provided below with step-by-step instructions for installing this multiboot sector onto an SBC6120's non-volatile storage drive following afterward:

PDP-8 / SBC6120/FP6120 “FlexBoot” Source Code

/===============================================================================
/ "FlexBoot" -  Enhanced multi-partition boot sector for the SBC6120
/-------------------------------------------------------------------------------
/
/ This enhanced multi-partition boot sector reads the front panel switches to
/ determine, at boot time, which IDE partition to boot.  This allows for the
/ loading and running of SBC6120 PDP-8 programs in the absence of an attached
/ serial console.
/
/ This multi-partition boot sector loads and runs the contents of the partition
/ number specified by the 12 front panel data-entry switches at the time of the
/ boot. This is accomplished by remapping unit zero to the indicated partition,
/ then loading the first 3,968 12-bit words (31 x 128), starting at location 0
/ of field 0. The execution of the loaded program begins at location 0026, which
/ is the instruction immediately following the multi-word SBC BIOS call to read
/ the IDE drive's data into RAM.  Thus, upon returning from the IDE READ call,
/ the newly requested program is in memory and takes over to begin running.
/
/ Under the influence of this multi-partition boot sector, normal OS/8 load and
/ startup is now ONLY AVAILABLE with ALL 12 front panel data-entry switches OFF.
/ In that case, OS/8 booting will proceed in the usual fashion.
/
/ If the front panel switches are non-zero (not all off) when the front panel
/ boot switch is actuated (twice), or the BIOS boot command is given, contents
/ of the specified (non-zeroth) partition will be loaded and started as noted
/ above.
/
/===============================================================================

CALLBIOS=6206   / call Bob's SBC6120 BIOS located in "control panel memory."
DEVIDE=4        / function code (0004) for the SBC's IDE disk I/O
MEMCPY=10       / function code (0010) to copy user-to-panel memory

/  Field definitions for Bob's (and OS/8 in general) IDE Read/Write function:
/  +-----+-----------------------------+-----------------+-------------------+
/  |  0  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  10  |  11  |
/  | R/W | Xfer Block Count (128 word) |   Memory Field  |  Unit Number 0-7  |
/  +-----+-----------------------------+-----------------+-------------------+

/  The functions below use the parameters '0200', '0110', and '3707' yielding
/  the following bit-field breakdowns (see the definition above):
/  0 00010 000 000 - read  2, 128-word pages into field 0 from unit 0
/  0 00001 001 000 - read  1, 128-word page  into field 1 from unit 0
/  0 11111 000 111 - read 31, 128-word pages into field 0 from unit 7

/-------------------------------------------------------------------------------
*0
BootSignature,  0302                    / 'B'   (also used as temporary storage)
                0317                    / 'O'
                0317                    / 'O'
                0324                    / 'T'
                0000                    / -0-

                / determine which partition to boot from...

                CDF                     / clear the data field for the future
                CLA OSR                 / read the switch register for partition
                SNA                     / if *any* switches are up... load that 
                JMP     BootOS8         / perform regular OS8 partition boot...
                DCA     BootSignature   / save our target partition number

                / we're booting from a partition other than 0 (OS/8) so first
                / we map that partition -- specified by the AC -- to unit zero
                
                / note that although Bob thoughtfully provided a BIOS call to
                / perform exactly this mapping, it turns out that a bug was in-
                / troduced into the code later in the game, rendering it unusable.
                / therefore, it's necessary to manually edit the partition-to-unit
                / mapping table in "panel memory" to accomplish the same function.

                CALLBIOS
                MEMCPY                  / cross panel-to-user memory copy
                0000                    / copy from field 0 in user memory
                BootSignature           / copy from location zero in user memory
                4000                    / copy to field 0 in panel memory
                0027                    / copy to location 0027 in panel memory
                0001                    / only transfer one word

                / load the first 3968 words (31 x 128) from mapped partition...
                
                CALLBIOS                / invoke the BIOS to read IDE sectors
                DEVIDE                  / we're reading from the IDE drive
                3707                    / load 31 128-word pages into field 0
                0                       / load starting at memory location 0
                0                       / and load from the start of the partition
                
                / our loaded code will overwrite THIS boot sector, so execution
                / of the newly loaded code will continue from here, location 0026

/-------------------------------------------------------------------------------
/ This is pretty much Bob's original OS/8 boot loading code, which, from the label
/ BootOS8 will be executed when all front panel switches are off (0000).  It was
/ shortened just a bit by removing his tests for read success in order to keep the
/ overall boot code short enough to fit. Since it's extremely unlikely that the
/ simple read operations could fail, this seemed a safe way to shorten the code.
/-------------------------------------------------------------------------------
                
                / what we want from the following call is actually to load the
                / second half of partition zero's first 256-block into the last
                / 128 words (7600-7777) of field zero. Since we don't have sub-
                / block (sub-sector) IDE addressing, we accomplish this by loading
                / the entire 0th 256-word block (sector) at 7400, which leaves its
                / second half right where we want it...

BootOS8,        CALLBIOS                / invoke BIOS to read IDE sectors into RAM
                DEVIDE                  / we're reading from the IDE drive
                0200                    / read 2 pages into field 0 from IDE unit 0
                7400                    / buffer address (7400 - 7777)
                0000                    / starting 256-word block number

                / the following call copies the first half (128-words) of the
                / 0th partition's first (boot) sector to the last 128-word page
                / 7600-7777 of memory field 1. The end of this (about the last
                / 3/4ths) contains OS/8 resident data, and the first portion
                / contains THIS code which lives at the front of IDE sector 0.
                / OS/8 simply overwrites this with its own tables.

                CALLBIOS                / invoke BIOS to read IDE sectors into RAM
                DEVIDE                  / we're reading from the IDE drive
                0110                    / read 1 page into field 1 from IDE unit 0
                7600                    / buffer address (7600 - 7777)
                0000                    / starting 256-word block number

                JMP  I  OS8Entry
OS8Entry,       7600                    / jump to our IDE boot handler...

/-------------------------------------------------------------------------------
$
The assembled listing for this source code, FlexBoot.lst, is also available.

Due to the size of the OS/8 operating system, and the fact that three hours of 9600 baud transfer is required to move it in hex ASCII format from a PC to the SBC6120, I wrote the OS/8 Windows utilities to make that process instantaneous by allowing the SBC6120's IDE drive to be attached through any means available to a Windows system, and to then perform a raw physical transfer of the OS/8 partition data to the SBC's drive.

However, this custom boot sector code, like the “DeepThought” and “LightsOut” toggle toys (and the tiny accompanying sector read/write utilities), are all short enough to be feasibly entered through a terminal console. This also means that there is no need for a Windows-centric approach, so Apple Mac and Linux/Unix users will not be disadvantaged.

Installing the “FlexBoot” multiboot sector into your SCB6120/FP6120

All of the following assumes that you already have an OS/8 boot sector installed onto the first (0th) sector of the first (0th) partition of an IDE-compatible non-volatile drive attached to the SBC6120. If you have not yet installed OS/8, the Windows utilities I mentioned above make doing so comparatively simple and quite fast. If you haven't yet installed OS/8, please do so before proceeding.

The following step-by-step instructions guide you through the process of first making some backups copies of the original OS/8 partition in case you ever want to revert to it. Then you will load the standard OS/8 boot sector into RAM, overwrite a portion of it with new multiboot code, and write it back to the non-volatile drive for subsequent use.

If the SBC6120 is currently running (the front panel RUN light is illuminated), briefly lower and raise the front panel HALT switch to return control to the BIOS and console. Establish communication with the BIOS so that pressing “Enter” on your terminal or terminal emulator returns the BIOS '>' prompt.

Let's begin by confirming the presence of the boot sector on the attached IDE-compatible non-volatile drive. We'll do this by using the SBC6120's BIOS disk dump (dd) command:

>dd 0 0 1
0000.000/ 0302 0317 0317 0324 0000 6206 0004 0200
0000.010/ 7400 0000 7430 7402 6206 0004 0110 7600
0000.020/ 0000 7430 7402 6203 5425 7600 3003 7201
0000.030/ 4053 6755 5054 6754 7410 7402 7450 5421
0000.040/ 7326 6751 6211 4053 3417 5044 0000 7607
0000.050/ 7607 0000 0000 0000 0000 0000 0000 7710
0000.060/ 7707 7706 7705 7704 7703 7702 0000 6202
0000.070/ 4207 1000 0000 0007 7746 6203 5677 0400
0000.100/ 0000 3340 6214 1275 3336 6201 1674 7010
0000.110/ 6211 7630 5321 6202 4207 5010 0000 0027
0000.120/ 7402 6202 4207 0610 0000 0013 7402 5020
0000.130/ 6202 4207 1010 0000 0027 7402 0000 5700
0000.140/ 0000 0000 0000 0000 0000 0000 0000 0000
0000.150/ 0000 0000 0000 0000 0000 0000 0000 0000
0000.160/ 4440 4440 0000 1040 4430 4430 4430 4430
0000.170/ 4440 4440 4440 4440 4440 4440 4440 0000
0000.200/ 4207 5000 0000 0033 7602 6213 5267 0002
0000.210/ 7200 6214 1262 3256 1261 6034 1263 7650
0000.220/ 6031 5224 6203 5664 1607 2207 0265 1250
0000.230/ 3250 1607 2207 3251 1607 2207 3252 1252
0000.240/ 1260 7640 5246 3250 7340 5256 6206 0004
0000.250/ 0000 0000 0000 7620 2207 3250 7402 5607
0000.260/ 0111 0200 6203 7575 7600 7770 0000 0000
0000.270/ 0000 0000 0000 0000 0000 0000 0000 0000
0000.300/ 0000 1311 0000 2250 2250 2250 2250 2250
0000.310/ 2250 2250 7300 1250 7041 1301 3317 7402
0000.320/ 3207 7332 1317 3325 1311 7402 5210 7402
0000.330/ 5200 0000 0000 0000 0000 0000 0000 0000
0000.340/ 0000 0000 0000 0000 6203 0200 0000 0000
0000.350/ 7750 7751 7752 7753 7754 7755 7607 4756
0000.360/ 3700 0000 3230 7402 5372 4207 0300 7000
0000.370/ 0035 7402 6203 6042 5775 0200 0000 0000
5066

If OS/8 is installed into the first partition you should see something like what's shown above.

Use the 'pc' (Partition Copy) command to make a few backups of your current OS/8 partition zero. In the example below, I have copied partition 0000 to partition 3777, 3776, 3775 and 3774 of my 8 gig drive. You should choose backup partition numbers suitable to the size of the drive you have attached to the SBC6120:
>pc 0000 3777
Overwrite partition 3777 ?y
Copying ............... Done
>pc 0000 3776
Overwrite partition 3776 ?y
Copying ............... Done
>pc 0000 3775
Overwrite partition 3775 ?y
Copying ............... Done
>pc 0000 3774
Overwrite partition 3774 ?y
Copying ............... Done
>
Now let's reset the SBC6120 with the master reset (mr) command to bring the SBC6120 into a known state:
>mr
Then clear all of memory. This will take a few seconds, during which the front panel's address register will count all the way up to 77777 as zeroes are being written into the PDP-8's RAM:
>cm
You can verify that memory has been cleared by displaying the first sector's-worth of RAM with the examine memory (e) command. You'll receive a nice block display of zeroes, not shown here:
>e 0-377
Now use the deposit memory (d) command to deposit the two tiny "SectorRW" programs into RAM at location 0400 and 0410. For reference, the source code for the two SectorRW programs is provided further down this page. You can enter each line manually, but terminal emulation programs often understand “copy & paste” semantics which make copying the commands from this page and pasting them into the terminal for sending to the SBC6120 much quicker, easier, and less error prone.

If you are a Windows user, the free, open source, and very nice “Tera Term” terminal emulator can be used. With Tera Term, the keystroke combination “Alt-V” will paste the Windows' clipboard into the terminal window while simultaneously sending it to the SBC6120, exactly as if it had been manually entered. (Here is a locally archived copy in case the file's home site ever disappears: TeraTerm_v2.3.zip.)

>d 00400 6206,0004,0200,0000,0000,7430,7402,7402
>d 00410 6206,0004,4200,0000,0000,7430,7402,7402
Use the first little program to copy the partition zero boot sector into location zero of RAM:
>st 0400
You should receive:
?Halted at 00410
PC>0410 PS>1000 AC>0000 MQ>0000 SP1>0000 SP2>0000

...and the first partition's boot sector will now be in RAM. If you wish to verify this, you could again issue the examine memory command used above...

>e 0-377
...which should now show the RAM's contents containing the same data that we previously dumped directly from the drive using the dump drive (dd) command at the beginning of this process.

Next, we need to overwrite the beginning of the just loaded sector with our own multiboot code. The commands to do this are a series of deposit (d) commands shown below. The following series of SBC6120 deposit (d) commands will overlay our replacement multiboot code onto the existing data in RAM:
>d 00000 0302,0317,0317,0324,0000,6201,7604,7450
>d 00010 5026,3000,6206,0010,0000,0000,4000,0027
>d 00020 0001,6206,0004,3707,0000,0000,6206,0004
>d 00030 0200,7400,0000,6206,0004,0110,7600,0000
>d 00040 5441,7600
Now we write the modified boot sector (now our multiboot sector) back to the first (0th) sector of the first (0th) partition by simply (c)ontinuing to run the tiny "SectorRW" program from where it stopped before:
>c
You should receive:
?Halted at 00420
PC>0420 PS>1000 AC>0000 MQ>0000 SP1>0000 SP2>0000
You're done! Partition zero of your SBC6120 IDE-compatible non-volatile drive now has the "FlexBoot" sector which will still boot OS/8 if the switch register is set to all 0's. But which will also load and run other programs, such as the DeepThought and LightsOut toggle toys, from any other non-zero partition.

Verify the newly written boot sector by dumping it from the drive to the console:

>dd 0 0 1
The first line should NOW look like:
0000.000/ 0302 0317 0317 0324 0000 6201 7604 7450
The original first line, which is NOT what you should expect to see, was:
0000.000/ 0302 0317 0317 0324 0000 6206 0004 0200

If you wish, you can verify that OS/8 still boots correctly by TURNING OFF ALL switch register data switches, lowering and raising the front panel HALT switch, then depressing the "Boot" switch twice...

If you should ever decide that you want to remove this special multiboot sector, the easiest way to restore the original OS/8 boot sector will be to copy one of the backup partitions over partition zero.

With the new multiboot sector now in place, you can proceed to load and save either or both of the “Toggle Toys” to your drive for instant loading and running without any serial console. See the “DeepThought” or “LightsOut” pages for similarly detailed (and deliberately somewhat redundant) step-by-step instructions for preparing these front panel toys.

SectorRW Source Code

For reference, the PAL-8 assembly language source code for the sector read/write (SectorRW) utilities used above to first read and then write the OS/8 boot sector is provided here:

PDP-8 / SBC6120/FP6120 “SectorRW” Source Code

/===============================================================================
/ "SectorRW" -  Single-sector read/write utilities used for Toggle Toys setup
/-------------------------------------------------------------------------------
/
/ These two short routines are loaded and executed from the SBC6120's serial
/ console to read and write the first IDE drive sector of unit 0 -- by default
/ and by design, partition 0, the OS/8 boot sector.  This is used during the
/ setup of the custom boot sector to read the original boot sector into RAM,
/ and to then write the modified boot sector back to the IDE drive.
/
/===============================================================================

CALLBIOS=6206   / call Bob's SBC6120 BIOS located in "control panel memory."
DEVIDE=4        / function code (0004) for the SBC's IDE disk I/O

/  Field definitions for Bob's (and OS/8 in general) IDE Read/Write function:
/  +-----+-----------------------------+-----------------+-------------------+
/  |  0  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  10  |  11  |
/  | R/W | Xfer Block Count (128 word) |   Memory Field  |  Unit Number 0-7  |
/  +-----+-----------------------------+-----------------+-------------------+

/  The functions below use the parameters '0200' and '4200' with the following
/  bit-field breakdowns (see the definition above):
/  0 00010 000 000 - read  2, 128-word pages (one sector) to field 0 from unit 0
/  1 00010 000 000 - write 2, 128-word pages (one sector) from field 0 to unit 0
/-------------------------------------------------------------------------------
*400

LoadSector0,    CALLBIOS                / invoke BIOS to read IDE sector 0 into RAM
                DEVIDE                  / we're reading from the IDE drive
                0200                    / read 2 pages (1 physical drive sector)
                0000                    / into field 0 and location 0
                0000                    / starting 256-word block number
                SZL                     / hopefully, we return with link cleared
                HLT                     / if error, halt the machine here
                HLT                     / if NO ERROR, we halt here ...
                                        / ... ready to 'C'ontinue ...
                
SaveSector0,    CALLBIOS                / invoke BIOS to write RAM to IDE sector 0
                DEVIDE                  / we're writing to the IDE drive
                4200                    / write 2 pages (1 physical drive sector)
                0000                    / from field 0 and location 0
                0000                    / starting 256-word block number
                SZL                     / hopefully, we return with link cleared
                HLT                     / if error, halt the machine here
                HLT                     / if NO ERROR, we halt here.

/-------------------------------------------------------------------------------
$
The assembled listing for this source code, SectorRW.lst, is also available.

PartWrite Source Code

For reference, the PAL-8 assembly language source code for the partition writer (PartWrite) utility which is used to write the toggle toys into their own partitions is provided here:

PDP-8 / SBC6120/FP6120 “PartWrite” Source Code

/===============================================================================
/ "PartWrite" -  Switch Register Driven Ram-to-Partition Writer Utility
/-------------------------------------------------------------------------------
/
/ This tiny program is used to write the first 256 words of SBC6120 RAM (the
/ first two PDP-8 pages, locations 00000-00377) to the beginning of the partition
/ number specified by the switch register at the time this program is run.  This
/ allows any of the "Toggle Toys" such as "DeepThought" or "LightsOut" to be made
/ available for immediate loading and execution using the modified "multiboot"
/ boot sector.
/
/===============================================================================

CALLBIOS=6206   / call Bob's SBC6120 BIOS located in "control panel memory."
DEVIDE=4        / function code (4) for the SBC's IDE disk I/O
MEMCPY=10       / function code (0010) to copy memory

/  Field definitions for Bob's (and OS/8 in general) IDE Read/Write function:
/  +-----+-----------------------------+-----------------+-------------------+
/  |  0  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  10  |  11  |
/  | R/W | Xfer Block Count (128 word) |   Memory Field  |  Unit Number 0-7  |
/  +-----+-----------------------------+-----------------+-------------------+

/  The function below uses the parameter '4207', yielding
/  the following bit-field breakdowns (see the definition above):
/  1 00010 000 111 - write 2, 128-word pages into field 0 from unit 7

/-------------------------------------------------------------------------------
*0400           / we'll load this little goodie at 0400, after the first two
                / pages of RAM (0-377)

                / first, we need to determine which partition to write into...

                CLA OSR                 / read the switch register for partition
                SNA                     / DO NOT EVER WRITE TO PAZRTITION ZERO!
                HLT                     / just halt if no switches are up
                DCA     TargetPart      / save our target partition for MemCopy

                / we're writing to a partition other than 0 (OS/8) so first
                / we map that partition -- specified by the AC -- to unit 7

                / note that although Bob thoughtfully provided a BIOS call to
                / perform exactly this mapping, it turns out that a bug was in-
                / troduced into the code later in the game, rendering it unusable.
                / therefore, it's necessary to manually edit the partition-to-unit
                / mapping table in "panel memory" to accomplish the same function.

                CALLBIOS
                MEMCPY                  / cross panel-to-user memory copy
                0000                    / copy from field 0 in user memory
                TargetPart              / copy from location zero in user memory
                4000                    / copy to field 0 in panel memory
                0027                    / copy to location 0027 in panel memory
                0001                    / only transfer one word

                / write to the first sector (512 bytes = 256, 16-bit words, or
                / 256, 12-bit PDP-8 words) of the mapped partition from the first
                / 256 words of RAM...
                
                CALLBIOS                / invoke the BIOS to read IDE sectors
                DEVIDE                  / we're writing to the IDE drive
                4207                    / write two 128-word pages from field 0
                0                       / starting at memory location 0
                0                       / and write to the start of the partition
                
                / detect any writing error based upon the status of the Link
                
                SZL                     / zero link is good news
                HLT                     / if we halt here, we had an error
                HLT                     / halting here is what we want!

TargetPart,     0                       / the partition we'll be writing to
/-------------------------------------------------------------------------------
$
The assembled listing for this source code, PartWrite.lst, is also available.

This ZIP file (352kb) contains all of the recently-written bits and pieces of
SBC6120 & FP6120 PDP-8 code for DeepThought, LightsOut, the custom OS/8
boot sector, and other PDP-8 code snippet utilities I created for this project.

GRC's PDP-8 Pages:
CLICK HERE to learn how YOU can acquire & build
one of these complete PDP-8 systems for yourself !!!

Jump to top of page
Gibson Research Corporation is owned and operated by Steve Gibson.  The contents
of this page are Copyright (c) 2024 Gibson Research Corporation. SpinRite, ShieldsUP,
NanoProbe, and any other indicated trademarks are registered trademarks of Gibson
Research Corporation, Laguna Hills, CA, USA. GRC's web and customer privacy policy.
Jump to top of page

Last Edit: Jan 31, 2010 at 14:59 (5,342.63 days ago)Viewed 5 times per day