Previous Thread
Next Thread
Print Thread
Page 1 of 6 1 2 3 4 5 6
#75555 - 12/22/11 04:01 PM Emulating the RM-380Z  
Joined: Dec 2011
Posts: 43
friol Offline
Member
friol  Offline
Member

Joined: Dec 2011
Posts: 43
Hello ppl,
I want to start contributing to MESS with a basic RM-380Z driver I am preparing (RM-380Z is a system based on a Z80 CPU).

I'm already stuck with the code (the code strangely writes to ROM, jumps outside ROM area, etc.).

Where can I ask for help? (if someone wants to help) smile

Thanks

#75556 - 12/22/11 04:17 PM Re: Emulating the RM-380Z [Re: friol]  
Joined: Mar 2001
Posts: 15,851
R. Belmont Online content
R. Belmont  Online Content

Very Senior Member

Joined: Mar 2001
Posts: 15,851
USA
Generally if a CPU goes way wrong early it's because you don't have RAM mapped where it's trying to store the stack. Running with -oslog and stepping the Z80 in the built-in debugger will show accesses to things you don't have mapped.

#75560 - 12/22/11 05:29 PM Re: Emulating the RM-380Z [Re: friol]  
Joined: Dec 2011
Posts: 43
friol Offline
Member
friol  Offline
Member

Joined: Dec 2011
Posts: 43
It's not that simple.

I've stepped through the Z80 code many times and, assuming the ROM dump I have is correct, I think the memory map of the system is:

0x0000-0x0fff ROM or RAM (controlled by I/O port)
0xe000-0xefff ROM bank switched (same I/O port as before)
0xf000-0xffff RAM (the code writes here the SP)

My problems are:

1) the code jumps to $E083 in the early stages, so there must be ROM there

2) when in $E000 area, the code does a RST 30h "without" switching ROM back to 0x0000. This is not clear, since that means it's executing RAM (?) or...?

I can post the driver here, I know this is not 100% clear when explained with words...

Thanks

#75562 - 12/22/11 05:49 PM Re: Emulating the RM-380Z [Re: friol]  
Joined: Mar 2001
Posts: 15,851
R. Belmont Online content
R. Belmont  Online Content

Very Senior Member

Joined: Mar 2001
Posts: 15,851
USA
Well, executing from RAM is fine assuming they copy code into the RAM first, of course smile

In general if something goes horribly wrong executing from a banked area, I would suspect the wrong part of ROM is mapped into the bank window.

#75563 - 12/22/11 05:50 PM Re: Emulating the RM-380Z [Re: friol]  
Joined: Aug 2009
Posts: 1,136
Kale Offline
Very Senior Member
Kale  Offline
Very Senior Member

Joined: Aug 2009
Posts: 1,136
Naples, Italy
Do a trace file if you really want help.

trace <name_of_file>.txt,0

In debugger, and put a breakpoint to where the code goes to la-la-land.

#75564 - 12/22/11 06:43 PM Re: Emulating the RM-380Z [Re: friol]  
Joined: Dec 2011
Posts: 43
friol Offline
Member
friol  Offline
Member

Joined: Dec 2011
Posts: 43
Here it is.

#75565 - 12/22/11 06:44 PM Re: Emulating the RM-380Z [Re: friol]  
Joined: Dec 2011
Posts: 43
friol Offline
Member
friol  Offline
Member

Joined: Dec 2011
Posts: 43
R.Belmont: RM-380Z should be a simple system with just 4kb of rom (4kb banked), according to the documentation.

#75566 - 12/22/11 07:10 PM Re: Emulating the RM-380Z [Re: friol]  
Joined: Aug 2009
Posts: 1,136
Kale Offline
Very Senior Member
Kale  Offline
Very Senior Member

Joined: Aug 2009
Posts: 1,136
Naples, Italy
According to that I don't think you're bankswitching 0x0000-0x0fff properly.

#75579 - 12/23/11 12:35 PM Re: Emulating the RM-380Z [Re: friol]  
Joined: Dec 2011
Posts: 43
friol Offline
Member
friol  Offline
Member

Joined: Dec 2011
Posts: 43

I'm revising the way I do bank switching.

Meanwhile, what puzzles me is this code (it's at the beginning):

000B: ld a,$A3
000D: ld ($1BFC),a
0010: jp $E083

If the instruction at 0x000D switches the ROM bank to 0xe000, what is executed next? 0x0010 is RAM now.

The System Manual is not clear but maybe gives an hint:

"When the reset button is pressed, PAGE bit in PORT0 is used to map ROM from 0xe000 to 0x0000. This allows the COS rom to start up and then remap the system to its normal configuration. It has the minor side effect that RAM at 0x0010 to 0x0013 is altered by pressing the reset button".

#75581 - 12/23/11 12:53 PM Re: Emulating the RM-380Z [Re: friol]  
Joined: Apr 2004
Posts: 1,550
judge Online content
Very Senior Member
judge  Online Content
Very Senior Member

Joined: Apr 2004
Posts: 1,550
So, ROM is present at both 0x000 and 0xE000 when that bit is set/unset.
Any more hints in the manual regarding PORT0 and the PAGE bit?

Page 1 of 6 1 2 3 4 5 6

Who's Online Now
7 registered members (Roberto Fresca, EoceneMiacid, MarkBielman, remax, Edstrom, Dorando, 1 invisible), 30 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Shout Box
Forum Statistics
Forums9
Topics8,496
Posts110,806
Members4,781
Most Online225
May 26th, 2014
Powered by UBB.threads™ PHP Forum Software 7.6.0
Page Time: 0.066s Queries: 15 (0.022s) Memory: 5.0195 MB (Peak: 5.2677 MB) Zlib enabled. Server Time: 2018-02-22 16:33:57 UTC