home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / da / modemdtr.sit / modem.asm < prev    next >
Assembly Source File  |  1986-08-13  |  2KB  |  64 lines

  1. ;------------------------
  2. ; modemDTR desk accessory
  3. ;    by Brian H. Powell    brian@sally.UTEXAS.EDU
  4. ;                cs.Powell@r20.UTEXAS.EDU
  5. ;                brian@ut-sally.UUCP
  6. ;
  7. ;    This desk accessory is used to tell the 128K ROM serial driver
  8. ;   to not negate DTR the next time it closes.  This is useful when you
  9. ;   want to quit a terminal program and not lose the connection.  (For
  10. ;   example, to change terminal programs or return to the Finder for
  11. ;   housekeeping.)  On a Macintosh with 64K ROMs, it just beeps.
  12. ;------------------------
  13.  
  14.     include    :equ_files:traps.txt
  15.     include    :equ_files:sysequ.txt
  16.  
  17. OrnEntry
  18.     dc.w    0        ; We don't need time, need a goodbye kiss,
  19.                 ;  or respond to control calls.
  20.     dc.w    0        ; We don't need time
  21.     dc.w    0        ; We don't respond to any events
  22.     dc.w    0        ; We don't have a menu
  23.  
  24. ; offsets to driver routines:
  25.     dc.w    OrnOpen-OrnEntry    ; Open
  26.     dc.w    done-OrnEntry        ; Prime
  27.     dc.w    done-OrnEntry        ; Control
  28.     dc.w    done-OrnEntry        ; Status
  29.     dc.w    done-OrnEntry        ; Close
  30.  
  31. OrnTitle    dc.b    9,0
  32.         dc.b    'modemDTR'
  33.         .align    2
  34.  
  35. ; The following are the driver reference numbers for the two output ports.
  36. modemPort    equ    -7
  37. printerPort    equ    -9
  38.  
  39. ; We'll need 29 bytes for the parameter block.
  40. paramblocksize    equ    29
  41.  
  42. ;______________________________________________________________________
  43.  
  44. OrnOpen
  45.     move.l    #paramblocksize,d0    ; Create a pointer to a parameter
  46.     _NewPtr                ;   block.
  47.     bne.s    error1            ; If it failed, beep
  48.  
  49.     clr.l    ioCompletion(a0)    ; no completion routine
  50.     move.w    #modemPort,ioRefNum(a0)    ; use the modem port
  51.     move.w    #16,csCode(a0)        ; secret code for this control call
  52.     move.b    #$80,csParam(a0)    ;  ditto
  53.     _Control
  54.     tst.w    d0            ; Was there an error?
  55.     bne.s    error2            ; If so, release memory and beep
  56.     _DisposPtr            ; If not, release memory and return
  57.     bra.s    done
  58.  
  59. error2    _DisposPtr
  60. error1    move.w    #15,-(sp)        ; if there was an error, beep.
  61.     _SysBeep
  62. done    rts
  63.  
  64.     end