Previous Thread
Next Thread
Print Thread
Page 1 of 14 1 2 3 13 14
#51908 07/25/09 03:23 AM
Joined: Jul 2009
Posts: 78
Ensjo Offline OP
Member
OP Offline
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.

Ensjo #52482 08/10/09 03:22 PM
Joined: Jul 2009
Posts: 78
Ensjo Offline OP
Member
OP Offline
Member
Joined: Jul 2009
Posts: 78
Current MC-1000 driver code:
http://git.redump.net/cgit.cgi/mess/tree/src/mess/drivers/mc1000.c

Info on MC-1000 to help the emulating process:
http://ensjo.wikispaces.com/MC-1000+on+JEMU

~~~~~

I'll try to interpret the code and then comment on it.

Ensjo #52489 08/10/09 05:20 PM
Joined: May 2009
Posts: 2,214
Likes: 382
J
Very Senior Member
Offline
Very Senior Member
J
Joined: May 2009
Posts: 2,214
Likes: 382
Originally Posted by Ensjo
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. smile

Joined: Jul 2009
Posts: 78
Ensjo Offline OP
Member
OP Offline
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. smile

Ensjo #52493 08/10/09 09:23 PM
Joined: May 2009
Posts: 2,214
Likes: 382
J
Very Senior Member
Offline
Very Senior Member
J
Joined: May 2009
Posts: 2,214
Likes: 382
Originally Posted by Ensjo
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. smile

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. smile

Ensjo #52498 08/11/09 03:03 AM
Joined: Oct 2006
Posts: 1,017
Likes: 21
S
Very Senior Member
Offline
Very Senior Member
S
Joined: Oct 2006
Posts: 1,017
Likes: 21
Originally Posted by Ensjo
Someone REALLY should set up a M.E.S.S. programming tutorial somewhere. smile

Good stuff (hopefully not too outdated) on MAMEDEV Wiki:
http://mamedev.org/devwiki/index.php/How_MAME_Works

See also Programming Docs:
http://mess.redump.net/#documentation

There'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.aspx
From 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
Ensjo Offline OP
Member
OP Offline
Member
Joined: Jul 2009
Posts: 78
Originally Posted by Just Desserts
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?

Ensjo #52579 08/12/09 05:51 PM
Joined: May 2009
Posts: 2,214
Likes: 382
J
Very Senior Member
Offline
Very Senior Member
J
Joined: May 2009
Posts: 2,214
Likes: 382
Originally Posted by Ensjo
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.


Originally Posted by Ensjo
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
C
Senior Member
Offline
Senior Member
C
Joined: Feb 2005
Posts: 449
Originally Posted by Just Desserts
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 smile

Curt Coder #52626 08/13/09 11:35 AM
Joined: Jul 2009
Posts: 78
Ensjo Offline OP
Member
OP Offline
Member
Joined: Jul 2009
Posts: 78
Originally Posted by Curt Coder
[...] I just wanted to see it boot smile

Hey, Curt... I downloaded MESS and run MC-1000... All I got was a black screen. Did you really see it boot? confused

Page 1 of 14 1 2 3 13 14

Link Copied to Clipboard
Who's Online Now
2 members (Waremonger, Heihachi_73), 230 guests, and 1 robot.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,320
Posts121,929
Members5,074
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com