I am trying to print the contents of a single element in an array I created. Here is what I have..

.model small

.stack 100h


my_arr db 1, 3, 5, 6, 2
mov al,
mov ah, 2h
int 21h ; code is relevent to this point
mov   ah, 01h   ;
int   21h    ;
mov   dl, al
mov   ah, 2h   ;
int   21h    ;
mov   ax, 4c00h ;
int   21h

end start

I've indicated the part of the code that deals with the array, the rest is for something else.

Anyway, so for example right now it should print a 1. I am getting a character printed, but it's always a triangle. No matter what elements I hardcode into the array it always seems to print a triangle. I'm wondering if mov ah, 2h is the correct way to print an element from an array? Any help on this? Thanks.
Posted on 2009-10-12 11:02:21 by dre
If I recall my dos, int 21h/2 prints the character in dl, not al. Also, sending the number 1 to the screen won't print the character '1' - probably a smiley-face. Consult an ascii chart (or just "add dl, '0'")...


Posted on 2009-10-12 12:59:17 by fbkotler