flat assembler
Message board for the users of flat assembler.

Index > DOS > How it works XLAT?

Author
Thread Post new topic Reply to topic
Andy



Joined: 17 Oct 2011
Posts: 26
Andy
I tried to understand how it works XLAT instruction and I wrote this short code for test:
Code:
mov bx,Table
mov al,4
xlatb
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 do expect to be write to STDOUT this char:
Image

Where is my wrong?
Post 02 Mar 2012, 12:37
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17278
Location: In your JS exploiting you and your system
revolution
Check your DS segment register.
Code:
org 0x100
mov ax,cs
mov ds,ax
mov bx,Table
;...    
Post 02 Mar 2012, 12:38
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
revolution: .COM programs have CS=DS=ES=SS at startup, all with the value of PSP. It is enough to add "org 100h" in the beginning to get this working.
Post 02 Mar 2012, 12:47
View user's profile Send private message Visit poster's website Reply with quote
Andy



Joined: 17 Oct 2011
Posts: 26
Andy
I spent 2 hours to check what I'm doing wrong and all this because I didn't set the origin? I'm feel so dumb. Well this is the way that go all beginners. It's good to have on whom you ask.

Thanks revolution!
Post 02 Mar 2012, 12:49
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17278
Location: In your JS exploiting you and your system
revolution
Tomasz Grysztar wrote:
revolution: .COM programs have CS=DS=ES=SS at startup, all with the value of PSP. It is enough to add "org 100h" in the beginning to get this working.
Thanks. It's been a while since I wrote a DOS program. I guess I was thinking of a boot sector where the segment registers need some coaxing to get them in the right position.
Post 02 Mar 2012, 13:04
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
Writing .COM programs was really like flat memory model programming, especially when combined with FRM. Wink
Post 02 Mar 2012, 13:13
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17278
Location: In your JS exploiting you and your system
revolution
offtopic: That was your 5000th post! Hehe, not that it actually means anything of course.
Post 02 Mar 2012, 13:40
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17278
Location: In your JS exploiting you and your system
revolution
Andy wrote:
I spent 2 hours to check what I'm doing wrong and all this because I didn't set the origin? I'm feel so dumb. Well this is the way that go all beginners. It's good to have on whom you ask.
We all gotta start somewhere. You came to the right place to solve the problem.
Andy wrote:
Thanks revolution!
Y'r welcome.
Post 02 Mar 2012, 13:42
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
revolution wrote:
offtopic: That was your 5000th post! Hehe, not that it actually means anything of course.
Well, I think that writing about flat model was a very good topic for a 5000th post. Smile I did not notice that, however.
Post 02 Mar 2012, 13:48
View user's profile Send private message Visit poster's website Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1409
Location: Toronto, Canada
AsmGuru62
COM files were actually quite awesome.
There is about 64Kb of code and around 560Kb of memory!
I once written large stuff with these - in 1989!!
Post 02 Mar 2012, 14:55
View user's profile Send private message Send e-mail Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 192
Location: Madrid - Spain
avcaballero
Some time ago I did something similar with xlat:

http://www.abreojosensamblador.net/Productos/AOE/html/Pags_en/Chap07.html

Search for "7.1.1.6. XLAT"

You have to follow the program execution with a debugger:

Greetings.

It would also be good that you look in Ralph Brown Interrupt List for xlat Wink. Well, maybe not here, sure, not an interrupt, where did I read it?, maybe here (only spanish text ha ha Wink):

http://www.gui.uva.es/udigital/


Description:
Filesize: 16.83 KB
Viewed: 4492 Time(s)

xlat_debugger.png



_________________
Siempre aprendiendo
Post 07 Mar 2012, 17:09
View user's profile Send private message Visit poster's website Reply with quote
16bitPM



Joined: 08 Jul 2011
Posts: 28
16bitPM
Tomasz Grysztar wrote:
Writing .COM programs was really like flat memory model programming, especially when combined with FRM. Wink


OK my turn to feel dumb: what's FRM?
Post 29 Mar 2012, 19:35
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
16bitPM wrote:
OK my turn to feel dumb: what's FRM?
The Flat Real Mode.
Post 29 Mar 2012, 20:42
View user's profile Send private message Visit poster's website Reply with quote
16bitPM



Joined: 08 Jul 2011
Posts: 28
16bitPM
Ow.. that one... never been a fan.
Post 30 Mar 2012, 18:21
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.