Guest User

Untitled

a guest
Nov 20th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. ;16 bit addition-subtraction
  2.  
  3. .model small
  4.  
  5. .data
  6.  
  7. x dw 1234h
  8. y dw 555Ah
  9. output db ?,?,?,?,'$'
  10.  
  11. .code
  12.  
  13. mov ax,@data
  14. mov ds,ax
  15.  
  16. mov ax,x
  17. add ax,y
  18. mov bx,ax
  19.  
  20. mov cl,04h
  21.  
  22. call print
  23. lea dx,output
  24. mov ah,09h
  25. int 21h
  26.  
  27. mov ah,4ch
  28. int 21h
  29. .exit
  30.  
  31. print proc near
  32.  
  33. ;displaying higher order bits
  34.  
  35. mov ah,bh;
  36. and ah,0f0h;
  37. ror ah,cl
  38. cmp ah,09h
  39. jnc ad1
  40. add ah,30h;
  41. jmp go1
  42. ad1:add ah,37h;
  43. go1:mov [output+0],ah
  44.  
  45.  
  46. mov ah,bh;
  47. and ah,0fh;
  48. cmp ah,09h
  49. jnc ad2
  50. add ah,30h;
  51. jmp go2
  52. ad2:add ah,37h;
  53. go2:mov [output+1],ah
  54.  
  55. ;displaying lower order bits
  56.  
  57. mov ah,bl;
  58. and ah,0f0h;
  59. ror ah,cl
  60. cmp ah,09h
  61. jnc ad3
  62. add ah,30h;
  63. jmp go3
  64. ad3:add ah,37h;
  65. go3:mov [output+2],ah
  66.  
  67.  
  68. mov ah,bl;
  69. and ah,0fh;
  70. cmp ah,09h
  71. jnc ad4
  72. add ah,30h;
  73. jmp go4
  74. ad4:add ah,37h;
  75. go4:mov [output+3],ah
  76.  
  77.  
  78. ret
  79. print endp
  80. end
Add Comment
Please, Sign In to add comment