halofreak1990 wrote:I guess you want a more in-depth explanation of the functions used?
If so, tell us which function you'd like to know more about, and we'll try to explain it.
However, most functions are self explanatory; their name says it all, in most cases.
Assembly, and the code in the bootloaders is rather complicated.
I only know as much assembly as what's been covered so far in the OSDev series, so I won't be too much of help there.
But, in any case, feel free to ask pretty much anything.
Hi again:
Sorry I left this thread for a while. However, now I am back once again.
Well I know programming and can write code. However, I really would
like to understand the ASM parts, I mean ASM can be pretty hard sometimes,
and sometimes you find Step-by-Step (SBS) tutorials that cover a lot and then
you see a line of code which matches another tutorial, however, in this line the
same code is described different, and therefore I end-up asking.
For instance what does the following code-snippet really do?
============================================================
msg db "Welcome to My Operating System!", 0
;***************************************
; Prints a string
; DS=>SI: 0 terminated string
;***************************************
Print:
lodsb
or al, al ; al=current character
jz PrintDone ; null terminator found
mov ah, 0eh ; get next character
int 10h
jmp Print
PrintDone:
ret
;*************************************************;
; Bootloader Entry Point
;*************************************************;
loader:
; Error Fix 1 ------------------------------------------
xor ax, ax ; Setup segments to insure they are 0. Remember that
mov ds, ax ; we have ORG 0x7c00. This means all addresses are based
mov es, ax ; from 0x7c00:0. Because the data segments are within the same
; code segment, null em.
mov si, msg
call Print
cli ; Clear all Interrupts
hlt ; halt the system
times 510 - ($-$$) db 0 ; We have to be 512 bytes. Clear the rest of the bytes with 0
dw 0xAA55 ; Boot Signiture
Above from:
http://www.brokenthorn.com/Resources/OSDev4.html
============================================================
I would like to know more about the "lodsb" instruction the other instructions used here.
Thanks!
