|
ForumsSega Master System / Mark III / Game GearSG-1000 / SC-3000 / SF-7000 / OMV |
Home - Forums - Games - Scans - Maps - Cheats - Credits Music - Videos - Development - Hacks - Translations - Homebrew |
Author | Message |
---|---|
|
Writing to bank N and speed reading ram or rom
Posted: Sun Mar 18, 2018 3:12 pm
|
Two questions i have made myself while finding Bugs
1.What happens if i write to ROM memory. I Suppose It does not happens nothing. Or it produces some Sort of exception debuggeable in emulicious? 2. Have changed the enemy allocation algorithm from reading directly from ROM bank, to make a copy to RAM (as i want to change It in Game) and read from RAM. Now the Game It seems faster! Maybe is faster the RAM reading than the ROM one? I am not doing bankswitching so this would not be the difference. Regards. |
|
|
Posted: Sun Mar 18, 2018 4:29 pm |
1. Why do you want to write to ROM?
2. The CPU reads from adresses. It doesn‘t care whether these are in RAM or in ROM. It takes the exact same number of cycles either way. Even if there was a difference due to the physical differences in memory types, you‘d have to do a lot of data reading to make a difference noticeable. What are you doing exactly? Maybe knowing more details can shed some light on the issue. |
|
|
Posted: Sun Mar 18, 2018 5:22 pm |
It was a bug.I was writing to an array on ROM. When changed the write to the copy on RAM everything go faster. It is a massively used function. Noticeably faster. Its strange. | |
|
Posted: Mon Mar 19, 2018 2:01 pm |
does the generated asm code was the same in both cases? I would say the speed shouldn't change... | |
|
Posted: Mon Mar 19, 2018 7:47 pm |
Writes to ROM don't do anything, unless Flash is used and it's !WE is wired up, then the memory will switch to programming mode if right stuff is written in it (and if code is running from the ROM it it'll crash). | |
|
Writing to bank N and speed reading ram or rom
Posted: Wed Mar 21, 2018 3:07 am
|
That's not entirely true. It depends on the hardware inserted into the cart or card slot.
For example, if a cart does not take into account the /RD line and uses the cart slot /CE for the chip /CE and the /EXM for chip /OE, then it will output data onto the data bus for any memory access, read or write, in the CPU address space 0x000 to 0x7FFF where the ROM is located. |
|
|
Posted: Wed Mar 21, 2018 9:45 am |
Right, all the 32 and 48KB things like SG-1000, SC-3000 and MyCard games. On those writes to ROM are harmful and can lead to damaged hardware. | |
|
Posted: Wed Mar 21, 2018 1:11 pm |
from a programmer's perspective, writing to ROM will silently fail (*) and will take the same CPU cycles than writing to RAM.
(*) CodeMaster's mapper writes to some ROM addresses to bankswitch. |
|