|
Joined: Jul 2009
Posts: 78
Member
|
OP
Member
Joined: Jul 2009
Posts: 78 |
I am Emerson Jos� Silveira da Costa <emerson.costa@gmail.com>, a Brazilian owner of a CCE MC-1000. I also have a wiki on this machine, and would love to see it fully implemented in MESS. I would like to help. I know some details of the hardware. I also know some C and could even code, if I had a tutorial on the files and functions that MESS uses.
|
|
|
|
Joined: May 2009
Posts: 2,214 Likes: 382
Very Senior Member
|
Very Senior Member
Joined: May 2009
Posts: 2,214 Likes: 382 |
I am Emerson Jos� Silveira da Costa <emerson.costa@gmail.com>, a Brazilian owner of a CCE MC-1000. I also have a wiki on this machine, and would love to see it fully implemented in MESS. I would like to help. I know some details of the hardware. I also know some C and could even code, if I had a tutorial on the files and functions that MESS uses. Some file-related advice: For the most part, the only files you'll need to deal with are in src/mess/, and possibly src/mame/machine/ and src/mame/includes/ for some peripheral chips. CPU-specific files are located in src/emu/cpu/, but that would be the only reason to venture into src/emu/ for any reason. If you have specific questions that you'd like to know more about, that would probably allow us to help you better.
|
|
|
|
Joined: Jul 2009
Posts: 78
Member
|
OP
Member
Joined: Jul 2009
Posts: 78 |
Well... for one, I see three memory-related code sections at mc1000.c... Memory Banking, Memory Maps and setup memory banking... I (still) don't get exactly the difference. Someone REALLY should set up a M.E.S.S. programming tutorial somewhere.
|
|
|
|
Joined: May 2009
Posts: 2,214 Likes: 382
Very Senior Member
|
Very Senior Member
Joined: May 2009
Posts: 2,214 Likes: 382 |
Well... for one, I see three memory-related code sections at mc1000.c... Memory Banking, Memory Maps and setup memory banking... I (still) don't get exactly the difference. Someone REALLY should set up a M.E.S.S. programming tutorial somewhere. First, Memory Maps are used to describe a range of addresses belonging to a CPU. In the case of the Z80, they can be Program addresses, or I/O addresses. Program addresses are typically used by things like ROM, RAM, video RAM, and some devices. I/O addresses are typically used for things like direct access to peripherals like audio / video chips, cassette interfaces, disk drives, keyboards, joysticks, and so on. Each entry in the memory map contains a starting address, an ending address, and a Read, Write, or Read + Write handler. The purpose of the handler is to handle reads and writes from those addresses. Memory banking is a technique that was used by some computers, game consoles, and arcade machines to expand the amount of memory that the CPU can use beyond the normal amount. This is accomplished by swapping different sections of RAM and ROM, or "banks", into the same address range at different times. If you need further explanation, don't hesitate to ask. Setting up memory banking is necessary in the MACHINE_RESET or MACHINE_START functions, because the emulated machine needs to know to what area of ROM or RAM a bank is pointing when it starts up. Again, if you need a more in-depth explanation, feel free to ask.
|
|
|
|
Joined: Oct 2006
Posts: 1,017 Likes: 21
Very Senior Member
|
Very Senior Member
Joined: Oct 2006
Posts: 1,017 Likes: 21 |
Someone REALLY should set up a M.E.S.S. programming tutorial somewhere. Good stuff (hopefully not too outdated) on MAMEDEV Wiki: http://mamedev.org/devwiki/index.php/How_MAME_WorksSee also Programming Docs: http://mess.redump.net/#documentationThere's another, much older, how-to made by... Brian McPhail? ... for some programming website, but I forgot when and where. I think it was around MAME 0.110-series. (Anyone remember?) [EDIT] Wow, I have a good memory - and I figured out the magical Google query: http://www.codeproject.com/KB/cpp/vcmame.aspxFrom 2003, so that would be MAME 0.72. Pretty outdated. There's also some REALLY old how-to's written by Dan Boris on how to do things like convert schematics into an arcade driver, but they date from 1998-1999 or so. http://www.atarihq.com/danb/emulation.shtml
Last edited by Stiletto; 08/11/09 03:14 AM.
|
|
|
|
Joined: Jul 2009
Posts: 78
Member
|
OP
Member
Joined: Jul 2009
Posts: 78 |
Memory Maps are used to describe a range of addresses belonging to a CPU. [...]
Memory banking is a technique [...] to expand the amount of memory that the CPU can use beyond the normal amount. This is accomplished by swapping different sections of RAM and ROM, or "banks", into the same address range at different times. I understand the concepts. I just don't get exactly what each section of code is doing. Tell me if I get it right: This section of code just defines the possible ranges of memory. (It neither allocates memory for the banks, nor sets which bank is active.) (Why does the range 0x2800~0x3fff is defined differently? It just says "AM_RAM", not "AM_RAMBANK(n)"? Is this how one defines a non-switchable range?) Then... this section of code under MACHINE_START defines the banks that can be active in each range of memory. (Is this where the memory is actually allocated for each bank? By the way, I don't see any memory allocation for the non-switchable range 0x2800~0x3fff above.) The banks that will be active are selected by means of the memory_set_bank() function call. Then comes the bankswitch function... I would expect it to use make a lot of memory_set_bank() function calls based on the state of the machine... but it calls a memory_install_readwrite8_handler() instead. What is the difference between both functions?
|
|
|
|
Joined: May 2009
Posts: 2,214 Likes: 382
Very Senior Member
|
Very Senior Member
Joined: May 2009
Posts: 2,214 Likes: 382 |
I understand the concepts. I just don't get exactly what each section of code is doing. Tell me if I get it right: This section of code just defines the possible ranges of memory. (It neither allocates memory for the banks, nor sets which bank is active.) (Why does the range 0x2800~0x3fff is defined differently? It just says "AM_RAM", not "AM_RAMBANK(n)"? Is this how one defines a non-switchable range?) Correct! Then... [url=http://git.redump.net/...ivers/mc1000.c#n356]this section of code under MACHINE_START defines the banks that can be active in each range of memory. (Is this where the memory is actually allocated for each bank? By the way, I don't see any memory allocation for the non-switchable range 0x2800~0x3fff above.)[/quote] Memory allocation for memory maps is handled entirely by the core. If you want to be able to access the storage area directly, supply an AM_BASE() parameter for that entry in the address map, like so: At the top of the file: static UINT8* ramarea; ... AM_RANGE(start, end) AM_RAM AM_BASE(&ramarea) When the driver is initialized, ramarea will be automatically updated to point to the internal memory region. The banks that will be active are selected by means of the memory_set_bank() function call. Then comes the bankswitch function... I would expect it to use make a lot of memory_set_bank() function calls based on the state of the machine... but it calls a memory_install_readwrite8_handler() instead. What is the difference between both functions? mc1000_bankswitch is called by the mc6847_attr_w and mc6845_ctrl_w write handlers. In mc1000_bankswitch, the majority of what it's doing is conditionally mapping or unmapping regions of memory depending on how much expansion memory is currently installed as well as what bank is being assigned to the MC6847 and MC6845 peripheral chips. The installed read/write functions for SMH_BANK(1) and SMH_BANK(2) never appear to change, though, so it might be a good idea to move line 42 and line 45 to a DRIVER_INIT function. There are plenty of examples of how to use DRIVER_INIT in various drivers.
|
|
|
|
Joined: Feb 2005
Posts: 449
Senior Member
|
Senior Member
Joined: Feb 2005
Posts: 449 |
The installed read/write functions for SMH_BANK(1) and SMH_BANK(2) never appear to change, though, so it might be a good idea to move line 42 and line 45 to a DRIVER_INIT function. There are plenty of examples of how to use DRIVER_INIT in various drivers. They can be placed in MACHINE_START just as well. I haven't gotten around to optimizing the driver yet, I just wanted to see it boot
|
|
|
|
Joined: Jul 2009
Posts: 78
Member
|
OP
Member
Joined: Jul 2009
Posts: 78 |
[...] I just wanted to see it boot Hey, Curt... I downloaded MESS and run MC-1000... All I got was a black screen. Did you really see it boot?
|
|
|
Forums9
Topics9,320
Posts121,929
Members5,074
|
Most Online1,283 Dec 21st, 2022
|
|
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!
|
|
|
|