home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / ansi / avatar1.arj / DISPATCH.DOC < prev    next >
Encoding:
Text File  |  1991-01-20  |  4.0 KB  |  86 lines

  1. Avatar Serial Dispatcher                Page 1
  2. Copyright (C) 1991 G. Adam Stanislav
  3. All Rights Reserved                    January 20, 1991
  4.  
  5. 1. This document is intended for programmers writing communication software
  6. for IBM PC/XT/AT and compatible computers.
  7.  
  8. 2. A common problem we have to deal with is the fact that another program
  9. may be running concurrently with ours, trying to access a serial port which
  10. shares the same IRQ with our own serial port.
  11.  
  12. 3. Up till now the only feasible solution was to use a FOSSIL driver loaded
  13. before the multitasking program. Unfortunately, there is a limitation to
  14. this solution: Not all programmers like using FOSSIL, mostly because it may
  15. not be available to program user, or at times because it does not do all our
  16. program needs.
  17.  
  18. 4. Avatar Serial Dispatcher (ASD) offers a new solution to this problem. As
  19. long as software is written to comply with the following specs, different
  20. programs can access serial ports sharing the same IRQ, whether using a FOSSIL
  21. or their own routines.
  22.  
  23. 5. ASD is built into AVATAR.SYS, both the commercially available versions
  24. and the version included for free with the AVT/1 console specs.
  25.  
  26. 6. ASD is an int 0Bh and int 0Ch dispatcher. Whenever one of these interrupts
  27. occurs, the ASD will call user installed routines starting with the most
  28. recently installed, ending with the first one or with the one that returns
  29. with AX = 0.
  30.  
  31. 7. ASD saves all registers and allocates enough local stack. ASD takes care
  32. of sending 20h to port 20h after all routines were called. Under no
  33. circumstances should the installed routines send 20h to port 20h on their
  34. own.
  35.  
  36. 8. Each routine should end with a far return. It should make AX = 0 if it
  37. finds the interrupt was meant for it. Otherwise it should make AX equal
  38. something else. Each and every routine is called with AX unequal 0, so if
  39. the interrupt is not for you, you can just leave AX as it is.
  40.  
  41. 8. The commercially available versions of AVATAR.SYS can have up to 20
  42. different routines installed for int 0Bh and 20 others for int 0Ch.
  43. The version that comes with AVT/1 console specs has room for up to 8 each.
  44.  
  45. 9. To install a routine, make ES:DI point at your routine, AX = 1Ah, BX = 'AV',
  46. AL = 'B' or 'C', depending on whether you want the routine called by int 0Bh
  47. or int 0Ch. Make sure DS contains the data segment your routine needs.
  48. Then call int 2Fh. ASD will restore your DS before calling your routine.
  49. That is very handy for routines written in high languages, such as C, Pascal,
  50. or Basic.
  51.  
  52. 10. Int 2Fh will return AX unchanged if AVATAR.SYS (or another ASD handler)
  53. is not installed. It will return AX = 0, if no more room is left in ASD.
  54. On success, AX will contain a handle which you can later use to deinstall
  55. your routine.
  56. Avatar Serial Dispatcher                Page 2
  57. Copyright (C) 1991 G. Adam Stanislav
  58. All Rights Reserved                    January 20, 1991
  59.  
  60.  
  61. 11. To deinstall your routine, make AH = 1Ah, BX = 'AV', CX = handle,
  62. AL = 'b' or 'c'. Then call int 2Fh.
  63.  
  64. 12. If installation fails because there is no ASD handler, use the old
  65. method of installing your own int 0Bh or 0Ch handler which saves all
  66. registers, allocates local stack, sets DS, and calls the same routine you
  67. would otherwise install with ASD.
  68.  
  69. 13. It is possible to modify existing FOSSIL drivers to follow this spec.
  70. That way FOSSIL programs can co-exist with programs that use their own
  71. serial routines.
  72.  
  73. 14. The important thing to remember is that ASD saves all registers, checks
  74. the value of AX after each routine, restores all registers and informs the
  75. PIC of the end of interrupt. Thus, the routines need not worry about saving
  76. and restoring any registers, and about sending 20h to port 20h. They should
  77. make sure to return 0 in AX if the interrupt was meant for them.
  78.  
  79. 15. Most high languages place return values in AX, which makes it very
  80. easy to use ASD.
  81.  
  82. 16. If this document is too terse, let me know, I will expand it further.
  83. I can be reached via Fidonet at 1:129/39.0, or via US Mail at Stanislav
  84. Publishing, 322 Mall Blvd., Suite 174, Monroeville, PA 15146.
  85.  
  86.