upsidedown

mi exp1re

Jan 27th, 2012
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. INCLUDE io.h
  2.  
  3. cr EQU 0dh
  4. lf EQU 0ah
  5.  
  6. data SEGMENT
  7. x DB ?
  8. y DB ?
  9. a DB ?
  10. b DB ?
  11. res DW ?
  12. prompt1 DB 'enter the value of x',0
  13. prompt2 DB 'enter the value of y',0
  14. prompt3 DB 'enter the value of a',0
  15. prompt4 DB 'enter the value of b',0
  16. string DB 40 DUP(?)
  17. lab DB cr,lf,'the result is'
  18. sum DB 6 DUP(?)
  19.     DB cr,lf,0
  20.  
  21. data ends
  22.  
  23. code SEGMENT
  24. ASSUME cs:code,ds:data
  25.  
  26. start:MOV AX,SEG data
  27.       MOV DS,Ax
  28.  
  29. prompt: output prompt1
  30.         inputs string,40
  31.         atoi string
  32.         MOV x,AL    
  33.    
  34.     output prompt2
  35.         inputs string,40
  36.         atoi string
  37.         MOV y,AL    
  38.  
  39.     output prompt3
  40.         inputs string,40
  41.         atoi string
  42.         MOV a,AL    
  43.  
  44.     output prompt4
  45.         inputs string,40
  46.         atoi string
  47.         MOV b,AL
  48.  
  49.     MOV AL,x
  50.     ADD AL,y
  51.     MOV BL,a
  52.     SUB BL,b
  53.  
  54.     MOV CL,a
  55.     ADD CL,b
  56.     MOV DL,x
  57.     SUB DL,y
  58.  
  59.     MUL BL
  60.     MOV BX,AX
  61.     MOV AL,CL
  62.     MUL DL
  63.  
  64.     MOV CX,AX
  65.     MOV DX,0
  66.     MOV AX,BX
  67.     CWD
  68.     DIV CX
  69.     itoa sum,AX
  70.     output lab
  71.  
  72. quit: MOV AL,0
  73.       MOV AH,4ch
  74.       int 21h
  75. code ends
  76.  
  77. END start
Advertisement
Add Comment
Please, Sign In to add comment