Designing MD sdcard flashcart for fun, advice?

For anything related to cart (SRAM, SF2 mapper, audio, CD mode 1, ...)

Moderator: BigEvilCorporation

MrD
Interested
Posts: 40
Joined: Sun Jan 26, 2014 4:29 pm

Re: Designing MD sdcard flashcart for fun, advice?

Post by MrD » Thu Jan 30, 2020 10:29 am

TmEE co.(TM) wrote:
Thu Jan 30, 2020 2:45 am
I think it would work, assuming flash is fine with its !CE always low. Logic itself should be sound, disregarding any timing issues.
Alright :D awesome! Sorry for being pushy, I'm just excited to get it working.

I think the Flash is okay with !CE being low - in Revision 0, a resistor pulls the Flash!CE to ground during isolation, so that the PIC doesn't have to waste a GPIO pin on enabling the Flash itself, so I've been doing lots of interleaved reading and writing to the Flash with !CE low for long periods. I'll have to verify this in the datasheet but I'm fairly sure the Flash has a longer time to readiness from !CE than !OE, so having it low always ought to make it respond to !OEs faster than it would (or at least reduce a reason why it could be slower) if I was lowering both !OE and !CE for each read.

Edit Image

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

Re: Designing MD sdcard flashcart for fun, advice?

Post by TmEE co.(TM) » Thu Jan 30, 2020 11:23 am

I guess it'll work then, I hope there won't be more troubles with the new version ~
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

MrD
Interested
Posts: 40
Joined: Sun Jan 26, 2014 4:29 pm

Re: Designing MD sdcard flashcart for fun, advice?

Post by MrD » Mon Feb 10, 2020 3:55 pm

https://www.mrdictionary.net/gameraccoon/

I've written a huge big blog about the two months it took to specify, design, manufacture and program the Game Raccoon Revision 0. :D

All the technical knowhow will be old hat to you guys, I'm sure, but you might enjoy reading how I got to the current state. The blog stops before I begin designing Revision 1 (i.e. that new logic diagram I posted last week), as that'll be a whole new post once I've finished R1, designed it in Eagle, tested it and had it made. (Events in China have meant that going further is impossible right now.)

Squall926
Newbie
Posts: 3
Joined: Sat Jun 02, 2012 2:14 pm

Re: Designing MD sdcard flashcart for fun, advice?

Post by Squall926 » Thu Feb 13, 2020 1:26 am

Hi!
I've been seeing your project and I can say, excellent work!
I made a card using sram and avr128. Now I'm trying to load it on the screen while loading on the sram. I need to understand how to load and execute a block of code on the console ram, I intend to use a 74HC595 on the date bus to increase the load percentage, but as the ROM will not be available it is necessary to be running on the internal ram, can you explain how you did it on the MD?
Using pvsneslib i do a Funtion point after copy function to ram, but crash sometimes. i believe ill need do in asm.

MrD
Interested
Posts: 40
Joined: Sun Jan 26, 2014 4:29 pm

Re: Designing MD sdcard flashcart for fun, advice?

Post by MrD » Thu Feb 13, 2020 7:33 am

Hi Squall :)

I'm not sure I understand your design. I think you should make a new thread with your schematic in it so we can follow it.
I need to understand how to load and execute a block of code on the console ram, I intend to use a 74HC595 on the date bus to increase the load percentage, but as the ROM will not be available it is necessary to be running on the internal ram, can you explain how you did it on the MD?
My cartridge uses a non-volatile Flash PROM mapped into the address space behind B17 !C_CE: 0x000000-0x3FFFFF. Since it's a non-volatile 16-bit PROM, it's available immediately and the Mega Drive boots from it as if it were an ordinary cartridge. I don't use any shift registers in my design - all the data is 16-bit wide.

The boot menu is a 4 mbyte image (written in 68000 asm) that does the TMSS check, then copies part of itself to Mega Drive RAM using a simple loop, then jmps to Mega Drive RAM. The reason I need to be executing from RAM is because the Flash IC is not available during game writes and SD card operations.

Squall926
Newbie
Posts: 3
Joined: Sat Jun 02, 2012 2:14 pm

Re: Designing MD sdcard flashcart for fun, advice?

Post by Squall926 » Thu Feb 13, 2020 7:29 pm

During the flash loaging the screen show some program status like 10%, 20%, 80%...? i'm tryting do this.
Show memory program status, but i dont know how copy a block code to internal sram and jump to it. Since i need remove flash to program.
The shift is only to put on bus the data with status when mcu stay occupied writting the flash/sram... this part is no implemented(but a lot easy).

Can u explain a bit how to copy block and run from sram?

MrD
Interested
Posts: 40
Joined: Sun Jan 26, 2014 4:29 pm

Re: Designing MD sdcard flashcart for fun, advice?

Post by MrD » Fri Feb 14, 2020 4:48 am

Here's the relevant code from entry_point.68k.asm in the GR Rev. 0 source. Nothing really special about it. :)

Code: Select all

; The RAM-resident Game Raccoon executable image is installed
; at the front of RAM.
RACCOON_RAM_RESIDENT_DESTINATION = RAM_START

        org $200
; We're going to put the binaries blob at $200 so we can calculate all the offsets
; and lengths in advance. 'main' will be pushed down into the ROM by the binaries
; archive, but that is of no consequence since the Mega Drive cart header is
; generated from the 'main' symbol.

        incbin  "included_binaries.bin"

        align   2
; Entry point when cart is booted.
main:
        ; Initialise Mega Drive:
        ; We want to satisfy the TMSS check as soon as possible.
        interrupts_disable
        move.b  (MM_VERSION_REGISTER+1),d0       ; Load the low byte from the version register.
        and.b   #$0F,d0
        beq     tmss_satisfy_tmss_unnecessary
        move.l  #"SEGA",(MM_TMSS_REGISTER)       ; Satisy TMSS on version != zero consoles by writing SEGA longword to its register.
tmss_satisfy_tmss_unnecessary:                   ; Branch here if we're on a version zero console that does not require TMSS compliance.
        
        ; Past this point, the console is entirely at our command.
        ; I'm going to copy the Game Raccoon Executable Area
        ; into RAM $FF0000...
        lea     raccoon_ram_resident_rom_included_block_start,a0
        lea     RACCOON_RAM_RESIDENT_DESTINATION,a1
        move.w  #(RACCOON_RAM_RESIDENT_ROM_INCLUDED_BLOCK_LENGTH_LONGS-1),d0
copy_next_long:        
        move.l  (a0)+,(a1)+
        dbf     d0,copy_next_long

        jmp     RACCOON_RAM_RESIDENT_DESTINATION
        
        ; Include the RAM-resident portion of the code contiguous in ROM,
        ; but with instructions based at the corresponding position in RAM.
        align   2        

raccoon_ram_resident_rom_included_block_start:        
        ; This file must always be a multiple of 4 large.
        ; (All the variables it messes with expect to begin on a long aligned address in RAM.)
        ; I want to ensure that in the assembly of raccoonramresident.68k.asm.
        incbin  "raccoonramresident.bin"
raccoon_ram_resident_rom_included_block_end = *

RACCOON_RAM_RESIDENT_ROM_INCLUDED_BLOCK_LENGTH_BYTES = raccoon_ram_resident_rom_included_block_end-raccoon_ram_resident_rom_included_block_start
RACCOON_RAM_RESIDENT_ROM_INCLUDED_BLOCK_LENGTH_LONGS = (RACCOON_RAM_RESIDENT_ROM_INCLUDED_BLOCK_LENGTH_BYTES/4)

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

Re: Designing MD sdcard flashcart for fun, advice?

Post by Chilly Willy » Fri Feb 14, 2020 4:12 pm

Putting assembly code into ram is easy. Doing so in C takes a little more thought. So here's another reminder of how to do it...

Code: Select all

void sd_op_delay() __attribute__ ((section (".data")));
void sd_op_delay()
{
    short i;

    for (i=0; i<16; i++)
    {
        asm("nop\n");
    }
}
Then any start routine before main() that copies the data segment from rom into ram will copy the code to the proper place automatically.
8)

When you put C code into ram, you probably want to check your MAP file after compiling to see the ram usage. Unless you're really squeezing ram hard, it's mostly no big deal, though.

MrD
Interested
Posts: 40
Joined: Sun Jan 26, 2014 4:29 pm

Re: Designing MD sdcard flashcart for fun, advice?

Post by MrD » Fri Feb 14, 2020 10:51 pm

https://cdn.discordapp.com/attachments/ ... cfinal.png

OK if there's no objections I'm gonna get this made as Revision 1 :D

MrD
Interested
Posts: 40
Joined: Sun Jan 26, 2014 4:29 pm

Re: Designing MD sdcard flashcart for fun, advice?

Post by MrD » Tue Feb 18, 2020 10:28 am

Rev 1 is at PCBWAY :)

MrD
Interested
Posts: 40
Joined: Sun Jan 26, 2014 4:29 pm

Re: Designing MD sdcard flashcart for fun, advice?

Post by MrD » Fri Mar 06, 2020 5:32 pm

Got photographs of the unassembled board today.

MrD
Interested
Posts: 40
Joined: Sun Jan 26, 2014 4:29 pm

Re: Designing MD sdcard flashcart for fun, advice?

Post by MrD » Tue Mar 24, 2020 8:13 pm

Progress is progressing slowly, understandably. Just had an email from the manufacturer's engineering team asking about some anomalies in my BOM. Turns out my capacitor choices were all the wrong package (I'd mixed up imperial and metric...) and this error was even on the Rev 0 design! I can only assume they worked off the text part of my BOM and ignored the model numbers the first time, since those boards were fitted with what I intended but not what my spreadsheet indicated. I'm glad they asked before doing something unusual, but the Rev 0 substitutes worked great.

MrD
Interested
Posts: 40
Joined: Sun Jan 26, 2014 4:29 pm

Re: Designing MD sdcard flashcart for fun, advice?

Post by MrD » Tue Mar 31, 2020 12:36 am

https://imgur.com/a/0t9qjEV

Images of Rev 1. at the manufacturer :D

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

Re: Designing MD sdcard flashcart for fun, advice?

Post by Chilly Willy » Tue Mar 31, 2020 2:28 am

Nice!

Post Reply