PorkyPiggy
Member
- Joined
- Jan 11, 2024
- Messages
- 46
@RichCini and I have collaborated on reconstructing the Monitor + BIOS ROM code that Microsoft used to transfer 86-DOS binaries to prototype IBM PCs in the early days of PC-compatible DOS.
According to the notes written by Bob O'Rear (one of the core devs from Microsoft responsible for porting SCP 86-DOS to the PC), Microsoft transferred 86-DOS binaries in Intel HEX format to the prototype IBM PC via serial communication, and used the prototype PC to write them to 5.25" disks.
Based on the aforementioned document and a photo of a prototype 5150, the BIOS ROM chip of prototype PCs contained both the ROM BIOS and a small monitor/debugger program. The monitor was capable of loading Intel HEX files into memory from serial ports and writing memory to disks.
After conversing with Rich, I decided to attempt the recreation of that monitor program. I had previously ported SCP's 8086 Monitor program to 8086tiny (a crude IBM PC/XT emulator somewhat similar to DOSBox), but this time it's for the actual PC.
The original 5150 ROM from April 1981 had only a few bytes of free space. Therefore, the first step was to get rid of unnecessary features to make room for the monitor. Compiling the original ROM source code was a challenging experience. I tried both MASM and ASM86, and neither worked out of the box. While they share very similar syntax, MASM is definitely smarter as it generates fewer useless NOPs, so I chose MASM. I had to remove the "AT 0F000H" and "AT 0FFFFH" from the CODE and VECTOR segments because MASM didn't accept them. However, this resulted in a huge (>64K) EXE file with relocations. Without a doubt, EXE2BIN refused to convert it to plain binary, so I had to create my own EXE2ROM utility. IBM also inexplicably hard coded various data offsets in the source, causing additional problems. After nuking CGA graphics mode and print screen support, I was left with about 2254 bytes of space for the monitor.
Porting the monitor was relatively straightforward. To align it with Bob's description, I added three commands: "H(EX) <address>," "L(OAD) <address> <disk> <head> <track> <sector> <count>," and "W(RITE) <address> <disk> <head> <track> <sector> <count>." These commands are for loading Intel HEX from the serial port to memory, loading disk sector(s) to memory, and writing memory to disk sector(s), respectively. I made the monitor work with both the keyboard/CRT and serial port 0. Outputs are sent to both the screen and serial port 0, and inputs are accepted from either, with the inputted character being echoed to both. However, I soon realized a problem - a separate port is needed for HEX file transfer, and the vanilla PC only has one port. To accommodate these PCs, I created a one-port version of the monitor that uses only the keyboard/CRT for interaction and port 0 for HEX transfer.
Demonstrations
Command execution. Commands can be entered in through both the keyboard and port 0 if you have 2 serial ports.
Manual boot from disk. "L 7C00 0 0 0 1 1" loads 1 sector from disk 0, head 0, track 0 starting at sector 1 to physical memory address 0x7C00. "R CS" followed by "0000" and "R IP" followed by "7C00" sets CS:IP to 0000:7C00, the default boot sector load location. "G" continues execution at the new CS:IP location, which in this case, booted 86-DOS 0.34.
HEX transfer to memory. "L 8000 0 0 0 1 1" loads the boot sector to 0x8000, and "D 8000" performs a hex dump of the loaded boot sector. As you can see, the boot sector was originally empty (filled with the default patten F6). "H 8000" starts hex transfer from port 1 (or port 0 for the single-port version) to memory address 0x8000, and in this case I transferred a valid boot sector in the Intel HEX format over. "D 8000" generates another hex dump and you can see it now contains the boot sector code. "W 8000 0 0 0 1 1" writes the newly transferred boot sector code to disk, and "L 7C00 0 0 0 1 1" loads it from disk to another address (0x7C00). "D 7C00" verifies that that the write succeeded and "B" boots from the disk.
Download
"5150_mon_bios_v1.zip" has a 2-port version and a 1-port version of the ROM. The 2-port version assumes port 0 for monitor interaction and port 1 for hex transfer. The 1-port version assumes port 0 for hex transfer. Serial configuration is the exact same as PC-DOS 1.00's (2400 baud, 8N1). Source code and toolchain will be provided in the next post, I still have some code clean-up to do.
Genuine Proto PC ROM Request
This is merely a re-creation of the monitor/proto ROM, we would prefer to have an actual prototype 5150 ROM. If you have real 5150 protos, please consider dumping the ROMs! Alternatively, if you are in contact with the IBM engineers who worked on the original PC or TubeTime/Eric Schlaepfer, please leave a message here!
Sincerely,
Pig
According to the notes written by Bob O'Rear (one of the core devs from Microsoft responsible for porting SCP 86-DOS to the PC), Microsoft transferred 86-DOS binaries in Intel HEX format to the prototype IBM PC via serial communication, and used the prototype PC to write them to 5.25" disks.
Start
1. Seattle Computer delivers source of QDOS and utilities on 8" QDOS formatted diskette & an absolute assembler.
2. Incorporate changes to QDOS using EDLIN + assemble into absolute code.
3. Run an encode program (written in BASIC) that converts absolute code to Intel ASCII hex format
4. Upload the encoded ASCII hex QDOS to the DEC 2020
5. BIOS for msdos written on 2020 in XMACRO-86 a cross assembler, assemble to absolute location.
6. Download BIOS + ASCII-hex encoded QDOS to Intel ISIS system
7. Encode the BIOS to Intel ASCII-hex on the Intel ISIS machine
8. Transfer the BIOS + QDOS over IBM RS232 to IBM PC prototype memory via ROM Debugger that accepts Intel ASCII hex.
9. Use IBM PC prototype debugger to write BIOS + QDOS to exact sector locations of PC prototype 5¼ diskette system
10. Repeat assembly, encoding, etc for QDOS utilities
Based on the aforementioned document and a photo of a prototype 5150, the BIOS ROM chip of prototype PCs contained both the ROM BIOS and a small monitor/debugger program. The monitor was capable of loading Intel HEX files into memory from serial ports and writing memory to disks.
After conversing with Rich, I decided to attempt the recreation of that monitor program. I had previously ported SCP's 8086 Monitor program to 8086tiny (a crude IBM PC/XT emulator somewhat similar to DOSBox), but this time it's for the actual PC.
The original 5150 ROM from April 1981 had only a few bytes of free space. Therefore, the first step was to get rid of unnecessary features to make room for the monitor. Compiling the original ROM source code was a challenging experience. I tried both MASM and ASM86, and neither worked out of the box. While they share very similar syntax, MASM is definitely smarter as it generates fewer useless NOPs, so I chose MASM. I had to remove the "AT 0F000H" and "AT 0FFFFH" from the CODE and VECTOR segments because MASM didn't accept them. However, this resulted in a huge (>64K) EXE file with relocations. Without a doubt, EXE2BIN refused to convert it to plain binary, so I had to create my own EXE2ROM utility. IBM also inexplicably hard coded various data offsets in the source, causing additional problems. After nuking CGA graphics mode and print screen support, I was left with about 2254 bytes of space for the monitor.
Porting the monitor was relatively straightforward. To align it with Bob's description, I added three commands: "H(EX) <address>," "L(OAD) <address> <disk> <head> <track> <sector> <count>," and "W(RITE) <address> <disk> <head> <track> <sector> <count>." These commands are for loading Intel HEX from the serial port to memory, loading disk sector(s) to memory, and writing memory to disk sector(s), respectively. I made the monitor work with both the keyboard/CRT and serial port 0. Outputs are sent to both the screen and serial port 0, and inputs are accepted from either, with the inputted character being echoed to both. However, I soon realized a problem - a separate port is needed for HEX file transfer, and the vanilla PC only has one port. To accommodate these PCs, I created a one-port version of the monitor that uses only the keyboard/CRT for interaction and port 0 for HEX transfer.
Demonstrations
Command execution. Commands can be entered in through both the keyboard and port 0 if you have 2 serial ports.
Manual boot from disk. "L 7C00 0 0 0 1 1" loads 1 sector from disk 0, head 0, track 0 starting at sector 1 to physical memory address 0x7C00. "R CS" followed by "0000" and "R IP" followed by "7C00" sets CS:IP to 0000:7C00, the default boot sector load location. "G" continues execution at the new CS:IP location, which in this case, booted 86-DOS 0.34.
HEX transfer to memory. "L 8000 0 0 0 1 1" loads the boot sector to 0x8000, and "D 8000" performs a hex dump of the loaded boot sector. As you can see, the boot sector was originally empty (filled with the default patten F6). "H 8000" starts hex transfer from port 1 (or port 0 for the single-port version) to memory address 0x8000, and in this case I transferred a valid boot sector in the Intel HEX format over. "D 8000" generates another hex dump and you can see it now contains the boot sector code. "W 8000 0 0 0 1 1" writes the newly transferred boot sector code to disk, and "L 7C00 0 0 0 1 1" loads it from disk to another address (0x7C00). "D 7C00" verifies that that the write succeeded and "B" boots from the disk.
Download
"5150_mon_bios_v1.zip" has a 2-port version and a 1-port version of the ROM. The 2-port version assumes port 0 for monitor interaction and port 1 for hex transfer. The 1-port version assumes port 0 for hex transfer. Serial configuration is the exact same as PC-DOS 1.00's (2400 baud, 8N1). Source code and toolchain will be provided in the next post, I still have some code clean-up to do.
Genuine Proto PC ROM Request
This is merely a re-creation of the monitor/proto ROM, we would prefer to have an actual prototype 5150 ROM. If you have real 5150 protos, please consider dumping the ROMs! Alternatively, if you are in contact with the IBM engineers who worked on the original PC or TubeTime/Eric Schlaepfer, please leave a message here!
Sincerely,
Pig