944,033 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 747
  • Assembly RSS
Oct 25th, 2009
0

TSR Help...

Expand Post »
I am trying to create an active TSR which prints an 'A'
when the ESC key is pressed, it doesn't work.
Can anyone tell me what's wrong?

Assembly Syntax (Toggle Plain Text)
  1. bits 16
  2. org 100h
  3.  
  4. jmp init.tsr
  5.  
  6. int1c:
  7. push ds
  8. push ax
  9. push cs
  10. pop ds
  11. call checkdos2
  12. jc int1c_e
  13. cmp byte [hotkey_found], 1
  14. jnz int1c_e
  15. call tsrapp
  16. int1c_e:
  17. pop ax
  18. pop ds
  19. iret
  20.  
  21. int28:
  22. push ds
  23. push ax
  24. push cs
  25. pop ds
  26. call checkdos
  27. jc int28_e
  28. cmp byte [hotkey_found], 1
  29. jnz int28_e
  30. call tsrapp
  31. int28_e:
  32. pop ax
  33. pop ds
  34. iret
  35.  
  36. checkdos2:
  37. push bx
  38. push es
  39. les bx, [InDOS]
  40. mov al, 0
  41. cmp al, byte [es:bx]
  42. jb checkdos2_e
  43. cmp al, byte [es:bx-1]
  44. checkdos2_e:
  45. pop es
  46. pop bx
  47. ret
  48.  
  49. checkdos:
  50. push bx
  51. push es
  52. les bx, [InDOS]
  53. mov al, 1
  54. cmp al, byte [es:bx]
  55. jb checkdos_e
  56. xor al, al
  57. cmp al, byte [es:bx-1]
  58. checkdos_e:
  59. pop es
  60. pop bx
  61. ret
  62.  
  63. InDOS dd 0
  64. Orig_isr9 dd 0
  65. in_isr9 db 0
  66. hotkey_found db 0
  67. hotkey_idx dw 0
  68. hotseq db 0x1b
  69.  
  70. isr9:
  71. push ds
  72. push bx
  73. push ax
  74. push cs
  75. pop ds
  76. in al, 0x60
  77. pushf
  78. cli
  79. call word far [Orig_isr9]
  80. mov ah, [in_isr9]
  81. or ah, [hotkey_found]
  82. jnz isr9_e
  83. inc byte [in_isr9]
  84. cmp al, byte [hotseq]
  85. jz isr9_foundkey
  86. jmp isr9_exit
  87. isr9_foundkey:
  88. mov byte [hotkey_found], 1
  89. isr9_exit:
  90. dec byte [in_isr9]
  91. isr9_e:
  92. pop ax
  93. pop bx
  94. pop ds
  95. iret
  96.  
  97. tsrapp:
  98. push dx
  99. mov ah, 0x2
  100. mov dl, 0x41
  101. int 0x21
  102. pop dx
  103. ret
  104.  
  105. pre equ $
  106.  
  107. init.tsr:
  108. mov ax, 0x3509
  109. int 0x21
  110. mov [Orig_isr9], bx
  111. mov [Orig_isr9+2], es
  112. mov dx, isr9
  113. mov ax, 0x2509
  114. int 0x21
  115. mov dx, int28
  116. mov ax, 0x2528
  117. int 0x21
  118. mov dx, int1c
  119. mov ax, 0x251c
  120. int 0x21
  121. mov ax, 0x3400
  122. int 0x21
  123. mov [InDOS], bx
  124. mov [InDOS+2], es
  125. mov dx, pre
  126. add dx, 0xf
  127. shr dx, 4
  128. mov ax, 0x3100
  129. int 0x21
Similar Threads
Reputation Points: 36
Solved Threads: 19
Junior Poster
NotNull is offline Offline
198 posts
since Oct 2008
Nov 1st, 2009
1
Re: TSR Help...
int 28h is called from within DOS, so the indos byte will always be greater than 0 when it is called. You should check that it is not greater than one.

Also, it was normal to hook int 8 as well as int 28h. When checking indos from within int 8 you should make sure that it is not greater than zero.

If you were writing a full scale TSR you would also need to hook int 10h and int 13h, and set a flag every time they were invoked. You should then check those flags, in the same way that you check indos, before popping up a TSR.
Last edited by mathematician; Nov 1st, 2009 at 9:20 pm.
Reputation Points: 14
Solved Threads: 4
Junior Poster
mathematician is offline Offline
149 posts
since Nov 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Help with End of Line character
Next Thread in Assembly Forum Timeline: Storing multiple things in a variable?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC