Close

We Have A BIOS Extension!

A project log for Improbable AVR -> 8088 substitution for PC/XT

Probability this can work: 98%, working well: 50% A LOT of work, and utterly ridiculous.

eric-hertzEric Hertz 01/15/2017 at 21:0032 Comments

UPDATE: Adding screenshot from 'dosbox'

------------

Thanks to @Shaos's hard work getting a PCjr ROM-Cartridge working over at #PCjrCart (https://hackaday.io/project/19160-pcjrcart/log/51792-creating-a-bios-extension), my work getting my first ROM extension was greatly reduced!

Here it is running as a .COM under 'dosbox'

And here it is as a ROM-Extension on my PC/XT clone:

Apparently on the XT, it runs the BIOS extensions almost immediately in the boot process, so this is on a completely black background. (Note that it cycles through text-colors as well as background-colors).

And I learned a lot, along the way.

We've got the BIOS in the ZIF socket on the left, because that's where I intend to do most of my work, later down the road... (and I found another BIOS to try out floating in the 'old chips' box).

And we've got the "BIOS-Extension ROM" further to the right.

A couple notes:

Here's the first-experiments. Before loading it into a ROM, you can try out the .COM executable under DOS...

-------------------

I won't give it *all* away... but go grab @Shaos's code from github (again https://hackaday.io/project/19160-pcjrcart/log/51792-creating-a-bios-extension)

Make sure you've got 'nasm' installed (the Assembler)... Look up "INT 10H" (wikipedia's got it)

You might want to install 'dosbox' as well... when running it slow the "cycles" to ~300 to mimic a PC/XT's execution-speed.

Here's a makefile to make things easier...

default:
	gcc -o pcjrcart pcjrcart.c crc16.c
	nasm test.asm -fbin -o test.com
	./pcjrcart test.com

clean:
	rm -f pcjrcart test.com test.bin

run:
	dosbox -machine cga test.com

Discussions

Steve Sybesma wrote 08/19/2019 at 00:27 point

A thought came to me that it might be possible to create an 'OnTrack' style BIOS extension for Virtualbox to fix shortcomings it has in emulating hardware when DOS is used as the guest OS.
Virtualbox uses SB16 emulation, but surprisingly only does it by DMA and not I/O. Many DOS games expect I/O to be used. A BIOS extension might be able to fix that problem. The old OnTrack technique was to install the BIOS extension file as being the very first file on the HDD and then loading it as the very first line in CONFIG.SYS. It allowed the computer to accept a larger HDD than the native BIOS allowed, so it was adding a real hardware function to the computer that didn't exist before. It seems like this technique is possible for other types of hardware, like sound cards.

  Are you sure? yes | no

Dave's Dev Lab wrote 07/11/2019 at 00:13 point

Hey Guys! I've created a new "list" for these 8088 homebrew projects - https://hackaday.io/list/166497-homebrew-8088-pc-projects

  Are you sure? yes | no

Dave's Dev Lab wrote 07/10/2019 at 21:21 point

@esot.eric / @Starhawk - i'll be adding in a hackaday.io page shortly, but here is the link to the tools repo based on @SHAOS 's work... https://github.com/prpplague/pc-rom-tools

  Are you sure? yes | no

Eric Hertz wrote 07/10/2019 at 16:58 point

@Dave's Dev Lab and @Ken Yap , (and, of course, @SHAOS ) thanky'all for choosing this "forum" for sharing your knowledge/experience! I guess this means I better start thinking of reviving my own efforts in this realm! This'll certainly make it easier.

Ken, That's a pretty cool idea, a ROM-bootable terminal-emulator.

Dave, what're your goals after 'hello world'?

  Are you sure? yes | no

Dave's Dev Lab wrote 07/10/2019 at 17:15 point

@esot.eric - i'm looking to design/build a backplane style 8088 DOS capable system. i buy/sell a lot of surplus components, and i've ended up with a bunch of original IBM ISA boards ( https://hackaday.io/project/165988-exploring-classic-ibm-game-controller-adapter ) as well as enough components to build a couple thousand kits. this was a first attempt at doing some ROM based stuff to support some of the custom devices i am looking to build such as a ROM based floppy drive with FreeDOS pre-installed. once i get some prototypes going, it might be interesting to get an AVR board designed up to use in the backplane system...

  Are you sure? yes | no

Eric Hertz wrote 07/10/2019 at 18:46 point

LOL, you should talk to @Starhawk  regarding a ROM-floppy... we've been exploring the topic of large flash-mem attached to the floppy-connector, looking like a hard drive [after bios extension]. OTOH, why are you considering ROM-floppy, when large ROM/flash C-drives are just as possible with your new bios-extension skillz?

  Are you sure? yes | no

Starhawk wrote 07/10/2019 at 19:24 point

Y HELO THAR.

It's amazing what can happen when one combines idle musings with friends that have an unusual gift for technological manipulation ;) truth be told, mostly what's happened by way of discussion is me learning way more about floppies and their interfaces than I ever intended.

  Are you sure? yes | no

Dave's Dev Lab wrote 07/10/2019 at 19:43 point

@esot.eric - the floppy is just one step in the process. kind of looking to do a whole series of small "discovery" documents for people exploring the 8088 based system...

  Are you sure? yes | no

Ken Yap wrote 07/10/2019 at 04:47 point

I was wondering whether it would be hello world or blink. 😆 Congrats.

  Are you sure? yes | no

Dave's Dev Lab wrote 07/10/2019 at 04:50 point

i was temped to put "computers make me want to drink hard liquor!"

  Are you sure? yes | no

Dave's Dev Lab wrote 07/10/2019 at 02:18 point

@Ken Yap - fantastic - https://photos.app.goo.gl/CRkQqTjjd2vcGoni7 , that image works! now i need to figure out why mine doesn't! thanks a bunch!

  Are you sure? yes | no

Ken Yap wrote 07/10/2019 at 02:25 point

Ha, that program was written at least 18 years ago. Time flies. Good luck.

  Are you sure? yes | no

Ken Yap wrote 07/10/2019 at 03:18 point

Ok, I've found a copy of my cvt100 ROMable terminal emulator on the Internet: 

https://ftp.dim13.org/pub/vt100/cvt100b.zip You may find the notes in tcj.txt useful. Good luck.

  Are you sure? yes | no

Dave's Dev Lab wrote 07/09/2019 at 20:36 point

@esot.eric - hey! would you mind posting a working .bin file for reference?

  Are you sure? yes | no

Eric Hertz wrote 07/09/2019 at 21:32 point

Hey, Dave! glad you're finding this useful!

But, I haven't had access to that computer for 2+ years, now... Good luck!

  Are you sure? yes | no

Dave's Dev Lab wrote 07/09/2019 at 22:01 point

@esot.eric - no worries! i'll pickup where you left off and post on a hackaday.io project page...

  Are you sure? yes | no

Eric Hertz wrote 07/09/2019 at 22:07 point

@Dave's Dev Lab  Excellent! The power of online/sharing project-communities! Please post a link to your project so's I [and others] can reference back to it when I come back to this project! Then I can be leap-frog learning from you! 

  Are you sure? yes | no

Ken Yap wrote 07/09/2019 at 05:53 point

@Dave's Dev Lab IIRC it's just a simple 8-bit sum over all the bytes in the extension BIOS code. This http://www.on-time.com/rtos-32-docs/rttarget-32/programming-manual/running-a-program-on-the-target/booting-from-a-bios-extension.htm talks about it but doesn't go into the checksum computation. The segment address depends on the slot the ROM is placed in or if on an extension card, e.g. video, disk controller, or Ethernet interface, set by jumpers or DIP switches. I used to write network boot ROMs, in C, but needed some special tricks to deal with the variable segment address.

  Are you sure? yes | no

Dave's Dev Lab wrote 07/09/2019 at 06:06 point

thanks! reading up on it now!

  Are you sure? yes | no

Ken Yap wrote 07/09/2019 at 06:11 point

Usually you designate one location in the image as the checksum byte, say the last byte but could be any, set it to zero, compute the checksum, then negate it and store that there.

You don't even have to write a program to do this summing and insertion, the srecord package can do this and much more.

  Are you sure? yes | no

Dave's Dev Lab wrote 07/09/2019 at 16:20 point

thanks @Ken Yap - i got that part worked out last night, but still no luck on getting code running...

  Are you sure? yes | no

Ken Yap wrote 07/10/2019 at 01:01 point

@Dave's Dev Lab A long long time ago I modified cvt100, a DOS vt100 comms program in Turbo C, to be rommable. It was intended to be published in TCJ but they stopped publishing around that time so I published it myself somewhere on the Internet, maybe Geocities. I find that I have also deleted my own copy of the project in the belief that nobody cares about this stuff anymore.

Anyway trying another tack I looked for original network boot ROM project by a friend of mine that started my interest in network booting. It seems to have survived here:

http://web.mit.edu/linux/people/mcmullan/netboot/readme

Unfortunately the directory is not searchable, but you can access the various files by substituting the filename for readme. The ones which are probably of most interest to you are rom.asm and layout.inc. There are only a limited number of things a BIOS extension can do. Naturally no DOS calls but you can make some BIOS calls. Also pay attention to the contents of CS, DS and SS.

  Are you sure? yes | no

Dave's Dev Lab wrote 07/10/2019 at 01:06 point

Thanks @Ken Yap - i'll have a read. now that i got the checksum working, the rom is "doing something" but i'm digging into the code now....

  Are you sure? yes | no

Ken Yap wrote 07/10/2019 at 01:29 point

@Dave's Dev Lab Ok I found one of my earlier efforts before cvt100 here: https://cyberside.net.ee/files/net/terminal/terminal-rom.tar.gz It uses compression to fit the code. There is an 8kB ROM image there which may or may not work. HTH.

  Are you sure? yes | no

Yann Guidon / YGDES wrote 01/16/2017 at 02:12 point

yay !

  Are you sure? yes | no

SHAOS wrote 01/16/2017 at 00:15 point

Congratulations! :)
I'll modify my Hello-program to read the page as well
And which address you use to run it?
PCJr BIOS also uses simple sum for addresses below D0000 (and CRC16 above)

  Are you sure? yes | no

Eric Hertz wrote 01/16/2017 at 08:54 point

I honestly don't know which address it's running from. I just plopped it in one of the sockets.

I tried several, at first, but got "System Error 20" which actually had a nice side-effect of my locating this:

https://bitbucket.org/sparky4/pcxtbios

wherein 'sparky4' actually released an open-ish-source BIOS for the XT, with some bugfixes and upgrades, and commented! I haven't tried it yet, but it's already been quite handy browsing his code.

It's definitely coded differently than the version I found in the IBM techref.

It seems the PC/XT looks for ROM extensions between C8000 - F4000, but looks like they use the same "rom_checksum" routine to test 'em as they do for BASIC ROMs (aka "ROS"?) (which I can't locate where those are supposed to be loaded)

Thanks again for sharing that work for folks like me!

  Are you sure? yes | no

SHAOS wrote 01/16/2017 at 14:36 point

ok, I see - thank you for using my work :)
open source is for sharing ;)

  Are you sure? yes | no

Dave's Dev Lab wrote 07/09/2019 at 05:06 point

@esot.eric - do you have any additional information on how the checksum is computed for the rom image?

  Are you sure? yes | no

jaromir.sukuba wrote 01/15/2017 at 21:34 point

It's alive! :)

Is the picture quality really that low or the photo is distorting/blurring high contrast transitions?

  Are you sure? yes | no

Eric Hertz wrote 01/15/2017 at 22:38 point

You mean it *shouldn't* be that bad? ;)

90% really that bad, 10% photo-distortion. Though, in the later images you can see a comparison of the CRT vs the LCD-TV, CRT is much clearer... and I ran the last experiment on the LCD-TV, since I was watching a movie on the CRT, which probably wasn't too smart for purposes of showing-off.

Otherwise, there are tons of possible reasons for its being so bad, laziness may be a big one. Once I *finally* got video-output at all, I put fine-tuning it on the back-burner. There are still 13 unlabelled-jumper-combinations I haven't tried, for instance :)

  Are you sure? yes | no