-
Hello everyone. I'm experimenting with my new imsai8080 replica. I dont't fully understand the configurations using "mpu-b(a) style bank switched rom" and the associated memory maps. My questions are a bit vague I'm afraid, but I'll try anyway. One of my first questions would be ; where do these ROMs come from ? For example the mpu-a rom ; who wrote them ? Is that an IMSAI product or card ? What was their "real life" equivalent in a real imsai8080 ? In real life, how would that have worked ? Does it just go in 0000H adress space replacing RAM there, and counting on the fact the processor start reading at 0000H ? My second question would be , what is exactly an "mpu-b style bank switching" ; for me "bank switch" usually implies that space is freed - but that doesn't sem to be the case here? What is switched ? Or is it the fact it switches between 256 bytes pages ? All in all, what exactly is that bank switching (that really seems to be at the core and the RAM and ROM system) I hope my question makes sense :) I've edited it multiple times to try to narrow down my question. thanks for your help ! |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 6 replies
-
There is a lot of documentation for the IMSAI. There is no way the High Nibble can summarize it all for you on his website. Google is your friend here. In the MAN: folder on the WebUI desktop you will find a PDF of the original IMSAI manual. There is a lot of good info here. MPU-B is the 8085 version of the IMSAI CPU Board. It supports bank switching, reading that section will help you understand band switching. A google search identifies several sources for the manual. One link is: Bank switching allows different memory blocks to be swapped in and out. On system start the ROM is active on the bus instead of the RAM at the same addresses (0xD800-0xFFFF has ROM active). The ROM contains the code necessary to boot from floppy. As CP/M is started the ROM is disabled and RAM is enabled at the same address space. The code that is in the ROMs was written by IMSAI. If you are trying to deposit into memory while CP/M is running you can't do that. The IMSAI needs to be stopped first. With it stopped you can then examine and deposit values into memory. To deposit at address 0x0000 there are several steps A test: You should end up with: Set A15...A0 to 0s (all down) If you did this correctly the Programmed Input switches now control the Programmed Output LEDs. ================== If you want to manually start CP/M you can do this. Power cycle the system (On the Front Panel PWR OFF then PWR ON) Above you reset the system; examined address 0xD800 setting the start address to 0xD800 then told the CPU to start running at that address. Hope this helps |
Beta Was this translation helpful? Give feedback.
-
Googling myself on the topic, I seem to have dug out the topic of "RST vector, interrupts", and the likes, and it also seem another chip than the 8080A is involved to explain why the cpu suddenly jumps some place else than 0000H (which is as I expected the stock bootstrap address for a 8080 and 8085, according to chatgpt). I imagine that the explanation is something like "the mpu B board has this or that chip working along with the 8085, inserting this other card in the S100 bus does this and that which triggers a new bootstrap address in place of 0000H, executing the ROM code". And the ROM we're all talking about was physically located on the MPU-B(a) board. Something like that :) Again the imsai8080 replica makes the user believe all that is easy - but switching from the 8080 with just RAM to the cpm with ROM and floppy would physically mean, back in the day, removing all the guts of the poor thing and switching boards. So really, I believe we're talking about two entirely different things when we switch from "full RAM 8080" to "ROM reading capable MPU-B". |
Beta Was this translation helpful? Give feedback.
-
I am replying with my current understanding of how the emulation works. Dave and or Udo may correct so look for that. You are correct the emulation is of a system with various cards installed. At the minimum in this config is the CPU, RAM cards, ROM card, I/O card and floppy controller card. Note that the ROM could be implemented on its own card or on the CPU card. Both were valid configurations. For the emulation it implements MPU-B bank switching however it doesn't emulate the 8085 CPU from that card. Some 3rd party CPU cards implemented MPU-B bank switching with a different CPU on the card. Sorry the docs differ. Let me try to explain - all values are in HEX: The 8080/Z-80 upon reset sets the PROGRAM COUNTER to 0000, Fetches the byte there and executes it. ROMs however in the IMSAI are in upper memory. So how can this work? Upon a power cycle or EXT.CLR of the system the memory map ends up looking as follows: MPU-A ROM at D800 So, a read from address 0x0000 will actually read the byte at 0xD800 and will get the first byte from the ROM. Let's look at the beginning of the boot ROM in its physical location (all values are in HEX): D800 3E LD A,40 After a power cycle or EXT.CLR the bank switching has the ROM active in the address space at D800 0000 3E LD A,40 Notice that these are identical to the contents at D800, this is because we are actually reading from D800 (the physical ROM). The hardware in the IMSAI is remapping 00xx to D8xx (shadows the ROM at 00xx), the CPU has no idea this is happening. The emulation faithfully emulates this behavior. What happens at system start looks like this. Notice where the address changes from 0006 to D810, this is where we moved from the shadow ROM to the physical ROM. 0000 3E LD A,40 ; Load the A register with 40 Now that we are running from the ROM (physical addresses D8xx) the code (or potentially hardware) will take care of disabling the shadow ROM so that RAM will occupy the 0000 block address space. From here the ROM proceeds to initialize the system then to boot CPM. Hope some of this makes sense? |
Beta Was this translation helpful? Give feedback.
-
It should be noted there were several ways to get an S100 machine booting from a ROM in high memory. |
Beta Was this translation helpful? Give feedback.
-
In my "Boot Switch Settings - V4.x.PDF" I can see the ROM settings aren't really clear. Let me try to explain. In the ROM matrix in the PDF you will see this:
The first 8 rows have to do with ROMs that are meant to be at address 0000H and would map those ROM into the system at address 0000H. These are NOT the IMSAI ROMs such as "mpu-a-rom.hex" and "mpu-a-vio-rom.hex" The next 8 rows have to do with the IMSAI ROMs such as "mpu-a-rom.hex" and "mpu-a-vio-rom.hex". In the diagram it states "ROM ADDR" which is meant to convey the actual address for the ROM. If you look at the CFG:->[MEMORY xx] section you can see how the ROM is mapped into the system (this is described in some detail below). With this hopefully understood lets move on to how the emulation is configured. I am assuming [MEMORY 1] as the memory map below. The Memory Map is set via the front panel switches as described on the High Nibbles web page at the URL in the summary section of this post.
Looking at the 3 arrows to the right you see "Down Down Up" or "0 0 1" which in binary is 1. This is how the emulation knows what [MEMORY xx] map to use, in this case [MEMORY 1] Your system may use [MEMORY 2] so it will look a little different from what I show below. [MEMORY 2] has a 2nd ROM loaded. In the WebUI open SYS: - You will see a Memory Map section, mine looks like:
Looking at this you can see the ROM that is loaded and its address range. If there was a 2nd ROM to be loaded you would also see it listed here. From the SYS: Window click the little [*] gear icon in the upper right. The CFG: window will open. In this window select "system.conf" and scroll down. You will find a section under [MEMORY 1] which looks like this (Using this one is set by the configuration word bits I just described above):
What do these lines mean?
Lets open "mpu-a-rom.hex" in a text editor; you will see rows of data like this:
This format is what's known as an "INTEL HEX FILE" format. Google for more info. Let me break it down quickly. The first row can be broken out like this, it is all in HEX:
You can ignore the 1st part ":20" In a previous message I listed the first few bytes we should find in the ROM:
If you compare the addresses in this and the data values in the HEX file you will see it matches. And in the WebUI in the SYS: , CFG: and "system.conf" sections you'll see some of this data as well. The emulation based on the settings described above will open up the HEX file "mpu-a-rom.hex" and will parse the contents. it will create a virtual ROM in the emulation starting at address D800H and will load the data into it. All of the setting described above are how the emulation knows to load this file. It will know this is a bankable ROM and cam be shadowed (PHANTOMed) to address 0000H In summary: The 4 bits in the ROM section of the configuration word determine which [MEMORY MAP] in SYS:->CFG:->[MEMORY xx] to use. The "Memory Map" section in SYS: makes this easier to read as it's in a more human readable form. Yeah, it's a lot to take in. |
Beta Was this translation helpful? Give feedback.
-
Hi @nbreeden2 ; Thanks for taking the time, Most of what you say is clear to me and if that's any relief I do have some experience with low level operation of CPUs, altough it's the first time I really try to dig into areas I've usually avoided. It seems those early computers basically fought with the fact all the Intel reset vectors (RST0-RST7) where very low in the address space, whereas certain software (you talk about cpm; maybe others ?) expect the lower space to be free. One last question ; the "shadowing" has to stop at some stage ; who does that , how and when ? Can this be reversed (the shadowing be put back) ? |
Beta Was this translation helpful? Give feedback.
-
There is a typo in the example code in the previous replies. I'm indicating a jump to D880 in some places when it actually is jumping to D810. Bank Switching / Shadow ROM are often controlled by bits on one or more I/O ports. I found this info for the MPU-B bank switching: A RESET will set the CPU to a knows state and start execution at 0000. With CPM loaded this becomes a soft start. In this state the Shadow isn't active. You can use the front panel to watch all this happen. This is how I actually determined there was Shadow ROM happening. I could examine the bytes at D800, looked for them at 0000 and found them there. I then booted CPM and STOPed the machine. From the front panel I could see that the bytes at D800 and 0000 were different which indicated the ROM had been switched out of the active address space. RESET didn't bring the ROM back onto the bus, RESET/RUN does a soft boot for CPM so this made sense. EXT.CLR however brought the ROM back into the address space and again I could see the ROM shadowed at 0000. EXT.CLR is External Clear so this makes sense to me. I then single stepped using the front panel to watch the code in ROM execute and could see when the address bus changed from 0006 to D810. Reset isn't the same as RST 0. Resetting the 8080/Z-80 results in getting the CPU back to a known state, fetching the instruction as address 0000 and executing it. RST 0 has a vector address in RAM. In the event of a RST 0 interrupt the system jumps to whatever address the RST 0 vector points at (where the handler is at). At https://obsolescence.wixsite.com/obsolescence/cpm-internals there is a decent description of how CPM boots, it doesn't 100% follow how I believe the IMSAI works but is very close. The CPM boot process will take care of setting up the RST vectors as needed. Debug typically uses RST 7. The other vectors are open for other uses. Some hardware might generate an interrupt when a byte is received on the UART, the particular build of CPM will need to be setup the interrupt vector. I don't believe the emulation as configured uses interrupts, instead polling is used to check for a byte received in the UART. Note that CPM is customized for different hardware, you have to write a BIOS for your specific hardware. CPM makes standard calls for disk I/O, serial I/O etc. There is a section in the CPM manuals that gets into how to write the BIOS. The code isn't really killing itself as you said. The emulation takes care of enabling shadow on power up or EXT.CLR. When the OUT to F3 happens the emulation or original hardware knows the code wants to disable the shadow function and does what it needs too to disable shadow. My guess is with Shadowing enabled the hardware (or emulated hardware) is adding D800 (probably ORing it) to the address the processor is asking for. Net result is the CPU asking for 0000, hardware adds D800, so the resulting address is D800. The CPU has no idea this is happening. When the out F3 occurs there looks to be a sequence the hardware uses to stop adding the D800 offset. Again the CPU has no idea this is happening. The net result is a clean handoff to the ROM at D800, the CPM boot loader being loaded into RAM then executed and CPM come up. As CPM starts it initializes memory as needed such as setting up the reset vectors, setting up UARTs etc. To close the loop here: Once the shadow function is disabled we now have ROM at D800 and RAM from 0000...D7FF. The code in the ROM reads the CPM boot loader from the floppy (drive 0, track zero, sector 0) someplace into RAM and passes control to it. This code most likely does the out F3 sequence to then disable to ROM resulting in RAM from 0000...FFFF (bank switches the ROM bank out / the RAM back in). The boot loader code then proceeds to bring CPM up. It's very possible I have some of the details wrong here but the sequence is going to result in a flow like I laid out above. You asked how to enable shadow, the MPU-B manual covers this. This also give insight into how port F3 controls shadowing. In this document
Later on we find:
So, we come back to the code:
We see the out F3 at address 0002/0003 - this starts the control command to disable the shadow so RAM will be in low memory. |
Beta Was this translation helpful? Give feedback.
-
This is all very interesting, Something that is important, I think, is that CP/M is really meant to be cross platform, so it provides a basic set of operations on various hardware. So it's more a driver than a ROM in the sense of Apple II roms for example, that are providing their own BIOS for hardware that never changes. So you end up with this convoluted process to load a platform agnostic driver in RAM from within a hardware agnostic platform, able to use ROM or not, located at misc places and misc sizes, that can bootstrap software thru misc medias, and then disappear. Your CPM PDF also talks about the currently selected drive byte, that should be something very easy to show with the CP-A panel and would make a great demonstration (for students, etc) of the CPA while running CP/M. |
Beta Was this translation helpful? Give feedback.
There is a typo in the example code in the previous replies. I'm indicating a jump to D880 in some places when it actually is jumping to D810.
Bank Switching / Shadow ROM are often controlled by bits on one or more I/O ports. I found this info for the MPU-B bank switching:
The address ranges that may be occupied by the MPU-B are 2K at 0000 or 4K at D000. The control I/O port is at F3.
If you look art the code snippets in my previous posts we can see an OUT to port F3 in the ROM.
A RESET will set the CPU to a knows state and start execution at 0000. With CPM loaded this becomes a soft start. In this state the Shadow isn't active.
The EXT.CLR front panel switch resets the IMSAI back to shad…