Author Topic: How it works XLAT  (Read 12476 times)

Offline Andy

  • Jr. Member
  • *
  • Posts: 2
How it works XLAT
« on: March 02, 2012, 12:27:35 PM »
I tried to understand how it works XLAT instruction and I wrote this short code for test:
Code: [Select]
mov bx,Table
mov al,4
xlat
mov dl,al
mov ah,2
int 21h

mov ah,4Ch
int 21h

Table db '0123456789'

The compilations works fine but the result is not what I really expect. If I understood well, XLAT should put in al the ascii value of 4, this mean 34h. So I expect to be write to STDOUT the character of 34h but I still get this:
http://solidfiles.com/d/8c8aa1ca3d

Where is my wrong?
« Last Edit: March 02, 2012, 12:29:51 PM by Andy »

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: How it works XLAT
« Reply #1 on: March 02, 2012, 02:29:51 PM »
Assembling this as a .com file?

Code: [Select]
org 100h  ; tell Nasm where dos will load us

See if that helps.

Best,
Frank


Offline Andy

  • Jr. Member
  • *
  • Posts: 2
Re: How it works XLAT
« Reply #2 on: March 02, 2012, 07:01:10 PM »
Yeah, that works. Thank you!