Enable disable R800 without bios

Page 1/2
| 2

By Daemos

Paragon (2044)

Daemos's picture

31-01-2014, 20:58

Title says it all. Anyone knows what value to which ports can do this?

Login or register to post comments

By Daemos

Paragon (2044)

Daemos's picture

01-02-2014, 12:55

Thanks. Very cool documentation. One more question remains however:

If you switch back to Z80 from R800 mode. Will the Z80 start reading opcode from adress 0 again? and vice versa?

By ARTRAG

Enlighted (6923)

ARTRAG's picture

01-02-2014, 14:14

Yes.afaik there is no way to share any register between the two cpu

By NYYRIKKI

Enlighted (6016)

NYYRIKKI's picture

01-02-2014, 14:20

No, it will continue from same address the CPU was when it was used last time.

By gdx

Enlighted (6071)

gdx's picture

01-02-2014, 15:01

It is possible to switch the Z80 / R800 ROM mode anytime but the MSX Datapack vol.3 advises to put the R800 DRAM mode only during or just after the boot of MSX and keep this mode until next Reset or the shutdown.

By Daemos

Paragon (2044)

Daemos's picture

01-02-2014, 17:10

Quote:

Yes.afaik there is no way to share any register between the two cpu

If this is the truth. Then I say YES Smile Smile Smile

Quote:

No, it will continue from same address the CPU was when it was used last time.

If this is the truth I come with another question. How can I parse the PC into the other cpu? how can the bios do such a thing? is the Z80/R800 being jumped to a certain adress before the switch is done? if so. What is that adress?

If statement 1 is truth I can simply write a jump into adress 0. no Problemo.

in case of statement 2: I have to jump to a adress where the CPU will pickup the stuff later. Some kind of opcode parking spot.

By Daemos

Paragon (2044)

Daemos's picture

01-02-2014, 20:56

Well I just tested it and looks like NYYRIKKI is right. So this is how I have solved the issue for my code.

Basicly I created a parking spot for the cpu at adress 0

After doing some init things on the rom I switch to R800 rom mode which happens at the parking spot. So the parking spot looks like this:

cpuparkingspot:

  ;time to switch
  ld a,6 ;2
  out ($E4),a ;2
  ld a,%01000000 ;2 ;$0005
  out ($E5),a ;2


;adress 8 will hold the cpu

  nop ;1

;8 bytes

  jp cpureturn ;write into this adress

;write at $000A
lenghtcpuparkingspot: equ $ - cpuparkingspot 

I manupilate a few of the opcodes after init. Each time I switch cpu each cpu Z80 or R800 is parked on the nop spot at adress 8. So when I perform the switch the other CPU takes on from there. Offcourse before I jump to adress 0 I save all the register stack etc etc etc then pop all the values back.

Haven't tested it yet on the rest of the engine but the init part works. The Z80 deadstop works and the R800 picks up nicely in ROM mode from there. Time to implement this serious code into our little project Wink

EDIT: code implementation works like a charm. The switching between Z80 and R800 goes flawlesly. Thank you all for your helpfull responses.

By NYYRIKKI

Enlighted (6016)

NYYRIKKI's picture

01-02-2014, 23:42

Daemos wrote:
Quote:

No, it will continue from same address the CPU was when it was used last time.

If this is the truth I come with another question. How can I parse the PC into the other cpu?

I'm sorry, but you can't... You have to move PC on each CPU one at a time.

Quote:

how can the bios do such a thing? is the Z80/R800 being jumped to a certain adress before the switch is done? if so. What is that adress?

I have explained this all in the link ARTRAG posted. BIOS uses only one spot in CHGCPU routine where the unused CPU always waits. How ever you can park each of the CPUs to own addresses as well, if you like. This would be great way of implementing ie. music replayer that has it's own CPU & registers to use if the CPU change would not take as much time as it takes. Sad

By Daemos

Paragon (2044)

Daemos's picture

01-02-2014, 23:47

Thanks for your reply. I have the problem solved. The cpu parking zone trick works like a charm. I have even fixed the turbo led along. The implementation is flawless. The code that is suposed to run on Z80 looks perfect now Smile

I am now going for some sicker stuff now and see if I can pull that one off. I don't think so but the main goal has allready been reached.

By NYYRIKKI

Enlighted (6016)

NYYRIKKI's picture

02-02-2014, 00:01

Great. BTW if your program has any kind of exit-functionality, remember to park the processors back to BIOS routine as even software reset is not enough to do this for you.

Page 1/2
| 2