Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's actually in 510 bytes; the MBR requires a two-byte signature to indicate to the BIOS that it's bootable / that it is a MBR, so you lose the ability to use/work with those two bytes¹.

You can see this in the original code on the line that reads,

          db 0x55,0xaa            ; Make it a bootable sector
So, 1% more impressive. (The original submission calls it "in 512 bytes" too.)

Now, what I'm curious about is the filler before the signature. You have to pad the binary to 510B prior to emitting the signature, s.t. the signature is in the right place. The author pads with 0x4f … but why that octet, and not, say, 0x00?

¹Unless, I suppose, you realize you need a 0x55 0xaa in your code somewhere, and re-use the signature. But that is not the case here. But I wouldn't put it past some of these tiny code challenges, as the authors tend to be quite clever.



If you're going to be pedantic enough to mention the 2 byte signature, I think you need to be more precise than '1% more impressive' when its less than 0.5% length differential. Or are you suggesting a non linear relationship between size and impressiveness??? I suppose a 1 byte pacman would be more than 100% more impressive, so that fits?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: