Implementation Details
5-60
To call an assembly routine from C––, the routine must be defined as GLOBAL
in the assembly file and as a CMM_FUNC in the C–– file. The following
contains C–– callable assembly routines for accessing the I/O ports, and a
wait routine. A C–– program which calls the assembly routines is also
provided.
RORG 0x0
GLOBAL _wait
GLOBAL _asminit
GLOBAL _oport
GLOBAL _iport
GLOBAL _cport
GLOBAL TIMER1_ISR, DAC_ISR
GLOBAL TIMER2_ISR, PORTD2_ISR
GLOBAL PORTD4_ISR, PORTD5_ISR
GLOBAL PORTD3_ISR, PORTF_ISR
GLOBAL reset, DUMMY_ISR
EXTERNAL _main0
include ”ram\ram.irx”
include ”control\control.irx”
include ”control\io_ports.irx”
include ”control\control.asm”
;****************************************************************
; Reset
; Begin at init614 in INIT.ASM.
; This sets the 614 to run at 8 MHz, 10 bit DAC at 8 kHz reset
;*****************************************************************
reset
include ”.\control\init.asm”
;****************************************************************
; _MAINASM
; The start of the assembly code, which is called from
; main routine in main.cmm
;****************************************************************
_asminit
nop ;pause for breath
nop
nop
out IFR,a0 ;clear all interrupt flags
;****************************************************************
; Main program
;****************************************************************
mainbegin
mov r4,1000 * 2 ;pause for a second
call _wait
; Set TIMER2 to run from the RTO/CTO (32 kHz) and with a one second period
in a0,IntGenCtrl
or a0,TIM2REFOSC ;set bit 9, CTO clock (32 kHz)
out IntGenCtrl,a0
INTE ;enable all interrupts
ret