This is probably one of the few times assembly is more readable and easy to understand than C. Many years ago I used to teach OS classes at a local university, we would build a simple bootstrap using NASM. The source code includes 32bits (a20 etc) and GDT iirc:https://github.com/eduardordm/sisop/blob/master/sisop.asm
userbinator|11 years ago
Also noticed a minor optimisation:
Could've been replaced with a 'lodsb', saving 2 bytes. Ditto for MOV BH/MOV BL with MOV BX. :-)drv|11 years ago
Two bytes shorter:
Three bytes shorter; this one may be a little too clever, since it depends on the low bit of CR0 being 0 initially:mkup|11 years ago
mvanotti|11 years ago
(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).
aosmith|11 years ago
aosmith|11 years ago
https://github.com/aosmith/toy-os
The x86 code seems like a bear but once it's explained it is fairly simple.