Genesis Pin Configuration Change in Master System Mode

For hardware talk only (please avoid ROM dumper stuff)
Post Reply
db-electronics
Very interested
Posts: 89
Joined: Mon Feb 24, 2014 6:04 pm
Location: Kapuskasing, Ontario, Canada
Contact:

Genesis Pin Configuration Change in Master System Mode

Post by db-electronics » Mon Mar 03, 2014 8:29 pm

When the Genesis is used in Master System mode (à la Power Base Converter), some of the Genesis signals are converted into signals which were once present on the Master System Cartridge port. I've already found (through the internet and through testing) the following:

Genesis -> Master System Mode
A23 -> Pause
A22 -> ? (tied to GND on Power Base Converter)
A21 -> ? (tied to +5V on Power Base Converter)
A20 -> ? (left open on Power Base Converter)
A19 -> nIORQ
A18 -> nCE
A17..A1 -> A16..A0

Has anybody ever come across a document, or found through experimentation, the function of A22, A21, A20 and/or other Genesis signals in Power Base Converter mode?
What does db stand for? Well that's an excellent question...
http://www.db-electronics.ca

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

Post by TmEE co.(TM) » Mon Mar 03, 2014 10:15 pm

Nobody knows what they do. It is in my todo list but I lack time.
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

db-electronics
Very interested
Posts: 89
Joined: Mon Feb 24, 2014 6:04 pm
Location: Kapuskasing, Ontario, Canada
Contact:

Post by db-electronics » Tue Mar 04, 2014 1:46 am

I'm going to experiment with those in the next few days. Clearly A21 and A22 are inputs...
What does db stand for? Well that's an excellent question...
http://www.db-electronics.ca

db-electronics
Very interested
Posts: 89
Joined: Mon Feb 24, 2014 6:04 pm
Location: Kapuskasing, Ontario, Canada
Contact:

Post by db-electronics » Tue Mar 04, 2014 3:05 am

Here's an interesting discovery:

nIORQ is not present on A19 on the model 2 Genesis. I wonder what else has been removed from the model 2 which we're not aware of yet...
What does db stand for? Well that's an excellent question...
http://www.db-electronics.ca

db-electronics
Very interested
Posts: 89
Joined: Mon Feb 24, 2014 6:04 pm
Location: Kapuskasing, Ontario, Canada
Contact:

Post by db-electronics » Sat Mar 15, 2014 3:31 am

Correction:

The nIORQ signal is in fact present on the Model 2 Genesis, I have confirmed this by finally finding the time to put one under the oscilloscope this evening.

Hmmm, this has me baffled at bit. Why would the YM2413 detection work on a model 1 but not a model 2?
What does db stand for? Well that's an excellent question...
http://www.db-electronics.ca

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Sat Mar 15, 2014 9:13 am

My guess would be that, since YM2413 detection is done by reading Z80 ports at addresses that are normally mapped to I/O chip, both could be trying to drive the data bus and there might be different behavior depending on the console model and what it does when reading ports $F0-$F3.

I am not sure if port $3E is fully functional in the Mega Drive and if you can disable I/O chip from software (which is what most Master System games that support FM attempt to do before detection) but I doubt it is possible (there is no input anywhere either to disable it through hardware like it is possible on Mark III or Master System).

There are still a lot of things to discover about Master System compatibility mode on the Mega Drive.

db-electronics
Very interested
Posts: 89
Joined: Mon Feb 24, 2014 6:04 pm
Location: Kapuskasing, Ontario, Canada
Contact:

Post by db-electronics » Sat Mar 15, 2014 2:46 pm

That's actually a very good theory. I'm going to compare the databus values of all my Genesis models with a logic analyzer (as soon as I get my hands on one) during YM2413 and will post the results.
What does db stand for? Well that's an excellent question...
http://www.db-electronics.ca

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

Post by TmEE co.(TM) » Sat Mar 15, 2014 4:06 pm

Neo Myth cart had no problems with SMS FM games, on my MD2. But that is all I can say as I no longer have the cart.
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

db-electronics
Very interested
Posts: 89
Joined: Mon Feb 24, 2014 6:04 pm
Location: Kapuskasing, Ontario, Canada
Contact:

Post by db-electronics » Sat Mar 15, 2014 4:36 pm

Thanks for the info Tiido, at least now I know that it can work!
What does db stand for? Well that's an excellent question...
http://www.db-electronics.ca

db-electronics
Very interested
Posts: 89
Joined: Mon Feb 24, 2014 6:04 pm
Location: Kapuskasing, Ontario, Canada
Contact:

Post by db-electronics » Sun Mar 16, 2014 2:43 am

I've discovered that the #RESET signal on cartridge port pin B27 is stuck to GND in Master System compatibility mode. When in Genesis mode, this pin sends an active-low reset pulse to the cartridge port when the Reset pushbutton is pressed.

Therefore, you can't rely on B27 for reset when in Master System compatibility...
What does db stand for? Well that's an excellent question...
http://www.db-electronics.ca

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

Post by Chilly Willy » Sun Mar 16, 2014 4:32 am

Here's a doc I found on detecting the 2413 in the SMS:

Code: Select all

FM Chip Detection
Notes:

    * This code requires memory address $c000 to contain the correct value to write to port $3e to enable the correct slot, RAM and controller inputs. This is ordinarily the case when running on any Master System with a BIOS.
    * The result is stored in a variable called HasFM. The code could be trivially changed to instead return the value in a register.
    * This code was taken from Phantasy Star.
    * Presumably the special bit patterns checked, and the value written to the chip at the end, are important for correct operation on a real Master System or Mark III. 

FMDetection:
    ld a,($c000)
    or $04             ; Disable I/O chip
    out ($3E),a
    ld bc $0700        ; Counter (7 -> b), plus 0 -> c
-:  ld a,b
    and $01
    out ($f2),a        ; Output data in the form %00000??1 FM chip lots of times
    ld e,a
    in a,($f2)
    and $07            ; Ignore high 5 bits,
    cp e               ; check low 3 are the same as what was written
    jr nz,+
    inc c              ; c = # of times the test was passed
+:  djnz -
    ld a,c
    cp $07             ; Check test was passed 7 times out of 7
    jr z,+
    xor a              ; If not, result is 0
+:  and $01            ; If so, result is 1
    out ($f2),a        ; Output result to FM chip
    ld (HasFM),a       ; Store result in HasFM
    ld a,($c000)
    out ($3e),a        ; Turn I/O chip back on
    ret
Note that you have to turn the IO chip off to check for the FM chip because otherwise all reads will be from the IO chip. After detection, the IO can be left on because the IO is read only and the FM is write only. Also note that the code counts on the BIOS in the SMS setting $C000 to the IO value needed for the slot or cart (whichever is active). If you know you're a cart, you can just hardcode the value output to $3E to turn the IO chip back on. Finally, note how multiple tests for the FM are done. Just one test won't always work.

db-electronics
Very interested
Posts: 89
Joined: Mon Feb 24, 2014 6:04 pm
Location: Kapuskasing, Ontario, Canada
Contact:

Post by db-electronics » Sun Mar 16, 2014 4:57 am

Thanks for bringing this info Chilly Willy. I have already hard-coded a small Z80 program in my VHDL code to initialize the Z80 stack and enable/disable the FM based on joypad input. I will try to init RAM location $C000 and see how that goes.

Code: Select all

   -- Array containing ROM of db PBCFM init code 
   --;************************************************************* 
   --; Boot section 
   --;************************************************************* 
   --    ld    sp, $dff2    ; setup stack pointer to point to DFF0 after reset 
   --    ld    b, $00       ; clear b as iteration counter = 256 
   ---:  in    a,(IOPortA)  ; read joypad 
   --    bit   0,a          ; check if up is pressed 
   --    jr    nz,+         ; if 1, reset and leave FM sound enabled 
   --    djnz  -            ; must read 256 times as 0 to disable FM sound 
   --    nop                ; nop, hardware will disable the FM chip if this opcode is read 
   --+:  rst $00            ; reset, nWR signal will disable this small BIOS and enable the game to boot 
   type dbROM_t is array (0 to 15) of std_logic_vector(7 downto 0); 
   constant dbBootROM : dbROM_t := 
                  (x"31",x"f2",x"df",x"06",x"00",x"db",x"dc",x"cb", 
                   x"47",x"20",x"03",x"10",x"f8",x"00",x"c7",x"00"); 
What does db stand for? Well that's an excellent question...
http://www.db-electronics.ca

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Sun Mar 16, 2014 10:16 am

db-electronics wrote:I've discovered that the #RESET signal on cartridge port pin B27 is stuck to GND in Master System compatibility mode. When in Genesis mode, this pin sends an active-low reset pulse to the cartridge port when the Reset pushbutton is pressed.

Therefore, you can't rely on B27 for reset when in Master System compatibility...
that's because this pin is 68k /RESET line (/VRES), which is indeed forced low in MS compatibility mode so that 68k remains inactive

RESET button is tied to /WRES signal which is internal to the console (in early model 1 schematics, it only goes to Bus Arbiter).
In MD mode, it resets 68k, Z80 and YM2612 (through /VRES and /ZRES).
In MS compatibility mode, /VRES is kept low and Z80 is apparently still resetted (which is different from how soft reset works on a real MS)

Post Reply