output function problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

output function problem

Post 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
mgarcia
Posts: 2
Joined: Sun Jan 27, 2008 3:01 pm

Post by mgarcia »

You are setting ds to 0, the null segment selector.
Post Reply