Posted by snoofydude 15 hours ago
https://en.wikipedia.org/wiki/The_Legend_of_Zelda_(video_gam...
Everything about them was procedurally generated, even the names, which required some clever code to ensure none of them used rude words.
People assume 10KB, with the BBC Micro¹² version's version using a mix of modes 4 & 5 (320×256×1bbp and 160×256×2bbp respectively), but as well as the split screen trickery they tweaked the graphics hardware in more detail than that to create custom modes. There were only 248 scanlines and either 256 or 128 pixels per line, so the display took 7.75KB. As well as leaving more memory for the rest of the code, this reduced the amount being drawn, so helped keep the draw speed acceptable.
This left about 24KB⁴ for the rest of the code and its working data. Still a very impressive feat!
> - managed to have eight galaxies with 256 distinct planets each.
IIRC it was originally going to be larger than that, they toned it down a bit but not due to technical limitations (the galaxy generator code would not have needed to be any larger).
--------
[1] The Electron lacked support that allowed the split screen to work (one of the chips removed meant the required timing signal wasn't available), so it was all monochrome though still with the custom resolution and taking 7.75KB.
[2] The version enhanced for the Master series use a mix of mode 1 and mode 2 to enable more colours, 2bbp for the view of space and 4bbp³ for the dashboard. This still used the custom resolution, so took 15.5KB rather than 20KB. This was achieved by using the shadow RAM bank to host the screen display (some programs instead used this feature to implement double-buffering for smoother screen drawing), allowing the screen to take twice as much space while also freeing up memory to hold things that would have been loaded from disc when needed⁵ in the Micro version.
[3] Actually effectively 3bbp as the BBC hardware did 8 colours and flashing variants instead of 16 colours (which most other systems used to provide two shades of 8 colours, using the 4th bit as an intensity flag).
[4] less a few chunks here & there needed by code in system ROMs when doing things like reading extra data from the floppy
[5] There were two chunks of code, one for in-flight and one for while docked, that were swapped in as you entered or left a space station. On the Micro these were pulled from disk each time, on the Master they could both be in RAM. If playing from cassette you had a cut-down version of the game that didn't need this split.
Perhaps not compression as we see it today. But one could argue that tile based graphics and code based music is a form of compression. Old games used a myriad of cool tricks to get around their limitations.
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
INTERP 0x0000000000000088 0x0000000000010088 0x0000000000010088
0x000000000000001c 0x000000000000001c 0x0
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
DYNAMIC 0x00000000000000e0 0x00000000000100e0 0x6c2f343662696c2f <-- "/lib64/ld-linux-x86-64.so.2"
0x2d78756e696c2d64 0x732e34362d363878 0x322e6f
readelf: Error: the dynamic segment offset + size exceeds the size of the file
LOAD 0x0000000000000000 0x0000000000010000 0x0000000000000000
0x0000000000001dc0 0x0000000000005660 RWE 0x1000
Two questions:1. Was this done manually or is there a tool you're using which does this? I see other size-reduction tricks in here as well.
2. Does anybody know of a tool for examining executables which doesn't crap out on binaries like this?
saw some comments about DEP on windows and this and honestly i wouldnt touch this thing with a 10ft stick. if the creator want ppl to play it they can provide a normal binary. not some obfuscated mess.
- Browser: works after renaming to .html
- Linux: "./snake.com: line 20: lzma: command not found". Installing the xz package makes it work (already had XWayland enabled so X11 worked, but may be needed if you have a strict Wayland session).
- Windows: As either .com or renaming to .exe I get "The application was unable to start correctly (0xc0000005). Click OK to close the application." Not sure how to make this one work, it's definitely not AV related though (I have that stripped in this sandbox VM).
Edit: Got it working in all 3 now. On Windows I still had DEP enabled on all programs to test some apps earlier, turning that back off allowed it to launch.
Edit: Got it working, was DEP.
If you mean the .html rename or whatever my Windows problem was, I must be missing it. Edit: Windows was DEP.
$ chmod +x snake.com
$ ./snake.com
... then it would try to use Mono to launch it: Cannot open assembly './snake.com': File does not contain a valid CIL image.
But, running it explicitly with Bash works: $ bash snake.com
Pretty nifty but doesn't work out of the box on any Linux, at least :p Running Debian 13.That's because of the binfmt handler that Mono installs which matches the PE header.
https://web.archive.org/web/20100304155706/http://www.thepro...
Related discussions:
https://news.ycombinator.com/item?id=14409210 (2017)
I wonder what kinds of modern games we could make with these same ideas.
With Haxe, you can write the application once, target both win32 and linux by compiling to C++ (which then you compile using the platform specific tooling for each paltform), and then target html by compiling to javascript. Then use the same concatenation mechanism and header abuse as described in the article to have all three targets merged into one file that can then be run on all platforms!
The ability to load .html files over the file:// protocol is a powerful, often neglected feature. In practice, it means you can double-click an HTML file and it runs an app in your browser instantly.
The OP actually wrote two native applications instead of just instantiating a browser.
https://developer.mozilla.org/en-US/docs/Web/Security/Defens...
https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/COR...
The security risk : https://www.mozilla.org/en-US/security/advisories/mfsa2019-2...
You need a local webserver. Or bundle everything in one html file.