Game Boy Zelda Comes With Source, Sort Of 200
Jamie found a fun story about a 90s Zelda Game Boy ROM that shipped with the source code- not so much on purpose, but more because the linker padded out the last meg of ROM with random memory contents, which happened to include game source code.
Avoiding the malloc() (Score:4, Informative)
Air Fortress (NES) had exact same issue! (Score:5, Informative)
Not true (Score:5, Informative)
Now the site is Wordpressed (like Slashdotting, only the other way around) and you can't get to it, but one of the last posts before it died pointed out that this was from a trainered version. That's where someone adds cheat code to a ROM. As it turns out, the original doesn't have any of the code in question. Dissassembling for the purpose of adding cheats is a completely sensible explanation of the code that was found.
The moral of the story? Start with a known clean dump (look for the "[!]" tag) before assuming that the introns were in the original game.
Re:Avoiding the malloc() (Score:5, Informative)
This is a non-story (Score:5, Informative)
Re:Not true (Score:3, Informative)
The 'disassembled' routines are simply a filling routine with register D and a copy routine.
As a Z80 developer, you really don't need to disassemble this kind of routines.
I guess the source code parts come from the intro, and its coder was not very good either. For example: CALL/RET instead of JP or disassembling a copy routine, and keeping it called L_B000_2914.
Re:Avoiding the malloc() (Score:5, Informative)
Rather than writing the extra few lines to calculate the padding required, set up a 0-filled buffer and truncate the first (or last) buffer, rounding up the fwrite call to 2mb requires 0 extra lines.
Besides, they don't expect many people to actually look at the ROM code. This emulation craze is fairly recent.
Re:Malloc clears? (Score:5, Informative)
But you don't get anything from another process. When malloc() runs out of memory and asks for a new chunk from the operating system, a modern system will usually zero the block that it returns, whereas some older operating systems (e.g. MS-DOS, I think?) would just give a pointer to a chunk of free memory which could still contain any data that the previous user had left in it; that could be any program which had previously run on the machine.
When you free something and call malloc() again afterwards, you may well get a block with old data from your program. But in most cases you won't get a block with old data from a different program.
The same applies to disk files; with some operating systems in the past you could open a file, write a byte a megabyte into the file and then read a megabyte of old data preceding it in free blocks which had been allocated to you and not cleared. That was obviously a big potential security hole, so most modern operating systems will zero all the data in the file instead (more precisely, they'll probably allocate a sparse file which will return zeros from areas which haven't been written to).
Re:Air Fortress (NES) had exact same issue! (Score:4, Informative)
There was also a chunk of code discovered in Secret of Evermore. [datacrystal.org]
Re:Avoiding the malloc() (Score:3, Informative)
Re:Avoiding the malloc() (Score:5, Informative)
NESticle was also released in 1997. These pretty much sparked a craze, and lead to the creation of the Emulation Community and its Golden Age was pretty much in full swing by the middle of 1998.
It has pretty much died, but Zsnes is still under very active development and the new pSX Emulator has revitalized Playstation emulation since ePSXe hasn't been updated in years and leaves MUCH to be desired.
http://www.romhacking.net/ [romhacking.net] for info on ROM hacking.
http://psxemulator.gazaxian.com/ [gazaxian.com] for pSX Emulator. Try it!
Re:Mingw32 for the Advance SDK? (Score:3, Informative)
Re:Not too uncommon (Score:1, Informative)
The BBC model B didn't have CMOS ram. The operating system ROM did have a chunk of text in the memory-mapped IO area. It read:
The BASIC ROM didn't have room for any extra text; the only cruft in the whole 16K is the name "Roger" in the last five bytes. The optional disk filing system ROM doesn't have any extra text either (I just checked).
I don't know what you saw, but it wasn't a standard part of the BBC micro.