Guest User

Untitled

a guest
Apr 26th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1.  
  2. ; multi-segment executable file template.
  3.  
  4. data segment
  5. ; add your data here!
  6. msg db "Benvenuti nella programmazione Assembler $"
  7. ; Walter Serlenga!
  8. othamsg db "Walter Serlenga$"
  9.  
  10. ; il $ indica il fine stringa, come il \0 in C
  11.  
  12.  
  13. ; DICHIARAZIONE COSTANTI PER L'OPERAZIONE Y=a-b+2c
  14. ;perche scrivi 'a' e non "a"?
  15. ; perche 'a' e un carattere
  16. ;"a" e una stringa
  17. ;quindi dovresti scrivere "a$"
  18. ;a=9,b=5,c=3
  19.  
  20. a EQU '9'
  21. b EQU '5'
  22. c EQU '6'
  23.  
  24. ends
  25.  
  26. stack segment
  27. dw 128 dup(0)
  28. ends
  29.  
  30. code segment
  31. start:
  32. ; set segment registers: Y=a-b+2c
  33. mov ax, data
  34. mov ds, ax
  35. mov es, ax
  36. mov bx, a
  37. mov cx, b
  38. mov dx, c
  39. sub bx, cx
  40. add bx, dx
  41.  
  42.  
  43. ; add your code here
  44.  
  45. lea dx, msg ; load effective address of msg into dx.
  46. mov ah, 9 ; print function.
  47. int 21h ; do it!
  48.  
  49. lea dx, othamsg ; load effective address of msg into dx.
  50. mov ah, 9 ; print function.
  51. int 21h ; do it!
  52.  
  53.  
  54. ; wait for any key....
  55. mov ah, 1 ; keyboard input
  56. int 21h ; do it!
  57.  
  58. mov ax, 4c00h ; exit to operating system.
  59. int 21h
  60. ends
  61.  
  62. end start ; set entry point and stop the assembler.
Add Comment
Please, Sign In to add comment