944,022 Members | Top Members by Rank

Ad:
-1

Passive TSR Hello World

by on Sep 29th, 2009
Assembles under NASM 16-bit,
invoke INT 0x65 to display message.
Assembly Code Snippet (Toggle Plain Text)
  1. bits 16
  2. org 100h
  3.  
  4. jmp init.tsr
  5. chk db '$$$ABz'
  6. handler:
  7. sti ; enable interrupts
  8. mov [cs:callerstk+2], ss
  9. mov [cs:callerstk], sp
  10. mov ss, [cs:tsrseg] ; mov segreg disables interrupts
  11. ; until end of next instruction
  12. mov sp, stk
  13. push ds
  14. push cs
  15. pop ds
  16. push dx
  17. push ax
  18. mov dx, msg
  19. mov ah, 0x9
  20. int 0x21
  21. pop ax
  22. pop dx
  23. pop ds
  24. mov ss, [cs:callerstk+2]
  25. mov sp, [cs:callerstk]
  26. iret
  27. tsrseg dw 0
  28. msg db 'h3LL0 wOrLDD',0xd,0xa,0x24
  29. callerstk dd 0
  30. times 0x100 db 0
  31. stk equ $+1
  32.  
  33. init.tsr:
  34. mov ax, 0x3565
  35. int 0x21
  36. mov si, chk
  37. mov di, chk
  38. mov cx, 0x6
  39. rep cmpsb ; Check if installed
  40. jz init.fail
  41. mov [tsrseg], cs
  42. mov dx, handler
  43. mov ax, 0x2565
  44. int 0x21
  45. mov es, [0x2c] ; Free enviroment block if not needed
  46. mov ah, 0x49
  47. int 0x21
  48. mov dx, stk-1
  49. add dx, 0xf
  50. shr dx, 0x4
  51. mov ax, 0x3100
  52. int 0x21
  53.  
  54. fail db 'AlReAdy iNstAleD$'
  55. init.fail:
  56. mov dx, fail
  57. mov ah, 0x9
  58. int 0x21
  59. mov ax, 0x4c01
  60. int 0x21
Comments on this Code Snippet
Sep 30th, 2009
0

Re: Passive TSR Hello World

What is it you need?
Practically a Posting Shark
wildgoose is offline Offline
891 posts
since Jun 2009
Feb 3rd, 2010
0

Re: Passive TSR Hello World

Assemble using NASM -F BIN -O TSR.COM TSR.ASM
It can be tested in Debug:
>DEBUG
-a
XXXX:0100 int 65
XXXX:0102 int 3
XXXX:0103
-g
h3LL0 wOrLDD
Junior Poster
NotNull is offline Offline
198 posts
since Oct 2008
Message:
Previous Thread in Assembly Forum Timeline: Assembly beginner question: finding median
Next Thread in Assembly Forum Timeline: Beginner question: from memory to register





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


Follow us on Twitter


© 2011 DaniWeb® LLC