upsidedown

MI EXPT 1 NOT WORKING

Jan 27th, 2012
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. include io.h
  2.  
  3.  
  4.  
  5. data segment
  6. x db ?
  7. y db ?
  8. a db ?
  9. b db ?
  10. z dw ?
  11. temp1 db ?
  12. temp2 db ?
  13. prompt1 db 'Enter x' ,0
  14. prompt2 db 'Enter y' ,0
  15. prompt3 db 'Enter a' ,0
  16. prompt4 db 'Enter b' ,0
  17. string db 40 DUP(?)
  18. ans db 'the sum is'
  19. sum db ?
  20.  
  21. data ends
  22.  
  23. code SEGMENT
  24.  
  25. ASSUME CS:code, DS:data
  26.  
  27. start: mov ax, SEG data
  28. mov  ds, ax
  29.  
  30. prompt: output prompt1
  31. inputs string,40
  32. atoi string
  33. mov x,al
  34.  
  35.  
  36. output prompt2
  37. inputs string, 40
  38. atoi string
  39. mov y,al
  40.  
  41.  
  42. output prompt3
  43. inputs string ,40
  44. atoi string
  45. mov a,al
  46.  
  47.  
  48. output prompt4
  49. inputs string ,40
  50. atoi string
  51. mov b,al
  52.  
  53.  
  54.  
  55. mov al,x
  56. add al,y
  57. mov temp1, al
  58.  
  59. mov al,a
  60. sub al,b
  61. mov temp2, al
  62.  
  63. mov al,x
  64. sub al,y
  65. mov x, al
  66.  
  67. mov al,a
  68. add al,b
  69. mov a, al
  70.  
  71.  
  72.  
  73. mov al, x
  74. mov bl, a
  75. mul bl
  76. mov z,ax
  77.  
  78.  
  79. mov al, temp1
  80. mov bl, temp2
  81. mul bl ; result in ax
  82.  
  83.  
  84. div z
  85. itoa sum,al
  86. output al
  87.  
  88.  
  89.  
  90.  
  91. int 21h
  92. code ends
  93.  
  94. end start
Advertisement
Add Comment
Please, Sign In to add comment