Author Topic: HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?  (Read 1135 times)

elmer

  • Hero Member
  • *****
  • Posts: 2153
HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?
« on: October 27, 2015, 07:22:29 AM »
Has anyone done any experiments to see exactly how the HuCard slot's /CARD_DETECT line disables the built-in CD BIOS on the Duo/Duo-R/SuperCDROM?

Can it be changed at any time, or is it latched at power-on?

Is it the same mechanism that's used on all of the machines?

Does the 64KB of CD RAM in banks $80-$87 also get disabled?

Inquiring mind(s) need to know!   :wink:

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?
« Reply #1 on: October 27, 2015, 08:42:53 AM »
From what I know; the effective change happens immediately upon the change from the hucard side. Well, whatever the propagation delay is, but it should be faster than any bus cycle of the cpu.

 Only the lower 1megabyte range is changed; the upper range remains as is. The 64k in the upper range mapped by the original base CD system, is always there when attached. This allows Duos and SuperCDROM addon units access to the 64k when older system hucards are inserted (Bios 2.x and lower).

 A word of caution about CD ram in bank $80/87 range: don't use it for page #1. For some reason, it causes issues (wrong values being read).  Any of the memory from $68 to $7f is fine to map into page 1 (address $2000). I found this out when doing nes2pce stuffs. Otherwise, it works fine mapped anywhere else (including page #7 which houses the interrupt vectors).

 IIRC, this is how the later version GE cards work on Duo/SuperCD units - bus access to rom changes on the hucard -> the card changes the state of the hucard detect pin, otherwise when accessing banks $68-7f it disables the hucard allows access to that ram. This is for the later GE cards. Mednafen author would probably know more (I never had any GE cards to test myself).

 Also to note: there's open bus address ranges in the upper 1megabyte range. The Arcade card, both pro and duo, map in interface registers in the $1a00-1aff range (hardware bank #$FF). That's pretty convenient cause that bank is always mapped there. The reason they chose $1a00-ff range is interesting; maybe some hardware dev stuff had additional mapped things in around this address range as well.

 The arcade card also mapped stuff in lower banks $40-43. These are mirrored corresponding I/O ports per 8k bank. I suspected that on the Duo card, they used the hucard detect pin, but now that I think about it - that's probably open bus range as well ($40-$67).
« Last Edit: October 27, 2015, 09:32:04 AM by Bonknuts »

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?
« Reply #2 on: October 27, 2015, 09:17:43 AM »
Thanks, that's exactly what I wanted to know, and exactly what I hoped was going on.

That means that a 1MB-RAM HuCard is possible.  :D

thesteve

  • Hero Member
  • *****
  • Posts: 2952
Re: HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?
« Reply #3 on: October 27, 2015, 01:09:56 PM »
more than that the arcade card DUO doesnt use card detect, and does add a ram bank

ccovell

  • Hero Member
  • *****
  • Posts: 2245
Re: HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?
« Reply #4 on: October 27, 2015, 01:19:07 PM »
Super CD RAM ($68-7F) also needs to be unlocked before using it:

   lda   #$AA
   sta   $18C0
   lda   #$55
   sta   $18C0   ;Unlocks Super CD-RAM!

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?
« Reply #5 on: October 27, 2015, 03:14:32 PM »
The card calls EX_MEMOPEN first before writing those. Has anyone tested to see if reading from $18c5, $18c6, and $18c3 is required first?

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?
« Reply #6 on: October 27, 2015, 04:35:58 PM »
Super CD RAM ($68-7F) also needs to be unlocked before using it:

   lda   #$AA
   sta   $18C0
   lda   #$55
   sta   $18C0   ;Unlocks Super CD-RAM!

Does anyone have any idea why they've even put that "lockout" in there?

Are there any carts that don't activate CARD_DETECT, but do still actually put stuff into the 3rd-256KB region ($0c0000-$0fffff) that would cause a conflict?

Perhaps they were just "being safe"?

While I'm asking ... does anyone know of any carts or add-ons that have been mapped into the $140000-$17ffff or $180000-$1bffff 256KB regions?

Just for fun, I'm trying to figure out how to make the cheapest but practical 1MB-RAM card, and have found that it would only take one additional 12cent part to make it "stealthy" and have it activate when a specified 256KB region is written to.

Is there any reason that anyone can think of to avoid that being the "obvious" $80000-$bffff region and make it one of the higher regions instead?

TailChao

  • Full Member
  • ***
  • Posts: 156
Re: HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?
« Reply #7 on: October 27, 2015, 04:41:19 PM »
Are there any carts that don't activate CARD_DETECT, but do still actually put stuff into the 3rd-256KB region ($0c0000-$0fffff) that would cause a conflict?

Perhaps they were just "being safe"?
My concern is moreso whether or not CARD_DETECT is honored over this enable sequence (i.e. if a card is present, the internal 192KB of RAM can absolutely not be unlocked).

If CARD_DETECT is ignored, there's the potential for bus fights both in the TED v2 and CD Stupid Card.
« Last Edit: October 27, 2015, 04:45:34 PM by TailChao »

ccovell

  • Hero Member
  • *****
  • Posts: 2245
Re: HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?
« Reply #8 on: October 27, 2015, 04:48:06 PM »
Well, I only have a SCD-ROM2 to test my things out with, but using a GameofYou flash cartridge containing PCEmon (so no intermediate software like on the Everdrive), all of the CD RAM is accessible from the cartridge, SCD-RAM starts out locked, and reading $18XX is not necessary before unlocking it.

TailChao

  • Full Member
  • ***
  • Posts: 156
Re: HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?
« Reply #9 on: October 27, 2015, 04:59:34 PM »
Well, I only have a SCD-ROM2 to test my things out with, but using a GameofYou flash cartridge containing PCEmon (so no intermediate software like on the Everdrive), all of the CD RAM is accessible from the cartridge, SCD-RAM starts out locked, and reading $18XX is not necessary before unlocking it.
Ugh, that's a total bummer. So you're getting a bus fight and the internal SCD-RAM is winning.
I'll have to update the modified SCD 3.0 software in the CD Stupid Card.

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?
« Reply #10 on: October 27, 2015, 05:52:48 PM »
I have a way to check to see if unlocking SCD ram disables the detect pin feature.

thesteve

  • Hero Member
  • *****
  • Posts: 2952
Re: HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?
« Reply #11 on: October 27, 2015, 06:21:08 PM »
im fairly sure the cart detect pin only effects the rom mapping
as in cart in disables internal rom, while everything remains unchanged
using a system cad in a duo doesnt conflict only because the internal and external timings match

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?
« Reply #12 on: October 27, 2015, 06:21:24 PM »
Well, I only have a SCD-ROM2 to test my things out with, but using a GameofYou flash cartridge containing PCEmon (so no intermediate software like on the Everdrive), all of the CD RAM is accessible from the cartridge, SCD-RAM starts out locked, and reading $18XX is not necessary before unlocking it.

Ugh, that's a total bummer. So you're getting a bus fight and the internal SCD-RAM is winning.
I'll have to update the modified SCD 3.0 software in the CD Stupid Card.

I'm too much of a newbie to have been around for GameOfYou's flash card, so I did a bit of searching and then found the schematic for it at ...

http://www.gamingenterprisesinc.com/Flash_HuCard/

So the problem is that he's tying the CARD_DETECT line low in hardware ... which probably should disable the 192KB of SCD RAM ... but Chris is telling us that it doesn't.

And that is a VERY-BAD-THING™, and will cause both the TED and CD Stupid Card (and ANY 1MB flash-or-RAM card) to have both the card's memory chip and the internal RAM chip fighting to both respond to a CPU "read" request at the same time.

At least, that's the case when the SCD RAM is unlocked.

So, if I'm understanding this, the "solution" would be to modify the SCD BIOS image on the CD Stupid Card and the TED to not actually do that "unlock" sequence anymore ... is that right?

I've not looked (yet) ... is that "unlock" process a part of the BIOS, or is it something that CD games do themselves?


I have a way to check to see if unlocking SCD ram disables the detect pin feature.

Thanks!   :D

thesteve

  • Hero Member
  • *****
  • Posts: 2952
Re: HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?
« Reply #13 on: October 27, 2015, 06:33:31 PM »
a duo has 4 ram banks in it
the work ram, is tied directly to the data bus with its own chip select pin off the 6280
the V-Ram is on its own bus and only directly connected to the 6270
the CD system ram is on the main bus, but uses 2 chip select pins off the D91317GD
the ADPCM has its own bus off the D91317GD

TailChao

  • Full Member
  • ***
  • Posts: 156
Re: HuCard CARD_DETECT line on Duo/Duo-R/SuperCDROM?
« Reply #14 on: October 27, 2015, 06:54:17 PM »
So, if I'm understanding this, the "solution" would be to modify the SCD BIOS image on the CD Stupid Card and the TED to not actually do that "unlock" sequence anymore ... is that right?

I've not looked (yet) ... is that "unlock" process a part of the BIOS, or is it something that CD games do themselves?
It looks like the unlock is part of the BIOS, @ $286B (mapped to $C86B). It calls EX_MEMOPEN and then decides whether or not to do the write sequence based upon its return.

Unfortunately, I only modified the jump table to point to a dummy EX_MEMOPEN. I'll need to change any direct references like this and stray write sequences. If a game does the write sequence directly, I can't do much about it.

Edit : It seems this is the only time the RAM is unlocked, and the BIOS is also using the return of EX_MEMOPEN to change whether it displays "SUPER CD-ROM2" or "CD-ROM2." Unless there's some packed code in the BIOS I don't know about, we should be fine.
I'll have some patches tomorrow.
« Last Edit: October 27, 2015, 07:56:21 PM by TailChao »