X86 boot sector written in C (2010)
crimsonglow.ca
crimsonglow.ca
Here is the annotated disassembly of the DOS 6.2 VBR: http://www.tburke.net/info/ntldr/bootsect.txt
Also noticed a minor optimisation:
mov AL, [SI] ; pega um byte da string e carrega em al
inc SI
Could've been replaced with a 'lodsb', saving 2 bytes. Ditto for MOV BH/MOV BL with MOV BX. :-)Two bytes shorter:
call print_str
ret
=>
jmp print_str
Three bytes shorter; this one may be a little too clever, since it depends on the low bit of CR0 being 0 initially: mov EAX, CR0
or EAX, 1
=>
mov EAX, CR0
inc AX(I am a teaching assistant at one of these courses and hate when students do everything in asm.. but they are allowed to do as they want, as long as it works as specified).
https://github.com/aosmith/toy-os
The x86 code seems like a bear but once it's explained it is fairly simple.
Having looked at the author's boot.c, I now understand that legibility is in the eye of the beholder.
Still, it's a neat and impressive hack. I wish I knew more about operating systems.
https://github.com/jhallen/joes-sandbox/tree/master/boot
They're assembly language MBR and Linux boot loaders I wrote long ago. The bootloaders understand EXT2 or FAT, yet still fit in 1K.
But it looks like this was actually started over 4 years ago, I didn't notice the date of the article. Was curious if anyone else noticed it like I did.
Shouldn't this be 0x55AA because of little endian? Otherwise nice writeup, but unreadable code.
Also, You use opera as well?