• Please review our updated Terms and Rules here

IBM 5160 BIOS Compile Error

NicolasF

Experienced Member
Joined
Jun 28, 2006
Messages
255
Location
Argentina
Hi, I would like to have a compilable source code for the IBM XT just to learn about the XT's original BIOS and also to learn more about the XT's arquitecture. The first thing I did was to try to OCR the source code from the IBM Technical Reference Manuals, but unfortunatly the source code looked really bad and it had thousands of mistaked which I had to correct them manually and it would take forever. So I tried to find any plain text source for the BIOS and found this one:

http://www.iee.et.tu-dresden.de/~kc-club/DOWNLOAD/DISK401/ROMBIOS.ALL

That code is missing the equates, so I decided to copy them by hand from the "IBM 5160 Technical Reference" (Apendix A-2 to A-5). It also seemed like someone made some simple modifications to the source but I tried to remove them to make it look just like the one in the book. I'm not sure which compiler to use to compile this, I'm guessing they used MASM maybe?? so I downloaded MASM 3, 4 and 6. When I try to compile it with any of them I'm getting this message:

"BIOS.ASM(623) : error 39: One operand must be const"

Line 623 has the following code: "MOV DATA_WORD[OFFSET EQUIP_FLAG],AX" just like the Technical Manual, but the code from the website has "MOV DATA_WORD[EQUIP_FLAG-DATA_BASE],AX" I could not find "DATA_BASE" anywhere. I'll attach the source file in case anyone wants to take a look at it.

Does anyone have any idea what the problem might be?
 
MASM 3 wasn't out yet when the 5150 or 5160 BIOS was done--and the early x86 Microsoft assemblers were terribly buggy. It could well have been the Intel assembler for ISIS-II or iRMX. It would make sense, as the MDS does have a PROM programmer option. It could also have been a cross-assembler.

The title lines at the top of each listing page might offer a hint.
 
I thougth they used MASM because in the Technical Reference manual under "suggested reading" it says "MACRO Assembler for the IBM Personal Computer"
 
It seems like DATA_BASE is a way of being able to relocate where the bios data area is allocated without changing a lot of code.
the equipment flag is always located at 40:10 (or 0:410) so depending on what the value for EQUIP_FLAG is, I have a hunch that DATA_BASE is probably 0.
 
Well, if you go to the 5150 BIOS listing, line 61, you'll see that DATA_WORD is defined as a word label in the BIOS data segment. Its value is 400H.

Why don't I think the IBM BIOS was first assembled with the Microsoft Macro Assembler? The copyright date for MASM 1.0 is 1981 and it's a piece of garbage. There was a lot of venting that IBM actually had the nerve to charge for something that bad, when DRI tossed in their assembler for free in CP/M and other products. Even in Mitch Waite and Chris Morgan's 1981 book about the 8088 (the IBM "Acorn" PC is given a light treatment) uses Microsoft's XMACRO88 as its assembler, which is nothing like MASM--(uses different syntax and mnemonics).

SCP's 8086 assembler also used a different syntax.

Another data point is to look at the listing itself. The page headers are clearly added later and the listing itself appears to have been produced on a line printer--not exactly standard fare for an 8088. However, cross-assemblers for the Intel 8086 had existed (including a couple from Intel) since the introduction of the 8086 in 1979.
 
I've been looking at the source listing and it has the instruction code for MOV BP,DATA_WORD[OFFSET RESET_FLAG] which is 8B2E7204. 8B2E is the instruction code for MOV BP,mem16 so the 7204 has to be the memory location 0472H. It seems like the instruction is trying to move whatever value is in memory location 472H to the BP register, I have to find out what is the assembler instruction that does that.
 
RESET_FLAG (location 72h in the BIOS data segment) is used to indicate to the BIOS start-up code that no memory test is to be performed. If the system finds that this word is set to 1234H, memory testing at POST is bypassed. Typically, you'll see this set on a Ctrl-Alt-Delete "three finger salute".

Really, if you're trying to understand this, download and read the Phoenix guide to the PC BIOS.
 
An alternate route to getting source would be to run Sourcer with the BIOS option; it isn't nearly as good as the tech ref, but stands a good chance of being recompilable.

If the OP doesn't own an XT with which to do this, contact me and I can run it on my XT for you and send you the output (although it won't match the 5160 BIOS).
 
It's an automatic disassembler. It's nowhere near as good as IDA but it was helpful in many circumstances. Try ftp://ftp.oldskool.org/pub/misc/Software/Programming/SOURCER_OLD.ZIP for an old copy. On the machine you want a disassembly of the BIOS, run "RUNBIOSP.BAT", say yes to "run sourcer now?", and then hit "g" for GO. It should create a new file called BIOS.LST (or similar) with the listing.
 
Back
Top