HEX Addition and Subtraction in 8086


Multi byte Addition and Subtraction using Hexadecimal numbers (8086)

Description:

This program adds and subtracts two 64 bits (8bytes) signed hexadecimal numbers using 8086 instructions.

Program:

NAME                        ADDSUBHEX

TITLE             8086 ALP FOR MULTIBYTE ADDITION/SUBTRACTION

VALUES        SEGMENT

N1      DB      12H,23H,34H,45H,56H,67H,78H,89H

N2      DB      12H,23H,34H,45H,56H,67H,78H,89H

S       DB      8 DUP (0)

D       DB      8 DUP (0)

VALUES        ENDS

CODES           SEGMENT

ASSUME CS: CODES, DS: VALUES

ADDSUB:         MOV     AX, VALUES

MOV     DS, AX

MOV   CX, 8

MOV   BX,7

CLC

ADDAGN:         MOV     AL, N1[BX]

ADC   AL, N2[BX]

MOV   S[BX], AL

DEC    BX

LOOP ADDAGN

MOV   CX, 8

MOV   BX, 7

CLC

SUBAGN:         MOV     AL, N1[BX]

SBB    AL, N2[BX]

MOV     D[BX], AL

DEC    BX

LOOP SUBAGN

INT     3

CODES           ENDS

END    ADDSUB

About these ads

Follow

Get every new post delivered to your Inbox.

Join 73 other followers