1 year ago

#155325

test-img

kpalacios

TASM: how do I print a number?

I'm trying to learn assembly ussing the TASM compiler and the amount of information I found is very low. I'm ussing DOSbox and when I run the code I don't get the answer I was expecting. Can someone tell me what am I doing wrong here?

;Programm to add 2 numbers

datos segment

    ;X db?
    Base dw 10

datos endS

pila segment stack 'stack'
    dw 256 dup(?)
pila endS


codigo segment
    Assume  CS:codigo,DS:datos,SS:pila

main:
    mov ax, pila
    mov ss, ax

    mov ax,  datos
    mov  ds, ax

    ;programm
    mov ax, 15
    mov bx, 10 ;trying to have 15 and 10 as numbers in a variable to be added
    add ax, bx
    inc ax     ;adding 1
    mov ah, 02h;telling the program to print

    int  21h

    mov ax, 4C00h
    int 21h

codigo ends

end main

The result I got was a weird character, the result I was expeceting was 26 obviously. Do you know what's happening?

assembly

tasm

0 Answers

Your Answer

Accepted video resources