Page 1 of 1

output function problem

Posted: Fri Feb 08, 2008 6:54 pm
by suthers
I use the following code for output:

Code: Select all

PutStr_32:
	xor ax, ax
	mov ds, ax
	mov eax, screen_pos 	
	.nextchar	
 	lodsb		
 	or al,al	
 	jz .return	
	mov byte [ds:eax], al
	inc eax
	mov byte [ds:eax], 1Bh
 	jmp .nextchar	
	.return
	mov [screen_pos], eax
	ret	   
        ;data
        screen_pos dd 0
It loads a character form the si registry into al and the prints it to the screen, it assembles without any error or warnings, but when i run it on vmware, it just restarts.
Can anybody tell me what is the cause of this error? (I am in protected mode by the way)
Thanks in advance,

Jules

Posted: Fri Feb 08, 2008 10:53 pm
by mgarcia
You are setting ds to 0, the null segment selector.