Advertisement
4doorsmorehories

8086 Add two 8bit no.

Jan 4th, 2023 (edited)
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASM (NASM) 0.76 KB | Source Code | 0 0
  1. ADD TWO 8 BIT NUMBERS
  2.  
  3. ASSUME CS:CODE,DS:DATA
  4. DATA SEGMENT
  5.     msg1 DB 0ah,0dh, "Enter the First number : $"
  6.     msg2 DB 0ah,0dh, "Enter the second number : $"
  7.     msg3 db 0ah,0dh, "Result : $"
  8. DATA ENDS
  9. CODE SEGMENT
  10. START: MOV AX,data
  11.     MOV DS,AX
  12.     LEA DX,msg1
  13.     MOV AH,09H
  14.     INT 21H
  15.     MOV AH,01H
  16.     INT 21H
  17.     MOV BH,AL
  18.     MOV AH,01H
  19.     INT 21H
  20.     MOV BL,AL
  21.     SUB BX,3030H
  22.     LEA DX,msg2
  23.     MOV AH,09H
  24.     INT 21H
  25.     MOV AH,01H
  26.     INT 21H
  27.     MOV CH,AL
  28.     MOV AH,01H
  29.     INT 21H
  30.     MOV CL,AL
  31.     SUB CX,3030H
  32.     LEA DX,msg3
  33.     MOV AH,09H
  34.     INT 21H
  35.     ADD BX,CX
  36.     AAA
  37.     ADD BX,3030H
  38.     MOV DL,BH
  39.     MOV AH,02H
  40.     INT 21H
  41.     MOV DL,BL
  42.     MOV AH,02H
  43.     INT 21H
  44.     MOV AH,4CH
  45.     INT 21H
  46. CODE ENDS
  47. END START
  48.  
  49.  
  50. Output
  51. C:\> <filename.exe>
  52. Enter the first number : 23
  53. Enter the second number : 45
  54. Result : 68
  55.  
Tags: masm 05/1/23
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement