Advertisement
venik2405

lab1_ass

Mar 15th, 2021
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. org 100h
  2. start:
  3. mov ah, $09
  4. mov dx, prog_name
  5. int 21h
  6.  
  7. mov ah, $02
  8. mov dx, 0x0D0A
  9. int 21h
  10.  
  11. mov ah, $09
  12. mov dx, info_str
  13. int 21h
  14.  
  15. mov ah, $02
  16. mov dx, 0x0D0A
  17. int 21h
  18.  
  19. mov ah, $09
  20. mov dx, result_is
  21. int 21h
  22.  
  23. mov ax, [a] ;ãðóçèì a â AX
  24. mov cx, [b] ;ãðóçèì b â CX
  25. sub ax, $08 ;îòíèìàåì îò à 8
  26. mul cx ;óìíîæàåì (a-8)*b, ðåçóëüòàò â DX:AX
  27. mov bx, [c] ;ãðóçèì â BX c
  28. add ax, bx ;ñêëàäûàåì (a-8)*b ñ c
  29. mov cx,[d] ;ãðóçèì â CX d
  30. add cx, $04 ;äîáàâëÿåì ê d 4
  31. div cx ;äåëèì AX íà CX (ò.å. (a-8)*b+c)/(d+4). ðåçóëüòàò â DX:AX
  32. mov [res],ax ;ñîõðàí¤åì ðåçóëüòàò (ìëàäøóþ ÷àñòü) â ÿ¾ res
  33.  
  34. mov ax, [res]
  35. add ax, '0'
  36.  
  37. mov bx,ax
  38.  
  39. mov ah, $02
  40. mov dx,bx
  41. int 21h
  42.  
  43. mov ah,$08
  44. int 21h
  45. ret
  46.  
  47. prog_name db "This program calculates ((a-8)*b+c)/(d+4)$"
  48. info_str db "where a=1, b=3, c=3, d=2$"
  49. result_is db "result is equal to $"
  50. a dw 11h
  51. b dw 3h
  52. c dw 3h
  53. d dw 2h
  54. res dw 0h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement