View Single Post
Old 06-20-2004, 06:09 PM   #2 (permalink)
Amaranthine
Registered User
 
Amaranthine's Avatar
 
Join Date: May 2004
Posts: 47
Amaranthine is on a distinguished road
AHA!!!
well, I figured I might as well let you know I found my mistake, and indeed it was a stupid one.
If you look at my WriteBin procedure you will notice I forgot to push or save the value of ax in any way. Since it get's shifted left 16 times it would always be 0 by the end of this procedure!
Anyway I just added a push ax and pop ax to it and now I don't always come up with zero.

But I would like to take this moment to ask another question, I have found a few very good uses for the xlat instruction but I never seem to be able to make them work. An example of one I am trying to make work(but it doesn't) is this:
Code:
; digitTable = "0123456789ABCDEF"
Al2Ascii proc
        push bx        ; save regs
	push ds
	sub bx,bx      ; set ds to zero
	mov ds,bx
	mov bx,OFFSET digitTable	; get digit from table
	xlat
	pop ds
	pop bx         ; restore regs
	ret
Al2Ascii endp
But it doesn't work (is my logic flawed?)
If anyone could give me a working example (or spot my error) of xlat using ds:bx (not ebx) I would greatly appreciate it.
Thanks yet again.
Amaranthine is offline   Reply With Quote