Page 2 of 3

Re: Designing MD sdcard flashcart for fun, advice?

Posted: Thu Jan 30, 2020 10:29 am
by MrD
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

Re: Designing MD sdcard flashcart for fun, advice?

Posted: Thu Jan 30, 2020 11:23 am
by TmEE co.(TM)
I guess it'll work then, I hope there won't be more troubles with the new version ~

Re: Designing MD sdcard flashcart for fun, advice?

Posted: Mon Feb 10, 2020 3:55 pm
by MrD
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.)

Re: Designing MD sdcard flashcart for fun, advice?

Posted: Thu Feb 13, 2020 1:26 am
by Squall926
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.

Re: Designing MD sdcard flashcart for fun, advice?

Posted: Thu Feb 13, 2020 7:33 am
by MrD
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.

Re: Designing MD sdcard flashcart for fun, advice?

Posted: Thu Feb 13, 2020 7:29 pm
by Squall926
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?

Re: Designing MD sdcard flashcart for fun, advice?

Posted: Fri Feb 14, 2020 4:48 am
by MrD
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)

Re: Designing MD sdcard flashcart for fun, advice?

Posted: Fri Feb 14, 2020 4:12 pm
by Chilly Willy
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.

Re: Designing MD sdcard flashcart for fun, advice?

Posted: Fri Feb 14, 2020 10:51 pm
by MrD
https://cdn.discordapp.com/attachments/ ... cfinal.png

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

Re: Designing MD sdcard flashcart for fun, advice?

Posted: Tue Feb 18, 2020 10:28 am
by MrD
Rev 1 is at PCBWAY :)

Re: Designing MD sdcard flashcart for fun, advice?

Posted: Fri Mar 06, 2020 5:32 pm
by MrD
Got photographs of the unassembled board today.

Re: Designing MD sdcard flashcart for fun, advice?

Posted: Tue Mar 24, 2020 8:13 pm
by MrD
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.

Re: Designing MD sdcard flashcart for fun, advice?

Posted: Tue Mar 31, 2020 12:36 am
by MrD
https://imgur.com/a/0t9qjEV

Images of Rev 1. at the manufacturer :D

Re: Designing MD sdcard flashcart for fun, advice?

Posted: Tue Mar 31, 2020 2:28 am
by Chilly Willy
Nice!

Re: Designing MD sdcard flashcart for fun, advice?

Posted: Thu Apr 09, 2020 11:19 am
by MrD
Raccoon Revision 1 arrived earlier this week. A very friendly DHL person placed it very gently on my porch floor and walked very quickly away. Spent the week assembling the interface parts and adapting the Revision 0 program to work inside the new layout. I ordered two boards, but only one of them works. :(

But the one that works works a treat, yaaay!

https://imgur.com/a/bz1nnGw
https://imgur.com/a/Bp2RyAz

Now I've got heckloads of blogging to do, as well as starting to look for a sprite artist to hire to work on menus and things.