Code: Select all
mov bx,MSG
call print_string
MSG: db "Hello",0
Code: Select all
print_string:
pusha
mov ah, 0x0E
print:
mov al,[bx]
cmp al, 0
je done
int 0x10
add bx,1
jmp print
done:
popa
ret
Code: Select all
mov bx,MSG
call print_string
MSG: db "Hello",0
Code: Select all
print_string:
pusha
mov ah, 0x0E
print:
mov al,[bx]
cmp al, 0
je done
int 0x10
add bx,1
jmp print
done:
popa
ret
Hmm, I have a jmp $ way before defining my data, so I don't think that would be a problemCombuster wrote:Or trying to interpret "Hello" as instructions afterwards.
Well, to be honest I was trying to comply with this: http://www.cs.bham.ac.uk/~exr/lectures/ ... os-dev.pdfXenOS wrote:You cannot use BX here because int 0x10, AH = 0x0E interprets it as page number and color.
http://www.ctyme.com/intr/rb-0106.htm
SI and lodsb are your friends.
Hint: XenOS talked about lodsb, check it out, and see what it does and how it can help you. Also, you may need to modify SI in your print routine if BX is the pointer to your string.ThisMayWork wrote:Well, to be honest I was trying to comply with this: http://www.cs.bham.ac.uk/~exr/lectures/ ... os-dev.pdfXenOS wrote:You cannot use BX here because int 0x10, AH = 0x0E interprets it as page number and color.
http://www.ctyme.com/intr/rb-0106.htm
SI and lodsb are your friends.
Section 3.4.8, Question 4.
I took a look at it, but now I need to find some other source of info. I chose this mainly because it doesn't use a cross-compiler (compiles with the -ffreestanding argument which I thought would produce the right executable) and also because it uses Intel Syntax ASM instead of GAS, which I find difficult to write. Does anybody have a proper book to recommend?Bender wrote:Hint: XenOS talked about lodsb, check it out, and see what it does and how it can help you. Also, you may need to modify SI in your print routine if BX is the pointer to your string.ThisMayWork wrote:Well, to be honest I was trying to comply with this: http://www.cs.bham.ac.uk/~exr/lectures/ ... os-dev.pdfXenOS wrote:You cannot use BX here because int 0x10, AH = 0x0E interprets it as page number and color.
http://www.ctyme.com/intr/rb-0106.htm
SI and lodsb are your friends.
Section 3.4.8, Question 4.
I haven't really read much of the document, but it doesn't use a cross-compiler which makes me feel suspicious, plus it's still seems to be under-construction, Section 6.3 - Section 7.2 are missing.