Passive TSR Hello World

Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
NotNull NotNull is offline Offline Sep 29th, 2009, 4:21 pm |
-1
Assembles under NASM 16-bit,
invoke INT 0x65 to display message.
Quick reply to this message  
Assembly Syntax
  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
0
wildgoose wildgoose is offline Offline | Sep 30th, 2009
What is it you need?
 
 

Tags
dos, interrupt, tsr

Message:


Similar Threads
Thread Tools Search this Thread



Tag cloud for dos, interrupt, tsr
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC