I have a putstring fun ction that works great from a guide but im trying not to look at it to much but before the person does anything the do pusha
This makes sense to me as it stores all the registers on the stack, well exactly:
60 PUSHA 18 Push AX, CX, DX, BX, original SP, BP, SI, and
DI
Ok so heres the first part of mmy string function:
Code: Select all
contents db "Test ",0
mov ecx, axcontents;
call showstring;
showstring:
pusha;
mov al, byte [ecx]; al = first char
Code: Select all
showstring:
pusha;
mov al, byte [ecx]; al = first char
pop edi <-------I dont understand why pop edi? as I cant remember setting edi anywhere? (Only set the segments es, ds , sp etc when setting stack)
;first line it seems edi gets used as an index but I didnt think edi was assigned anywhere? (Im in protected mode btw so no ints)
Code: Select all
mov bl, byte [edi] ; get next character
cmp bl, 0 ; is it 0 (Null terminator)?
je .done ; yep-bail out
Code: Select all
mov ax, 0x10 ; set data segments to data selector (0x10)
mov ds, ax
mov ss, ax
mov es, ax
mov esp, 90000h ; stack begins from 90000h
2 final things, one regarding:
60 PUSHA 18 Push AX, CX, DX, BX, original SP, BP, SI, and
DI
what does it mean by ORIGINAL SP, BP, SI, and
DI
as in the most recent values I set sp bp etc to?
Also where can I find some nasm assembly tutorials using the same syntax thats on the brokenthorn site?(http://www.brokenthorn.com/Resources/OSDev8.html) and that also teach basic assembly but that doest use any shortcut code that relies on some form of os runtime
Thanks