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

Joined: Mar 2001
Posts: 16,807
Likes: 32
R
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,807
Likes: 32
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.

Joined: Dec 2011
Posts: 43
F
friol Offline OP
Member
OP Offline
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

Joined: Mar 2001
Posts: 16,807
Likes: 32
R
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,807
Likes: 32
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.

Joined: Aug 2009
Posts: 1,142
Likes: 3
Very Senior Member
Offline
Very Senior Member
Joined: Aug 2009
Posts: 1,142
Likes: 3
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.

Joined: Dec 2011
Posts: 43
F
friol Offline OP
Member
OP Offline
Member
F
Joined: Dec 2011
Posts: 43
Here it is.

Joined: Dec 2011
Posts: 43
F
friol Offline OP
Member
OP Offline
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.

Joined: Aug 2009
Posts: 1,142
Likes: 3
Very Senior Member
Offline
Very Senior Member
Joined: Aug 2009
Posts: 1,142
Likes: 3
According to that I don't think you're bankswitching 0x0000-0x0fff properly.

Joined: Dec 2011
Posts: 43
F
friol Offline OP
Member
OP Offline
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".

Joined: Apr 2004
Posts: 1,555
J
Very Senior Member
Offline
Very Senior Member
J
Joined: Apr 2004
Posts: 1,555
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

Link Copied to Clipboard
Who's Online Now
3 members (R. Belmont, 2 invisible), 30 guests, and 6 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,974
Posts117,891
Members5,001
Most Online890
Jan 17th, 2020
Forum Host
These forums are hosted by www.retrogamesformac.com
Forum hosted by www.retrogamesformac.com