#### ecjohnny

Joined Jul 16, 2005
142
Hi
Can anyone help me with basic 8086 programming. i need to display the offset address of an element in an array. For example address of arr[2], arr[6] etc...

Here is what i've tried but i got a bunch of "rubbish" on display. It compile fine with no error/warning.

data segment

arr db 12,45,34,3 ;examples

data ends

code segment
assume cs:code, ds:data
start :

MOV AH, 9
LEA DX, arr+1 ;display arr[1]???
INT 21H

MOV AH, 4CH
INT 21H

code ends
end start

#### MrChips

Joined Oct 2, 2009
22,550
INT 21h / AH=9 - output of a string at DS: DX.
String must be terminated by '$'. Rich (BB code): example: org 100h mov dx, offset msg mov ah, 9 int 21h ret msg db "hello world$"

Last edited:

#### ecjohnny

Joined Jul 16, 2005
142
i still dont get it
am i using the wrong interrupt? should i use ah = 02

#### MrChips

Joined Oct 2, 2009
22,550
You have to write a routine to convert the binary into a character format.

#### ecjohnny

Joined Jul 16, 2005
142
You have to write a routine to convert the binary into a character format.
Oh i see.. no wonder i got bunch of funny chars. just to clarify so my offset address is in binary form? or hexadecimal? to convert it to ASCII for display.

Thanks

#### MrChips

Joined Oct 2, 2009
22,550
Oh i see.. no wonder i got bunch of funny chars. just to clarify so my offset address is in binary form? or hexadecimal? to convert it to ASCII for display.
This is always a misunderstanding with someone not in the know.
Everything is always in binary. Hexadecimal is all smoke and mirrors.

As my other quote: There are only 10 types of people in this world, those who understand binary and those who don't.