by eduardordm · 12y ago · 0 comments
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.