• Please review our updated Terms and Rules here

New XT BIOS - Looking for testers!

640KB

Experienced Member
Joined
Jan 8, 2019
Messages
134
Location
NYC
For the past several months I have been working on a new BIOS project for XT, clones and compatibles. It started out as a curiosity of "what would it take to write a 'Hello World' as a BIOS ROM", and then went all the way down the rabbit hole of "what would it take to make it a full BIOS". Of course, there are many other very high quality open-source BIOS projects out there, each with different goals. The goal of this is to be a "100% PC Compatible" clone BIOS as a drop-in alternative for any 8K ROM, on original/vintage hardware. This BIOS is all 100% brand new code, released as open source under GPLv3. Great care was taken to prevent any copyrighted or proprietary code from being introduced with the help of the retrocomputing community to produce "clean room" specs whenever suitable public documentation was unavailable.

Testing wise, I'd love to hear how it works on your "daily driver", with whatever software/titles you use and might throw at it. Naturally I've run Flight Simulator 1.0 and Lotus so anything else that could help stretch the compatibility tests would be great. Would also love to hear about success or issues with hardware, especially things like less-common video cards, third-party storage adapters (esoteric ROM-based HD floppy adapters), and "high speed Turbo" motherboards > 8MHz.

Otherwise, would greatly appreciate any bug reports, incompatibilities, testing results, suggestions or feedback in general!

Here is a link to the project on GitHub with more details:
https://github.com/640-KB/GLaBIOS

And download links for ROM images:
https://github.com/640-KB/GLaBIOS/releases

And Source:
https://github.com/640-KB/GLaBIOS/tree/main/src

Thanks!

640KB
 
Impressive work writing a PC BIOS replacement from scratch. Hat's off to you.

Lotus 1-2-3 and Flight Simulation 1.0 were used as compatibility tests precisely because they did not use the BIOS, so you may want to add more systems to your test suite.

How much room is left, and do you accept pull requests?
 
Impressive work writing a PC BIOS replacement from scratch. Hat's off to you.

Lotus 1-2-3 and Flight Simulation 1.0 were used as compatibility tests precisely because they did not use the BIOS, so you may want to add more systems to your test suite.

How much room is left, and do you accept pull requests?

Yeah, I kinda wondered why those would have historically been chosen but figured it was worth starting there. I haven't found a ton of programs that seem to specifically target the BIOS for compatibility but if you know of good ones I'd really love to test against them.

Approx 110 bytes are left and I've been able to consolidate it into 96 contiguous bytes. I was sort-of earmarking it for the only feature I did not implement, which is INT 10h, AH=4 "read light pen" (because 1. why? 2. I have neither a light pen, nor CRT to test or develop against), otherwise I've sort of held it there for bug fixes or other small enhancements later.

Absolutely happy to accept pull requests. What'd you have in mind? :)
 
Better/alternative CGA snow handling, but 110 bytes isn't enough. For example, scroll the screen upward using the display start address register, instead of copying the data (but then this complicates support for multiple video pages, and falling back to something else when the adapter isn't CGA).

For compatibility testing, anything that hammers the BIOS: GWBASIC, any early application program written directly for the IBM PC (because programs ported over from CPM, like Sorcim's SuperWriter, rely on ANSI codes and DOS for everything). Alternately: Write a BIOS function tester.

Don't bother with lightpen support. Nobody has one, and even if they did, they'd likely want their system stock.
 
Better/alternative CGA snow handling, but 110 bytes isn't enough. For example, scroll the screen upward using the display start address register, instead of copying the data (but then this complicates support for multiple video pages, and falling back to something else when the adapter isn't CGA).

For compatibility testing, anything that hammers the BIOS: GWBASIC, any early application program written directly for the IBM PC (because programs ported over from CPM, like Sorcim's SuperWriter, rely on ANSI codes and DOS for everything). Alternately: Write a BIOS function tester.

Don't bother with lightpen support. Nobody has one, and even if they did, they'd likely want their system stock.

Now that would be an A-list feature! I read a bit about doing that but wasn't quite sure how to handle the multiple video pages and address wrapping but if anyone knows, it's you! :)

There already is fall back scroll code for non-CGA video adapters (it does straight writes for anything other than CGA mode 2,3) so that's there. How many bytes do you think that would need? I could probably find the bytes if you think it could be done!
 
Last edited:
Adding 6845 register address movement into the scrolling routines shouldn't be that bad, but where more than 100 bytes would be needed is fixups for handling multiple video pages. I don't know how many programs used multiple video page support in the BIOS, but handling them would be necessary if 100% compatibility was the goal.

These are just ideas; I'm currently over-extended and couldn't contribute in the short term. I'm just drumming up interest for others who may have more time :)
 
Adding 6845 register address movement into the scrolling routines shouldn't be that bad, but where more than 100 bytes would be needed is fixups for handling multiple video pages. I don't know how many programs used multiple video page support in the BIOS, but handling them would be necessary if 100% compatibility was the goal.

These are just ideas; I'm currently over-extended and couldn't contribute in the short term. I'm just drumming up interest for others who may have more time :)
Totally understood. I'd want to make it a build-time option anyway so someone could choose whether or not to have the standard video page compatibility or wonderful smooth CGA text scrolling.
 
Last edited:
Some real-world testing:

I'm using the "EMM Computers/homebrew8088.com" mainboard. It has some decidedly non-5160 features (specifically, the keyboard controller is more of a modern AT-controller shoehorned into place) and is a semi-passive backplane design that can support different CPU cards. An 8237 is on an optional card for DMA, and does not handle DMA0, because the system is all SRAM and does not need refresh. Also, there are no DIP switches to guide configuration.

If I use the card with a discrete 4.77MHz 8088 and friends, it boots up to the point where it would load an OS, but announces "Error 4200" DMA and KB INIT. This is not 1000% surprising based on the known hardware differences.

I copied the shim code out of the BIOS normally used with this board, to wake up the keyboard controller, and it was able to boot up and get either error blocks of "DMA", "DMA" and "KB INIT" or "DMA", "KB INIT" and "KB Stuck". But you can now proceed to boot (at least a floppy).

I was able to get similar results with an V40-- with a strange caveat. I normally use a 20MHz CPU, clocked at 8MHz (16MHz crystal) and that will not boot. Black screen, no beeps. At 5MHz (10MHz crystal) or 7.5MHz (15MHz) it boots fine. With the BIOS I normally use, booting is no problem at much higher clocks than 8MHz-- it will at least POST even at 20 with enough wait states enabled. :) Not sure if there's something weird about it being a V40, or the timing just breaks down somewhere at 8MHz.

Practical notes:

* The hard drive size detection is weird. It reported the drives as [24Mb (1024 16 63)] while those dimensions should be ~504Mb

* It looks like this requires your hard disc BIOS of choice to inject an INT19 handler, otherwise it's only going to try to boot from the first floppy.

* My personal ROM map tends to put the Malinov floppy BIOS at F0000, the CH375/6 BIOS at F2000, and the XT-IDE BIOS at F4000, so I was surprised to note that the ROM scan ends below F4000. It might make sense to make that a define, like the Anonymous BIOS does, to take advantage of more precious high ROM space.

* Aesthetically, my CH375 BIOS dumps a lot of stuff on screen, and I think it messes up when the main BIOS wants to report its count of drives and sizes, throwing the layout off a bit. The Anonymous BIOS seems to initialize the option ROMs before displaying the self-test messages.

For the record, the "shim code" mentioned looks like this: I added it in the empty space, and JMP to it right after the POWER_ON label, and added an AFTER_V40 label after the jmp. In the original BIOS, it does more to preserve registers, and is done as a call, but at this point in time, I suspect we have no registers we care about and messing with the stack may not make sense at this moment in boot.

The stuff addressing port FFFx is only for the V40 to try to put its hardware into place.

There's probably some give-and-take here needed-- we might need to do something smarter to initialize the keyboard controller to prevent the keyboard error at boot, or maybe there's an over-sensitive detection code. I know that some of the controls nominally on port 61 aren't actually wired up physically on the board).

Code:
init_v40:
   
    MOV DX, 0FFFEh        ;OPCN - INT SELECT
    XOR AL, AL
    OUT DX, AL

    MOV DX, 0FFFDh        ;OPSEL - ENABLE PERIPHERAL
    MOV AL, 06        ;ONLY ENABLE THE INTERRUPT CONTROLLER AND TIMER
    OUT DX, AL        ;

    MOV DX, 0FFFCh        ;OPHA - ON CHIP PERIPHERAL HIGH ADDRESS REGISTER
    MOV AL, 00        ;ANY 256K BLOCK EXCEPT OVERLAP WITH RESGISTERS
    OUT DX, AL

    MOV DX, 0FFFBh     ;DULA - DMA LOWER ADDRESS REGISTER
    XOR AL, AL        ; Not initialized as not used
    OUT DX, AL            ; to save space

    MOV DX, 0FFFAh        ;IULA  - 8259 LOWER ADDRESS REGISTER
    MOV AL, 020h                                  
    OUT DX, AL

    MOV DX, 0FFF9h        ;TULA - 8254 LOWER ADDRESS REGISTER
    MOV AL, 040h
    OUT DX, AL

    MOV DX, 0FFF8h        ;SULA - SERIAL PORT LOWER ADDRESS REGISTER
    MOV AL, 0D0h        ; Not initialized since not used
    OUT DX, AL

    ;0XFFF7 RES

    MOV DX, 0FFF6h        ;WCY2 - WAIT
    MOV AL, 01        ;Sets the number of wait cycles for DMA and refresh cycles
    OUT DX, AL

    MOV DX, 0FFF5h        ;WCY1 - WAIT
    MOV AL, 25h        ;BITS 7-6 = IO, 5-4 = UPPER MEM, 3-2 = MIDDLE MEM, 1-0 LOWER MEM
            ;00 NO WAIT, 11 LONGEST WAIT
    OUT DX, AL

    MOV DX, 0FFF4h        ;WMB - MEMORY BOUNDARIES
    MOV AL, 6        ;BITS 6-4 LOWEST MEMORY, BITS 2-0 HIGHEST MEMORY, MIDDLE IS EVERYTHING ELSE 0
    OUT DX, AL        ;

    ;0XFFF3 RES

    MOV DX, 0FFF2h        ;RFC - REFRESH CONTROL
    XOR AL, AL        ;NO 82
    OUT DX, AL

    ;0XFFF1 RES

    MOV DX, 0FFF0h        ;TCKS - TIMER PIN SELECTION
    MOV AL, 014h        ;1=PIN, 0=INTERNAL, BITS 1-0 PRESCALE DIV FOR INTERNAL
    OUT DX, AL

    ; We formerly set up the interrupt controller and timer here, but the
    ; mainline BIOS does this itself.  Removing this and the beep as soon as power on occurs

    mov cx, 0FFFFh
DELAYLOOP:
    loop DELAYLOOP
    dec CX
DELAYLOOP2:
    loop DELAYLOOP2
    IN Al, 060h
    MOV AL, 060h        ;WRITE COMMAND BYTE TO KEYBOARD CONTROLLER
    OUT 064h, AL        ;OUT COMMAND PORT
    MOV AL, 041h        ;PC MODE, ENABLE INTERRUPT
    OUT 060h, AL        ;OUT DATA PORT
JMP AFTER_V40
 
For compatibility testing, anything that hammers the BIOS
And that is quite simple to do: a program that activates all interrupts that on their turn are still connected to the BIOS. Therefore check the vectors first: if DOS has rerouted them, then you are not testing the BIOS but DOS.
In my opinion INT 13h, handling the floppy drive, and INT 10h, handling the video, are the most important. If they work, even testing them on an emulator is fine enough, and you can boot and have a prompt, then you can start writing and testing programs that dig deeper into your BIOS.

I have written one as well but I have to be honest: I copied the floppy part from a clone BIOS for the simple reason that at that time I had no idea how things work. I do know now but I'm not sure if I could write INT 13h from scratch.
The biggest fun of having your own BIOS is that you can tweak it in every direction. For example: I refitted a board with SRAM instead of DRAM: no refresh needed and single-stepping is no problem any more. But that also means that I can drop the refresh part in the BIOS and save some bytes for other goodies.

So keep on having fun with this project!
 
Some real-world testing:

First of all, thank you for your very thorough testing and most importantly, thank you for breaking it! :LOL:

I'm using the "EMM Computers/homebrew8088.com" mainboard. It has some decidedly non-5160 features (specifically, the keyboard controller is more of a modern AT-controller shoehorned into place) and is a semi-passive backplane design that can support different CPU cards. An 8237 is on an optional card for DMA, and does not handle DMA0, because the system is all SRAM and does not need refresh. Also, there are no DIP switches to guide configuration.

Curious, if there are no DIP switches on the board what happens if you IN port 62h (with bit 3 of 61h 1 or 0)? All 0's, all 1's?

If I use the card with a discrete 4.77MHz 8088 and friends, it boots up to the point where it would load an OS, but announces "Error 4200" DMA and KB INIT. This is not 1000% surprising based on the known hardware differences.

That definitely makes sense why it would report a DMA error if there is no DMA channel 0, as that is not a situation I had considered. So it doesn't have a DMA chip at all and you are using the Malinov floppy ROM for INT 13h, which supports your floppy/flash emulation hardware, right?

I added a DRAM_REFRESH build option that if you make it 0 it will turn off all memory refresh code. Maybe I could add an option to disable DMA altogether, though would have to think about that a bit since it'd leave the INT 13h floppy code totally broken (though if you have no DMA chip I guess it already is... hmm...).

I copied the shim code out of the BIOS normally used with this board, to wake up the keyboard controller, and it was able to boot up and get either error blocks of "DMA", "DMA" and "KB INIT" or "DMA", "KB INIT" and "KB Stuck". But you can now proceed to boot (at least a floppy).

I was able to get similar results with an V40-- with a strange caveat. I normally use a 20MHz CPU, clocked at 8MHz (16MHz crystal) and that will not boot. Black screen, no beeps. At 5MHz (10MHz crystal) or 7.5MHz (15MHz) it boots fine. With the BIOS I normally use, booting is no problem at much higher clocks than 8MHz-- it will at least POST even at 20 with enough wait states enabled. :) Not sure if there's something weird about it being a V40, or the timing just breaks down somewhere at 8MHz.

Great test case! The fastest "bare metal" I've been able to test is a vintage 8MHz V20, so that's exactly why I'm very interested to test on real faster hardware. The emulators I've used that have faster clock rates don't seem to emulate the chipset "quirks", rather they just speed up the simulation it seems.

Can you try this? Under "Enable/Disable POST tests", set all of the tests to 0 and build it again and see if it comes up. Then we can re-enable them one by one and see which is causing it to halt with black screen. I've pushed the other two fixes, though if you don't want to pull and re-merge your V40 code you'll need to change the "JMP SHORT INT_02_AFTER" to "JMP INT_02_AFTER" for it to assemble after you turn off all those POST tests (that's changed in the update I just made too).

Note: It is supposed beep code whichever test is failing, but perhaps it's failing too early or something with that board I'm not accounting for that is not allowing the beep to work. Does the BIOS beep at all? It should beep when POST is done, two short beeps if POST error and also when you ctrl-alt-del.

* The hard drive size detection is weird. It reported the drives as [24Mb (1024 16 63)] while those dimensions should be ~504Mb
That's an easy one -- I found the display bug and it's fixed (1024*16*63 doesn't fit in 16 bits, duh)! Funny, I'd never tested a drive larger than 33MB other than using a Malinov XT-IDE BIOS - which don't actually "POST" until INT 19 so they just aren't visible to the BIOS during on the post screen, thus I never saw one that was wrong. Another great test case - thank you!

* It looks like this requires your hard disc BIOS of choice to inject an INT19 handler, otherwise it's only going to try to boot from the first floppy.

So your CH375 BIOS doesn't actually hook INT 19, rather it just re-vectors INT 13 and expects the BIOS ROM to attempt boot at 80h? I hadn't encountered that in any adapters that I've tested but it makes sense. So the BIOS INT 19 should first attempt boot at drive 0h and failing that try again with 80h? I added a INT_19_BOOT_HD option (enabled by default) that implements that behavior now.

* My personal ROM map tends to put the Malinov floppy BIOS at F0000, the CH375/6 BIOS at F2000, and the XT-IDE BIOS at F4000, so I was surprised to note that the ROM scan ends below F4000. It might make sense to make that a define, like the Anonymous BIOS does, to take advantage of more precious high ROM space.

Makes total sense. For whatever reason I had explicitly written "start at 0C800H, end below 0F400H" so whatever source I had read must have been wrong or I misunderstood it - so yeah, F4000 should be included in the scan. Fixed! Great suggestion to add these are configurable options, did that too.

* Aesthetically, my CH375 BIOS dumps a lot of stuff on screen, and I think it messes up when the main BIOS wants to report its count of drives and sizes, throwing the layout off a bit. The Anonymous BIOS seems to initialize the option ROMs before displaying the self-test messages.

So how much stuff are we talking about? Possible to screenshot just so I know what we're dealing with?

Yeah, I defer the storage option scan as long as possible to 1) give a spinning HD as much time to boot as it can 2) wait to do any floppy drive checks in case floppy support is provided by a ROM (which in your case it is).

we might need to do something smarter to initialize the keyboard controller to prevent the keyboard error at boot, or maybe there's an over-sensitive detection code

Entirely possible it's just over-sensitive detection code and your system is just too fast for the timeout allotted. What's happening if that it's not receiving the interrupt back from the keyboard controller saying the reset was successful, though I'm not sure if that's because of the increased speed of your board or the shoehorned AT-controller, as you said. I'll increase the timeout a little bit and maybe try it again?

To clarify, did the error you saw say "KB Init" or "KB INT"? They are actually two different errors, though I can see now that they're a bit too similar -- I'll re-word one of them.

For the record, the "shim code" mentioned looks like this: I added it in the empty space, and JMP to it right after the POWER_ON label, and added an AFTER_V40 label after the jmp. In the original BIOS, it does more to preserve registers, and is done as a call, but at this point in time, I suspect we have no registers we care about and messing with the stack may not make sense at this moment in boot.

I can probably just add that as an ARCH option for build and have it conditionally included. Is that port range (FFFx) totally standard for the V40? Anything else I should know about the V40 too? :)

Again, thanks SO much for this very thorough testing. You threw some hardware at it that I'd never contemplated which was exactly what I'd hoped for! I've already fixed two bugs and have some new things to consider too.

I've updated the source with those fixes (called v0.1.1) so you can pull or merge if you want to try. Let me know and I'll keep going on it to make this work on this and hopefully other homebrews!

640KB
 
And that is quite simple to do: a program that activates all interrupts that on their turn are still connected to the BIOS. Therefore check the vectors first: if DOS has rerouted them, then you are not testing the BIOS but DOS.
In my opinion INT 13h, handling the floppy drive, and INT 10h, handling the video, are the most important. If they work, even testing them on an emulator is fine enough, and you can boot and have a prompt, then you can start writing and testing programs that dig deeper into your BIOS.

Yeah, I wrote some little test programs, especially for video to try to hit the more edge cases such as scrolling a partial window, drawing pixels using the BIOS (nobody in their right mind would do that) to try to see if I could shake loose some kind of goofy behavior. Ultimately I've sort of got to the point where I've tried many of the test cases I can think of and would love to hit it with things that I haven't thought of.

I refitted a board with SRAM instead of DRAM: no refresh needed and single-stepping is no problem any more. But that also means that I can drop the refresh part in the BIOS and save some bytes for other goodies.

That's another great use case I hadn't considered. I just added a DRAM_REFRESH option that removes the DMA and timer setup code on build. Granted if you don't have a DMA controller at all (like the homebrew board above) the code won't actually be doing anything anyway, but in the case where you do have DMA but don't use DRAM then it'll save the bytes and the performance hit. Though of course, it's not like the bytes can be re-used since that hole won't be there for the other build types, unless there's a goodie that can be added that only applies to SRAM? Hmm!

Thanks!

640KB
 
That's another great use case I hadn't considered. I just added a DRAM_REFRESH option that removes the DMA and timer setup code on build. Granted if you don't have a DMA controller at all (like the homebrew board above) the code won't actually be doing anything anyway, but in the case where you do have DMA but don't use DRAM then it'll save the bytes and the performance hit.

Careful; this is scope creep. Is your project meant to be an IBM PC 5150/5160 BIOS replacement? Then all of the above non-IBM use cases shouldn't be in the BIOS (they'll never get used).

If your project is meant to be a generic PC BIOS replacement for clone PCs, then sure, add everything including the kitchen sink -- but you're going to have to expand to 16K, it won't all fit in 8K.

What is the intended scope of the BIOS?
 
Careful; this is scope creep. Is your project meant to be an IBM PC 5150/5160 BIOS replacement? Then all of the above non-IBM use cases shouldn't be in the BIOS (they'll never get used).

If your project is meant to be a generic PC BIOS replacement for clone PCs, then sure, add everything including the kitchen sink -- but you're going to have to expand to 16K, it won't all fit in 8K.

What is the intended scope of the BIOS?
Point well taken. The intended scope is meant to be for original PC, XT and "100%" clones. If it can be modified trivially to work with new hardware builds without sacrificing any of the original features, I'm open to the idea, but otherwise it needs to stay true to the original intention.

The feedback I'm getting loud and clear is that there are two features people really want to see which are 1) smooth CGA text scrolling 2) HD floppy drive support. Frankly I don't see #2 happening in 8K, however the next bunch of found and re-purposed bytes is going to be going towards #1 entirely. That's the next focus and the intention!
 
Curious, if there are no DIP switches on the board what happens if you IN port 62h (with bit 3 of 61h 1 or 0)? All 0's, all 1's?
From what I've heard, this is a bit of a strange point with the EMM boards-- they are perhaps not as obsessive about electrical termination as "real" products, so I've seen "unconnected" ports display unpredictable results-- sometimes you'd get different values with an 8088 card versus the V40 card. Reading port 62 produces 0x0E for me whether port 61 is 4C or 40. I think 0x0E or 0x0F on dead ports has been widely reported.

That definitely makes sense why it would report a DMA error if there is no DMA channel 0, as that is not a situation I had considered. So it doesn't have a DMA chip at all and you are using the Malinov floppy ROM for INT 13h, which supports your floppy/flash emulation hardware, right?
You can get an 8237 on a card for DMA purposes. By default it does not cover DMA channel 0, but does do the others. Floppy drives work fine with it. There's a jumper on the card to enable DMA 0 but it still seems to report a "DMA" error at boot.

The Anonymous BIOS tries to set up the DMA controller for refresh, but just passively ignores the fact this didn't actually enable refresh. It probably assumes "well, if no refresh happens, when we get to RAM check or parity later, it's gonna blow up and we'll know THEN" :) :) :)
Can you try this? Under "Enable/Disable POST tests", set all of the tests to 0 and build it again and see if it comes up. Then we can re-enable them one by one and see which is causing it to halt with black screen. I've pushed the other two fixes, though if you don't want to pull and re-merge your V40 code you'll need to change the "JMP SHORT INT_02_AFTER" to "JMP INT_02_AFTER" for it to assemble after you turn off all those POST tests (that's changed in the update I just made too).
I just fetched the 0.1.1 repo and added back the same shimming for now.

I turned off POST_TEST_DMA and it now boots at 8Mhz, and even at 14MHz. For some reason, at anything over 8MHz, many things are stable, but something tends to fire a NMI when you run TOPBENCH. This happens with the other BIOS too. Yours fails with a "tries to reboot, in a weird graphic mode, and freezes at 192k" error, but at that point we're outside "expected to work" territory-- the other BIOS is equally stupid, throwing up a nonsense "Parity error at 00000" message despite the system not being equipped with parity.

Looking at the code, it seems like if the WB_TEST process fails, it tries to jump to WB_TEST_DONE, but there's no return there. It's just marked an ENDP, then "116 bytes empty space" followed by the INT12 handler. In my code, I have the "initialize V40 and keyboard controller" stuff there, and that jumps back to the top of the boot process; I could see this causing an endless loop if the test failed.

Adding a "RET" after WB_TEST_DONE makes it behave how you'd "expect" -- the DMA test fails with an endless loop of two short, four long beeps. I think it booted normally at 7.5MHz still. I did see at least one reboot where it hung, but that was before adding the RET-- maybe the 7.5MHz setup fails a small percent of the time.
That's an easy one -- I found the display bug and it's fixed (1024*16*63 doesn't fit in 16 bits, duh)! Funny, I'd never tested a drive larger than 33MB other than using a Malinov XT-IDE BIOS - which don't actually "POST" until INT 19 so they just aren't visible to the BIOS during on the post screen, thus I never saw one that was wrong. Another great test case - thank you!
Cool. Thanks.
So your CH375 BIOS doesn't actually hook INT 19, rather it just re-vectors INT 13 and expects the BIOS ROM to attempt boot at 80h? I hadn't encountered that in any adapters that I've tested but it makes sense. So the BIOS INT 19 should first attempt boot at drive 0h and failing that try again with 80h? I added a INT_19_BOOT_HD option (enabled by default) that implements that behavior now.
It *optionally* hooks INT 19 (compile-time option). Since the Anonymous BIOS already tries to boot from drive 80, I usually left it off. Of course, something like the XT-IDE BIOS also offers similar functionality. Not a big deal either way-- I suspect the norm on XT class machines may be to override INT 19.

Makes total sense. For whatever reason I had explicitly written "start at 0C800H, end below 0F400H" so whatever source I had read must have been wrong or I misunderstood it - so yeah, F4000 should be included in the scan. Fixed! Great suggestion to add these are configurable options, did that too.


So how much stuff are we talking about? Possible to screenshot just so I know what we're dealing with?
Well, I think it depends on the cards installed. It's completely cosmetic, but I don't know what most "real" drive controllers do. This is probably among the worst case scenarios, two chatty devices, to where the signature for the floppy BIOS rolled off the screeen. Maybe the simplest cleanup would be to draw the floppy/HDD count line after the option BIOSes complete, so they aren't trampling on the same line of the screen. The XT-IDE BIOS, by comparison, is silent at init-time and seems to do all its work during the actual-boot phase.
IMG_20220825_195129.jpg


To clarify, did the error you saw say "KB Init" or "KB INT"? They are actually two different errors, though I can see now that they're a bit too similar -- I'll re-word one of them.
Looks like KB INT. I seem to get it more on warm boots than cold, but I note the DMA error does not seem to occur on a warm boot. Key Stuck is pretty consistently there.

I can probably just add that as an ARCH option for build and have it conditionally included. Is that port range (FFFx) totally standard for the V40? Anything else I should know about the V40 too? :)
The V40 has configuration registers at FFFx, but the exact values are subject to change. The EMM board doesn't use all the V40 peripherals (notably, giving up on their DMA controller and serial port because it's not PC-like enough), and the wait-state mappings at 0xFFF5 and possibly what memory->wait state mappings at 0xFFF4 are subject to personal taste. The values I'm using now, FFF5=0x25 is are "0 WS for IO, 2 WS for memory over 640k, and 1 WS bvelow that". A more conservative default may be 0xFF (3 WS for everything) and then using a post-boot tool to dial in your preferences.

I can definitely understand the desire to treat this as a generic BIOS, especially early on. There's plenty of dragons to chase in this hardware. It's "north of Sanyo MBC-550, but south of Compaq Portable" levels of compatible, and it probably makes more sense to focus on more standard kit first, so we don't end up wrecking something for everyone else so one weird little hobby kit works better. :) On the other hand, maybe the "generic XT" you want to target is a bit of an envelope, and you want machines that bend the envelope. I figure, even if this only targets "100% compatible" machines, it's still valuable for my machine because perhaps it can be hammered into shape as a seperate branch, or used as a source of good ideas. At the least, I see some value in the idea of modular power-on tests, because you could build different options for testing known-incomplete machines. If you know the DMA controller is shot, it's helpful to be able to skip it just locking up on testing that, and move on to other things that could be erroring.

I will note at least one thing this BIOS does better than the Anonymous one-- it was able to autodetect my third serial port, and doesn't have some easily-spooked tests for game ports and clocks. (Since it has some noise on dead ports, these often mislead)
 
Last edited:
Careful; this is scope creep. Is your project meant to be an IBM PC 5150/5160 BIOS replacement? Then all of the above non-IBM use cases shouldn't be in the BIOS (they'll never get used).
If this is going to be a IBM BIOS replacement, then consider this: various vectors of the interrupts were always found at the same address. The best example: the far jump in the first BIOS found at F000:FFF0 in a IBM BIOS jumps to F000:E05B. Later BIOSes did the same. Many BIOSes of clones did the same as well. Many, not all. Same for the NMI vector: 0E2C3h.
The only reason I can think of using the same addresses is that early software used these vectors for some reason in a direct way. Stupid, but that is my opinion.

A year or two ago I tried an experiment where I removed all fixed addresses of my own BIOS (except 0FFF0h of course). Result: MS-DOS 6.22 hang somewhere in its starting sequence. I didn't research what the probable cause could be, I just replaced the vectors and that was it. Call me lazy (which I am), but it wasn't important enough for me: with the vectors I haven't run in any trouble in years.
 
This is very a very cool effort, I'm looking forward to take a look at the source as I've spent the last year or so skim reading the IBM 5150 BIOS and the PCjr BIOS while modifying Serges 8088_bios to work on my Xi8088 derived (almost) DMA-less, all-in-one PC the XTjr, and I'm v interested to see how you've gone about stuff. I might even try booting it on my machine just to see it freak out 😋

Update: I think I would agree with others that I'd keep this XT & compatible and not worry about weirdly beardy machines like mine. Maybe a fork or spin off future version could add more customisation/modularity for other mobo features...
 
Last edited:
Some continuing thoughts from my weird not-quite-compatible universe:

The on-screen reported "DMA" error-- not the beep-code/never-boots failure-- is set at point 27B in the code.

It's checking channel 0, and even with the "enable channel 0" jumper set on the DMA controller board, it doesn't pass. There is a high chance this was limited/not at all tested on the actual card and may never have worked as expected; I'm more than willing to blame the hardware here rather than your firmware.

For my purposes, I just put that test behind the same flag as the DMA register check in early POST.

The keyboard-related test failures (KB INT/Key Stuck) are almost certainly due to the "clever" nature of the mainboard design. Specifically, the keyboard-enable/disable line is not actually wired up on port 61, so it's probably causing tests that expect "if I disable the controller, things will behave a specific way" to not meet assertions (Beyond that, there are likely differences between an XT and AT style controller that add fun nuance). It does meet the minimum standard for working-- that being "by the time we reach the end of boot, I can press keys and stuff happens." I suspect your diagnostics are simply much more, well, *actually there*, than the ones in the Anonymous BIOS.

I'm eager to see what this becomes for "real" XT clone hardware, and either by then I'll have broken down and built something more compatible (I keep telling myself to build a Micro 8088), or forked this to remove the incompatible tests. :) It's definitely an impressive effort.

Interesting note: I always had problems with Sid Meier's Civilization freezing during world construction when using a V20 or V40 CPU and the Anonymous BIOS, but an 8088 worked fine. With this BIOS, it actually finished building the world and let me play. Surprisingly playable at 14MHz, a bit poky at 5MHz.
 
Back
Top