home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 508.lha / IO_Expansion_Board / Includes / newser.i < prev   
Text File  |  1991-05-06  |  7KB  |  289 lines

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