Author Topic: the source code for SNES/SFC Myth Cart menu v0.05  (Read 55018 times)

0 Members and 2 Guests are viewing this topic.

Offline mic_

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 632
Re: the source code for SNES/SFC Myth Cart menu v0.05
« Reply #30 on: March 01, 2010, 10:55:24 PM »
My latest version that now compiles with WLA-DX: http://jiggawatt.org/badc0de/myth_menu_wla-3.zip

It doesn't work though. I'm wondering if there were missing parts in the code released by Dr. Neo, because it's checking the vblank NMI flag in a couple of places, but I don't see it enabling NMI anywhere, so it ends up in an infinite loop.

Offline mic_

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 632
Re: the source code for SNES/SFC Myth Cart menu v0.05
« Reply #31 on: March 02, 2010, 02:05:28 AM »
Duh.. I didn't notice that DBR was set to $7e. I need to change a bunch of load/store instructions to use long addressing in order to force the bank to $00.
I'll see what happens once I'm done with that.

Offline mic_

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 632
Re: the source code for SNES/SFC Myth Cart menu v0.05
« Reply #32 on: March 02, 2010, 02:23:36 AM »
..and we have lift off: http://jiggawatt.org/badc0de/myth_menu_wla-4.zip



I haven't tried putting it on my cart yet, but getting it to compile into something that runs in BSNES means one hurdle has been overcome.

Offline ~tak

  • Newbie
  • *
  • Posts: 46
Re: the source code for SNES/SFC Myth Cart menu v0.05
« Reply #33 on: March 02, 2010, 02:32:59 AM »
 :-*

oh man, I wish I'm not on business trip today and could be back at home for working on this too...

mic, you are fantastic! you deserve a big THANKS!

now I can finally inject my nice 8x8 bitmap font and the rest I've got from trainer menus
« Last Edit: March 02, 2010, 02:35:18 AM by ~tak »

Offline spinal

  • Coder of DSision
  • Neo MOD
  • Hero Member
  • *
  • Posts: 796
    • spinalcode
Re: the source code for SNES/SFC Myth Cart menu v0.05
« Reply #34 on: March 02, 2010, 03:43:09 AM »
I haven't tried putting it on my cart yet, but getting it to compile into something that runs in BSNES means one hurdle has been overcome.

I just tried it on the myth, it works the same as in emu.

cycles through the following...
Quote
DSP1 HROM 4M SAVE 2K
DSP1 LROM 4M
DSP FX 8M
ROM 24M
HROM  32M Save 2K
HROM 48M s8K (256M-B0)
HROM 48M s8K (256M-B1)
HROM 48M s8K (256M-B2)
HROM 48M s8K (256M-B3)
HROM 48K s8K (64M-B1)
HROM 48K s8K (64M-B1)

Offline mic_

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 632
Re: the source code for SNES/SFC Myth Cart menu v0.05
« Reply #35 on: March 02, 2010, 03:58:28 AM »
You mean you put it on the cart as a "game"?
What I meant was replace the file NEOSNES.BIN in your NEO2 Ultra Menu directory with this new one (keep a backup of the old file for security purposes of course) to see if it still can load games properly.

Offline spinal

  • Coder of DSision
  • Neo MOD
  • Hero Member
  • *
  • Posts: 796
    • spinalcode
Re: the source code for SNES/SFC Myth Cart menu v0.05
« Reply #36 on: March 02, 2010, 04:27:36 AM »
Oh, I assumed it would work as either.
Anyway, as the actual menu, it doesn't load anything, smw just gave me a black screen, dkc reset back to the menu.

Offline mic_

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 632
Re: the source code for SNES/SFC Myth Cart menu v0.05
« Reply #37 on: March 02, 2010, 04:35:32 AM »
Yeah, I just tried it myself and noticed the same thing.

Offline mic_

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 632
Re: the source code for SNES/SFC Myth Cart menu v0.05
« Reply #38 on: March 02, 2010, 04:53:02 AM »
Ok, I fixed some errors. Now it can load ROMs properly (at least the few I tried): http://jiggawatt.org/badc0de/myth_menu_wla-5.zip

Offline mic_

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 632
Re: the source code for SNES/SFC Myth Cart menu v0.05
« Reply #39 on: March 23, 2010, 10:50:55 PM »
Has anyone looked into the possibility of replacing the GBA CARD -> PSRAM copy loop with some block move instructions (MVP)? The current loop, which copies two bytes per iterations seems to take 19 (6+6+2+2+3) cycles per iteration - or 9.5 cycles per byte. MVP promises to take 7 cycles/byte (or 7.00390625, since it takes one cycle extra each time a page boundary is crossed). You might need some extra overhead that isn't necessary for a normal loop, but there's still potential for saving about 2.5 seconds when copying a 32Mbit ROM.
« Last Edit: March 24, 2010, 12:25:35 AM by mic_ »

Online Dr.neo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3826
Re: the source code for SNES/SFC Myth Cart menu v0.05
« Reply #40 on: March 24, 2010, 12:04:46 PM »
woooo mic_ , it's awesome!  ~sm-69.gif~.gif ~sm-69.gif~.gif ~sm-69.gif~.gif ~sm-69.gif~.gif ~sm-69.gif~.gif
In my world,have 0 and 1 only ......Matrix World......

Offline ChillyWilly

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1751
  • Just a coding machine.
Re: the source code for SNES/SFC Myth Cart menu v0.05
« Reply #41 on: March 24, 2010, 01:00:54 PM »
For that matter, the SNES has DMA channels. Maybe one could be used to DMA the data instead of using the CPU.

Offline mic_

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 632
Re: the source code for SNES/SFC Myth Cart menu v0.05
« Reply #42 on: March 24, 2010, 02:28:03 PM »
I don't think DMA can be used. AFAIK they're only usable for transfers to/from the PPU.

Offline mic_

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 632
Re: the source code for SNES/SFC Myth Cart menu v0.05
« Reply #43 on: March 24, 2010, 04:26:12 PM »
Of course, you could also do something like this:

Code: [Select]
MOV_1M:
    CPU_ACC8
    PHB   ; Save DBR
    LDA #$40
    PHA
    PLB   ; Set DBR=$40

    CPU_REGS16        ; A,16 & X,Y 16 BIT
    LDX     #$7FFE
-:
    LDA.W   $0000,X    ; READ GBA CARD
    STA.L   $500000,X  ; WRITE PSRAM
    LDA.W   $8000,X    ; READ GBA CARD
    STA.L   $508000,X  ; WRITE PSRAM
    LDA.L   $410000,X  ; READ GBA CARD
    STA.L   $510000,X  ; WRITE PSRAM
    LDA.L   $418000,X  ; READ GBA CARD
    STA.L   $518000,X  ; WRITE PSRAM
    DEX
    DEX
    BPL     -

    PLB   ; Restore DBR
    CPU_REGS8
    RTS

Note that just plugging this code in won't work, since you also need to change the code that calls MOV_1M.
Anyway, this loop should take 6.625 cycles per byte transferred, instead of 9.5 like the original version. That's a saving of about 30%.
If you unrolled it one step further (16 bytes/iteration instead of eight) you could get it down to 6.1875 cycles/byte - or a saving of nearly 35%.

Offline mic_

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 632
Re: the source code for SNES/SFC Myth Cart menu v0.05
« Reply #44 on: March 25, 2010, 02:25:19 AM »
I've implemented the changes I mentioned in my last post, and thought I should make my new version available to you: http://jiggawatt.org/badc0de/myth_menu_wla-0.07.zip
Just replace the file named NEOSNES.BIN in your NEO2 Ultra Menu directory with the one in my zip. The updated source code is also included for those of you who are interested.

Here's a short video showing the difference in speed compared to the previous menu version: http://www.youtube.com/watch?v=0VnYi2NsTnU