home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 550b.lha / newser_v2.10 / newser.i < prev    next >
Text File  |  1991-09-08  |  6KB  |  248 lines

  1. *****************************************************************************
  2. * Program:  newser.i - ©1990, 1991 by The Puzzle Factory and Dan Babcock
  3. *           Permission granted for non-commercial use (only!)
  4. * Function: The include file for newser.device
  5. *
  6. * Author:   Jeff Lavin and Dan Babcock
  7. * History:  08/23/90 V1.00 Created
  8. *           06/27/91 V2.10 Latest...
  9. *****************************************************************************
  10.  
  11.     ifeq    __M68
  12.     fail    "Using the wrong assembler"
  13.     endc
  14.  
  15. ;Put a message to the serial port.  Used like so:
  16. ;
  17. ;    PUTDEBUG   30,<'%s/Init: called'>
  18. ;
  19. ;Parameters can be printed out by pushing them on the stack and
  20. ;adding the appropriate C printf-style % formatting commands.
  21.  
  22. PUTDEBUG     macro        ;[level,msg]
  23.     ifge    INFO_LEVEL-\1
  24.     pea    (subSysName,pc)
  25.     movem.l    a0/a1/d0/d1,-(sp)
  26.     lea    (.msg\@,pc),a0    ;Point to static format string
  27.     lea    (4*4,sp),a1    ;Point to args
  28.     bsr    KPutFmt
  29.     movem.l    (sp)+,d0/d1/a0/a1
  30.     addq.l    #4,sp
  31.     bra.b    .end\@
  32.  
  33. .msg\@    cstr    \2,10
  34.     even
  35. .end\@
  36.     endc
  37.     endm
  38.  
  39. *** MACROS ***
  40.  
  41. ;Un-comment this if you need it!
  42. ;SYS    macro
  43. ;    jsr    (_LVO\1,a6)
  44. ;    endm
  45.  
  46. Disable    macro
  47.     ifc    '\1',''
  48.     move.w    #INTF_INTEN,(_intena).l
  49.     move.l    a6,-(sp)
  50.     movea.l    (SysBase).w,a6
  51.     addq.b    #1,(IDNestCnt,a6)
  52.     movea.l    (sp)+,a6
  53.     endc
  54.     ifnc    '\1',''
  55.     movea.l    (SysBase).w,\1
  56.     move.w    #INTF_INTEN,(_intena).l
  57.     addq.b    #1,(IDNestCnt,\1)
  58.     endc
  59.     endm
  60.  
  61. Enable    macro
  62.     ifc    '\1',''
  63.     move.l    a6,-(sp)
  64.     movea.l    (SysBase).w,a6
  65.     subq.b    #1,(IDNestCnt,a6)
  66.     movea.l    (sp)+,a6
  67.     bge.s    .Enable\#
  68.     move.w    #INTF_SETCLR!INTF_INTEN,(_intena).l
  69. .Enable\#
  70.     endc
  71.     ifnc    '\1',''
  72.     movea.l    (SysBase).w,\1
  73.     subq.b    #1,(IDNestCnt,\1)
  74.     bge.s    .Enable\#
  75.     move.w    #INTF_SETCLR!INTF_INTEN,(_intena).l
  76. .Enable\#
  77.     endc
  78.     endm
  79.  
  80. Forbid    macro
  81.     move.l    a6,-(sp)
  82.     movea.l    (SysBase).w,a6
  83.     addq.b    #1,(TDNestCnt,a6)
  84.     movea.l    (sp)+,a6
  85.     endm
  86.  
  87. Permit    macro
  88.     movem.l    d0/d1/a0/a1/a6,-(sp)
  89.     movea.l    (SysBase).w,a6
  90.     SYS    Permit
  91.     movem.l    (sp)+,d0/d1/a0/a1/a6
  92.     endm
  93.  
  94. PREFFILE    macro
  95.     cstr    'S:Serial-Preferences'
  96.     even
  97.     endm
  98.  
  99. MYDEVNAME    macro
  100.     cstr    'newser.device'
  101.     even
  102.     endm
  103.  
  104. MYUNITNAME1         macro
  105.     cstr    'SER1:'
  106.     even
  107.     endm
  108.  
  109. MYUNITNAME2         macro
  110.     cstr    'SER2:'
  111.     even
  112.     endm
  113.  
  114. MYUNITNAME3         macro
  115.     cstr    'SER3:'
  116.     even
  117.     endm
  118.  
  119. MYUNITNAME4         macro
  120.     cstr    'SER4:'
  121.     even
  122.     endm
  123.  
  124. *** EQUATES ***
  125.  
  126. MYPROCSTACKSIZE    equ    $900    ;Stack size for the task we will create
  127. MYPRI    equ    0    ;Used for configuring the roms
  128. VERSION    equ    1    ;A major version number.
  129. REVISION    equ    0    ;A particular revision
  130. MYDEV_END    equ    CMD_NONSTD+2    ;Number of device comands 
  131. MD_NUMUNITS    equ    4    ;Maximum number of units in this device
  132.  
  133. *** New SerialPrefs Structure ***
  134.  
  135. UnitPrefs    clrso
  136. up_BufSize    so.w    1    ;0 to 7
  137. up_BaudRate    so.w    1    ;0 to 15
  138. up_WordLen    so.b    1    ;0=5, 1=6, 2=7, 3=8
  139. up_StopBits    so.b    1    ;0=1, 1=2
  140. up_Parity    so.b    1    ;0=Odd, 1=Even, 2=Mark, 3=Space, 4=None
  141. up_Shake    so.b    1    ;0=RTS/CTS, 1=xON/xOFF
  142. up_Sizeof    soval
  143.  
  144. SerialPrefs    clrso
  145. sp_Unit01    so.b    up_Sizeof    ;For ACIA 0, Unit 1
  146. sp_Unit02    so.b    up_Sizeof    ;For ACIA 0, Unit 2
  147. sp_Unit11    so.b    up_Sizeof    ;For ACIA 1, Unit 1
  148. sp_Unit12    so.b    up_Sizeof    ;For ACIA 1, Unit 2
  149. serialprefs_Sizeof    soval
  150.  
  151. *** The Hardware ***
  152.  
  153. ;The ACIAs are located at $400 byte boundaries beginning at ACIA_Base:
  154. ;
  155. ; Unit1    equ    $BF9000    ;65C52 DACIA chip 1, unit 1
  156. ; Unit2    equ    $BF9400    ;65C52 DACIA chip 1, unit 2
  157. ; Unit3    equ    $BF9800    ;65C52 DACIA chip 2, unit 1
  158. ; Unit4    equ    $BF9C00    ;65C52 DACIA chip 2, unit 2
  159.  
  160. ACIA_Base    equ    $BF9000    ;Base address of all units
  161. ACIA1    equ    $800    ;Offset of 2nd chip
  162. UNIT2    equ    $400    ;Offset of 2nd unit
  163.  
  164. IER    equ    $0000    ;Interrupt Enable Register
  165. ISR    equ    $0000    ;Interrupt Status Register
  166. CTR    equ    $0100    ;Control Register
  167. FMR    equ    $0100    ;Format Register
  168. CSR    equ    $0100    ;Control Status Register
  169. CDR    equ    $0200    ;Compare Data Register
  170. ACR    equ    $0200    ;Auxilliary Control Register
  171. TDR    equ    $0300    ;Transmit Data Register
  172. RDR    equ    $0300    ;Receive Data Register
  173.  
  174. * Interrupt Status Registers (ISR1=0, ISR2=4) Read only
  175.  
  176.     BITDEF    ISR,SETCLR,7    ;Any bit set
  177.     BITDEF    ISR,TDRE,6    ;Transmit Data Register Empty
  178.     BITDEF    ISR,CTST,5    ;Transition on *CTS Line
  179.     BITDEF    ISR,DCDT,4    ;Transition on *DCD Line
  180.     BITDEF    ISR,DSRT,3    ;Transition on *DSR Line
  181.     BITDEF    ISR,PAR,2    ;Parity status
  182.     BITDEF    ISR,FEOB,1    ;Frame error, Overrun, Break
  183.     BITDEF    ISR,RDRF,0    ;Receive Data Register Full
  184.  
  185. * Interrupt Enable Registers (IER1=0, IER2=4) Write only
  186.  
  187.     BITDEF    IER,SETCLR,7    ;Same as above
  188.     BITDEF    IER,TDRE,6
  189.     BITDEF    IER,CTST,5
  190.     BITDEF    IER,DCDT,4
  191.     BITDEF    IER,DSRT,3
  192.     BITDEF    IER,PAR,2
  193.     BITDEF    IER,FEOB,1
  194.     BITDEF    IER,RDRF,0
  195.  
  196. * Control Status Registers (CSR1=1, CSR2=5) Read only
  197.  
  198.     BITDEF    CSR,FE,7    ;Framing Error
  199.     BITDEF    CSR,TUR,6    ;Transmitter Underrun
  200.     BITDEF    CSR,CTSL,5    ;*CTS Level
  201.     BITDEF    CSR,DCDL,4    ;*DCD Level
  202.     BITDEF    CSR,DSRL,3    ;*DSR Level
  203.     BITDEF    CSR,RBRK,2    ;Receive Break
  204.     BITDEF    CSR,DTRL,1    ;*DTR Level
  205.     BITDEF    CSR,RTSL,0    ;*RTS Level
  206.  
  207. * Control Registers (CR1=1, CR2=5) Write only
  208.  
  209.     BITDEF    CR,CTRL,7    ;1=Access FMR,  0=Access CTR
  210.     BITDEF    CR,AUX,6    ;1=Access ACR,  0=Access CDR
  211.     BITDEF    CR,STOP2,5    ;1=2 stop bits, 0=1 stop bit
  212.     BITDEF    CR,ECHO,4    ;1=Echo mode,   0=Echo mode disabled
  213.  
  214. * Format Registers (FR1=1, FR2=5) Write only
  215.  
  216.     BITDEF    FR,FRMT,7    ;1=Access FR, 0=Access CR
  217.  
  218. WORDLEN_5    equ    %00000000    ;Bits 5-6
  219. WORDLEN_6    equ    %00100000
  220. WORDLEN_7    equ    %01000000
  221. WORDLEN_8    equ    %01100000
  222.  
  223. PAR_ODD    equ    %00000000    ;Bits 3-4
  224. PAR_EVEN    equ    %00001000
  225. PAR_MARK    equ    %00010000
  226. PAR_SPACE    equ    %00011000
  227.  
  228.     BITDEF    FR,PAR,2    ;1=Parity as specified in bits 3-4
  229.     BITDEF    FR,DTR,1    ;1=Set DTR hi, 0=Set DTR lo
  230.     BITDEF    FR,RTS,0    ;1=Set RTS hi, 0=Set RTS lo
  231.  
  232. * Compare Data Register  (CDR1=2, CDR2=6) Write only
  233.  
  234. ;Bit 6 of Control Register must be 0.  By writing a value into this
  235. ;register, the DACIA is put into the compare mode.  In this mode the Receive
  236. ;Data Register Full bit is inhibited until a character is received that
  237. ;matches the value in this register.  The next character is then received
  238. ;normally.
  239.  
  240. * Auxiliary Control Registers (ACR1=2, ACR2=6) Write only
  241.  
  242. ;Bit 6 of Control Register must be 1.
  243.  
  244.     BITDEF    ACR,BRK,1    ;Transmit break
  245.     BITDEF    ACR,ARM,0    ;Address recognition mode
  246.  
  247. ;End of File
  248.