2 Replies - 286 Views - Last Post: 23 September 2017 - 12:07 AM

#1 sunshine33  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 15-September 17

Few questions about adding two numbers in assembly language .

Posted 22 September 2017 - 11:35 PM

.model small
.data
 opr1 dw 1234h
 opr2 dw 0002h
 result dw 01 dup(?),'$'
.code
        mov ax,@data
        mov ds,ax
        mov ax,opr1
        mov bx,opr2
        clc
        add ax,bx
        mov di,offset result
        mov [di], ax

        mov ah,09h
        mov dx,offset result
        int 21h

        mov ah,4ch
        int 21h
        end


In this code opr1 , opr2 are the name of the variables .

But what are these ? 1234h , 0002h . Is it numbers in HEX .

Is This A Good Question/Topic? 0
  • +

Replies To: Few questions about adding two numbers in assembly language .

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13488
  • View blog
  • Posts: 53,879
  • Joined: 12-June 08

Re: Few questions about adding two numbers in assembly language .

Posted 22 September 2017 - 11:48 PM

What does dw mean?

Perhaps DW is Define Word? What does h mean after some numbers? Maybe hex? So put that together..
Was This Post Helpful? 0
  • +
  • -

#3 sunshine33  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 15-September 17

Re: Few questions about adding two numbers in assembly language .

Posted 23 September 2017 - 12:07 AM

The data stored in a memory byte are called its contents


DB - byte(s)
DW - word(s)
DD - doubleword(s)
DQ - quadword(s)
DT - tenbyte(s)



100 - decimal
100b - binary
100h - hexadecimal
'100' - ASCII
"100" - ASCII


So , this means

opr1 dw 1234h

opr2 dw 0002h

The content 1234h , 0002h are stored in a variable name called opr1 , opr2 .?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1