The task simonwjackson is describing is exactly the function of the unix-realm file command and libmagic database.
I wrote a file(1) magic(5) for iNES, NES2.0, and UNIF in this thread.
Detecting an NES rom based on file contents.
Moderator: Moderators
Re: Detecting an NES rom based on file contents.
blargg wrote:Find a file with lots of occurrences of the pairs $15 $40 and $07 $20
Code: Select all
bisqwit@chii:~/src/nescom/clever$ egrep '2007|4015' cv.lst
- $803E 8D 07 20: sta $2007
$C0F9 8D 15 40: sta $4015
$CBDB 8D 07 20: sta $2007
- $CBE9 8D 07 20: sta $2007
+ $FDA2 8D 07 20: sta $2007
$FE98 8D 15 40: sta $4015
$FEAF 8D 15 40: sta $4015
bisqwit@chii:~/src/nescom/clever$ egrep '2007|4015' cv2u.lst
$967D AD 15 40: lda APU_HW__4015_EnableChannelsMask
$A3CF 8D 15 40: sta APU_HW__4015_EnableChannelsMask
$A3E4 8D 15 40: sta APU_HW__4015_EnableChannelsMask
$C09F 8D 15 40: sta APU_HW__4015_EnableChannelsMask
$C6F7 8D 07 20: sta $2007
- $C714 8D 07 20: sta $2007
- $CBBD 8D 07 20: sta $2007
- $CBD9 8D 07 20: sta $2007
$CBF2 AD 07 20: lda $2007
$CBF5 AD 07 20: lda $2007
$CC15 8D 07 20: sta $2007
VRAM games might have some more, and games that do a lot of custom timing.
Bigfoot for example has 360 matches, 347 of them being for $2007.
-
- Posts: 7
- Joined: Tue Nov 12, 2013 7:05 am
Re: Detecting an NES rom based on file contents.
This should get me most of the way there for nes, thanks lidnariq!lidnariq wrote:The task simonwjackson is describing is exactly the function of the unix-realm file command and libmagic database.
I wrote a file(1) magic(5) for iNES, NES2.0, and UNIF in this thread.
Re: Detecting an NES rom based on file contents.
Today I read "Taxes redux: You can’t open the file until the user tells you to open it" by Raymond Chen and learned exactly why Windows relies so much on the file extension: the storage hierarchy may end at a remote server that accesses a library of tapes in a nearline jukebox. File Explorer needs a concept of "file type" even for something that has been archived to a tape drive or otherwise on a remote server. Reading magic numbers from each file in a folder to determine their type would force the file system to recall each file from the server if the files happen to be archived.
Re: Detecting an NES rom based on file contents.
Makes sense, I guess file extensions are more important than I have thought.