Neo TeAm Forum

The 9th. NEO Project for SNES => The 9th. NEO Project for SNES Dev kit. => SNES development section => Topic started by: Dr.neo on February 22, 2010, 04:14:08 PM

Title: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Dr.neo on February 22, 2010, 04:14:08 PM
;=================== the source code for SNES/SFC Myth Cart menu v0.05 ===================
;===================             Copy right by: Neo TeAm               ===================
;===================        www.NEOFLASH.com / Feb.22th 2010           ===================


        .ORG    $0              ; GENERAL VAR
ITEM    EQU       $00
MY      EQU       $01
MX      EQU       $02
TP      EQU       $03         ;3,4
TPP     EQU       $04         ;3,4
A1L     EQU       $05
A1H     EQU       $06
JOY1    EQU       $07
JOYA    EQU       $08
T.PAGE  EQU       $09
PAGE    EQU       $0A
G.STA1  EQU       $0B
POINT   EQU       $0C
COLOR   EQU       $0D
COUNT   EQU       $0E
GO      EQU       $0F

MYTH     EQU       $10
LEX     EQU       $11
M1L     EQU       $12
M1H     EQU       $13
M2L     EQU       $14
M2H     EQU       $15

M3L     EQU       $16
M3H     EQU       $17

RUX     EQU       $20 ;0
RBH     EQU       $21 ;2
RBL     EQU       $22 ;1
RZX     EQU       $23 ;3
SBX     EQU       $24 ;4
SZX     EQU       $25 ;5
MODE    EQU       $26 ;6
RSZ     EQU       $27 ;1
EDSP    EQU       $28 ;1
ESRAM   EQU       $29 ;1
SRAM_M  EQU       $2A ;1    ;NEW
CARD_M  EQU       $2B ;1    ;NEW
PMENU   EQU       $2C ;1    ;NEW
MOV     EQU       $2F ;6

AA      EQU       $30 ;6
AP0     EQU       $31 ;6
AP1     EQU       $32 ;6
RAP0    EQU       $33 ;6
WAP0    EQU       $34 ;6
RAP1    EQU       $35 ;6
WAP1    EQU       $36 ;6
WAZ0    EQU       $37 ;6
WAZ1    EQU       $38 ;6
WAZ2    EQU       $39 ;6
CPID    EQU       $3F ;6

TERR    EQU       $40 ;6

BANK   .EQU    $8000
PAL    .EQU    $2116
PAH    .EQU    $2117
PDL    .EQU    $2118
PDH    .EQU    $2119

        ORG     $ABCD   ;MYTH
        .DB     '-'
        HEX     000000
        .DB     'h'
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        .ORG    $8000
BEGIN:
         JMP     START+$000000~

        ORG     $ABCD
        .DB     '+'
        HEX     000000
        .DB     'h'
        .ORG    $8010      ;MYTH
;...............................................................................
MS2
        .DB     $FF,14,01,02
        .TEXT   " LOADING......(  )"
        .DB     0

        .ORG    $8035      ;MYTH
;===============================================================================
MOV_1M:
        REP     #$30        ; A,16 & X,Y 16 BIT
        LDX     @$0000
^0      LDA     $400000~,X  ; READ GBA CARD
        STA     $500000~,X  ; WRITE PSRAM
        INX
        INX
        BNE     <0

        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
^0      LDA     $410000~,X
        STA     $510000~,X
        INX                 ;0
        INX
        BNE     <0          ;0
        SEP     #$30
        RTS
;...............................................................................
        ORG     $ABCD
        .DB     '+'
        HEX     000000
        .DB     'h'
        .ORG    $8060        ;MYTH
MS4
        .DB     $FF,12,01,02
        .TEXT   " GAME (001)"
        .DB     0
;===============================================================================
        ORG     $ABCD
        .DB     '+'
        HEX     000000
        .DB     'h'
        .ORG    $8080        ;MYTH
;...............................................................................
TEST_PARMB0:
        REP     #$30        ; A,16 & X,Y 16 BIT
        LDX     @$0000
        LDA     @$0000      ; READ GBA CARD
^0
        STA     $500000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0
        SEP     #$30
        RTS

TEST_PARMC0:
        LDA     #$00
        STA     TERR
        REP     #$30        ; A,16 & X,Y 16 BIT
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$0000
^0
        CMP     $500000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        SEP     #$30
        RTS
^1
        SEP     #$30
        LDA     #$01
        STA     TERR
        RTS

;===============================================================================
; print card name
        ORG     $ABCD
        .DB     '+'
        HEX     000000
        .DB     'h'
        .ORG    $8100        ;MYTH
MS3
        .DB     $FF,12,01,02
        .TEXT   "                        "
        .DB     0
       
;===============================================================================
        ORG     $ABCD
        .DB     '+'
        HEX     000000
        .DB     'h'
        .ORG    $8180        ;MYTH
       
TEST_CARD:

         LDA    #30
         JSR    PRINT

         LDA    #$20      ; OFF A21
         STA    $C003~

         JSR    SET_NEOCMC  ; ON_NEO CARD A24 & A25 + SA16 & SA17

         LDA    #$20      ; OFF A21
         STA    $C003~

         LDA     #$00
         STA     $C003~   ; SET A16~A23
         STA     $C002~   ; SET A24,A25

         LDA     #$01
         STA     $C00D~   ; A25,A24 ON

         LDA     #$04
         STA     $C018~  ; SET SRAM SAVE TYPE
         LDA     #$0F
         STA     $C019~  ; SET $700000

         LDA     #$01
         STA     $C011~  ; SRAM ON !

         LDA     #$00
         STA     $700000~
         LDA     #$01
         STA     $720000~
         LDA     #$02
         STA     $740000~
         LDA     #$03
         STA     $760000~
         
         LDA     $700000~
         CMP     #$00
         BNE     >1
         LDA     $720000~
         CMP     #$01
         BNE     >1
         LDA     $740000~
         CMP     #$02
         BNE     >1
         LDA     $760000~
         CMP     #$03
         BNE     >1
         LDA     #$00
         LDA     #28
         JSR     PRINT
^1
         STA    $C018~  ; SET SRAM SAVE TYPE
         STA    $C019~  ; SET $000000
         STA    $C011~  ; SRAM ON !
;------------------------------------------------------------------------------
         LDA    #$04       ; COPY MODE !
         STA    $C000~

         LDA    #$01       ; PSRAM WE ON !
         STA    $C014~
                         
         LDA    #$F8
         STA    $C007~     ;PSRAM    8M SIZE
;-------------------------------------------------------------------------------
         LDA    #$00       ;PSRAM   BANK
         STA    $C006~
         STA    $500000~
         STA    $500001~

         LDA    #$01       ;PSRAM   BANK
         STA    $C006~
         STA    $500000~
         STA    $500001~

         LDA    #$02       ;PSRAM   BANK
         STA    $C006~
         STA    $500000~
         STA    $500001~

         LDA    #$03       ;PSRAM   BANK
         STA    $C006~
         STA    $500000~
         STA    $500001~

         LDA    #$04       ;PSRAM   BANK
         STA    $C006~
         STA    $500000~
         STA    $500001~

         LDA    #$05       ;PSRAM   BANK
         STA    $C006~
         STA    $500000~
         STA    $500001~

         LDA    #$06       ;PSRAM   BANK
         STA    $C006~
         STA    $500000~
         STA    $500001~

         LDA    #$07       ;PSRAM   BANK
         STA    $C006~
         STA    $500000~
         STA    $500001~
;-------------------------------------------------------------------------------

         LDA    #$00       ;PSRAM   BANK
         STA    $C006~
         LDA    $500000~
         CMP    #$00
         BNE    >0

         LDA    #$01       ;PSRAM   BANK
         STA    $C006~
         LDA    $500000~
         CMP    #$01
         BNE    >0

         LDA    #$02       ;PSRAM   BANK
         STA    $C006~
         LDA    $500000~
         CMP    #$02
         BNE    >0
         JMP    >2
TS_ERR:
^0
         LDA    #32
         JSR    PRINT
         JMP    >1
TS_OK:
         LDA    #31
         JSR    PRINT
^1
         LDA    #$00       ;
         STA    $C000~
         JMP    MENU1
;-------------------------------------------------------------------------------
^2
        LDA     #20
        JSR     PRINT
        LDA     #$00       ;PSRAM   BANK
        STA     $C006~
        JSR     TEST_PARMA0
        LDA     TERR
        CMP     #$00
        BNE     >0
        JMP     >1
^0
        JMP    >0
^1
        LDA     #21
        JSR     PRINT
        LDA     #$01       ;PSRAM   BANK
        STA     $C006~
        JSR     TEST_PARMA0
        LDA     TERR
        CMP     #$00
        BNE     >0
        JMP     >1
^0
        JMP    >0
^1
        LDA     #22
        JSR     PRINT
        LDA     #$02       ;PSRAM   BANK
        STA     $C006~
        JSR     TEST_PARMA0
        LDA     TERR
        CMP     #$00
        BNE     >0
        JMP     >1
^0
        JMP    >0
^1

        LDA     #23
        JSR     PRINT
        LDA     #$03       ;PSRAM   BANK
        STA     $C006~
        JSR     TEST_PARMA0
        LDA     TERR
        CMP     #$00
        BNE     >0
        JMP     >1
^0
        JMP    >0
^1

        LDA     #24
        JSR     PRINT
        LDA     #$04       ;PSRAM   BANK
        STA     $C006~
        JSR     TEST_PARMA0
        LDA     TERR
        CMP     #$00
        BNE     >0
        JMP     >1
^0
        JMP    >0
^1

        LDA     #25
        JSR     PRINT
        LDA     #$05       ;PSRAM   BANK
        STA     $C006~
        JSR     TEST_PARMA0
        LDA     TERR
        CMP     #$00
        BNE     >0
        JMP     >1
^0
        JMP    >0
^1

        LDA     #26
        JSR     PRINT
        LDA     #$06       ;PSRAM   BANK
        STA     $C006~
        JSR     TEST_PARMA0
        LDA     TERR
        CMP     #$00
        BNE     >0
        JMP     >1
^0
        JMP    >0
^1

        LDA     #27
        JSR     PRINT
        LDA     #$07       ;PSRAM   BANK
        STA     $C006~
        JSR     TEST_PARMA0
        LDA     TERR
        CMP     #$00
        BNE     >0
       
        JMP     TS_OK
^0
        JMP     TS_ERR
;------------------------------------------------------------------------------
TEST_PARMA0:

        LDA     #$00
        STA     TERR
       
        REP     #$30        ; A,16 & X,Y 16 BIT

       
        LDX     @$0000
        LDA     @$0000      ; READ GBA CARD
^0
        STA     $500000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$0000
^0
        CMP     $500000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        LDX     @$0000
        LDA     @$0001      ;
^0
        STA     $510000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$0001
^0
        CMP     $510000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        LDX     @$0000
        LDA     @$0002      ;
^0
        STA     $520000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$0002
^0
        CMP     $520000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        LDX     @$0000
        LDA     @$0003      ;
^0
        STA     $530000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$0003
^0
        CMP     $530000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        LDX     @$0000
        LDA     @$0004      ;
^0
        STA     $540000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$0004
^0
        CMP     $540000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        LDX     @$0000
        LDA     @$0005      ;
^0
        STA     $550000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$0005
^0
        CMP     $550000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        LDX     @$0000
        LDA     @$0006      ;
^0
        STA     $560000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$0006
^0
        CMP     $560000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        LDX     @$0000
        LDA     @$0007      ;
^0
        STA     $570000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$0007
^0
        CMP     $570000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        LDX     @$0000
        LDA     @$0008      ; READ GBA CARD
^0
        STA     $580000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$0008
^0
        CMP     $580000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        LDX     @$0000
        LDA     @$0009      ;
^0
        STA     $590000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$0009
^0
        CMP     $590000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        LDX     @$0000
        LDA     @$000A      ;
^0
        STA     $5A0000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$000A
^0
        CMP     $5A0000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        LDX     @$0000
        LDA     @$000B      ;
^0
        STA     $5B0000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$000B
^0
        CMP     $5B0000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        LDX     @$0000
        LDA     @$000C      ;
^0
        STA     $5C0000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$000C
^0
        CMP     $5C0000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        LDX     @$0000
        LDA     @$000D      ;
^0
        STA     $5D0000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$000D
^0
        CMP     $5D0000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        LDX     @$0000
        LDA     @$000E      ;
^0
        STA     $5E0000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$000E
^0
        CMP     $5E0000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        LDX     @$0000
        LDA     @$000F      ;
^0
        STA     $5F0000~,X  ; WRITE PSRAM
        INC     A
        INX
        INX
        BNE     <0

                     
        LDX     @$0000      ;  MOVE BOOT CODE TO SRAM
        LDA     @$000F
^0
        CMP     $5F0000~,X
        BNE     >1
        INC     A
        INX                 ;0
        INX
        BNE     <0          ;0
        JMP     >0
^1
        JMP    >1
^0
;-------------------------------------------------------------------------------
        SEP     #$30
        RTS
^1
        SEP     #$30
        LDA     #$01
        STA     TERR
        RTS
;===============================================================================
SET_NEOCM5:
         LDA    #$E0      ; SET BANK   ;1 1 1 0
         STA    $C001~
         LDA    $FFA400~  ; FFD2XX     ;01

         LDA    #$00      ; SET BANK   ; 0 0 0
         STA    $C001~
         LDA    $C02A00~  ; 0015XX     ;02
         LDA    $C3A400~  ; 01D2XX     ;03
         LDA    $C42A00~  ; 0215XX     ;04

         LDA    #$E0      ; SET BANK   ;1 1 1 0
         STA    $C001~
         LDA    $FC2A00~  ; FE15XX     ;05
         RTS
;===============================================================================
SET_NEOCMA:
         JSR    SET_NEOCM5
         LDA    #$20      ; SET BANK   ;0 0 1 0
         STA    $C001~
         LDA    $EE2406~  ; 372203     ;06   ;
         RTS
;===============================================================================
SET_NEOCMB:
         JSR    SET_NEOCM5

         LDA    CARD_M
         CMP    #$00
         BEQ    >0
         CMP    #$01
         BEQ    >1
         JMP    >2
;-------------------------------------------------------------------------------
;A CARD
^0
         LDA    #$C0      ; SET    ;1 1 0 0
         STA    $C001~
         LDA    $F55C88~  ; DAAE44     ;06
         RTS
;-------------------------------------------------------------------------------
;B CARD
^1
         LDA    #$C0      ; SET    ;1 1 0 0
         STA    $C001~
         LDA    $F51C88~  ; DA8E44     ;06
         RTS
;-------------------------------------------------------------------------------
;C CARD
^2
         LDA    #$C0      ; SET    ;1 1 0 0
         STA    $C001~
         LDA    $F41C88~  ; DA0E44     ;06
         RTS
;===============================================================================
SET_NEOCMC:
         JSR    SET_NEOCM5

         LDA    #$E0      ; SET        ;1 1 1 0
         STA    $C001~
         LDA    $DC0C60~  ; EE0630     ;06
         RTS
;===============================================================================
SET_NEOCMD:

         JSR    SET_NEOCM5
         LDA    #$20      ; SET BANK   ;0 0 1 0
         STA    $C001~
         LDA    $EE2006~  ; 372003     ;06   ;  TO BIOS MENU

         JSR    SET_NEOCM5
         LDA    #$C0      ; SET        ;1 1 0 0
         STA    $C001~
         LDA    $F50088~  ; DA0044     ;06
         RTS
;===============================================================================
;
;===============================================================================
BOOT_RUN:

         LDA    #$20      ; OFF A21
         STA    $C003~
         JSR    SET_NEOCMA  ;
         JSR    SET_NEOCMB  ;
         JSR    SET_NEOCMC  ; ON_NEO CARD A24 & A25 + SA16 & SA17

         LDA     RBH
         STA     $C002~   ; SET AH25,AH25
         
         LDA     #$01
         STA     $C00D~   ; A25,A24 ON


; MOVE   PSRAM
MOV_4M:
          LDA    RZX
          CMP    #$04
          BNE    >0
          LDA    #$3C  ;4M
          STA    RSZ
         
          LDA    #$35     ;35= 4MM
          STA    AP0
          LDA    #$30     ;30= 4M
          STA    AP1
         
          LDA    #$04     ;04 = 4M
          STA    WAZ0
         
          LDA    #$00     ;00 = 4M~8M
          STA    WAZ1
          JMP    MOV_PSRAM

;;;;;;;;8M
^0
          LDA    RZX
          CMP    #$08
          BNE    >0
          LDA    #$38  ;8M
          STA    RSZ

          LDA    #$39     ;39= 8M
          STA    AP0
          LDA    #$30     ;30= 8M
          STA    AP1
         
          LDA    #$08     ;08 = 8M
          STA    WAZ0
         
          LDA    #$00     ;00 = 4M~8M
          STA    WAZ1
          JMP    MOV_PSRAM

;;;;;;;;16M
^0
          LDA    RZX
          CMP    #$09
          BNE    >0
          LDA    #$30  ;16M
          STA    RSZ
         
          LDA    #$37     ;37= 16M
          STA    AP0
          LDA    #$31     ;31= 16M
          STA    AP1
         
          LDA    #$08     ;08 = 8M
          STA    WAZ0
         
          LDA    #$01     ;00 = 16M
          STA    WAZ1
          JMP    MOV_PSRAM
         
;;;;;;;;24M
^0
          LDA    RZX
          CMP    #$A
          BNE    >0
          LDA    #$20  ;32M
          STA    RSZ
         
          LDA    #$35     ;35= 24M
          STA    AP0
          LDA    #$32     ;32= 24M
          STA    AP1
         
          LDA    #$08     ;08 = 8M
          STA    WAZ0
         
          LDA    #$02     ;02 = 24M
          STA    WAZ1
          JMP    MOV_PSRAM
;32M============================================================================
^0
          LDA    RZX
          CMP    #$0B
          BNE    >0
          LDA    #$20  ;32M
          STA    RSZ
         
          LDA    #$33     ;33 = 32M
          STA    AP0
          LDA    #$33     ;33 = 32M
          STA    AP1
         
          LDA    #$08     ;08 = 8M
          STA    WAZ0
         
          LDA    #$03     ;03 = 32M
          STA    WAZ1
          JMP    MOV_PSRAM
         
;40M============================================================================
^0
          LDA    RZX
          CMP    #$0C
          BNE    >0
          LDA    #$00  ;64M
          STA    RSZ
         
          LDA    #$31     ;33 = 32M
          STA    AP0
          LDA    #$34     ;33 = 32M
          STA    AP1
         
          LDA    #$08     ;08 = 8M
          STA    WAZ0
         
          LDA    #$04     ;04 = 40M
          STA    WAZ1
          JMP    MOV_PSRAM
;48M ===========================================================================
^0
          LDA    RZX
          CMP    #$0D
          BNE    >0
         
          LDA    #$00  ;64MM
          STA    RSZ
         
          LDA    #$39     ;39 = 48M
          STA    AP0
          LDA    #$34     ;34 = 48M
          STA    AP1
         
          LDA    #$08     ;08 = 8M
          STA    WAZ0
         
          LDA    #$05     ;05 = 48M
          STA    WAZ1
          JMP    MOV_PSRAM
;64M ===========================================================================
^0
          LDA    RZX
          CMP    #$0E
          BNE    >0

          LDA    #$00  ;64MM
          STA    RSZ
         
          LDA    #$35     ;39 = 64M
          STA    AP0
          LDA    #$36     ;34 = 64M
          STA    AP1
         
          LDA    #$08     ;08 = 8M
          STA    WAZ0
         
          LDA    #$07     ;05 = 64M
          STA    WAZ1
          JMP    MOV_PSRAM
^0
;===============================================================================
MOV_PSRAM:

         LDA    #$00
         STA    WAZ2
             
         LDA    #$04       ; COPY MODE !
         STA    $C000~

         LDA    #$01       ; PSRAM WE ON !
         STA    $C014~
                         
         LDA    #$F8
         STA    $C003~     ;GBA CARD 8M SIZE
         STA    $C007~     ;PSRAM    8M SIZE

         LDA    RBL
         STA    $C001~
         
         LDA    #$00
         STA    $C006~

^2
         LDA    #$3E
         STA    RAP0
         LDA    #$4E
         STA    WAP0
         
         LDA    #$3F
         STA    RAP1
         
         LDA    #$4F
         STA    WAP1
         
^0
         INC    RAP0
         INC    RAP1
         INC    WAP0
         INC    WAP1
         
         INC    RAP0
         INC    RAP1
         INC    WAP0
         INC    WAP1

         LDA    RAP0
         STA    $7E803D~
         LDA    WAP0
         STA    $7E8041~

         LDA    RAP1
         STA    $7E804C~
         LDA    WAP1
         STA    $7E8050~
         
         DEC    AP0
         LDA    AP0        ; L-BYTE
         STA    $7E8024~
         LDA    AP1        ; H-BYTE
         STA    $7E8023~   ;
         
         LDA    #$02
         JSR    PRINT
         
         JSR    MOV_1M
         LDA    AP0
         CMP    #$30
         BNE    >1
         LDA    #$3A
         STA    AP0
         DEC    AP1  ;
^1
         DEC    WAZ0
         LDA    WAZ0
         CMP    #$00
         BNE    <0
         
         LDX    WAZ1
         CPX    WAZ2
         BNE    >0
         JMP    >9
^0
;===============================================================================
         INC    WAZ2
         LDA    WAZ2
         CMP    #$01
         BNE    >0
         
         LDA    #$01        ;16M
         STA    $C006~

         CLC
         LDA    #$08
         ADC    RBL
         STA    RBL
         STA    $C001~
         
         LDA    #$8
         STA    WAZ0      ;
         JMP    <2
;-------------------------------------------------------------------------------
^0       CMP    #$02        ;24M
         BNE    >0
         LDA    #$02
         STA    $C006~

         CLC
         LDA    #$08
         ADC    RBL
         STA    RBL
         STA    $C001~
         
         LDA    #$8
         STA    WAZ0
         JMP    <2
;-------------------------------------------------------------------------------
^0       CMP    #$03        ;32M
         BNE    >0
         LDA    #$03
         STA    $C006~
         
         CLC
         LDA    #$08
         ADC    RBL
         STA    RBL
         STA    $C0
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on February 22, 2010, 04:52:23 PM
Very nice  :D  ::sm-24.gif::
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on February 22, 2010, 04:53:45 PM
Which assembler are you using? Doesn't look like wla-dx at least.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Dr.neo on February 23, 2010, 12:00:28 AM
we use our special design compiler,not the standard one.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Sektor on February 23, 2010, 12:45:51 AM
Scary  ~sm-34.gif~

I'm sure ChillyWilly and others will make good use of it  ~sm-42.gif~
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on February 23, 2010, 01:20:49 AM
Which assembler are you using? Doesn't look like wla-dx at least.

You should be able to compile it with "SNASM" or "snescomp".
But don't forget to apply the header on top of the object.

 ~sm-37.gif~
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on February 23, 2010, 02:01:11 AM
Scary  ~sm-34.gif~

I'm sure ChillyWilly and others will make good use of it  ~sm-42.gif~

Yes - keep some parts in assembly (changed to wla-dx assembly) and switch the rest over to C using snes-sdk.

Anywho, let's thank Dr. neo for the release as it really helps in making the menus, being a prime source of info on how the Myth works. Thanks!!
 ::sm-29.gif::
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ~tak on February 23, 2010, 02:36:48 AM
veeeeeeerrryyyyy nice!!!

thanks for sharing, should also be possible to compile with WLA-DX with minor changes, right?

personally I like to use bitmap fonts instead of ascii, however it's always tie to rom space too. is there a limitation of size for the menu?

thanks
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on February 23, 2010, 03:39:03 AM
Well, from a first glance over the code, the SNES Myth is indeed very much like the MD Myth, with a very similar hardware interface. The Myth registers appear at 0xC0XX, and to use the MD Myth names:

0xC000 = OPTION_IO: 0=normal mode, 1=run from PSRAM, 4=copy mode, 6=ext mode
0xC001 = GBAC_LIO: A23-16
0xC002 = GBAC_HIO: A25-24, rom bank offset
0xC003 = GBAC_ZIO: rom bank size
0xC004 = GBAS_BIO: SRAM bank
0xC005 = GBAS_ZIO: SRAM bank size
0xC006 = PRAM_BIO: PSRAM bank (0-7)
0xC007 = PRAM_ZIO: PSRAM bank size
0xC008 = RUN_IO
0xC00D = EXTM_ON: enables A25-24
0xC00E = RST_SEL
0xC010 = RST_IO
0xC011 = SRAM_WE: 1=write enable SRAM
0xC014 = WE_IO: 1=write enable PSRAM
0xC018 = type of SRAM
0xC019 = address of SRAM in SNES mem map
0xC01A = type of ext DSP
0xC01B = address of ext memory for DSP
0xC01F =  something to do with ESRAM

When in copy mode, the flash appears at 0x400000 and the PSRAM at 0x500000. Up to 1MByte can be copied.

In the menu flash, the code starts at 0x8000 and is copied to the lower RAM. The menu relies on modifying the ram as part of the copy process. Menu entries start at 0xC800 and go to 0xFFC0, taking 64 bytes per entry. At 0xFFE0 is a byte for the CPLD version, while 0xFFE1 and 0xFFE2 are a magic cookie to identify whether the CPLD version byte is valid. 0xFFF0 is a byte identifying the version of game flash (used when setting the game flash mode for proper reading).
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on February 23, 2010, 03:41:33 AM
I'm currently translating all the code to WLA-DX syntax (while also exchanging some anonymous labels for real names). I'll post the results here once I'm finished, unless someone objects and rather do it themselves.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: FloBo on February 23, 2010, 03:43:08 AM
Wow. Thanks for sharing! Already looking forward to customize this :)

 ~sm-39.gif~ Just figured how I got used to using wla makros. This thing is huuuuge :)
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ~tak on February 23, 2010, 05:08:51 AM
I'm currently translating all the code to WLA-DX syntax (while also exchanging some anonymous labels for real names). I'll post the results here once I'm finished, unless someone objects and rather do it themselves.

great, thanks mic_, appriciate your effort!

Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on February 23, 2010, 07:11:15 AM
Here's what I've got so far: http://jiggawatt.org/myth_menu_wla.asm

It's nearly done, but some directives haven't been translated, and I might have missed a couple of labels here and there so it probably won't assemble in its current form. I'll continue this tomorrow (today actually, since it's after midnight here :P )

Some more of the code should also be macrofied.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on February 23, 2010, 07:58:25 AM
Nice!
 8)

One thing that may help you...

Code: [Select]
        .ORG    $8035      ;MYTH
;===============================================================================
MOV_1M:
        CPU_REGS16        ; A,16 & X,Y 16 BIT
        LDX     #$0000
MOV_1M_LOOP:
LDA.L     $400000,X  ; READ GBA CARD
        STA.L     $500000,X  ; WRITE PSRAM
        INX
        INX
        BNE     MOV_1M_LOOP

        LDX     #$0000      ;  MOVE BOOT CODE TO SRAM
COPY_BOOT:
LDA.L     $410000,X
        STA.L     $510000,X
        INX                 ;0
        INX
        BNE     COPY_BOOT         ;0
        CPU_REGS8
        RTS

The reason it sets the origin to $8035 is that the $40/$50/$41/$51 in the loops are written over by the main rom copy routine later in the code. It's copied into RAM, then the copy code sets those bytes each time through the loop when copying 1MB of flash to psram.

This is a prime thing to clean up... self-modifying code is usually something to be avoided when you can. Especially where the locations are hardcoded to one version of code. One change to the loops above and you'll have a prbolem if you also forget to change the self-modifying parts later.

I'm not sure why he simply didn't do something like

Code: [Select]
        LDX     #$0000
MOV_1M_LOOP:
LDA.L     $400000,X  ; READ GBA CARD
        STA.L     $500000,X  ; WRITE PSRAM
  LDA.L     $410000,X  ; READ GBA CARD
        STA.L     $510000,X  ; WRITE PSRAM
LDA.L     $420000,X  ; READ GBA CARD
        STA.L     $520000,X  ; WRITE PSRAM
LDA.L     $430000,X  ; READ GBA CARD
        STA.L     $530000,X  ; WRITE PSRAM
LDA.L     $440000,X  ; READ GBA CARD
        STA.L     $540000,X  ; WRITE PSRAM
LDA.L     $450000,X  ; READ GBA CARD
        STA.L     $550000,X  ; WRITE PSRAM
LDA.L     $460000,X  ; READ GBA CARD
        STA.L     $560000,X  ; WRITE PSRAM
LDA.L     $470000,X  ; READ GBA CARD
        STA.L     $570000,X  ; WRITE PSRAM
LDA.L     $480000,X  ; READ GBA CARD
        STA.L     $580000,X  ; WRITE PSRAM
LDA.L     $490000,X  ; READ GBA CARD
        STA.L     $590000,X  ; WRITE PSRAM
LDA.L     $4A0000,X  ; READ GBA CARD
        STA.L     $5A0000,X  ; WRITE PSRAM
LDA.L     $4B0000,X  ; READ GBA CARD
        STA.L     $5B0000,X  ; WRITE PSRAM
LDA.L     $4C0000,X  ; READ GBA CARD
        STA.L     $5C0000,X  ; WRITE PSRAM
LDA.L     $4D0000,X  ; READ GBA CARD
        STA.L     $5D0000,X  ; WRITE PSRAM
LDA.L     $4E0000,X  ; READ GBA CARD
        STA.L     $5E0000,X  ; WRITE PSRAM
LDA.L     $4F0000,X  ; READ GBA CARD
        STA.L     $5F0000,X  ; WRITE PSRAM
      INX
        INX
        BNE     MOV_1M_LOOP

It's not so big and avoids all the self-modifying. It should be faster as well. Cleaning up other parts of the code would also make up for the difference in size.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ~tak on February 23, 2010, 11:40:09 PM
could someone point me please to the maximum size for the menu? I assume it has one, right? :)

Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on February 23, 2010, 11:59:10 PM
could someone point me please to the maximum size for the menu? I assume it has one, right? :)

Like on the MD Myth, it's not so much about size as it is about making sure the "compatible" areas are reserved. You need to leave $C800 to $1FFFF reserved for the menu, and keep the total length below where the bad blocks are stored (madmonkey mentioned where the bad block list is once, but I forget the value - I think you can go to 512KB).
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: King Of Chaos on February 24, 2010, 02:00:12 AM
So that means a deluxe version is possible, correct?
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on February 24, 2010, 02:16:05 AM
According to v3.01 of the programmer the menu capacity is 16 Mbit. Dunno if you can use all of that though.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on February 24, 2010, 02:33:25 AM
Yes, a "deluxe" menu is possible. I'm not sure what the largest size the Neo2 Ultra Menu will write - it was 64KB on the MD. It might be the same here with the SNES. You'd have to use madmonkeys writer to write a bigger menu if that is indeed the case. That's what I use to write the MD deluxe menu.

Now that the SNES menu is released, madmonkey can start adding support for the SNES Myth in his writer as well.
 :D
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ~tak on February 24, 2010, 04:32:25 AM
Here's what I've got so far: http://jiggawatt.org/myth_menu_wla.asm

It's nearly done, but some directives haven't been translated, and I might have missed a couple of labels here and there so it probably won't assemble in its current form. I'll continue this tomorrow (today actually, since it's after midnight here :P )

Some more of the code should also be macrofied.

Since you've done a great job so far, let me contribute as well :)

Replace:
Code: [Select]
       .ORG    $FFC0
        .DB    "NEO TEAM (C) 2010        "
        .ORG    $FFD5
        .DB     $21,$01,$08,$03,$00,$00,$00
with:
Code: [Select]
.SNESHEADER
NAME    "NEO TEAM (C) 2010    " ; ROM Name in Header // 21Char Max!
HIROM ; Set ROM Type
FASTROM
CARTRIDGETYPE $01
ROMSIZE $08
SRAMSIZE $03
COUNTRY $00
LICENSEECODE $33
VERSION $00
.ENDSNES

Replace:
Code: [Select]
       HEX     000000with:
Code: [Select]
       .PRINTV        HEX     000000

I'm not sure if this should be changed as well from 2_Break to 1_Break?:
Code: [Select]
JMP    MOV_BOOT_TO_SRAM\2_BREAK

btw, can someone please explain me what this means? havent got it yet *CONFUSED*
Code: [Select]
       .ORG     $ABCD   ;MYTH
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on February 24, 2010, 02:15:45 PM
Quote
I'm not sure if this should be changed as well from 2_Break to 1_Break?:
Code:

   JMP    MOV_BOOT_TO_SRAM\2_BREAK
Nope, that's not a typo. It's a the same behaviour that was in the original code. But since that will in practice skip all subsequent tests, the code should be rewritten so that it jumps past all the tests at once instad of chaining JMPs like this.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Dr.neo on February 24, 2010, 02:59:10 PM
hehe, i like the open source more and more now  ::sm-18.gif::
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: spinal on February 25, 2010, 04:31:49 AM
[unrelated]
I wish I could learn asm quick enough to help you guys.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on February 26, 2010, 12:13:38 AM
Quote
Replace:
Code:

        HEX     000000

with:
Code:

        .PRINTV        HEX     000000

Actually I think it'd be equivalent to .DB $00,$00,$00. PRINTV HEX 000000 does something different.
But all those .ORG $ABCD / .DB '-' / HEX 000000 / .DB 'h'  don't seem to fill any purpose. I couldn't find anything like that in the menu binary, and the area starting at $ABCD only contains zeroes.

Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on February 26, 2010, 12:47:26 AM
Well, remember that the 0.05 menu was a test menu - probably a number of those "random" values stuck here and there were merely to act as markers when looking at the data later, say after dumping the menu flash, just to be sure things were being written to the correct place.

Notice that the largest block of code is the test code. It's not really needed for the menu. Diagnostics should really be a different program that is burned and run if something is wrong. The menu really shouldn't need to do any more testing than is needed to run.

Separating the menu and diagnostic also allows you to be more comprehensive on both - the menu can be larger with more features since it isn't "wasting" space on unneeded tests, and the diagnostic can do more testing since it's not "wasting" space on menu code.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on February 26, 2010, 12:51:49 AM
A lot of that code can be macrofied, which will make it a lot more compact than it is now. It can then be IFDEF:ed so that it only will be included when building with a DEBUG flag.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on February 26, 2010, 06:15:24 PM
Here's an update: http://jiggawatt.org/myth_menu_wla-2.zip

I haven't done anything about the self-modifying code yet. But I've macrofied some more code, and I've replaced nearly all hardcoded IO-register addresses with defines. I've also moved some of the defines and macros into separate files for clarity.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ~tak on February 27, 2010, 01:00:31 AM
_mic, thank you so much for all your effort on this! appriciate it

since I'm new to this kind of ASM and SNES, and try to make your source working with wla-dx too, can you help me on this?
Code: [Select]
-:      LDA     SDATA1,X
shouldn't it be like that?
Code: [Select]
-:      LDA.w     SDATA1,X
I'm not quite sure yet...
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on February 27, 2010, 01:06:24 AM
That should only be necessary if the SDATA1 evaluated to something <=0xFF, in order to disambiguate between a direct page address and an absolute address.
For some reason you still have to write .L for 24-bit addresses (you'd think the assembler would figure that out automatically). WLA-DX is weird in some ways..  :-X
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on February 27, 2010, 08:30:42 PM
Good work mic_! This cleanup will help alot the development of the new menu  ~sm-42.gif~
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ 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.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ 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.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on March 02, 2010, 02:23:36 AM
..and we have lift off: http://jiggawatt.org/badc0de/myth_menu_wla-4.zip

(http://jiggawatt.org/picsplz/mythmenuwla.png)

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.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ~tak 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
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: spinal 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)
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ 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.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: spinal 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.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on March 02, 2010, 04:35:32 AM
Yeah, I just tried it myself and noticed the same thing.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ 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
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ 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.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Dr.neo 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
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly 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.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ 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.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ 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%.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ 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
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on March 25, 2010, 03:00:49 AM
Nice! Every little bit helps.  :D
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: sanni on March 25, 2010, 05:03:37 AM
Just out of curiosity, the menu is a rom(like a game), so it "runs" on the SNES cpu and not in the fpga thingie in the Neo Myth Cart?
So for making a menu for MD Myth you need to know how to code for MD, for a SNES menu you need to know about SNES development and for the N64 menu you would need to know about N64 dev?
And that menu, which runs on the snes, has access to the Neo2 cart and then loads a game rom into the Neo Myth cart and tells the SNES: "here is your game"?

So if one would take your SNES code and do some magic and then put it in the N64 Myth, it would not work because it is coded for SNES and not N64 right?

So this:
LDA.W   $0000,X    ; READ GBA CARD
STA.L   $500000,X  ; WRITE PSRAM
tells the SNES, go there and do that, it doesn't tell the  fpga thingie in the Neo Myth Cart to do it?

(sorry for offtopic and stupid questions  ::sm-02::)
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on March 25, 2010, 05:12:31 AM
I figured I might as well unroll the loop one extra step (to 16 bytes/iteration): http://jiggawatt.org/badc0de/myth_menu_wla-0.08.zip
Should be about 6.6% faster than the previous improvement.

I think 16 bytes/iteration pretty much is as far as it's worth unrolling the loop. If you doubled it to 32 bytes it would start getting kinda bloated, and the additional gain in speed would only be something like 3.5%.

@sanni: Yes. The menu code runs on the host console's CPU. In this case it's the SNES so it's 65816 code. If it was the MD Myth it would be M68000 code. The only thing special about those LDA/STA instructions you mentioned is that the memory areas they reference ($4xxxxx and $5xxxxx) are mapped to the Neo2 card and PSRAM in the Myth, respectively. That mapping is something I guess the FPGA handles, unless there's some additional hardware for that.


Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on March 26, 2010, 05:42:24 AM
Generally speaking - the flash card in the Myth presents the menu flash to the console at power-on for it to boot from. Native code for the console in question is loaded and run - that code is the menu. The menu does what is need to run a selected game - that may be to copy the game from flash or SD into RAM inside the Myth, or perhaps to simply point to where the game is in flash so the console can access it directly. Then the menu simulates a reset so that the console starts the selected game as if it were booting for the first time.

For the MD Myth, the code is 68000, but my extended menu (in the works right now) will also run on the 32X for a nicer (and maybe faster) menu if the user has a 32X. In that case, the menu code will be SH2.

For the SNES Myth, the code is 65816. I'm not sure if we can take advantage of coprocessors on the SNES, but it's something I will be looking into eventually.

For the N64, the code is MIPS64. If you want to work on all of them, you should look into coding for those CPUs. You don't have to be an expert at assembly - all the above have C compilers, and the bulk of the current MD menu is in C, not assembly. It will be the same for the others once I get the updated menu going - mostly C with a little assembly for certain low-level tasks.

Also, while you can't DIRECTLY use (assembly) code for one CPU on another, you can use the lessons learned to make the code for the other CPU faster/better.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: the|Gamer on March 27, 2010, 11:54:47 PM
Hi,
O.K.

I get everything ready for compile !
Then I try to design the User Interface so we can split the work ;)
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on March 28, 2010, 02:06:34 AM
Then I try to design the User Interface

What do you mean exactly  ???
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: the|Gamer on March 28, 2010, 05:14:33 AM
Hi,
a german SNES Coder "Dforce300 or D4S" had a project named "Ultra16" I want a NEO SNES Myth Menu that looks like his menü :

http://www.youtube.com/watch?v=Jpn7J2OUy7k&feature=player_embedded
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: sanni on March 28, 2010, 05:24:46 PM
Here are some things to read about N64 coding: http://tinyurl.com/ylshxj5
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on March 28, 2010, 06:16:36 PM
Quote
Here are some things to read about N64 coding:
Huh? Wrong forum? This is the SNES dev section.

Anyway, I find it hard to see who's going to want to spend all that time working on something that's just a copy of some existing UI. The Ultra16 probably has features that the Myth doesn't, so it would be better to come up with a new UI that's made specifically for the Myth.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on March 28, 2010, 07:01:05 PM
I agree with mic_ , and regarding the asm menu , i prefer it the way it is now , and i like how mic_ keeps working on it and cleaned up some parts.

That way , the C(with asm support code) menu will be much easier to be implemented , and once the important features are finished(SD,FS,Better detection,Region patching) then maybe it wouldn't hurt to create a gui.

But to work right now on a full gui menu i think its unrealistic  :P
(Not to mention that the official programmer still has the 64KB menu code limit and we will have to wait until madmonkey is done with SNES support)
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: madmonkey on March 28, 2010, 08:22:35 PM
you don't have to wait for the snes support, you can use raw io command line options to write whatever you like to the menu flash.
of course menu entries(for roms on flash) will be erased in this case, but it doesn't matter for test builds, or if you only plan on using sd cart with it.
but I agree that gui should not be a priority.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on March 29, 2010, 12:38:12 AM
I've got another menu update for you guys to try: http://jiggawatt.org/badc0de/myth_menu_wla-0.09.zip

The biggest news here is that it lists up to 8 games at once. The choise of colors are a bit bad since I haven't bothered changing the palette. This list of games should probably be some shade of gray instead, with the currently highlighted game in white. Would make it easier to read IMO.

Screenshot:
(http://jiggawatt.org/picsplz/mythmenuv009.jpg)

I've also made a small improvement to the game loading code once again, so it should be about 4% faster than v0.08. Some of the old code has also been rewritten, changed or moved around by me. Since the original code is written in a pretty obfuscated way it was easier for me to just write my own routines.

There's one downgrade in this version; namely that it doesn't show the games' save type. That's something that could be put back in, though. I just haven't done it yet.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on March 29, 2010, 01:20:43 AM
Great job mic_   >:D , posted it on news http://www.neoflash.com/go/index.php        ~sm-77.gif~.gif
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: spinal on March 29, 2010, 01:58:55 AM
Excellent work mic_ I can't wait to try it.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ronaldo_76 on March 29, 2010, 02:05:32 AM
thanks mic_  :-*
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on March 29, 2010, 04:19:41 AM
Nice job adding that to the asm menu!   ::sm-09.gif::
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on March 30, 2010, 12:51:39 AM
The menu has officially been pimped   ~sm-67.gif~.gif

Download link: http://jiggawatt.org/badc0de/myth_menu_wla-0.10.zip

I've updated the menu with some nicer graphics today. The graphics for the second BG layer are compressed using LZSS because it allowed me to fit them in 7kB instead of 20kB. I've included the compressor in the source directory so that you still will be able to compile the menu source yourself if you wish to do so. The .PDN file (for Paint.NET) is also included if you want to make changes to it.

Screenshot:
(http://jiggawatt.org/picsplz/mythmenu010.jpg)

And a short video: http://www.youtube.com/watch?v=Cz6TtGf72ZU
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: sanni on March 30, 2010, 12:59:27 AM
You sir, are the greatest  :) ;D

That is looking fantastic  >:D :-*
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: spinal on March 30, 2010, 01:02:41 AM
Looks great mic_, much, um, SNESier that anything I would have came up with.


..so is the menu staying asm, or are there any plans to port it to C in the future?
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on March 30, 2010, 01:13:51 AM
Quote
..so is the menu staying asm, or are there any plans to port it to C in the future?
I don't know. I'm not sure what ChillyWilly (and Conle?) have in mind. I guess they've got their plates full since they're also involved with the MD Myth and the N64 Myth.
I'm just working on the SNES menu for the time being, and I'm staying with asm. But anyone is free to rewrite the menu - entirely or partially - in some other language.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Sektor on March 30, 2010, 01:22:45 AM
Nice job, it looks great!
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on March 30, 2010, 01:54:16 AM
I'm hoping the C based menu I've been working on for the MD and N64 also compiles with tcc in the snes-sdk. I'm shooting for a generic framework menu so that all the different Myths have a similar look and feel to them. I may have to make a snes specific version if the snes-sdk compiler has trouble.

In the meantime, I love all the work mic has put into the assembly based menu. He's really doing a great job here.  ::sm-29.gif::
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on March 30, 2010, 02:01:21 AM
Wow!  ~sm-66.gif~.gif impressive work  ~sm-77.gif~.gif ! That looks really beatiful :D

Will post it on news once i finish something  im working on ::sm-07.gif:: 
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: spinal on March 30, 2010, 02:46:44 AM
Will post it on news once i finish something  im working on ::sm-07.gif::

Done!  :D
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on March 30, 2010, 07:17:49 PM
One feature I think would be nice is the ability to list the games alphabetically (like, press Select and the games are listed alphabetically. Press Select again and the games are shown in the order they were put on the cart). It's certainly doable, but it would complicate the code a bit, so I'm not working on that right now.

I've been working on some other small additions though, as you can see here:
(http://jiggawatt.org/picsplz/mythmenu011-wip1.png)

There are now arrows indicating if the games list can be scrolled further down/up. The ROM size, save size, ROM type and DSP type are now also shown. I've picked a slightly darker color for the non-highlighted games to give better contrast. I'm also thinking of making L and R scroll through the list 8 games at a time.
I expect to be done with these fixes sometime today or tomorrow.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on March 30, 2010, 08:09:16 PM
Its only getting better & better ! 8)

PS:
Imagine what will happen if mic_ & ChillyWilly meet each other in real life.... => They will be talking in ASM   ~sm-73.gif~.gif  ~sm-80.gif~.gif
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on March 31, 2010, 02:22:27 AM
Here's v0.11 with the additions that I mentioned in my previous post: http://jiggawatt.org/badc0de/myth_menu_wla-0.11.zip

Screenshot:
(http://jiggawatt.org/picsplz/mythmenu011.jpg)

And another youtube video: http://www.youtube.com/watch?v=0oYRgq65ix8

There are three bugs in this version that I'm aware of; the first two happens after you run the cart self test (by pressing Start). The card revision (shown at the top of the screen) will become incorrect, and the "GAME (nnn)" counter will also show the wrong value. None of these affect the operation of the menu, it's only the wrong graphics that are shown. I know how to fix both bugs so I'll take care of that later.
The third is that the ROM type will always be shown as "LOROM" in the menu, even for HIROM games. I'm not sure why that's happening because it works with the example ROM entries that are in the code.

I've added some more comments in the code where I describe some of the data tables that are used.

On a bit of a side note, I started thinking that apLib perhaps would be a better choise to compress some of the data, rather than LZSS. The apLib encoder performs slightly better than LZSS, and the decoder uses less RAM than my LZSS decoder and is probably faster. The downside is obviously that there's no apLib decoder for the 65816 that I'm aware of. There's a 68000 implementation that was posted over at the SpritesMind forum that perhaps could be ported to the 65816, with some changes (the 65816 doesn't have 32-bit registers like the 68000 does). This would be a pretty low-priority task, but it could be useful.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: spinal on March 31, 2010, 02:52:02 AM
Wow, another update, probably before some people noticed the previous one!
Great stuff.  :P
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on March 31, 2010, 02:57:09 AM
mic_ thanks for all your efforts  ~sm-77.gif~.gif , but i think at this point it would worth the trouble to make a C menu just like ChillyWilly's md menu(myth io/config functionality in asm & the rest just C code) before it gets too complex.  ~sm-67.gif~.gif


Also there seems to be enough people willing to contribute compared with md/n64 myth so that's another good reason :)
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on March 31, 2010, 03:12:04 AM
I wouldn't call the current code complex. Of course that may be because I've written much of it myself, and because I've read through the other parts more than most people. So I personally see no need for a rewrite - but like I've said; I'm not stopping anyone else from doing that.

This shouldn't be seen as THE menu. It's just my own personal menu that I'm sharing with the rest of you in case anyone else wants to use it   ::sm-24.gif::
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on March 31, 2010, 03:32:07 AM
in case anyone else wants to use it   ::sm-24.gif::

 ~sm-80.gif~.gif
Yeah , like pretty much anyone who happens to own a myth snes fc  ~sm-80.gif~.gif
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: DjoeN on April 02, 2010, 04:28:57 AM
Thx mic_,

For sharing your custom menu for the snes myth!
Appreciate it very much!
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: 64scener on April 02, 2010, 06:15:24 PM
Awsome menu, thanks! :-)
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ~tak on April 03, 2010, 06:53:35 PM
dude! I was just off for some weeks and now this very cool work from _mic! well done mate.

@mic: have you consider to use bitmap fonts (8x8), such as from a cracktro?
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on April 04, 2010, 09:09:55 PM
The current font _is_ an 8x8 bitmap font. They only use one bitplane in order to save space, so each pixel can only be either color 0 (transparent) or color 1. If you want to use a font with a different look, all you need to do is replace all the font data starting at the label TYPE:. I made a comment there in the source code that explains the data format. The first char in the font is $20 (space) and it goes all the way up to $ff, or something like that.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ~tak on April 04, 2010, 11:57:59 PM
very cool, I had not yet the time to download your latest src, just have seen the pictures.
thanks also for further details, you're work is very valuable to everyone here, kudos!
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on April 06, 2010, 05:10:19 PM
Just a few quick notes from the 15 minutes or so that I spent playing around with the SNES C compiler:

* Function parameters seem to be passed on the stack, and are pushed right-to-left. 8-bit parameters are actually pushed as 8-bit and not as 16-bit.

* Return values are put in the variable tcc__r0, which seems to be a Direct Page variable.

One potential problem that I noticed is that the compiler is using long addressing for subroutine calls/returns. This is bad for code relocation (like when the menu relocates parts of itself from ROM to RAM, as is the case). It may be possible to do a work-around for this by creating function pointers for all the relevant functions and offset them by the RAM base address. I don't know exactly what the compiler supports so I can't say for sure.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Dr.neo on April 06, 2010, 08:46:35 PM
woo mic_ , it's a great menu indeed! you are our hero!

 ~sm-93.gif~.gif
 ~sm-93.gif~.gif
 ~sm-93.gif~.gif
 ~sm-93.gif~.gif
 ~sm-93.gif~.gif
 ~sm-93.gif~.gif
 ~sm-93.gif~.gif
 ~sm-93.gif~.gif
 ~sm-43.gif~
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on April 07, 2010, 02:02:05 AM
I've fixed the 3 known bugs from the previous version, so here is v0.12: http://jiggawatt.org/badc0de/myth_menu_wla-0.12.zip
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on April 07, 2010, 02:24:28 AM
Nice work as usual!  ~sm-77.gif~.gif

That's good info on the compiler. I didn't know about the return value thingy. It seems to me that only assembly functions that hammer on the hardware directly should go into ram, and those can be written to be position independent. C code would be for a higher level in the menu, and not need to be relocated. That's how I handle it with the MD menu - anything the hammers directly on the Myth goes into RAM (mainly because it needs to as the menu flash will not be mapped during certain Myth operations), and is in assembly except for a few routines in the SD interface handler.

Does the SNES compiler do sections? That's the main method I use on the MD menu to put code into RAM. I seem to remember seeing code to copy the .data section to RAM in the SNES startup code, so as long as the compiler allows you to designate sections, that should handle relocation issues.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on April 07, 2010, 02:41:22 AM
Quote
Does the SNES compiler do sections?
Yep. In fact it appears to create a new section for every function. And then there are some others like .data, .rodata, .bss.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on April 07, 2010, 05:32:24 AM
The .data section is the one you'd want for Myth code. That's one place you can always count on to be around, while the rom can/will switch between the menu and game flash, or some offset into the menu or game flash. Assuming we can use the zip ram with the SNES Myth, the flash will disappear completely while the zip ram is selected.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on April 07, 2010, 10:20:32 PM
Here's some menu C code for those interested (based on the assembly menu): http://jiggawatt.org/badc0de/myth_menu-0.20-wip1.zip

Note that while this code does compile, the resulting binary isn't usable since so much stuff is missing. I just thought I should get the ball rolling.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on April 07, 2010, 11:48:28 PM
Here's some menu C code for those interested (based on the assembly menu): http://jiggawatt.org/badc0de/myth_menu-0.20-wip1.zip

Note that while this code does compile, the resulting binary isn't usable since so much stuff is missing. I just thought I should get the ball rolling.

Excellent job  ;D  ;D  ;D
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on April 08, 2010, 01:42:08 AM
Here's some menu C code for those interested (based on the assembly menu): http://jiggawatt.org/badc0de/myth_menu-0.20-wip1.zip

Note that while this code does compile, the resulting binary isn't usable since so much stuff is missing. I just thought I should get the ball rolling.

Me and Conle have been making good strides in improving certain features (using the MD Myth) which we should be able to move over to the SNES fairly easily given how alike the two are. After we release the next MD update, I'll be hopping on this.
 ~sm-78.gif~.gif :D
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on April 08, 2010, 04:50:10 AM
Another small observation: Any function that writes more than a couple of bytes to VRAM should probably be in assembly. The code generated by the C compiler just isn't fast enough to finish within reasonable time, so you end up having to insert a lot of extra wait-for-vblanks to ensure that you're never writing to VRAM during the active display phase. This in turn makes the whole menu pretty sluggish.

An alternative could be to have the C functions update the map data to a buffer in RAM instead, and then DMA that whole chunk of memory to VRAM once all pending updates have finished.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on April 08, 2010, 03:32:29 PM
Another small observation: Any function that writes more than a couple of bytes to VRAM should probably be in assembly. The code generated by the C compiler just isn't fast enough to finish within reasonable time, so you end up having to insert a lot of extra wait-for-vblanks to ensure that you're never writing to VRAM during the active display phase. This in turn makes the whole menu pretty sluggish.

How about a C extern imported function in ASM that will look like : void write to vram(buffer,offset,size) ?
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on April 08, 2010, 03:42:47 PM
No need. I've implemented the DMA-buffer idea and it seems to give good performance.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on April 08, 2010, 03:56:58 PM
Here's the latest C code: http://jiggawatt.org/badc0de/myth_menu-0.20-wip2.zip

It now lets you move up and down through the games list, but you can't actually run a game yet.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on April 08, 2010, 04:04:33 PM
You're really fast  :P  :D
Thanks for all your hard work  8)
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on April 09, 2010, 01:44:37 AM
You're really fast  :P  :D
Thanks for all your hard work  8)

He's trying to steal my coding machine title!  ^-^
 ~sm-79.gif~.gif
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on April 09, 2010, 05:02:27 PM
Another WIP of the C version: http://jiggawatt.org/badc0de/myth_menu-0.20-wip3.zip

This implements nearly everything from the asm version, except for the cart self test and parts of the code needed to run ROMs. A new feature is that if you go to the "secondary cart" screen (by pressing Y) you'll also see some system information (CPU/PPU version etc). I've also begun implementing support for listing ROMs in alphabetical order, but it's not used yet.

The big problem with this menu is that it doesn't work on the Myth (you can test it in BSNES though) :P
I'm not sure yet why that is. I've switched to the same memory configuration as the assembly menu (HIROM, code starting at bank 1) - including recompiling all the SNESC libraries, which I've included in the zip. The one major difference from the asm version is that this menu runs almost entirely from ROM. But the first part of the asm menu also runs from ROM so I don't see why that should be a problem, until you start messing with the Myth banking registers maybe.

As far as code relocation goes, I decided to handle that manually for the small amount of code that is copied to RAM. It seems like the assembler doesn't allow you to place code inside a .ramsection, and the sections created by the C compiler for code are all SUPERFREE, which means the linker will put them at the lowest free address it can find - and that's typically in ROM.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on April 09, 2010, 10:36:52 PM
Doesn't snes-sdk compile projects as LOROM? I ran into that myself when trying to run the example that comes with it. The includes/asms with snes-sdk also have comment like "we'll get to hirom eventually".
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on April 10, 2010, 02:15:54 AM
Doesn't snes-sdk compile projects as LOROM? I ran into that myself when trying to run the example that comes with it. The includes/asms with snes-sdk also have comment like "we'll get to hirom eventually".

Indeed it does, but:
Quote from: mic_
I've switched to the same memory configuration as the assembly menu (HIROM, code starting at bank 1) - including recompiling all the SNESC libraries, which I've included in the zip.

So I've successfully switched it to HIROM. I was just bringing that up so that noone would think that I was using a memory layout completely different from the asm version's and expecting it to work.

Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on April 10, 2010, 02:46:50 AM
Just making sure.  :D

Maybe it doesn't work from the Myth because it then tries to actually use it. BSNES has no Myth cart, so improperly using something that doesn't exist maybe doesn't hang the menu. Or something.  ~sm-82.gif~.gif  ~sm-79.gif~.gif
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on April 10, 2010, 02:51:56 AM
Yeah it could be something that the crt0 does that the Myth doesn't like. Or maybe I've forgotten a write to some Myth I/O register (though I think I made sure to include all of them). It's just gonna take some good old staring-at-source-code debugging to figure it out, since the Myth-specific stuff isn't testable in an emulator.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on April 10, 2010, 08:45:51 AM
Yeah it could be something that the crt0 does that the Myth doesn't like. Or maybe I've forgotten a write to some Myth I/O register (though I think I made sure to include all of them). It's just gonna take some good old staring-at-source-code debugging to figure it out, since the Myth-specific stuff isn't testable in an emulator.

How big is your code? On the MD Myth, it defaults to only showing 64KB (or something like that) to the Genesis. It could be something here. That's why one of the first things the Genesis init does it to activate the menu flash properly and set it to show the full 1MB that can be mapped into the Genesis space. You might need to do something similar on the SNES.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on April 10, 2010, 09:23:56 AM
How big is your code?

I can answer this. Its 1Mb! 
NEOSNES.BIN 128KB

But even the original menu has the same size
 ::sm-07.gif::
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on April 10, 2010, 09:50:45 AM
I can answer this. Its 1Mb! 
NEOSNES.BIN 128KB

But even the original menu has the same size
 ::sm-07.gif::

But like the original MD menu, it doesn't use anything outside the first 64KB. The rest is padding. It just makes me wonder if it has the same issue given how much like the MD Myth it is.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on April 10, 2010, 11:57:12 AM
But like the original MD menu, it doesn't use anything outside the first 64KB. The rest is padding. It just makes me wonder if it has the same issue given how much like the MD Myth it is.

I had a quick look at offsets $10000 ~ $20000 and both versions(C & ASM) only got padbytes like you said  :D . But at the same time this means
that the issue is not the size of the code  >:(  :-X
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on April 10, 2010, 06:01:13 PM
Ok, I figured out what the problem was.. The Myth doesn't use the reset vector when starting the menu. It just assumes that the entrypoint is at 00:8000. But the SNESC crt0 had some dummy interrupt handlers at 8000, so the first instruction that would be executed was an RTI, which would cause a branch to who-knows-where. I fixed it by inserting a JMP to the real entry point as the first instruction at 8000.

Here's the latest code/libraries: http://jiggawatt.org/badc0de/myth_menu-0.20-wip4.zip

Note that you still can't start any games because that code isn't finished yet.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on April 11, 2010, 12:10:01 AM
 ~sm-57.gif~.gif  Great news  ~sm-42.gif~
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on April 12, 2010, 09:16:50 PM
The latest C code: http://jiggawatt.org/badc0de/myth_menu-0.20-wip5.zip

Booting the cart plugged into the back of the Myth now works. Alphabetical listing has also been added (press Select to switch between logical and alphabetical listing).

Booting ROMs still isn't working for some reason. I've verified that the correct data is being copied to PSRAM, but then something goes wrong and the game never starts. I'll see if I can find anything tomorrow or maybe Wednesday.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: King Of Chaos on April 13, 2010, 06:39:14 AM
Awesome work! :)
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ronaldo_76 on April 13, 2010, 04:12:09 PM
the menu looks great mic_  ~sm-42.gif~
i hope you get the games started.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on April 15, 2010, 02:28:18 AM
Ok, here it is finally with ROM loading working:

Just the binary: http://jiggawatt.org/badc0de/myth_menu-0.20.zip
Source code: http://jiggawatt.org/badc0de/myth_menu-0.20-src.zip

And a short video showing off some of the features: http://www.youtube.com/watch?v=uWnpau8CLjE

The file neo2.asm in the source package is a bit messy right now because there's some unused code in there that I haven't cleaned out already. And I should probably turn the screen on a bit later than I'm doing now, because in the current version you'll see some garbage on BG0 for a couple of frames when you first power your SNES on.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ronaldo_76 on April 15, 2010, 02:53:56 AM
mic_ you are great.  :-*
thank you so much for this menü, i like it. and thanks for the hard work and time you invest in it.

THANK YOU
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on April 15, 2010, 02:57:26 AM
I like the transition effect from the menu to the info. That's pretty cool.  8)
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on April 15, 2010, 11:08:27 AM
Great job again  >:D - and yeah that transition effect is really cool.I moved the video stream pointer back just to watch it for 2nd time  ~sm-80.gif~.gif
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: stefan_iro on April 16, 2010, 01:09:42 AM
Hello mic_,

your menu looks really impressive!
Unfortunatelly I have no idea how to burn the v0.20 to the SNES Myth card?  ~sm-41.gif~
Do I need the Nero Dual Programmer to burn the NEOSNES.BIN to the FPGA?

Thanks for your help,
Stefan
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ronaldo_76 on April 16, 2010, 01:14:39 AM
copy the "NEOSNES.BIN" to root dir of the NEO2 Ultra Menu and burn the card
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on April 16, 2010, 01:15:03 AM
If you're using the NEO2 Ultra Menu software on your PC all you need to do is open the program directory (e.g. C:\NEO2 Ultra Menu) and paste the new NEOSNES.BIN in there before running the program. After that, whenever you add new games to the cart it will put the new menu on the cart as well.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: stefan_iro on April 16, 2010, 02:03:24 AM
Thanks to ronaldo_76 & mic_ for this little guide!  ~sm-76.gif~.gif
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on May 03, 2010, 03:08:30 AM
Menu v0.22 is now available: http://jiggawatt.org/badc0de/myth_menu-0.22.zip

The biggest news in this version is that you can now use game genie codes (up to 4 of them).
Some of the controls have changed a bit from earlier versions of the menu, but I've included a readme in the zip that explains the controls for all the submenus.

Screenshot:
(http://jiggawatt.org/badc0de/mythmenu022.png)

A video showing the game genie functionality: http://www.youtube.com/watch?v=c8ZfmludfKA


The source code is no longer available on my server. I've moved it to the same google code repository where the MD menu is hosted: http://code.google.com/p/neo-myth-menu/
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: King Of Chaos on May 03, 2010, 05:03:42 AM
Amazing, good work! One question, will it be possible to support Pro Action Replay codes eventually? Example of a PAR code is 7E09C51A - AFAIK the SNES Game Genie does ROM and PAR does RAM (and ROM too?).
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on May 03, 2010, 06:43:06 AM
GG and PAR codes both do ROM and RAM. RAM codes will not work on the Myth as it is not really a GG or PAR. ROM codes work because they patch the ROM. RAM codes require special hardware that intercepts RAM reads and replaces the value with it's own value.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on May 03, 2010, 01:01:53 PM
GG on the SNES didn't handle RAM, only the AR did (unless the info I've found is wrong).
The Myth might actually be able to do cheats that patch RAM, unless the cheat routine that gets copied to the FPGA's RAM just was an idea Neoflash had that didn't get implemented (look at run_3800 and CHEAT in neo2.asm - those are both from the original menu code and not written by me).
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ChillyWilly on May 03, 2010, 01:58:03 PM
The SNES Myth provides sram at 0x3800 to 0x3FFF so that the menu has a way to start the game without the flash being mapped into the address space. This allows the start code to clear all the SNES RAM and hardware so the game starts clean. It doesn't take up all the sram, so there's room for patches to individual games - when a game is loaded, the code could be patched to jump to a small routine in the sram which does it's thing, then returns back to the game. I think the CHEAT code is an example of that. The loader would patch the game to jump from the correct spot to 0x3E00 to the CHEAT code, which then returns back to the game. This would have to be done by a programmer for each individual game.

Example: let's say we have a GG or PAR code that we know patches RAM. We don't have hardware to patch RAM, so what we do is look at the game in question and find it's vertical blank handler. Then we alter the exit code of the handler to jump to 0x3E00 instead. The code there would store the correct GG or PAR value to the correct place in RAM and then exit. So each and every vblank would force the RAM to the value from the cheat code. That would probably work for many games. It's just a matter of knowing where to patch the game to make the jump to the cheat code in the sram. It wouldn't necessarily need to be the vertical blank - it could be the code that reads the controller pad, or some other routine called right before the RAM in question is used.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on May 03, 2010, 02:06:47 PM
Patching the vblank vector (or intercepting the read) is exactly how the AR worked on the SNES iirc. For GG codes you don't have to worry about that since they only target ROM. One could of course come up with new GG codes that target RAM, which would then work on the Myth or in an emulator but not on a real GG.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on May 03, 2010, 06:49:43 PM
The NMI vector seems to be stored right before the RESET vector, i.e. at $FFFA. One could keep a small table (for 4-8 codes) that the Cheat routine goes through to patch the relevant RAM locations every frame before jumping to the original NMI vector. You could re-use the current code editing menu since AR codes are the same length as GG codes (8 bytes). The difference is that AR code don't need to be deciphered in any way, they're entered directly as BBOOOOVV (BB=bank, OOOO=offset, VV=value).
I can try doing this later unless someone else does it before me.

 
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on May 04, 2010, 11:31:07 AM
Menu v0.22 is now available: http://jiggawatt.org/badc0de/myth_menu-0.22.zip

The biggest news in this version is that you can now use game genie codes (up to 4 of them).
Some of the controls have changed a bit from earlier versions of the menu, but I've included a readme in the zip that explains the controls for all the submenus.

Screenshot:
(http://jiggawatt.org/badc0de/mythmenu022.png)

A video showing the game genie functionality: http://www.youtube.com/watch?v=c8ZfmludfKA


The source code is no longer available on my server. I've moved it to the same google code repository where the MD menu is hosted: http://code.google.com/p/neo-myth-menu/

Just posted it on the news page  :)
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on May 05, 2010, 04:02:54 AM
Action Replay support has been added in the latest version: http://jiggawatt.org/badc0de/myth_menu-0.23.zip

Screenshots:
(http://jiggawatt.org/badc0de/mythmenu023.png)
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Conle on May 05, 2010, 05:00:42 AM
Action Replay support has been added in the latest version: http://jiggawatt.org/badc0de/myth_menu-0.23.zip

Screenshots:
(http://jiggawatt.org/badc0de/mythmenu023.png)

I have just updated the main page  :D
By the way , maybe its time to open a new thread with your releases ?  :)
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: King Of Chaos on May 05, 2010, 10:20:11 AM
Holy ****! Excellent work man, love this menu! I'm wondering though if 4 codes is the absolute limit possible? If not, 8 may be more logical (since there's room on the right side). :)
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: ronaldo_76 on May 05, 2010, 02:38:49 PM
great work. fantastic menü! :-*
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on May 05, 2010, 03:30:37 PM
Holy ****! Excellent work man, love this menu! I'm wondering though if 4 codes is the absolute limit possible? If not, 8 may be more logical (since there's room on the right side). :)

You can actually have up to 8 codes now; 4 GG codes and 4 AR codes. There's no memory limitation to prevent supporting more codes though. I just capped it at 4 each because I thought "who's gonna want to do that much typing before playing a game anyway?".
One possibility for the empty space is to merge the GG and AR codes screens into one unified cheat screen, with GG codes to the left and AR codes to the right.

A feature that could be added in some future version is to have a cheat code database stored in the menu for some of the more common games. Assuming that your ROMs have good headers, the menu could then auto-detect which game you've highlighted by looking at the checksum (and possibly other header fields). By pressing a button you could then get a list of cheats for that game that you can pick from.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: King Of Chaos on May 05, 2010, 10:02:16 PM
You can actually have up to 8 codes now; 4 GG codes and 4 AR codes.

Yeah, I found that out and was messing with that. :P 8 GG and 8 PAR codes would be neat though which is more provided than the SNES PowerPak (only 5 Game Genie slots which doesn't support the Pro Action Replay codes). Thinking about it, if there's no limit perhaps by pressing a button it'll add a new code line to the list to add another code (which you can delete/remove by pressing another key)?

I just capped it at 4 each because I thought "who's gonna want to do that much typing before playing a game anyway?".

Me. There's some games out there with some interesting multiple codes. :P That and it'd be neat to test codes I hack on the real hardware instead of emulators.

One possibility for the empty space is to merge the GG and AR codes screens into one unified cheat screen, with GG codes to the left and AR codes to the right.

This could confuse some people - I think it's perfect as-is right now with separate menus.

A feature that could be added in some future version is to have a cheat code database stored in the menu for some of the more common games. Assuming that your ROMs have good headers, the menu could then auto-detect which game you've highlighted by looking at the checksum (and possibly other header fields). By pressing a button you could then get a list of cheats for that game that you can pick from.

I like this. How would the format be set up? There's a few databases of codes including an XML file out there, maybe it wouldn't be hard to whip a little something up to test. :P
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on May 05, 2010, 11:13:39 PM
Quote
I like this. How would the format be set up? There's a few databases of codes including an XML file out there, maybe it wouldn't be hard to whip a little something up to test.

I was thinking of doing it manually since I'm talking about maybe a couple of dozen games and a few hundred codes in total.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on May 06, 2010, 03:01:37 AM
Here's the kind of design I had in mind:

Code: [Select]
// cheat.h

#define CODE_TYPE_AR 1
#define CODE_TYPE_GG 2

typedef struct
{
char *codes;
char *description;
u8 codeType;
} cheat_t;


typedef struct
{
u16 romChecksum;
u16 romChecksumCompl;
cheat_t const **cheats;
} cheatDbEntry_t;


// super_mario_world.c

const cheat_t super_mario_world_cheats[] =
{
{"7E0F3099", "Fast timer", CODE_TYPE_AR},
{"7E0DBF63", "Infinite coins", CODE_TYPE_AR},
{"7E0DAA80", "Can\'t jump", CODE_TYPE_AR},
{"7E0DC101", "Always have Yoshi", CODE_TYPE_AR},
{"009E2562", "Start with 99 lives", CODE_TYPE_AR},
{"008E2888", "Timer doesn't count down", CODE_TYPE_AR},
{"009E35E6", "Start as Super Mario", CODE_TYPE_AR},
{"00D0B6A9", "Keep powerups when you fall and die", CODE_TYPE_AR},
{"3E2CAF6F", "Unlimited jumps", CODE_TYPE_GG},
{"DDB46F07", "Start with 1 life", CODE_TYPE_GG},
{"D6B46F07", "Start with 9 lives", CODE_TYPE_GG},
{"D02CAF6F", "Low jump", CODE_TYPE_GG},
{"D42CAF6F", "Super jump", CODE_TYPE_GG},
{"DF2CAF6F", "Mega jump", CODE_TYPE_GG},
{"CBB76D67D4B76DA73CB76FD769B76F07", "Start as Caped Mario", CODE_TYPE_GG},
{"DFCE64A0", "Little Yoshi grows into big Yoshi after eating 1 enemy", CODE_TYPE_GG}
};



// cheat_database.c

extern const cheat_t super_mario_world_cheats[];

const cheatDbEntry_t cheatDatabase[] =
{
{0xC536, 0x3AC9, super_mario_world_cheats}, // (E) (V1.1) [!]
{0xA0DA, 0x5F25, super_mario_world_cheats}, // (U) [!]
};

Note: This is not something I've tried compiling. I'm just giving you an idea of how a simple cheat database could be represented.

Each game would have its own C file with an array of cheats. And then cheatDatabase[] would keep a pointer to those arrays along with the ROM's checksum to be used for identification.
A cheat that require multiple codes would just store all the codes in one long sequence, as with the "Start as Caped Mario" cheat.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: King Of Chaos on May 06, 2010, 04:05:17 AM
That'd work for me. Super Mario World and Super Metroid are basically the few worthy ones anyways. :P Here's some of my favorites for Super Mario World...

"7E1497FF","Invincibility (Walk Though Enemies)"
"7E1490FF","Invincibility (Starman Effect)"
"89E4-AFD9+89C6-D4DB","Invincibility (Yoshi)"
"C2EC-0700","Infinite flying time for Yoshi"
"C222-D4DD","Infinite lives"
"7E001900","Always Small Mario"
"7E001901","Always Big Mario"
"7E001902","Always Cape Mario"
"7E001903","Always Fire Mario"
"DDC1-64DD+DDC5-6DAD","Nintendo's Debug"
"DDA6-DF07","Nintendo's Debug 2"
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on May 06, 2010, 05:31:49 PM
Here's how I plan for it to work:

(http://jiggawatt.org/mythmenucheats.png)

If you press Select at the main menu, the menu will check if there are any cheats in the cheat database for the highlighted game (by matching checksums). If there are any cheats available you will get a screen like the one shown above. There you can choose among the available cheats, which are listed only with their description. When you press B to add one of the cheats in the list, that entry should be highlighted in some other color (green?) and the remaining slots counter is decremented.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: stefan_iro on May 06, 2010, 10:33:06 PM
The SNES Myth Card is a good flash card, but just your menu makes it superior to the retrousb card  ~sm-76.gif~.gif

 ~sm-89.gif~.gif Keep on coding!  ~sm-88.gif~.gif
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: Sektor on May 06, 2010, 10:56:43 PM
It will need SD support to really be superior but still great work.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: King Of Chaos on May 06, 2010, 10:59:55 PM
I like the design, looks good to me. :D What other games would you want codes? I've got lists I could post here. :) Here's some from a few of my favorite games that don't require many codes...

Amazing Spider-Man, The - Lethal Foes (Japan):

"7E0E0C40","Infinite health"
"7E1C2309","Infinite lives"
"7E1C2263","Infinite time"


X-Men - Mutant Apocalypse (USA):

"7E0C4C21","Untouchable"
"33DB-E407","Infinite health"
"C2D1-8F67","Infinite lives (training mode)"
"C2D7-5F64","Infinite lives (mission mode)"
"7E0B7E08","Infinite lives (Wolverine)"
"7E0B7F08","Infinite lives (Cyclops)"
"7E0B8208","Infinite lives (Beast)"
"7E0B8008","Infinite lives (Psylocke)"
"7E0B8108","Infinite lives (Gambit)"
"7E0B8901","Use 1 button specials from practice mode in mission mode"


Star Fox (USA):

"79DB-2286","Invincibility"
"0DFC-FA8C","Infinite health (Slippy)"
"0DFC-FA5C","Infinite health (Falco)"
"0DFC-FA7C","Infinite health (Peppy)"
"DBF3-BE8B","Infinite lives"
"D9FC-9EEB","Infinite bombs"
"46DB-2286","Infinite shield"
"F4F2-F38B+DFF2-F35B","Double blasters"


Death and Return of Superman, The (USA):

"2D6B-CF6D+ED6C-CFAD","Invincibility"
"C92D-C7DD+992D-C70D+622D-C76D+242D-C7AD+D32F-CDDD","Infinite energy"
"3324-3F6D","Infinite lives"
"3323-C76D+D323-C7AD","Infinite special attacks"


Captain America and the Avengers (USA):

"7E16A820","Invincibility (Player 1)"
"7E16A963","Invincibility (Player 2)"
"7E022663","Infinite health (Player 1)"
"7E022763","Infinite health (Player 2)"
"7E0225FF","Infinite lives (Player 1)"
"7E0227FF","Infinite lives (Player 2)"


Regarding the SD card support, isn't it possible just to port the SD code from the MD Myth deluxe menu to the SNES menu?
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on May 06, 2010, 11:58:14 PM
Star Fox would be pointless to add since we can't play SuperFX games on the Myth anyway (that I know of). But I can add the others. If you can give me the SNES header checksum and checksum complement for the dumps you want recognized (probably the ones tagged [!]) that would be good.

Most of the SD-code from the MD menu can hopefully be reused. There's some low-level stuff in assembly that needs to be rewritten.

Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: King Of Chaos on May 07, 2010, 06:06:35 AM
Yeah, I forgot about Star Fox using the Super FX chip so cross that one off the list. Since you asked for both the checksum and complements, here they are for the ones I posted above (hopefully they're right and not reversed).

Amazing Spider-Man, The - Lethal Foes (J):

Header checksum: 0xB729
Checksum complement: 0x48D6

X-Men - Mutant Apocalypse (U):

Header checksum: 0x3807
Checksum complement: 0xC7F8

Death and Return of Superman, The (U):

Header checksum: 0x01A3
Checksum complement: 0xFE5C

Captain America and The Avengers (U):

Header checksum: 0xC971
Checksum complement: 0x368E

What some other games that I should post codes for? Any ideas, guys?

P.S. If these codes work for international versions of the games, I can post the checksums for them as well.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on May 07, 2010, 03:24:53 PM
Quote
What some other games that I should post codes for? Any ideas, guys?
The games I have in my list (besides the ones you've added) are

Castlevania : Dracula X
Chrono Trigger
Contra III
Legend of Zelda : A Link to The Past
Magical Quest Starring Mickey Mouse
Megaman X
Pocky & Rocky
Rock 'N Roll Racing
Secret of Mana
Super Castlevania IV
Super Ghouls 'N Ghosts
Super Mario World
Super Metroid
Super Punch-Out!!
Super Star Wars
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: stefan_iro on May 07, 2010, 04:33:53 PM
ARP codes is a great feature and your selection of implemented cheats is also good, but I wish there would be a pal/ntsc selection for games which check the country code of the system.
By now I have to fix games like Super Mario Allstars manually using tools like SNESTL12. I think it really would be nice to have a implemented pal/ntsc selection for games which ask for the country code...
 ~sm-74.gif~.gif
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on May 07, 2010, 04:37:26 PM
Autopatching region checks in games is certainly possible, and is something I'm considering adding to the menu. It will make game loading times longer though. Probably by at least 100%.
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: stefan_iro on May 07, 2010, 10:18:00 PM
Autopatching region checks in games is certainly possible, and is something I'm considering adding to the menu. It will make game loading times longer though. Probably by at least 100%.

Wow, 100% longer loading times!
But as with ARP codes this should be optional. If you don´t want longer loading times, just don´t use autopatching.
By the way, your coding skills are nothing but great!
 ~sm-36.gif~
Title: Re: the source code for SNES/SFC Myth Cart menu v0.05
Post by: mic_ on May 07, 2010, 10:33:21 PM
That was just a guesstimate, based on the fact that the ROM has to be copied from the Neo2 to PSRAM, and then scanned for a bunch of strings.
If someone were to do an offline scan of the entire GoodSNES set and determine that e.g. all of the games with software region protection have the protection code in the first megabyte of the ROM then that's something that could be used to speed up the patcher. :P