Uncompiled source code in Kart Fighter. Also, error messages in Somari?

Joined: December 5th, 2015, 3:15 am

April 7th, 2016, 2:47 am #1

I'm not sure if I posted this in the right part of PGC forums, but whatever. :P

So, I've been opening up some Hummer Team games with a hex editor text editor and found some (kinda) interesting stuff. :)

Apparently, there's a TON of uncompiled source code in Kart Fighter. (I put it in a spoiler because it's a lot of code). :
[+] spoiler
[+] spoiler

Code: Select all

       sta     Chreg3
        lda     (r0),y
        sta     Chreg4
     •–M  0ß–My
        sta     Chreg5
        rts
        ;;--------------------------------------
        ;;-     SetIpval:
        ;;-     inpmß–Mccò©–Mress.
        ;;-             r0 = $2002.
        ;;--------------------------------------
SetIpval:
        asl     a
        tax
™–M  ¨–M #$00
        lda     (r0),y          ;;; lda $2002.
        ldy     #$04
        lda     Ip_code
        asl     a
        asl    =¨–M  ‹––M ;;; Ip_code * 4.
        clc                     ;;; (Ip_code*4)+pat_address
        adc     pat_address+1,x ;;; lo.
        sta    —–Mˇˇ  hÆ–M     #$00
        adc     pat_address,x   ;;; hi.
        sta     (r0),y          ;;; store $2006 hi.
        lda     r2
        sta•Æ–Mr0–∞–M     ;;; store $2006 lo.
        iny
        ;;;-----     read ip_val.
        lda     (r0),y
        lda     (r0),y
        sta   J±–Mun8≥–M          ;;; set irq.
        lda     (r0),y
        sta     col_ndx                 ;;; set color.
        lda     (r0),y
        ,¥–M  †µ–M                ;;; set music.
        lda     #$00
        sta     col_msk
        sta     fade_cnt                ;;; initial fade.∂–M  ∏–M       ;;--------------------------------------
        ;;-     Setcheckcode:
        ;;-     input : Acc pat address.
        ;;-   ø∏–M  p∫–M2002.
        ;;--------------------------------------
Setcheckcode:
        asl     a
        tax
        ldy     #$00
        lddª–M(rÿº–M      ;;; lda $2002.
        iny
        iny
        lda     Ip_code
        asl     a
        asl     a               ;;; Ip_code RΩ–M  @ø–Mc
        adc     pat_address+1,x ;;; lo
        sta     (r0),y
        lda     #$00
        adc     pat_address,x   ;;; (Ip_code*4)∫ø–Mdd®¡–M      sta     (r0),y          ;;; store $2006
        iny
        ;;;-----     read ip_val.
        lda     (r0),y
        sta     _"¬–M  ƒ–M       ;;; set irq.
        lda     (r0),y
        sta     col_ndx                 ;;; set color.
        lda     (r0),y
        staMƒ–MMu                 ;;; set music.
        rts


;==============================================================================
;=      BacktˇˇC3ck to set c3.
;=              r0=$2002.
;==============================================================================
Backto_C3:
        lˇˇ  $00
        lda     (r0),y          ;;; lda $2002
        ldy     #$04
        lda     pat_address+4
        sta     (r0),y          ;;; stoˇˇ $ hi.
        lda     pat_address+5
        sta     (r0),y          ;;; store $2006 lo.
        iny
        lda     (r0),y          ;;; RESETˇˇ20x∆–Mb.
        ;;;
        ldx     #$00
?c10    lda     (r0),y                  ;;; read $2007 c3 sub.
        cmp     #$ff
        beqµ∆–Mc0       sta     _DBuffer,x              ;;; store c1 sub to ram.
        inx
        bne     ?c10
?c00    ;;;==================== seting over.ˇˇ  ‡»–Ma     (r0),y                  ;;; jmp to ram c1 sub.
        sta     a0              ;;; lo
        lda     (r0),y
        pha       …–M  HÀ–M; hi
        lda     a0
        pha                     ;;; lo
        rts

;;=====================================================ÖÀ–M==∞Õ–M========
;;=     PAT ROM DATA:                      PAT ROM ADDRESS.
;;=             SEG3_$3E8 BANK_VAL TABLE.   ($0E48).
;;=        ÌÕ–MEG––MP_VAL TABLE.     ($1170).
;;=             SEG5_$268 C3_SUB (RAM).     ($1668).
;;=
;;=             SEG1_$208 CHECK CODE $F8    ($0608í––M= Ä“–M    SEG7_$3ff CHECK CODE $8F    ($1FF8).
;;=============================================================================
pat_address:
±”–M       $0e,$48         ;;; 0 bank_val address.
        db      $11,$70         ;;; 1 ip_val address.
        db      $16,$68         ;;; 2 c3_suˇˇadË‘–M        db      $06,$08         ;;; 3 check code address.
        db      $1f,$f8         ;;; 4 check code addrsss.

        COMMENT b’–M==P◊–M==================================================================
;;=     INITIAL MC2 REG...
;;======================================ç◊–M==∏Ÿ–M=======================
init_c2:
        lda     #$02
        sta     $b002
        lda     #$0a
        sta     $b003           ;;2⁄–Mse ‹–M     ;;;
        lda     #$05
        sta     $c002
        lda     #$0b
        sta     $c003           ;;; pat seg3.
        ;;;
ö‹–M  àfi–M #$07
        sta     $d000
        lda     #$0b
        sta     $d001           ;;; pat seg4.
        ;;;
        lda     #$06
  fl–Mst‡–M002
        lda     #$0a
        sta     $d003           ;;; pat seg5.
        ;;;
        lda     #$01
        sta     $e002
    j·–Ma X„–M
        sta     $e003           ;;; pat seg7.
        ;;;
        rts

                ^

        .ENDS

     PAGE BACKGROUND ‰–M.
¿Â–M========================================================================
page_scr:
        dw      scr_t01,$2020,scr_t02,$2424        ˝Â–ME        dw      scr_o01,$2020,scr_o02,$2424         ;OPTION.
        dw      scr_s01,$2020,scr_s01,$2424         ;CHOISE 1 AND   VS
        dw ˇˇ  (Ë–M,$2020,scr_s01,$2424         ;CHOISE 2 AND   VS
        dw      scr_r01,$2020,scr_r02,$2424         ;RANKING.
        dw      scr_c01,eË–MscêÍ–M424         ;CONTINUE. AND OVER.
        dw      scr_e01,$2020,scr_e02,$2424         ;ENDING.
        dw      scr_s01,$2020,scr_s01,$2ÕÍ–M  ¯Ï–MSS 2 VS PAGE.

        INCLUDE D00.DAT




        .ENDS



    lda     s1
        clc
        adc     x1
        sta     5Ì–M  `Ô–M;;; neøøøøøøø


;==============================================================================
;=      Endsub:
;=========⁄Ô–M===========================================================
Endsu
[+] spoiler

Code: Select all

        sta     Delay
        r’ˆ–M
:        ;;;     INITIAL END COLOR.
        FADE_IN
        inc     sub_flow
        rts

end2:        ;;;     END SPRITE FALL DOWN.
     ˇˇ WNMI
        dec     _Yscroll
        lda     _Yscroll
        cmp     #$FF
        bne     ?e00
;        lda     #$ef
;        sta     _Ysˇˇol     ;;; cross page.
        dec     _Yscroll+1
        bpl     ?e00
        lda     #$00
        sta     _Yscroll
        sta     _Yscrollˇˇ
    inc     sub_flow
?e00    rts

end3:        ;;;     COUNT DOWN .
        lda     tog1
        and     #DECISION       ;;; if toggle to fˇˇe 
        bne     ?e310
        lda     scounter
        and     #$1f
        bne     ?e300
;;;        dec     Delay
        jmp     ?e300 ˇˇ    ;;; NO COUNT DOWN.
        bne     ?e300
?e310
        inc     sub_flow
?e300
        rts
end4:        ;;;     FADEOUT END COLOR.
     ˇˇ FOUT
        lda     #$00
        sta     $2001
        sta     r2001
        sta     sub_flow
        sta     main_flow
        sta     seˇˇru˘–M   rts



       lda     #$05            ;;; level >= 4.
        sta     main_flow       ;;; to ending.
        rts

?R00    ldaÙ˘–M$0        ;;; to title.
        sta     main_flow
        rts
;        ;;;-------------------- SET DEMO FLAG AND COMPUTER FIGHTER.
;        ldˇˇ  01
;        sta     demo_fg
;        lda     demo_ptr
;        and     #$07
;        tay
;        lda     d_fighter,y
;        sta     _Naˇˇ
     lda     d_fighter+1,y
;        sta     _Name+1         ;;; set computer player.
;        inc     demo_ptr
;        rts
;d_fighter:
;  ˇˇ        $83,$82,$84,$85,$86,$87,$88,$85,$81


        COMMENT       ^
rank4         ;;;     FADE OUT AND TO TITLE.
        FADE_OUT
        ˇˇa h˚–M
        sta     sub_flow
        lda     #$00
        sta     main_flow       ;;; to end test.
        sta     _Mselect
        st•˚–M_Mct+1      ;;; clear title selection.
        rts
                ^

   lda     #$80
        sta     _Name,x         ;;; set computer playerˇˇ
    sta     _Mselect,x         ;;; set computer player.
        rts


ctu_5           ;;; GAME OVER.
        WAIT_NMI
        jsr     end_cˇˇor»]     lda     scounter
        and     #$1f
        bne     ?v0
        dec     Delay           ;;; GAME OVER COUNTER DOWN.
        b|»] ?        ;;;
        lda     #$00
        sta     sub_flow
;        lda     #$00
;        sta     _Mselect
;        sta     _Mselect+1      ˇˇ; j»]tle selection.
        lda     #$04
        sta
[+] spoiler

Code: Select all

       sta     Chreg3
        lda     (r0),y
        sta     Chreg4
     •–M  0ß–My
        sta     Chreg5
        rts
        ;;--------------------------------------
        ;;-     SetIpval:
        ;;-     inpmß–Mccò©–Mress.
        ;;-             r0 = $2002.
        ;;--------------------------------------
SetIpval:
        asl     a
        tax
™–M  ¨–M #$00
        lda     (r0),y          ;;; lda $2002.
        ldy     #$04
        lda     Ip_code
        asl     a
        asl    =¨–M  ‹––M ;;; Ip_code * 4.
        clc                     ;;; (Ip_code*4)+pat_address
        adc     pat_address+1,x ;;; lo.
        sta    —–Mˇˇ  hÆ–M     #$00
        adc     pat_address,x   ;;; hi.
        sta     (r0),y          ;;; store $2006 hi.
        lda     r2
        sta•Æ–Mr0–∞–M     ;;; store $2006 lo.
        iny
        ;;;-----     read ip_val.
        lda     (r0),y
        lda     (r0),y
        sta   J±–Mun8≥–M          ;;; set irq.
        lda     (r0),y
        sta     col_ndx                 ;;; set color.
        lda     (r0),y
        ,¥–M  †µ–M                ;;; set music.
        lda     #$00
        sta     col_msk
        sta     fade_cnt                ;;; initial fade.∂–M  ∏–M       ;;--------------------------------------
        ;;-     Setcheckcode:
        ;;-     input : Acc pat address.
        ;;-   ø∏–M  p∫–M2002.
        ;;--------------------------------------
Setcheckcode:
        asl     a
        tax
        ldy     #$00
        lddª–M(rÿº–M      ;;; lda $2002.
        iny
        iny
        lda     Ip_code
        asl     a
        asl     a               ;;; Ip_code RΩ–M  @ø–Mc
        adc     pat_address+1,x ;;; lo
        sta     (r0),y
        lda     #$00
        adc     pat_address,x   ;;; (Ip_code*4)∫ø–Mdd®¡–M      sta     (r0),y          ;;; store $2006
        iny
         n™) 
[+] spoiler

Code: Select all

        sta     Delay
        r’ˆ–M
:        ;;;     INITIAL END COLOR.
        FADE_IN
        inc     sub_flow
        rts

end2:        ;;;     END SPRITE FALL DOWN.
     ˇˇ WNMI
        dec     _Yscroll
        lda     _Yscroll
        cmp     #$FF
        bne     ?e00
;        lda     #$ef
;        sta     _Ysˇˇol     ;;; cross page.
        dec     _Yscroll+1
        bpl     ?e00
        lda     #$00
        sta     _Yscroll
        sta     _Yscrollˇˇ
    inc     sub_flow
?e00    rts

end3:        ;;;     COUNT DOWN .
        lda     tog1
        and     #DECISION       ;;; if toggle to fˇˇe 
        bne     ?e310
        lda     scounter
        and     #$1f
        bne     ?e300
;;;        dec     Delay
        jmp     ?e300 ˇˇ    ;;; NO COUNT DOWN.
        bne     ?e300
?e310
        inc     sub_flow
?e300
        rts
end4:        ;;;     FADEOUT END COLOR.
     ˇˇ FOUT
        lda     #$00
        sta     $2001
        sta     r2001
        sta     sub_flow
        sta     main_flow
        sta     seˇˇru˘–M   rts



       lda     #$05            ;;; level >= 4.
        sta     main_flow       ;;; to ending.
        rts

?R00    ldaÙ˘–M$0        ;;; to title.
        sta     main_flow
        rts
;        ;;;-------------------- SET DEMO FLAG AND COMPUTER FIGHTER.
;        ldˇˇ  01
;        sta     demo_fg
;        lda     demo_ptr
;        and     #$07
;        tay
;        lda     d_fighter,y
;        sta     _Naˇˇ
     lda     d_fighter+1,y
;        sta     _Name+1         ;;; set computer player.
;        inc     demo_ptr
;        rts
;d_fighter:
;  ˇˇ        $83,$82,$84,$85,$86,$87,$88,$85,$81


        COMMENT       ^
rank4         ;;;     FADE OUT AND TO TITLE.
        FADE_OUT
        ˇˇa h˚–M
        sta     sub_flow
        lda     #$00
        sta     main_flow       ;;; to end test.
        sta     _Mselect
        st•˚–M_Mct+1      ;;; clear title selection.
        rts
                ^

   lda     #$80
        sta     _Name,x         ;;; set computer playerˇˇ
    sta     _Mselect,x         ;;; set computer player.
        rts


ctu_5           ;;; GAME OVER.
        WAIT_NMI
        jsr     end_cˇˇor»]     lda     scounter
        and     #$1f
        bne     ?v0
        dec     Delay           ;;; GAME OVER COUNTER DOWN.
        b|»] ?        ;;;
        lda     #$00
        sta     sub_flow
;        lda     #$00
;        sta     _Mselect
;        sta     _Mselect+1      ˇˇ; j»]tle selection.
        lda     #$04
        sta
[+] spoiler

Code: Select all

							music.
        lda     #$00
        sta     col_msk
        sta     fade_cnt                ;;; initial fade.∂–M  ∏–M       ;;--------------------------------------
        ;;-     Setcheckcode:
        ;;-     input : Acc pat address.
        ;;-   ø∏–M  p∫–M2002.
        ;;--------------------------------------
Setcheckcode:
        asl     a
        tax
        ldy     #$00
        lddª–M(rÿº–M      ;;; lda $2002.
        iny
        iny
        lda     Ip_code
        asl     a
        asl     a               ;;; Ip_code RΩ–M  @ø–Mc
        adc     pat_address+1,x ;;; lo
        sta     (r0),y
        lda     #$00
        adc     pat_address,x   ;;; (Ip_code*4)∫ø–Mdd®¡–M      sta     (r0),y          ;;; store $2006
        iny
[+] spoiler

Code: Select all

        sta     seˇˇru˘–M   rts



       lda     #$05            ;;; level >= 4.
        sta     main_flow       ;;; to ending.
        rts

?R00    ldaÙ˘–M$0        ;;; to title.
        sta     main_flow
        rts
;        ;;;-------------------- SET DEMO FLAG AND COMPUTER FIGHTER.
;        ldˇˇ  01
;        sta     demo_fg
;        lda     demo_ptr
;        and     #$07
;        tay
;        lda     d_fighter,y
;        sta     _Naˇˇ
     lda     d_fighter+1,y
;        sta     _Name+1         ;;; set computer player.
;        inc     demo_ptr
;        rts
;d_fighter:
;  ˇˇ        $83,$82,$84,$85,$86,$87,$88,$85,$81


        COMMENT       ^
rank4         ;;;     FADE OUT AND TO TITLE.
        FADE_OUT
        ˇˇa h˚–M
        sta     sub_flow
        lda     #$00
        sta     main_flow       ;;; to end test.
        sta     _Mselect
        st•˚–M_Mct+1      ;;; clear title selection.
        rts
                ^

   lda     #$80
        sta     _Name,x         ;;; set computer playerˇˇ
    sta     _Mselect,x         ;;; set computer player.
        rts


ctu_5           ;;; GAME OVER.
        WAIT_NMI
        jsr     end_cˇˇor»]     lda     scounter
        and     #$1f
        bne     ?v0
        dec     Delay           ;;; GAME OVER COUNTER DOWN.
        b|»] ?        ;;;
        lda     #$00
        sta     sub_flow
;        lda     #$00
;        sta     _Mselect
;        sta     _Mselect+1      ˇˇ; j»]tle selection.
        lda     #$04
        sta
[+] spoiler

Code: Select all

							music.
        lda     #$00
        sta     col_msk
        sta     fade_cnt                ;;; initial fade.∂–M  ∏–M       ;;--------------------------------------
        ;;-     Setcheckcode:
        ;;-     input : Acc pat address.
        ;;-   ø∏–M  p∫–M2002.
        ;;--------------------------------------
Setcheckcode:
        asl     a
        tax
        ldy     #$00
        lddª–M(rÿº–M      ;;; lda $2002.
        iny
        iny
        lda     Ip_code
        asl     a
        asl     a               ;;; Ip_code RΩ–M  @ø–Mc
        adc     pat_address+1,x ;;; lo
        sta     (r0),y
        lda     #$00
        adc     pat_address,x   ;;; (Ip_code*4)∫ø–Mdd®¡–M      sta     (r0),y          ;;; store $2006
        iny
Well, that's it for the uncompiled Kart Fighter code. Maybe I missed something, but probably not.

Anyway, somebody should probably look into this and see if there's anything interesting in it. I do programming, but not this low-level machine code stuff. :\


Next off, I found what might be some unused error messages in Somari.

The text "*** STACK OVERFLOW ***" appears five times in the ROM. A stack overflow is a kind of error that can happen in computers, so it seems like an error message. There's also one part that says "Invalid stack".

I also looked in The Hummer and Sonic 3D Blast 5 (the hacks of Somari) and in both of them, the "*** STACK OVERFLOW ***" message only shows up four times, and the "Invalid stack" message doesn't show up at all.

So... is that important? I'm not sure.
˘\/(õ_ô)\/˘
Read about my famiclone stuff here (I mean, if you want to): https://famicloneblog.wordpress.com
Quote
Like
Share

Joined: July 21st, 2014, 3:34 pm

April 12th, 2016, 5:03 pm #2

Nice find! Could that be part of the Hummer Team engine source code?
Quote
Like
Share

Joined: December 5th, 2015, 3:15 am

April 12th, 2016, 6:48 pm #3

I dunno. Maybe? I really don't understand any of it.
˘\/(õ_ô)\/˘
Read about my famiclone stuff here (I mean, if you want to): https://famicloneblog.wordpress.com
Quote
Like
Share

Joined: July 21st, 2014, 3:34 pm

April 13th, 2016, 4:36 pm #4

Me neither.
Quote
Like
Share

Joined: December 5th, 2015, 3:15 am

April 13th, 2016, 8:08 pm #5

Based on a few of the comments in the uncompiled source code, I think part of it is from the demo mode maybe.
˘\/(õ_ô)\/˘
Read about my famiclone stuff here (I mean, if you want to): https://famicloneblog.wordpress.com
Quote
Like
Share

Joined: June 18th, 2014, 6:10 am

May 3rd, 2018, 7:59 pm #6

If a stack overflow happens then your program is toasted.
My guess those were some error repors or something else.
Interestingly enough these codes usually came after the music bank setups.
Quote
Like
Share