Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Program to perform all SUBTRACTION on two operands : (decimal, binary, octal,hexadecimal)

Posted By: Logan Bouchard     Category: Unix / Linux / Ubuntu     Views: 6051

Write a program to perform all SUBTRACTION on two operands : (decimal, binary, octal,hexadecimal).

Code for Program to perform all SUBTRACTION on two operands : (decimal, binary, octal,hexadecimal) in Unix / Linux / Ubuntu

DATA SEGMENT
A DB 10
B DB 20
C DB ?

A1 DB 10H
B1 DB 20H

A2 DB 10O
B2 DB 20O

A3 DB 10B
B3 DB 10B
DATA ENDS
CODE SEGMENT
     ASSUME DS:DATA,CS:CODE
START:
      MOV AX,DATA
      MOV DS,AX
      MOV AH,00

      MOV AL,B
      SUB AL,A
      MOV C,AL

      MOV AL,B1
      SUB AL,A1
      MOV C,AL

      MOV AL,B2
      SUB AL,A2
      MOV C,AL

      MOV AL,B3
      SUB AL,A3
      MOV C,AL
     
      MOV AH,4CH
      INT 21H
CODE ENDS
END START

;OUTPUT:->
;-R
;AX=0000  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0B98  ES=0B98  SS=0BA8  CS=0BA9  IP=0000   NV UP EI PL NZ NA PO NC
;0BA9:0000 B8A80B        MOV     AX,0BA8
;-T
;
;AX=0BA8  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0B98  ES=0B98  SS=0BA8  CS=0BA9  IP=0003   NV UP EI PL NZ NA PO NC
;0BA9:0003 8ED8          MOV     DS,AX
;-T
;
;AX=0BA8  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0005   NV UP EI PL NZ NA PO NC
;0BA9:0005 B400          MOV     AH,00
;-T
;
;AX=00A8  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0007   NV UP EI PL NZ NA PO NC
;0BA9:0007 A00100        MOV     AL,[0001]                          DS:0001=14
;-T
;
;AX=0014  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=000A   NV UP EI PL NZ NA PO NC
;0BA9:000A 2A060000      SUB     AL,[0000]                          DS:0000=0A
;-T
;
;AX=000A  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=000E   NV UP EI PL NZ AC PE NC
;0BA9:000E A20200        MOV     [0002],AL                          DS:0002=00
;-T
;
;AX=000A  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0011   NV UP EI PL NZ AC PE NC
;0BA9:0011 A00400        MOV     AL,[0004]                          DS:0004=20
;-T
;
;AX=0020  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0014   NV UP EI PL NZ AC PE NC
;0BA9:0014 2A060300      SUB     AL,[0003]                          DS:0003=10
;-T
;
;AX=0010  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0018   NV UP EI PL NZ NA PO NC
;0BA9:0018 A20200        MOV     [0002],AL                          DS:0002=0A
;-T
;
;AX=0010  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=001B   NV UP EI PL NZ NA PO NC
;0BA9:001B A00600        MOV     AL,[0006]                          DS:0006=10
;-T
;
;AX=0010  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=001E   NV UP EI PL NZ NA PO NC
;0BA9:001E 2A060500      SUB     AL,[0005]                          DS:0005=08
;-T
;
;AX=0008  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0022   NV UP EI PL NZ AC PO NC
;0BA9:0022 A20200        MOV     [0002],AL                          DS:0002=10
;-T
;
;AX=0008  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0025   NV UP EI PL NZ AC PO NC
;0BA9:0025 A00800        MOV     AL,[0008]                          DS:0008=02
;-T
;
;AX=0002  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0028   NV UP EI PL NZ AC PO NC
;0BA9:0028 2A060700      SUB     AL,[0007]                          DS:0007=02
;-T
;
;AX=0000  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=002C   NV UP EI PL ZR NA PE NC
;0BA9:002C A20200        MOV     [0002],AL                          DS:0002=08
;-T
;
;AX=0000  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=002F   NV UP EI PL ZR NA PE NC
;0BA9:002F B44C          MOV     AH,4C
;-T
;
;AX=4C00  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0031   NV UP EI PL ZR NA PE NC
;0BA9:0031 CD21          INT     21
  
Share: 



Logan Bouchard
Logan Bouchard author of Program to perform all SUBTRACTION on two operands : (decimal, binary, octal,hexadecimal) is from Montreal, Canada.
 
View All Articles

 

Other Interesting Articles in Unix / Linux / Ubuntu:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!