Using 32x as a 3rd plane, possible?

Ask anything your want about the 32X Mushroom programming.

Moderator: BigEvilCorporation

Miquel
Very interested
Posts: 514
Joined: Sat Jul 30, 2016 12:33 am

Using 32x as a 3rd plane, possible?

Post by Miquel » Fri Apr 12, 2019 4:40 pm

1) What I want to do is:

- MD/Genesis works as you expect, as it is alone (no exception table differences, for example)
- if MD detects 32x:
-----> 32x is initialized, a program is uploaded along some graphics
-----> All 32x does it wait for a word (command) to display this or those other screen
- MD runs the main program as there was no 32x, but if there is, sends the appropriate command for this stage, changing the optional 3rd layer

Is that possible? Work alongside the 32x but without interfering a normal MD program in any way.

2) Could 32x do transparencies? For example to do shadows, that is, taking the MD-VPD output and making it darker on certain areas.
HELP. Spanish TVs are brain washing people to be hostile to me.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Re: Using 32x as a 3rd plane, possible?

Post by TmEE co.(TM) » Fri Apr 12, 2019 6:54 pm

32X output can only be above or below MD layer, it cannot do intermediates. Only way you could do some shadowing etc. is to render the output of MD itself on 32X side and apply whatever you want.

As far as other stuff goes, no, you cannot really do that. 32X changes the memory map drastically, at best you need a 2in1 game, one that works on vanilla MD and other that works as 32X game.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Miquel
Very interested
Posts: 514
Joined: Sat Jul 30, 2016 12:33 am

Re: Using 32x as a 3rd plane, possible?

Post by Miquel » Fri Apr 12, 2019 7:48 pm

TmEE co.(TM) wrote:
Fri Apr 12, 2019 6:54 pm
32X output can only be above or below MD layer, it cannot do intermediates. Only way you could do some shadowing etc. is to render the output of MD itself on 32X side and apply whatever you want.
I was thinking something like "Crusader of Centy"/"Solei" when the clouds obscure the scenario but are not visible themselves. Zelda for GBA also does that.
HELP. Spanish TVs are brain washing people to be hostile to me.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Re: Using 32x as a 3rd plane, possible?

Post by TmEE co.(TM) » Sat Apr 13, 2019 12:07 am

Soleil does checkerboard pattern which you could do on the 32X too, but you're not gonna get any real shadow/highlight type stuff without recreating the MD image on 32X side.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Miquel
Very interested
Posts: 514
Joined: Sat Jul 30, 2016 12:33 am

Re: Using 32x as a 3rd plane, possible?

Post by Miquel » Wed Apr 24, 2019 3:17 am

TmEE co.(TM) wrote:
Fri Apr 12, 2019 6:54 pm
As far as other stuff goes, no, you cannot really do that. 32X changes the memory map drastically, at best you need a 2in1 game, one that works on vanilla MD and other that works as 32X game.
I'm probably missing something because, after looking docs a little bit, the only thing I can see is the very first 0x100 bytes are reassigned, but everything else remains the same, even better: is possible to control 32x video (audio?) hardware from the 68K, so no need to code anything in SH2.

What am I missing?
HELP. Spanish TVs are brain washing people to be hostile to me.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Re: Using 32x as a 3rd plane, possible?

Post by TmEE co.(TM) » Wed Apr 24, 2019 3:29 am

When 32X is enabled the ROM is only in $880000 to $9FFFFF, the first 4MB no longer has ROM in it. See page 15 for more info : http://www.tmeeco.eu/SMD/32x_hardware_manual.pdf
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Using 32x as a 3rd plane, possible?

Post by Sik » Wed Apr 24, 2019 12:59 pm

Unless you set RV=1, in which case the 68000 mapping is mostly¹ restored (albeit the SH-2s won't be able to access cartridge area until RV becomes 0 again). Not useful if you want the SH-2s to access ROM tho.

¹The 68000 vectors keep pointing to the banked area so you still need to account for that, but at least it's easier to cope with the occasional case.
Sik is pronounced as "seek", not as "sick".

Miquel
Very interested
Posts: 514
Joined: Sat Jul 30, 2016 12:33 am

Re: Using 32x as a 3rd plane, possible?

Post by Miquel » Wed Apr 24, 2019 11:10 pm

Perfect! that’s exactly what I want. Now how to handle those moved vectors…
Last edited by Miquel on Wed Mar 18, 2020 8:53 pm, edited 1 time in total.
HELP. Spanish TVs are brain washing people to be hostile to me.

Miquel
Very interested
Posts: 514
Joined: Sat Jul 30, 2016 12:33 am

Re: Using 32x as a 3rd plane, possible?

Post by Miquel » Thu Apr 25, 2019 11:26 pm

My game now has a dual boot, MG/Genesis and s32X/Mars mode in one: it executes and passes ok the needed code on 0x400-0x800.
To my understanding, everything is exactly where I need it, the 68k has control of everything. Then the default mode is intended to be a mix mode, so why no game is designed to be compatible with both modes?

What I don’t know is if I need to write a program for the SH2 or them are in some sort or waiting state. How I put them to sleep? Is there a sleep command?
Last edited by Miquel on Wed Mar 18, 2020 8:52 pm, edited 1 time in total.
HELP. Spanish TVs are brain washing people to be hostile to me.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Re: Using 32x as a 3rd plane, possible?

Post by Chilly Willy » Fri Apr 26, 2019 2:37 pm

Yes, there is... it's called - "SLEEP". :wink:

SLEEP puts the SH2 in power down mode until an (enabled) interrupt arrives, which will wake the processor. Pretty standard stuff here. Oh, be sure you put the routine that sleeps in sdram as rom won't be available when RV = 0.

And no one made dual carts because they want people to have to buy separate carts if they want both versions. You make twice the money that way! :lol:

Miquel
Very interested
Posts: 514
Joined: Sat Jul 30, 2016 12:33 am

Re: Using 32x as a 3rd plane, possible?

Post by Miquel » Tue Apr 30, 2019 11:44 am

Roger Chilly Willy!

I expend some time reading SH2 and is pretty similar to 68k code, why Motorola didn’t do a pipelined version of the 68k then?

Anyway, the boot rom of the 32x at the end jumps at whatever is in 0x24000020, what happens if there is nothing written there?
The boot room first checks ram and the it clears it, so what is instruction 0x0000? Invalid opcode?

Another thing: is possible to force the slave cpu to only run CODE (not necessary data) from the cache only? I mean, seems the pretty obvious way to run at 100% performance.

I have accomplished to compile assembler code, but when I try with C code, bizarre results are obtained, let's see:

1) For the command:

Code: Select all

FLAGS32X := -m2 -mb -O6 -g -fomit-frame-pointer -Wall -Wextra -Wparentheses -Wno-unused -Wno-switch

bin/32x/sh-elf-gcc.exe $(FLAGS32X) -c $< -o $@ 
Result:

Code: Select all

 sh-elf-gcc.exe: Rock.mdp/main.c32: linker input file unused because linking not done 
True linkage is not done, but I didn't ask for it...??

2) The same command without the "-c" option:
Result:

Code: Select all

ld: unrecognised emulation mode: shelf
Does it mean can't compile sh2 code? because is the "sh-elf-gcc.exe" file for sure
HELP. Spanish TVs are brain washing people to be hostile to me.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Re: Using 32x as a 3rd plane, possible?

Post by TmEE co.(TM) » Tue Apr 30, 2019 2:18 pm

68040 and 68060 are the pipelined 68k series CPUs.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Re: Using 32x as a 3rd plane, possible?

Post by Chilly Willy » Tue Apr 30, 2019 4:19 pm

Anyway, the boot rom of the 32x at the end jumps at whatever is in 0x24000020, what happens if there is nothing written there?
I think you're misinterpreting the boot code. The boot code looks for a header in the rom that tells it things like where the data segment in the rom is, how big it is, where the vbr for each SH2 is, and a starting entry point. The header looks like this

Code: Select all

! Standard Mars Header at 0x3C0

        .ascii  "JagDoom32X      "              /* module name */
        .long   0x00000000                      /* version */
        .long   __text_end-0x02000000           /* Source (offset in ROM) */
        .long   0x00000000                      /* Destination (offset in SDRAM) */
        .long   __data_size                     /* Size */
        .long   master_start                    /* Master SH2 entry point */
        .long   slave_start                     /* Slave SH2 entry point */
        .long   master_vbr                      /* Master SH2 VBR */
        .long   slave_vbr                       /* Slave SH2 VBR */
The vbr tables are part of the data segment copied into sdram, and then the VBR in each SH2 is set, and then the starting entry is jumped to.

Miquel
Very interested
Posts: 514
Joined: Sat Jul 30, 2016 12:33 am

Re: Using 32x as a 3rd plane, possible?

Post by Miquel » Wed May 01, 2019 1:39 am

TmEE co.(TM) wrote:
Tue Apr 30, 2019 2:18 pm
68040 and 68060 are the pipelined 68k series CPUs.
And why end here? That bad was sales? Just around 1996 appeared plenty of cpus pushing speed around this concept
Chilly Willy wrote:
Tue Apr 30, 2019 4:19 pm
[...]
Yep, the boot room does this:

Code: Select all

org 0
	dc.l reset						; 0: POWER ON RESET PC

org 0x140
	reset:

org 0x2ea
	mov.l @(0x050, pc), r8				; 0x00000338, r8 = $24000018
	...
	mov.l @(0x008, r8), r10				; r10 = $24000020
	...
	jmp @r10

org 0x338
	dc.l $24000018
So if there is no sh2 code in the cartridge, it jumps to 0, since memory is cleared before, an it founds there a 0x00000140 value, since sh2, I believe, is big endian, it tries to execute instruction 0, and then instruction 0x140, whatever they are.

Conclusion: some sh2 code is needed even if you only want to stop/sleep it.
HELP. Spanish TVs are brain washing people to be hostile to me.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Re: Using 32x as a 3rd plane, possible?

Post by TmEE co.(TM) » Wed May 01, 2019 3:36 am

Motorola couldn't up the clocks and their chips started to lag behind others (intel, IBM etc.) who were getting faster and faster, their big flagship chips weren't competitive anymore and customers moved to new things. In the end they dropped 68k line and started doing PowerPC instead...
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Post Reply