carms28
carms28

Reputation: 1

emu8086- program adding two number and the output will shown

  1. If you type in the keyboard 3 it will be 3 + and type another number 3 it will be 3 = 3+3=6 I'm new in this subject and it very hard for me to understand this please help me and thank you in advance

Int 21h /0ah Data -> AL 1st register
2nd register Al

Add 1st register, 2nd register Register Al Print

Upvotes: 0

Views: 14849

Answers (3)

JONNY BHAI
JONNY BHAI

Reputation: 1

.model small
.stack 100 
.data 
    a dw 2
    b dw 4

.code
    start: 
           mov ax, @data
           mov ds, ax
           mov ax, a
           add ax, b 

           mov ax, 4c00h
           int 21h
           end start

Upvotes: 0

Ruby Rae Olaya
Ruby Rae Olaya

Reputation: 29

mov ah, 09h
mov dx, enterfnstr
int 21h
mov ah, 01h
int 21h
mov bl, al
sub bl, 30h
mov ah, 09h
mov dx, entersnstr
int 21h
mov ah,01h
int 21h
sub al, 30h
add al, bl
aaa
dec ah
mov bh, ah
add bh, 30h
add al, 30h
mov bl, al
mov ah, 09h
mov dx, sum
int 21h
mov ah, 02h
mov dl, bh
int 21h
mov ah, 02h
mov dl, bl
int 21h
mov ah, 0
int 16h

Upvotes: 1

carms28
carms28

Reputation: 1

; You may customize this and other start-up templates; ; The location of this template is c:\emu8086\inc\0_com_template.txt

org 100h

mov ah,1h                  ;read the character ,input stored in al
int 21h  

len equ 32         
mov bl,al                  ;bl stores first input

mov al,'+'                 ;print the character
mov ah,0eh
int 10h

mov ah,1h                  ;read the character ,input stored in al
int 21h

mov cl,al                  ;cl another reg

mov dl,bl                  ;moving the value of bl to dl
mov ah,2h

mov dl,cl                  ;moving the value of cl to dl
mov ah,2h 

mov al,'='                 ;print the character
mov ah,0eh
int 10h

sub bl,30h                 ;converted first to decimal
sub cl,30h

add bl,cl

add bl,30h

mov dl,bl                  ;print the character
mov ah,2h
int 21h 

ret

Upvotes: 0

Related Questions