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

Re: Emulating the RM-380Z [Re: friol] #75556
12/22/11 04:17 PM
12/22/11 04:17 PM
Joined: Mar 2001
Posts: 15,988
USA
R
R. Belmont Offline
Very Senior Member
R. Belmont  Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 15,988
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.

Re: Emulating the RM-380Z [Re: friol] #75560
12/22/11 05:29 PM
12/22/11 05:29 PM
Joined: Dec 2011
Posts: 43
F
friol Offline OP
Member
friol  Offline OP
Member
F
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

Re: Emulating the RM-380Z [Re: friol] #75562
12/22/11 05:49 PM
12/22/11 05:49 PM
Joined: Mar 2001
Posts: 15,988
USA
R
R. Belmont Offline
Very Senior Member
R. Belmont  Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 15,988
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.

Re: Emulating the RM-380Z [Re: friol] #75563
12/22/11 05:50 PM
12/22/11 05:50 PM
Joined: Aug 2009
Posts: 1,138
Naples, Italy
Kale Offline
Very Senior Member
Kale  Offline
Very Senior Member
Joined: Aug 2009
Posts: 1,138
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.

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

Re: Emulating the RM-380Z [Re: friol] #75565
12/22/11 06:44 PM
12/22/11 06:44 PM
Joined: Dec 2011
Posts: 43
F
friol Offline OP
Member
friol  Offline OP
Member
F
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.

Re: Emulating the RM-380Z [Re: friol] #75566
12/22/11 07:10 PM
12/22/11 07:10 PM
Joined: Aug 2009
Posts: 1,138
Naples, Italy
Kale Offline
Very Senior Member
Kale  Offline
Very Senior Member
Joined: Aug 2009
Posts: 1,138
Naples, Italy
According to that I don't think you're bankswitching 0x0000-0x0fff properly.

Re: Emulating the RM-380Z [Re: friol] #75579
12/23/11 12:35 PM
12/23/11 12:35 PM
Joined: Dec 2011
Posts: 43
F
friol Offline OP
Member
friol  Offline OP
Member
F
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".

Re: Emulating the RM-380Z [Re: friol] #75581
12/23/11 12:53 PM
12/23/11 12:53 PM
Joined: Apr 2004
Posts: 1,553
J
judge Offline
Very Senior Member
judge  Offline
Very Senior Member
J
Joined: Apr 2004
Posts: 1,553
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
0 registered members (), 51 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Shout Box
Forum Statistics
Forums9
Topics8,566
Posts111,888
Members4,805
Most Online225
May 26th, 2014
Powered by UBB.threads™ PHP Forum Software 7.6.1.1
(Release build 20180111)
Page Time: 0.055s Queries: 15 (0.023s) Memory: 5.7231 MB (Peak: 5.9443 MB) Zlib enabled. Server Time: 2018-08-17 13:33:02 UTC