MAMEWorld >> Programming
Previous thread Previous  View all threads Index   Next thread Next   Flat Mode Flat  

BigAlUK
MAME Fan
Reged: 09/28/18
Posts: 4
Send PM
IBM5150 Emulator Memory Issues
10/06/18 05:15 PM


This emulator isn't presently working in regard to memory mapping. Someone needs to take a long hard look at the IBM Technical Reference April 1983, plus not get confused between the motherboard switch settings for the old Rev.A board and the new Rev.B board.

I also have no idea what the guys were thinking when they set up the 5150 SW1-3 and SW1-4 DIP-switch menu subitems in MAME: What do these options mean? They make no sense, and should be driven by the same code that tries to set Sw2 switches according to chosen memory rather than altered directly by the user. Cloudy thinking at play here, I think.

The point is this: On a RevB system (1982 BIOS) or a RevA system (1982 BIOS again) or indeed on a older Pre-1983 machine (a RevA board and either of the 1981 BIOSs), the switches SW-3 and SW-4 should both be OFF (signal=1) as soon as the first 64KBytes is installed on the motherboard, whether that be 4 banks of 16K (RevA) or 1 bank of 64K (RevB). Thus if you have a 1982 BIOS, SW1-3 and SW1-4 should never change form being both off (the BIOS expects this and behaves accordingly - screwing up royally if it is not so).

For a pre-1982 BIOS, the SW1-3 and SW1-4 switches tell you how many 16KByte banks are installed. The BIOS effectively reads the switches as a binary number, adding one and multiplying by 16(K). Furthermore, a RevA system using either of the 1981 BIOSs will never read SW2-5. This is why you would never see a 1981 BIOS on a true original RevB board unless someone had been dicking around!

There's a good reason for not reading SW2-5. Back in 1981, IBM only supplied 32KByte and 64KByte ISA based memory cards. Consequently, the 5150 simply does not have enough slots to reach more than 512KBytes. By not reading SW2-5, the theoretical limit is 544KBytes, but that wasn't even physically obtainable at the time. This is also why PC DOS 1.0 misbehaves if you try an emulate more than 512KBytes - it wasn't expecting that to be possible! PC DOS 1.1 corrects this primarily because it expects the 1982 BIOS (but puts up with a 1981 BIOS).

I would suggest a major rework of the memory provision in the MAME IBM5150 emulator following the rules below:

  1. If the BIOS date is one of the two 1981 BIOSs, assume a RevA board. Thus memory can be 16k, 32K, 48K, 64K (and up to now SW1-3 & SW1-4 are counting in 16KByte-banks and SW2-1 to SW2-4 must all be ON (giving a count of 0000b), SW2-5 is ignored). Above this, SW2-1 to SW2-4 come into play, counting in steps of 32KBytes and SW1-3 and SW1-4 stay OFF, thus always representing the first 64K. The maximum you should allow in total is 512KBytes (not 544K), because there aren't enough ISA slots. Machines from 1981 were usually only fitted with 128K because of the cost of slots (only 5 ISA slots available, and you already need 1 each for a graphics card and a floppy controller. Too much memory means foregoing a serial, parallel or games adapter or two).
  2. The 1982 BIOS was written in such a way that it would not care whether a RevA or a RevB motherboard was in play. This means the RevA motherboards with a 1982 BIOS always left the factory with a full 64K installed and SW1-3 and SW1-4 switched off. Apart from that SW2-1 to SW2-5 are now used (still in 32K steps) to count up to the full 640KBytes.
  3. RevB boards were only ever fitted with the 1982 BIOS. Furthermore, whether they left the factory with 64K, 128K, 192K or 256K on the motherboard, SW1-3 and SW1-4 were always off - indicating at least 64K. SW2-1 to SW2-2 would then count up the other RAM on the motherboard first (still in 32K steps, but missing out every other step until 256K is accounted for). After that, you could use 32K, 64K or the new 64/256K ISA cards (the latter allowing 64,128,192 or 256). But SW2-1 to SW2-5 would now count in 32K steps all the way to 640K.
  4. So, as a backward check, for any RAM amount that is valid upon both the RevA and RevB systems, irrespective of BIOS, the SW1 and SW2 settings are identical. The BIOS cannot tell the difference between RevA and RevB. By DESIGN.
  5. Some amounts are invalid on 1981 BIOSs: the first 64K is in 16K steps, the rest is 32K steps, the max is 512K
  6. Some amounts are invalid on 1982 BIOSs: anything less than 64K is no-go, the first 256K is 64K banks (two 32K steps) on a RevB and 32K steps on a RevA. After 256K, it is all 32K steps up to the full 640K.
  7. Finally, in 1982 there was at least one third party card that provided up to 448K on a single card (it may have been banked in 64K or fully kitted, I'm not sure). But the point is that this card would have allowed a full 512K on a PC with a 1981 BIOS and only using a single ISA slot - which is very good news for emulators! Just how careful you need to be here is of course dependent on how seriously you take your emulation of ISA slots.
  8. And on a pre-emptive note, the 5161 ISA slot extension box wasn't available until 1983, and it required a 1982 BIOS anyway. Furthermore, it was both listed and sold with a pre-fitted 10MByte hard drive, and rarely (I suspect) without one. Whilst using it would help the 5-slot limit, that was with a 3-slot cost: Transmitter, Receiver and a hard drive. It would rarely have been bought just to allow more cards because, by 1983, the 3rd-party market was awash with multi-function cards.


I hope this is all helpful and look forward to being able to use MAME for my historic PC emulation collection. Not the least because as yet it is the only 5150 emulator that I could find that can emulate a 1983 IBM5150 machine with an 8087 coprocessor!

By the way, I couldn't get the tape drive to record anything but zeroes - but that's already on another thread.







Entire thread
Subject Posted by Posted on
* IBM5150 Emulator Memory Issues BigAlUK 10/06/18 05:15 PM
. * Re: IBM5150 Emulator Memory Issues MooglyGuy  10/06/18 06:45 PM
. * Re: IBM5150 Emulator Memory Issues BigAlUK  10/06/18 09:06 PM
. * Re: IBM5150 Emulator Memory Issues MooglyGuy  10/06/18 10:01 PM
. * Re: IBM5150 Emulator Memory Issues BigAlUK  10/06/18 10:51 PM

Extra information Permissions
Moderator:  Pi 
0 registered and 145 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 825