Jump to content

  •  

Photo

Get nemesis compressed size


  • This topic is locked This topic is locked
6 replies to this topic

#1 Sonic master

Sonic master

    4 Chaos Emeralds

  • Member
  • 226 posts
  • Gender:Male
  • Interests:Homebrew games for retro systems.

Posted 02 September 2012 - 01:37 AM

Hello everyone I am working on dissembling micheal jackson's moonwalker so far it appears to be alot easier than I thought it would be. I am doing this for practice and in hopes to add pcm music to the game and anyways I was just wonder how I would split the data in the rom to a separate file for example I have located the nemesis compressed sega art at offset ROM:00031E32 how do I figure out the compressed filesize to separate it to a different file without accidentally getting other data.
Edit here is a genesis program that will display the filesize on the screen

align macro

	 cnop 0,\1

	 endm

DPORT    EQU $C00000    ; VDP Data port

CPORT    EQU $C00004    ; VDP Command port





    rsset $FF0000

;all varibles go here



; ---------------------------------------------------------------------------

; disable interrupts

; ---------------------------------------------------------------------------



disable_ints:    macro

        move    #$2700,sr

        endm



; ---------------------------------------------------------------------------

; enable interrupts

; ---------------------------------------------------------------------------



enable_ints:    macro

        move    #$2300,sr

        endm



; ---------------------------------------------------------------------------

; DMA copy data from 68K (ROM/RAM) to the VRAM

; input: source, length, destination

; ---------------------------------------------------------------------------



writeVRAM:    macro

        lea    (CPORT).l,a5

        move.l    #$94000000+(((\2>>1)&$FF00)<<8)+$9300+((\2>>1)&$FF),(a5)

        move.l    #$96000000+(((\1>>1)&$FF00)<<8)+$9500+((\1>>1)&$FF),(a5)

        move.w    #$9700+((((\1>>1)&$FF0000)>>16)&$7F),(a5)

        move.w    #$4000+(\3&$3FFF),(a5)

        move.w    #$80+((\3&$C000)>>14),(a5)

        ;move.w    (v_vdp_buffer2).w,(a5)

        endm



; ---------------------------------------------------------------------------

; DMA copy data from 68K (ROM/RAM) to the CRAM

; input: source, length, destination

; ---------------------------------------------------------------------------



writeCRAM:    macro

        lea    (CPORT).l,a5

        move.l    #$94000000+(((\2>>1)&$FF00)<<8)+$9300+((\2>>1)&$FF),(a5)

        move.l    #$96000000+(((\1>>1)&$FF00)<<8)+$9500+((\1>>1)&$FF),(a5)

        move.w    #$9700+((((\1>>1)&$FF0000)>>16)&$7F),(a5)

        move.w    #$C000+(\3&$3FFF),(a5)

        move.w    #$80+((\3&$C000)>>14),(A5)

        ;move.w    (v_vdp_buffer2).w,(a5)

        endm

Vectors:

    dc.l $FFFE00, Entrypoint, Error, Error

    dc.l Error, Error, Error, Error

    dc.l Error, Error, Error, Error

    dc.l Error, Error, Error, Error

    dc.l Error, Error, Error, Error

    dc.l Error, Error, Error, Error

    dc.l Error, Error, Error, Error

    dc.l HBlank, Error, VBlank, Error

    dc.l Error, Error, Error, Error

    dc.l Error, Error, Error, Error

    dc.l Error, Error, Error, Error

    dc.l Error, Error, Error, Error

    dc.l Error, Error, Error, Error

    dc.l Error, Error, Error, Error

    dc.l Error, Error, Error, Error

    dc.l Error, Error, Error, Error

Header:

    dc.b "SEGA MEGA DRIVE " ; Console name

    dc.b "(C) Sega 16 2012" ; Copyright/Date

DomesticName:

    ;dc.b "Code template by drx - www.hacking-cult.org	 " ; Domestic Name

	 dc.b "Genesis does								    "

    ;dc.b "Code template by drx - www.hacking-cult.org	 " ; International Name

	 dc.b "Genesis does								    "

    dc.b "GM 00000000-42" ; Version

Checksum:

    dc.w $0042  ; Checksum

    dc.b "J			   " ; I/O Support

RomStartLoc:

    dc.l 0 ; ROM Start

RomEndLoc:

    dc.l RomEnd ; ROM End

RamStartLoc:

    dc.l $FF0000 ; RAM Start

RamEndLoc:

    dc.l $FFFFFF ; RAM End



    dc.b $20,$20,$20,$20 ; 'RA',$F8,$20 if SRAM = on



SramStart:

    dc.l $20202020 ; $200000 if SRAM = on

SramEnd:

    dc.l $20202020 ; $20xxxx if SRAM = on



    dc.b  "    "

    dc.b  "			    "

    dc.b  "			    "

    dc.b  "			    "

    dc.b  "F			   "  ; enable any hardware configuration

FMPORT1  EQU $A04000

FMPORT2  EQU $A04001

FMPORT3  EQU $A04002

FMPORT4  EQU $A04003

;---------------------

; Code start

;---------------------



Entrypoint:



    tst.l ($A10008).l ;Test Port A control

    bne PortA_Ok



    tst.w ($A1000C).l ;Test Port C control



PortA_Ok:

    bne SkipSetup



    move.b ($A10001).l,d0 ;version

    andi.b #$F,d0

    beq SkipSecurity ;if the smd/gen model is 1, skip the security

    move.l #'SEGA',($A14000).l



SkipSecurity:



    move.w ($C00004).l,d0 ;hang if VDP locked due to security failure



    moveq #0,d0

    movea.l d0,a6

    move.l a6,usp ;set usp to $0



;---------------------

; Setup VDP registers

;---------------------

    lea (VDPSetupArray,pc),a0

    move.w #(VDPSetupArrayEnd-VDPSetupArray)/2,d1 ;$18 VDP registers



VDPSetupLoop:

    move.w (a0)+,($C00004).l

    dbra d1,VDPSetupLoop





    move.l #$40000080,($C00004).l

    move.w #0,($C00000).l ;clean the screen





;---------------------

; Init the Z80

;---------------------



    move.w #$100,($A11100).l ;Stop the Z80

    move.w #$100,($A11200).l ;Deassert reset to the Z80



Waitforz80:

    btst #0,($A11100).l

    bne Waitforz80 ;Wait for z80 to halt



    lea (Z80Init,pc),a0

    lea ($A00000).l,a1

    move.w #Z80InitEnd-Z80Init,d1



InitZ80:

    move.b (a0)+,(a1)+

    dbra d1,InitZ80



    move.w #0,($A11200).l ;Assert reset to the Z80

    move.w #0,($A11100).l ;Start the Z80

    move.w #$100,($A11200).l ;Deassert reset to the Z80





;---------------------

; Reset the RAM

;---------------------



    lea ($FFFF0000).l,a0

    move.w #$3fff,d1



ClearRAM:

    move.l #0,(a0)+

    dbra d1,ClearRAM





;---------------------

; VDP again

;---------------------





    move.w    #$8174,($C00004).l

    move.w    #$8F02,($C00004).l





;---------------------

; Clear the CRAM

;---------------------



    move.l #$C0000000,($C00004).l ;Set VDP ctrl to CRAM write

    move.w #$3f,d1



ClearCRAM:

    move.w #0,($C00000).l

    dbra d1,ClearCRAM





;---------------------

; Clear the VDP stuff

;---------------------



    move.l #$40000010,($C00004).l

    move.w #$13,d1



ClearStuff:

    move.l #0,($C00000).l

    dbra d1,ClearStuff





;---------------------

; Init the PSG

;---------------------



    move.b #$9F,($C00011).l

    move.b #$BF,($C00011).l

    move.b #$DF,($C00011).l

    move.b #$FF,($C00011).l



;---------------------

; Load the z80 driver

;---------------------



    move.w #$100,($A11100).l ;Stop the Z80

    move.w #$100,($A11200).l ;Deassert reset to the Z80



Waitforz80a:

    btst #0,($A11100).l

    bne Waitforz80a ;Wait for z80 to halt



    lea (Z80Driver,pc),a0

    lea ($A00000).l,a1

    move.w #Z80DriverEnd-Z80Driver,d1



LoadZ80Driver:

    move.b (a0)+,(a1)+

    dbra d1,LoadZ80Driver



    move.w #0,($A11200).l ;Assert reset to the Z80

    move.w #0,($A11100).l ;Start the Z80

    move.w #$100,($A11200).l ;Deassert reset to the Z80



;---------------------

; Clear the registers

; and set the SR

;---------------------



    movem.l ($FF0000).l,d0-a6

    lea ($FFFE00).l,a7

    move #$2700,sr

SkipSetup:





;-----------------------

; Here starts your code

;-----------------------

Main:

; input: source, length, destination

; ---------------------------------------------------------------------------



    writeVRAM    font,512,32

    writeCRAM    palette,4,0

    lea    (nemdat).l,a0

    move.l  #$45440000,($C00004).l ; Starts at tile 17

    bsr.s    nemdec

    lea    (nemdat).l,a1

    move.l    a0,d0

    subi.l    #nemdat,d0

    subq    #1,d0

    bsr.w    showhexulong

;---------------------------------

; nothing else for the 68000 to do

;---------------------------------

loop:

    bra.s    loop

    rts

;---------------------

; Error exceptions

;---------------------



Error:

    rte



;---------------------

; Horizontal Blank

;---------------------

HBlank:

    rte

;---------------------

; Vertical Blank

;---------------------

VBlank:

    rte



NemDec:                    ; CODE XREF: ROM:00000C60p

                    ; ROM:00000D52p ...

        ;movem.l    d0-a1/a3-a5,-(sp)

        lea    (loc_15332).l,a3

        lea    ($C00000).l,a4

        bra.s    loc_152C2

; ---------------------------------------------------------------------------



loc_152B8:                ; CODE XREF: ROM:000007A4p

                    ; ROM:000007ECp ...

        movem.l    d0-a1/a3-a5,-(sp)

        lea    (loc_15348).l,a3



loc_152C2:                ; CODE XREF: NemDec+10j

        lea    ($FFFFCA00).w,a1

        move.w    (a0)+,d2

        lsl.w    #1,d2

        bcc.s    loc_152D0

        adda.w    #$A,a3



loc_152D0:                ; CODE XREF: NemDec+24j

        lsl.w    #2,d2

        movea.w    d2,a5

        moveq    #8,d3

        moveq    #0,d2

        moveq    #0,d4

        bsr.w    sub_15362

        move.b    (a0)+,d5

        asl.w    #8,d5

        move.b    (a0)+,d5

        move.w    #$10,d6



loc_152E8:                ; CODE XREF: NemDec+7Cj

        moveq    #8,d0

        bsr.w    sub_153C4

        cmpi.w    #$FC,d1    ; 'ü'

        bcc.s    loc_15324

        add.w    d1,d1

        move.b    (a1,d1.w),d0

        ext.w    d0

        bsr.w    sub_153D8

        move.b    1(a1,d1.w),d1



loc_15304:                ; CODE XREF: NemDec+8Aj

        move.w    d1,d0

        andi.w    #$F,d1

        andi.w    #$F0,d0    ; 'ð'

        lsr.w    #4,d0



loc_15310:                ; CODE XREF: NemDec:loc_1531Ej

        lsl.l    #4,d4

        or.b    d1,d4

        subq.w    #1,d3

        bne.s    loc_1531E

        jmp    (a3)

; ---------------------------------------------------------------------------



loc_1531A:                ; CODE XREF: ROM:00015338j

                    ; ROM:00015344j ...

        moveq    #0,d4

        moveq    #8,d3



loc_1531E:                ; CODE XREF: NemDec+70j

        dbf    d0,loc_15310

        bra.s    loc_152E8

; ---------------------------------------------------------------------------



loc_15324:                ; CODE XREF: NemDec+4Cj

        moveq    #6,d0

        bsr.w    sub_153D8

        moveq    #7,d0

        bsr.w    sub_153D4

        bra.s    loc_15304

; End of function NemDec



; ---------------------------------------------------------------------------



loc_15332:                ; DATA XREF: NemDec+4o

        move.l    d4,(a4)

        subq.w    #1,a5

        move.w    a5,d4

        bne.s    loc_1531A

        bra.s    loc_1535C

; ---------------------------------------------------------------------------

        eor.l    d4,d2

        move.l    d2,(a4)

        subq.w    #1,a5

        move.w    a5,d4

        bne.s    loc_1531A

        bra.s    loc_1535C

; ---------------------------------------------------------------------------



loc_15348:                ; DATA XREF: NemDec+16o

        move.l    d4,(a4)+

        subq.w    #1,a5

        move.w    a5,d4

        bne.s    loc_1531A

        bra.s    loc_1535C

; ---------------------------------------------------------------------------

        eor.l    d4,d2

        move.l    d2,(a4)+

        subq.w    #1,a5

        move.w    a5,d4

        bne.s    loc_1531A



loc_1535C:                ; CODE XREF: ROM:0001533Aj

                    ; ROM:00015346j ...

        ;movem.l    (sp)+,d0-a1/a3-a5

        rts



; =============== S U B    R O U T    I N E =======================================





sub_15362:                ; CODE XREF: NemDec+34p

        move.b    (a0)+,d0



loc_15364:                ; CODE XREF: sub_15362+12j

        cmpi.b    #$FF,d0

        bne.s    loc_1536C

        rts

; ---------------------------------------------------------------------------



loc_1536C:                ; CODE XREF: sub_15362+6j

        move.w    d0,d7



loc_1536E:                ; CODE XREF: sub_15362+38j

                    ; sub_15362:loc_153B2j

        move.b    (a0)+,d0

        cmpi.b    #$80,d0

        bcc.s    loc_15364

        move.b    d0,d1

        andi.w    #$F,d7

        andi.w    #$70,d1    ; 'p'

        or.w    d1,d7

        andi.w    #$F,d0

        move.b    d0,d1

        lsl.w    #8,d1

        or.w    d1,d7

        moveq    #8,d1

        sub.w    d0,d1

        bne.s    loc_1539C

        move.b    (a0)+,d0

        add.w    d0,d0

        move.w    d7,(a1,d0.w)

        bra.s    loc_1536E

; ---------------------------------------------------------------------------



loc_1539C:                ; CODE XREF: sub_15362+2Ej

        move.b    (a0)+,d0

        lsl.w    d1,d0

        add.w    d0,d0

        moveq    #1,d5

        lsl.w    d1,d5

        subq.w    #1,d5



loc_153A8:                ; CODE XREF: sub_15362+4Cj

        move.w    d7,(a1,d0.w)

        addq.w    #2,d0

        dbf    d5,loc_153A8



loc_153B2:                ; DATA XREF: sub_153C4+Ar

        bra.s    loc_1536E

; End of function sub_15362



; ---------------------------------------------------------------------------

        dc.b   0

        dc.b   1

        dc.b   0

        dc.b   3

        dc.b   0

        dc.b   7

        dc.b   0

        dc.b  $F

        dc.b   0

        dc.b $1F

        dc.b   0

        dc.b $3F ; ?

        dc.b   0

        dc.b $7F ; 

        dc.b   0

        dc.b $FF



; =============== S U B    R O U T    I N E =======================================





sub_153C4:                ; CODE XREF: NemDec+44p sub_153D4p

        move.w    d6,d7

        sub.w    d0,d7

        move.w    d5,d1

        lsr.w    d7,d1

        add.w    d0,d0

        and.w    loc_153B2(pc,d0.w),d1

        rts

; End of function sub_153C4





; =============== S U B    R O U T    I N E =======================================





sub_153D4:                ; CODE XREF: NemDec+86p

        bsr.s    sub_153C4

        lsr.w    #1,d0

; End of function sub_153D4





; =============== S U B    R O U T    I N E =======================================





sub_153D8:                ; CODE XREF: NemDec+56p NemDec+80p

        sub.w    d0,d6

        cmpi.w    #9,d6

        bcc.s    locret_153E6

        addq.w    #8,d6

        asl.w    #8,d5

        move.b    (a0)+,d5



locret_153E6:                ; CODE XREF: sub_153D8+6j

        rts

; End of function sub_153D8



showhexulong:

    ;input d0 the long unsigned hex value that you need to be displaed

    ;return value garbage

    move.l    #$46000003,d2

    lea    ($C00004).l,a1

    lea    ($C00000).l,a0

    move.l  d2,(a1)    ;send command to the command port

    move.l    d0,d1

    ;first display bits 32-24

    swap    d1

    lsr.l    #8,d1

    bsr.s    showhexuchar

    move.l    d0,d1

    lsr.l    #8,d1

    lsr.l    #8,d1

    bsr.s    showhexuchar;24-16

    move.l    d0,d1

    lsr.l    #8,d1

    bsr.s    showhexuchar;16-8

    move.l    d0,d1

    bsr.s    showhexuchar;8-0

    rts



showhexuchar:

    ;this function assumes that A0 points to correct vram location and auto increment is all set up

    ;input d1

    ;returns nothing relay just the same data in d1 and garbage in d2

    moveq    #0,d2

    moveq    #0,d3

    move.b    d1,d2    ;make sure we have only 1 byte

    move.b    d1,d3

    lsr.b    #4,d3

    addq    #1,d3

    move.w  d3,(a0)

    and.b    #15,d2

    addq    #1,d2

    move.w    d2,(a0)

    rts

nemdat:

    ;to calulate the filesize do (whatever a0 is minus nemdat offset)-1

    incbin    nemsega.bin

    even

palette:

    dc.w    0

    dc.w    $EEE

font:

    ;0

    dc.l    $01111110

    dc.l    $01000010

    dc.l    $01000110

    dc.l    $01001010

    dc.l    $01001010

    dc.l    $01010010

    dc.l    $01100010

    dc.l    $01111110

    ;1

    dc.l    $01100000

    dc.l    $10100000

    dc.l    $00100000

    dc.l    $00100000

    dc.l    $00100000

    dc.l    $00100000

    dc.l    $00100000

    dc.l    $11111000

    ;2

    dc.l    $01111000

    dc.l    $00001000

    dc.l    $00010000

    dc.l    $00100000

    dc.l    $00100000

    dc.l    $01000000

    dc.l    $10000000

    dc.l    $11111100

    ;3

    dc.l    $01111100

    dc.l    $00000100

    dc.l    $00000100

    dc.l    $00000100

    dc.l    $01111100

    dc.l    $00000100

    dc.l    $00000100

    dc.l    $01111100

    ;4

    dc.l    $01000100

    dc.l    $01000100

    dc.l    $01000100

    dc.l    $01111100

    dc.l    $00000100

    dc.l    $00000100

    dc.l    $00000100

    dc.l    $00000100

    ;5

    dc.l    $01111110

    dc.l    $01000000

    dc.l    $01111100

    dc.l    $00000100

    dc.l    $00000100

    dc.l    $00000100

    dc.l    $00001000

    dc.l    $01110000

    ;6

    dc.l    $00000100

    dc.l    $00001000

    dc.l    $00010000

    dc.l    $00100000

    dc.l    $01111000

    dc.l    $10000100

    dc.l    $01000010

    dc.l    $00111100

    ;7

    dc.l    $01111100

    dc.l    $00001000

    dc.l    $00001000

    dc.l    $00010000

    dc.l    $00010000

    dc.l    $00100000

    dc.l    $01000000

    dc.l    $01000000

    ;8

    dc.l    $01111110

    dc.l    $01000010

    dc.l    $01000010

    dc.l    $01111110

    dc.l    $01000010

    dc.l    $01000010

    dc.l    $01000010

    dc.l    $01111110

    ;9

    dc.l    $01111000

    dc.l    $01000100

    dc.l    $01000010

    dc.l    $01111110

    dc.l    $00000100

    dc.l    $00001000

    dc.l    $00010000

    dc.l    $00100000

    ;A

    dc.l    $00001000

    dc.l    $00010100

    dc.l    $00100100

    dc.l    $00111100

    dc.l    $00100100

    dc.l    $01000010

    dc.l    $01000010

    dc.l    $01000010

    ;B

    dc.l    $01110000

    dc.l    $01001000

    dc.l    $01000100

    dc.l    $01111100

    dc.l    $01000100

    dc.l    $01000100

    dc.l    $01001000

    dc.l    $01110000

    ;C

    dc.l    $00000100

    dc.l    $00001000

    dc.l    $00010000

    dc.l    $00100000

    dc.l    $01000000

    dc.l    $00100000

    dc.l    $00010000

    dc.l    $00001000

    ;D

    dc.l    $01100000

    dc.l    $01010000

    dc.l    $01001000

    dc.l    $01000100

    dc.l    $01000010

    dc.l    $01000100

    dc.l    $01001000

    dc.l    $01110000

    ;E

    dc.l    $01111100

    dc.l    $01000000

    dc.l    $01000000

    dc.l    $01111100

    dc.l    $01000000

    dc.l    $01000000

    dc.l    $01000000

    dc.l    $01111100

    ;F

    dc.l    $01111100

    dc.l    $01000000

    dc.l    $01000000

    dc.l    $01111100

    dc.l    $01000000

    dc.l    $01000000

    dc.l    $01000000

    dc.l    $01000000

;---------------------

; VDP registers array

;---------------------



VDPSetupArray:

    dc.w $8004 ;9-bit palette = 1 (otherwise would be 3-bit), HBlank = 0

    dc.w $8134 ;Genesis display = 1, DMA = 1, VBlank = 1, display = 0

    dc.w $8230 ;Scroll A - $C000

    dc.w $8338 ;Window - $E000

    dc.w $8407 ;Scroll B - $E000

    dc.w $857c ;Sprites - $F800

    dc.w $8600 ;Unused

    dc.w $8700 ;Backdrop color - $00

    dc.w $8800 ;Unused

    dc.w $8900 ;Unused

    dc.w $8A00 ;H Interrupt register

    dc.w $8B00 ;Full screen scroll, no external interrupts

    dc.w $8C81 ;40 cells display

    dc.w $8D3F ;H Scroll - $FC00

    dc.w $8E00 ;Unused

    dc.w $8F02 ;VDP auto increment

    dc.w $9001 ;64 cells scroll

    dc.w $9100 ;Window H position

    dc.w $9200 ;Window V position

    dc.w $93FF ;DMA stuff (off)

    dc.w $94FF ;DMA stuff (off)

    dc.w $9500 ;DMA stuff (off)

    dc.w $9600 ;DMA stuff (off)

    dc.w $9780 ;DMA stuff (off)

VDPSetupArrayEnd:





;---------------------

; Z80 init code

;---------------------



Z80Init:

    dc.w $af01, $d91f, $1127, $0021, $2600, $f977

    dc.w $edb0, $dde1, $fde1, $ed47, $ed4f, $d1e1

    dc.w $f108, $d9c1, $d1e1, $f1f9, $f3ed, $5636

    dc.w $e9e9

Z80InitEnd:

;---------------------

; Music driver (z80)

;---------------------        



Z80Driver:

        dc.b    $c3,$46,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00

        dc.b    $00,$00,$00,$00,$00,$f3,$ed,$56,$31,$00,$20,$3a,$39,$00,$b7,$ca,$4c,$00,$21,$3a,$00,$11,$40,$00,$01,$06,$00,$ed,$b0,$3e,$00,$32,$39,$00,$3e,$b4,$32,$02,$40,$3e,$c0,$32,$03,$40,$3e,$2b,$32,$00,$40,$3e,$80,$32,$01,$40,$3a,$43,$00,$4f,$3a,$44,$00,$47,$3e,$06,$3d

        dc.b    $c2,$81,$00,$21,$00,$60,$3a,$41,$00,$07,$77,$3a,$42,$00,$77,$0f,$77,$0f,$77,$0f,$77,$0f,$77,$0f,$77,$0f,$77,$0f,$77,$3a,$40,$00,$6f,$3a,$41,$00,$f6,$80,$67,$3e,$2a,$32,$00,$40,$7e,$32,$01,$40,$21,$40,$00,$7e,$c6,$01,$77,$23,$7e,$ce,$00,$77,$23,$7e,$ce,$00,$77

        dc.b    $3a,$39,$00,$b7,$c2,$4c,$00,$0b,$78,$b1,$c2,$7f,$00,$3a,$45,$00,$b7,$ca,$4c,$00,$3d,$3a,$45,$00,$06,$ff,$0e,$ff,$c3,$7f,$00

Z80DriverEnd:





RomEnd:


Edited by Sonic master, 03 September 2012 - 12:08 AM.

  • 0

#2 rika_chou

rika_chou

    Adopt

  • Pro User
  • 306 posts
  • Gender:Male

Posted 02 September 2012 - 02:45 AM

The "Nemesis art searcher" program (http://info.sonicret...sis_MD_Programs), will scan any ROM to try and find any Nemesis compressed art.
  • 0

#3 Sonic master

Sonic master

    4 Chaos Emeralds

  • Member
  • 226 posts
  • Gender:Male
  • Interests:Homebrew games for retro systems.

Posted 02 September 2012 - 03:31 AM

The "Nemesis art searcher" program (http://info.sonicret...sis_MD_Programs), will scan any ROM to try and find any Nemesis compressed art.

Good idea but it appears to be decompressing the art Although it did find some offsets that I did not find yet so this did help me.
  • 0

#4 MarkeyJester

MarkeyJester

    A word in your shell-like, pal

  • Pro User
  • 1337 posts
  • Gender:Male

Posted 02 September 2012 - 03:38 AM

This is why I always install a hexadecimal editor onto my operating system, as a programmer, I find it to be a very useful tool:

Posted Image

Another method you might be more interested in, is using the "split.exe" tool that came with most early Sonic disassemblies, which reads from a list of offsets and sizes.

I am a little shocked that you lack knowledge of ripping binary data from ROMs, considering the general programming knowledge you have =$
  • 0

#5 Sonic master

Sonic master

    4 Chaos Emeralds

  • Member
  • 226 posts
  • Gender:Male
  • Interests:Homebrew games for retro systems.

Posted 02 September 2012 - 03:46 AM

This is why I always install a hexadecimal editor onto my operating system, as a programmer, I find it to be a very useful tool:

Posted Image

Another method you might be more interested in, is using the "split.exe" tool that came with most early Sonic disassemblies, which reads from a list of offsets and sizes.

I am a little shocked that you lack knowledge of ripping binary data from ROMs, considering the general programming knowledge you have =$

Yes that does work but I was interested in finding the compressed filesize (if that is possible) of a nemesis compressed archive I do have hex workshop. Also I am new to hacking I have been programming for much longer.

Edited by Sonic master, 02 September 2012 - 03:55 AM.

  • 0

#6 MarkeyJester

MarkeyJester

    A word in your shell-like, pal

  • Pro User
  • 1337 posts
  • Gender:Male

Posted 02 September 2012 - 04:05 AM

Oh right, I didn't read the end of your sentence thoroughly, sorry, I read "how do I rip data from a ROM" and thought, what the hell man? Haha...

When it comes to compressed data, there are a few methods, some more beneficial than others:

1. Knowing the data after the compressed data will often give you a clear idea on the size, i.e. one Nemesis data after another, knowing the start of the second data will give you the end of the first. This does not however confirm 100% that it is the end though, as there could be unknown data directly after the first data and right before the second data that isn't obvious.

2. Using a decompressor and recompressor tool, you can decompress the data and recompress it into a seperate file, this will give you a clear understanding of the size of the data, HOWEVER, it will require the compressor to compress the data back the exact same way using the same method, as far as I'm aware, there are no compressors that do that which are available to us, not unless you write one to be more accurate to SEGA's.

3. Copy the Nemesis decompression algorithm routine from one of the Mega Drive games, onto a brand new ROM of your own, copy the data from the MJ ROM at offset 00031E32 up to 00041E31 (there's an extremely unlikely chance of the data being 10000 bytes, as VRAM and even 68k is only that size, so you'll know for definate that the data ends somewhere from 0031E32 - 0041E31), include the file to the ROM, write a routine to load that data's address, and pass it to the Nemesis decompression routine, and edit the end of the routine to somehow "store" the end offset of the compressed data when it's finished decompressing, and by store I mean either displaying on screen or saving to RAM so you can make a savestate and read it from there. Better yet, take that end offset and subtract the starting offset to get you the exact size.

4. Copy the data from the MJ ROM at offset 00031E32 up to 00041E31 (like in number 3), and decompress using a decompressor tool, and check the uncompressed data, if the data is fine, remove a byte from the end of the compressed data file, then decompress and check again, and keep checking until the uncompressed data becomes incorrect near the end of the file, when it becomes incorrect, then you'll know the exact end address.
  • 0

#7 Sonic master

Sonic master

    4 Chaos Emeralds

  • Member
  • 226 posts
  • Gender:Male
  • Interests:Homebrew games for retro systems.

Posted 02 September 2012 - 04:17 AM

This does not however confirm 100% that it is the end though, as there could be unknown data directly after the first data and right before the second data that isn't obvious..

That is what I was trying to avoid thus I created this thread and I will go with #3 it seems to be the best way I assume all I have to do is remove the code that saves the registers. Also I can see how my first post can be confusing so I fixed it.
Edit It appears to be working so far once I add an on screen display and verify that it is indeed the end of the file I will post the source
Edit on a slightly unrealted note after the sega data there is this odd string of text

 aIncomingMessageDonT:dc.b 'INCOMING	  MESSAGE`					 DON^T MOVE I HAVE'

ROM:00032166				 dc.b ' A	  SURPRISE	  FOR YOU				 INCOMING	  '

ROM:00032166				 dc.b 'MESSAGE`								    I GOT YOU]		 '

ROM:00032166				 dc.b '								   INCOMING	  MESSAGE`	  '

ROM:00032166				 dc.b '			    MICHAEL    YOUR TIME	 IS UP]			 '

ROM:00032166				 dc.b '					 INCOMING	  MESSAGE`				    '

ROM:00032166				 dc.b '  GOODBYE	   MICHAEL[HEH[  HEH[HEH					   '

ROM:00032166				 dc.b '	   INCOMING	  MESSAGE`								  '

ROM:00032166				 dc.b '   NO]												  INCOMIN'

ROM:00032166				 dc.b 'G	  MESSAGE`									 NOOOO   '

ROM:00032166				 dc.b '															   '

ROM:00032166				 dc.b '															   '

ROM:00032166				 dc.b '						    '

I don't ever remember seeing this in game it has been awhile though.

Edited by Sonic master, 02 September 2012 - 05:23 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users