-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
MCS48 RESET #12916
Comments
MAME's scheduler should not run a device that's held in reset. It's not up to the CPU core itself. |
So this is an issue with segausb.cpp or sega80v.cpp? |
What is the issue you're seeing, exactly? |
Put simply, the i8035 continues to retrieve and execute opcode while its reset is asserted. It's interesting that some MCUs specifically do not run op codes when held in reset. So I was thinking that adding something like that to the mcs48 driver would have been a fix. e.g. In the case of the Sega universal sound board, the i8035 runs from RAM loaded by the Z80. The universal sound board uses the msb of its control line to assert both nRESET and nLOAD. nLOAD is implemented correctly in the segausb.cpp driver. However, while that's asserted, you can see in the debug logs it's executing garbage at system boot and while the RAM is being reloaded by the Z80 on occasion. This is probably not very noticeable since the factory Sega Z80 code is usually performing several sequential resets and additionally foul sounding outputs could be hidden by the way the audio analog switches are emulated. Since I'm writing Z80 code from scratch for the system it's easily noticed. |
That doesn’t make sense. One of the issues I’ve encountered in MAME is that the 4004 and 4040 taking multiple cycles to clear internal dynamic registers on reset can’t be emulated precisely because the execute loop isn’t called while the reset line is asserted. The framework assumes reset happens instantaneously and the CPU does nothing as long as reset is asserted. |
segausb.cpp reset line is over here: https://github.com/mamedev/mame/blob/master/src/mame/sega/segausb.cpp#L220 Which game are you seeing issues with? I tried Tacscan and it's not misbehaving. If it's a homebrew ROM*, make sure to not write 0 to port 0x38 (0x3f in tacscan) until the i8035 program area is filled. |
I'm testing with Star Trek, and it's 0x3F as well. The factory ROMs quite often write 0xFF, load USB_RAM, then write 0x7F. If you look at the schematic, you'll see that the MSB is supposed to reset and assert the RAM load latch. SegaUSB is implementing it as a single shot; it lets the 8035 run while it's being reloaded. I have no idea why the emulation seems to work well enough anyway. I can only suspect changing the memory from under the 8035 while running would crash it and it reboots anyway. |
This doesn't apply to Star Trek though? Speech MCU has a ROM, not RAM, so the main CPU doesn't need to stall the MCU. |
Correct, The Universal Sound Board and the Speech board both have 8035s. The USB runs from RAM that's written and most importantly re-written during operation. Not the case for the speech board. I've made a fork and will propose a patch for review. |
Are you using the newest and unmodified version of MAME? device_reset: MAME holds mcu in reset, MCU is not running. |
Other than printfs, it's pretty much head-master. that device_reset is single shot, not held. MCS48 is fetching opcodes and running while P1 write = FF.
...
|
At the start: If it was the 1st one with the bug you're describing, it would printf: The 1st MCU starts later: |
I've been investigating some oddities with the Sega G80 Universal Sound board emulation.
It's interesting that the I8035 is allowed to run even while it's being held in reset. Is this an oversight or typical for MAME?
https://github.com/mamedev/mame/blame/324cdb96e05cb09a439b21ff267c713a806ba9dc/src/devices/cpu/mcs48/mcs48.cpp#L1355C2-L1355C2
The text was updated successfully, but these errors were encountered: