;****************************************************************************
;* Copyright 1990 to 1995 MBARI                                             *
;****************************************************************************
;* Summary  : Assembly language configuration file for 3x5 microcontroller  *
;* Filename : config.s                                                      *
;* Author   : Andrew Pearce                                                 *
;* Project  : Tiburon ROV                                                   *
;* Version  : 1.0                                                           *
;* Created  : 04/26/91                                                      *
;* Modified : 03/10/95                                                      *
;* Archived :                                                               *
;****************************************************************************
;* Modification History:
;* $Header: /usr/tiburon/.cvsroot/micro/ac_micro/config.s,v 1.3 1997/05/07 15:23:39 pean Exp $
;* $Log: config.s,v $
;* Revision 1.3  1997/05/07 15:23:39  pean
;* Cleaned up Include files and makefile for new directory structure.
;*
;* Revision 1.1.1.1  1997/05/02 17:15:43  pean
;* Initial release of the microcontroller software after Tiburon
;* Moolpool Dive to test IView, Lapboxes, modified Power can
;* GF/5V using bus capacitance mode.
;*
; Revision 1.3  95/09/13  11:31:40  11:31:40  pean (Andrew Pearce)
; Final release for Tiburon
;
;* Revision 1.2  95/04/25  09:45:43  09:45:43  pean (Andrew Pearce)
;* Pressure sensor resolution changed to 0.01 PSIA
;
;* Revision 1.1  92/05/14  11:21:02  11:21:02  pean (Andrew Pearce 408-647-3746)
;* Initial revision
;
;****************************************************************************
;
$TITLE("MBARI AC Can Microcontroller")
;
MICRO   MODULE MAIN, STACKSIZE(2500)    ; Decimal Byte Stack
;
;********************* Memory address and size *******************************
;
RAM_BASE_ADDR   EQU   0C000H     ; Base address of external RAM
RAM_SIZE        EQU    4000H     ; Size of RAM in bytes 16384 decimal
;
;******************** Switches for Optional Sub-system Support ***************
;
USE_HUMIDITY_SENSOR EQU 1       ; Include Support for Humidity Sensor
USE_WATCHDOG_TIMER  EQU 0       ; Enable Watch Dog Timer
USE_TIMER_CHAIN     EQU 1       ; Add timer chain Support
;
;************************ Interrupt Vector Table *****************************

interrupt_vector_table      EQU 2000H   ; Address of interrupt table
int_vector_table_ext        EQU 2030H   ; and additional interrupts

        CSEG AT interrupt_vector_table

        DCW  isr_dummy                  ; Timer1 Overflow Interrupt Handler
        DCW  isr_dummy                  ; AD Conversion Interrupt Handler
        DCW  isr_dummy                  ; HSI Data Available Interrupt Handler
        DCW  isr_dummy                  ; HSO Interrupt Handler
        DCW  isr_dummy                  ; HSI 0 Interrupt Handler
        DCW  software_timer_isr         ; Software Timer Interrupt Handler
        DCW  isr_dummy                  ; Serial Port Interrupt Handler
        DCW  isr_dummy                  ; External Interrupt Handler
        DCW  isr_dummy                  ; Trap Interrupt Handler
        DCW  isr_dummy                  ; Unimplemented Opcode Handler

        CSEG AT int_vector_table_ext

        DCW  isr_dummy                  ; Serial Transmitter Interrupt Handler
        DCW  receiver_isr               ; Serial Receiver Interrupt Handler
        DCW  isr_dummy                  ; HSI Fifo Data Interrupt Handler
        DCW  isr_dummy                  ; Timer2 Capture Interrupt Handler
        DCW  isr_dummy                  ; Timer2 Overflow Interrupt Handler
        DCW  isr_dummy                  ; External Interrupt Handler
        DCW  isr_dummy                  ; HSI Fifo Full Interrupt Handler
        DCW  isr_dummy                  ; NMI Interrupt Handler

;***************************************************************************
;
;       CHIP CONFIGURATION BYTE
;
;***************************************************************************
;
chip_configuration_register     EQU     2018H   ; Address of CCR in ROM
;
; Define Chip Configuration Register:
;   Bit 0 = 0: Power Down Mode Disabled
;   Bit 1 = 0: Bus Width not controlled by 16/8* Pin
;   Bit 2 = 1: WR and BHE Mode
;   Bit 3 = 0: ADV Mode
;   Bit 4 = 1: Wait States not limited internally
;   Bit 5 = 1: Wait States not limited internally
;   Bit 6 = 1: EPROM Write Protection Disabled
;   Bit 7 = 1: EPROM Read Protection Disabled

        CSEG AT chip_configuration_register
        DCB  0F4H

;*****************************************************************************
; push_c_context - macro to save C context for Interrupt Service Routines
;
push_c_context  MACRO
        PUSH    PLMREG+0
        PUSH    PLMREG+2
        PUSH    PLMREG+4
        PUSH    PLMREG+6
        PUSH    PLMREG+8
        ENDM
;
;*****************************************************************************
; pop_c_context - macro to restore C context for Interrupt Service Routines
;
pop_c_context   MACRO
        POP     PLMREG+8
        POP     PLMREG+6
        POP     PLMREG+4
        POP     PLMREG+2
        POP     PLMREG+0
        ENDM
;
;*****************************************************************************

        CSEG

sw_timer_2_hook:
        RET

sw_timer_3_hook:
        RET

IF USE_HUMIDITY_SENSOR
$INCLUDE (\hardware\micro\humid.s)
ENDIF


