-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved memory handling for 68K co-pro #212
Comments
A pull request is a fine way seeing the changes. I did just have a quick look and there is a need to deal with the ROM at the top of the address space - I don't know how that is decoded on real hardware. I am also not sure there is any one authoritative version of the hardware but having b-em support CiscOS seems like a useful goal. We could make the memory size a config file parameter - it is allocated with malloc rather than static so allocation would probably be done after the config file has been written but don't wait for that one. I can always do that if you want. |
I've submitted a pull request. I don't know if the original hardware that CiscOS ran on was ever made public. The images of it show that it used a 68008 and had a different memory map (according to the CiscOS source code). So, having it run under b-em without those hardware limitations seems like a good thing to me. The code currently emulates a 68020 which gives access to the full 4GB address space. I'm OK with the memory size being a parameter. Maybe that change goes along with having the available co-pro models and ROM versions in the config file as mentioned in the Z80 discussion? Would any of the other co-processors benefit from having a configurable memory size? I think 8192K is probably a good default for the 68K co-pro RAM size. The code in CiscOS to determine the CPU type doesn't appear to work with the b-em 680x0 emulation, AFAIK it's only purpose is to set the CPU string in the startup banner. If I get time, I'll see if I can work out why it's not working. Update on the last point. The address/bus error stack frame is only implemented in Musashi for the 68000 and I'm not sure that the code in CiscOS gets that correct. The 68000 documentation says that the CPU saves 7 words (14 bytes) of information to the stack, which ties up with the code in Musashi. However, CiscOS is looking for 18 bytes, so it fails. As Musashi doesn't have any code for anything other than the 680000, the other checks are destined to fail. |
Are you running a more recent version of CiscOS than the ROM bundled with b-em? Also see: https://github.com/stardot/b-em/tree/sf/tubecfg which has the changes to define tube models in the config file. |
I'm running version 2.03 of CiscOS which is the from the most recent source code I can find for it. I couldn't assemble the 2.03 source code though, so I converted it to vasm format and used that to assemble it. I also changed the version string to 2.04 so I could tell the difference. b-em has version 2.02 bundled with it. If you want a more up to date version, I can send my build of it your way. I'll take a look at the tubecfg branch, thanks. |
It would probably be useful to have a copy of what you're running. I did a bit of searching and found a forum post https://stardot.org.uk/forums/viewtopic.php?p=248915#p248915 where I had discovered I could assemble some version of CiscOS with vasm. I also found a copy on my PC that claims to be 2.03, in the sense that the filename is CiscoOs203.asm, but which still has the version string in the file set to 2.02. The reason for querying this is that anything I have tried to run reports the memory size as 3072K regardless of what I configure the size to be, so I am trying to get to the bottom of whether I have broken something or just that the code to test the amount of memory is new. |
I have found the issue: there is a constant for the maximum amount of memory the checkramsize routine will scan and it was set too low to check to the end of the memory sizes I was trying. |
Ah yes, I changed that when I was playing around getting it to build:
There are two small fixes in the 2.03 version that aren't in the 2.02 version:
I'd recommend updating the version string to 2.03 and using that version with b-em. Maybe use the current date for the build date string? I've been trying to find out what the CiscOS license allows and doesn't allow. Unfortunately, the text is contradictory. There are a number of bugs in 2.03 that it would be good to fix. |
Thanks. I am getting some warnings from vasm:
As far as I can see, the first warning is that MOVEQ will sign-extend the 8-bit value loaded so that will leave the relevant register set to 0xffffffff not 0x000000ff. What I have not established is whether this is a bug or harmless in the context. |
I suspect that in the first two cases, it doesn't matter as the code following just moves a byte anyway:
The comment on the next two seems to imply that it is intended:
The call to OSBYTE seems wrong to me. It should be using MOVE.B not MOVEQ as it will be sign extended.
This does seem to be done correctly in other cases where the D0 value is > 127, so it was probably an oversight:
The last one seems wrong, but the call following is commented out:
Later, where it is used, the code is correct:
The auto align warning at the end could be mitigated by adding this before it:
|
Thanks. On why the CPU detection doesn't work, that is because the 68K emulation doesn't emulate the correct stack frame for the address exception. It does push something onto the stack and says it only works for 68000 but what is pushed doesn't match any of the stack sizes expected by the CPU detection code. There are comments in the relevant code to the effect that this bit of the emulation is not complete. |
Somewhere, I think, you asked about the new tube config sections. Running the tubecfg version should add some to .config/b-em/b-em.cfg but here is the extra one for the 68K:
For the boot ROM, you can also include a full path if you have built it out of tree, |
FYI, there is a photo here: |
Thanks for the configuration example. It seems that path is freed twice and causes an abend on the second one:
Here's the output from an LLDB session:
|
Oops, I will look at that - that may have been a merge mistake. Meanwhile, see https://stardot.org.uk/forums/viewtopic.php?t=27849 - it looks like checking for a stack frame of 18 bytes for the 68000 is a bug in CiscOS. |
Fix for the double-free pushed. |
I've been playing around with the 68K co-pro which is commented out by default. The CiscOS ROM determines the amount of installed memory as follows:
So it depends on the address decoding wrapping around, which b-em doesn't currently do.
I made some simple changes to b-em involving:
uint8_t data = mc68000_ram[addr % MC68000_RAM_SIZE];
And changing MC68000_RAM_SIZE to 0x800000 gives 8MB which is nice.
Going extreme and setting it to 0xFFFE0000 (the maximum value) gives:
I can create a pull request for my changes, but you may have a preferable way of doing it.
The text was updated successfully, but these errors were encountered: