home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / zip / gnu / gemlib27.lzh / GEMLIB27 / RESETAUX.S < prev    next >
Text File  |  1993-07-30  |  2KB  |  48 lines

  1. |
  2. | Reset the Aux rs232 port.  Usage:
  3. |    char    *rs232_iorec = Iorec(0);    |* Do this first    *|
  4. |
  5. |    if (rs232_reset())
  6. |        Cauxout(0x11);            |* sent an XOFF        *|
  7. |
  8. | This subroutine was written by Martin Minow, Arlington, MA
  9. | and is in the public domain.
  10. |
  11. |    .shrd                | Public data
  12. |    .globl    rs232_iorec_        | -> aux io record. see below
  13.     .text                | Public instructions
  14.     .globl    _rs232_reset
  15.  
  16. _rs232_reset:
  17.     movl    d2,sp@-            | Save a scratch register
  18.     clrl    sp@-            | Super(0L) switches to super mode
  19.     movw    #0x20,sp@-        | Super opcode
  20.     trap    #1            | Call TOS
  21.     addqw    #6,sp            | Clear stack
  22.     movl    d0,sp@-            | Save old stack for now.
  23. |
  24. | If you don't already have the iorec as a readily-available global,
  25. | uncomment the following code (which is, of course, untested)
  26. |
  27.     clrw    sp@-            | Aux port is device zero
  28.     movw    #14,sp@-        | Iorec
  29.     trap    #14            | Xbios(14)
  30.     addqw    #4,sp            | Clear stack
  31. | End of "get iorec" code. We already have this information:
  32. |    movl    rs232_iorec_,a0        | a0 -> I|O record
  33.     movl    d0,a0            | a0 -> I|O record
  34.     movw    sr,sp@-            | Save cpu status
  35.     orw    #0x700,sr        | Disable interrupts
  36. |    clrl    a0@(6)            | Clear input  head, tail -- crashes
  37.     clrl    a0@(20)            | Clear output head, tail
  38.     clrl    d2            | Clear result
  39.     orb    a0@(30),d2        | Get old rcv xoff state
  40.     clrw    a0@(30)            | Cancel rcv, xmt xoff states
  41.     movw    sp@+,sr            | Enable interrupts
  42.     movw    #0x20,sp@-        | Super -- old_stack is still at (sp)
  43.     trap    #1            | Exit super mode
  44.     addqw    #6,sp            | Clean junk from stack
  45.     movl    d2,d0            | Get result
  46.     movl    sp@+,d2            | Restore d2    
  47.     rts                | Exit routine
  48.