.nolist .include "s1200def.inc" .list ; ; Define all registers here ; ; NOTE: R13-15, R25-29, 31 free ; ; 1. Each int handler needs a high tmp and SREG save register if it is ; a. going to allow interrupts, or be generated while in another. ; b. needs to diddle high I/O or load constant data. ; c. depends upon SREG flags ; 2. This code has two handlers: Timer and Extern (UART) - neither can interrupt ; the other, but we seperate the tmp and sreg anyway. ; 3. Counters can be moved to low register with minor code additions. ; 4. ZL is used for monitor. ; ; Main Routine Stuff ; .def Flags = R16 ; conversion/comm flags .equ AD_Done = 7 ; .equ AD_Ovr = 6 ; Overflow .equ AD_Left = 5 ; Left/Right flag .equ Ar_Disable=4 ; 1 = disable arbitrate process .equ RxRdy = 0 ; ; ; Monitor routine stuff ; .def M_Temp = R0 ; Temp storage for monitor byte read/write .def M_Flags = R17 ; see module for bit definitions. ; ; Behavior Logic Variables ; ; The following are Bit flags that live in the upper nibble of B_State ; .equ B_Right = 4 ; right bumper detect .equ B_Bump = 5 ; In bump evasion mode .equ B_Left = 6 ; Left Bumper detect .def B_Delay = R1 ; 0=no sleep, 1-254=1/10 sec delay, 255=halt .def B_State = R18 .def E_Delay = R2 .def E_State = R19 .def E_temp = R20 ; ; Analog stuff ; .def AD_Results = R3 ; results .def Left_eye = R4 .def Right_eye = R5 ; ; Usart stuff ; .def bitcnt = R21 ; bit counter .def Txbyte = R22 ; Data to be transmitted .def Rxbyte = R23 ; Received data .def U_tmp = R24 ; Baud rate counter/temp register ; ; Timer Registers ; .def I_save = R7 ; Storage for the SREG in interrupt routine .def I_tmp = R25 ; General purpose = used in interrupts only! .def Clk0 = R8 .def Clk1 = R9 ; ; Servo Registers ; .def SC_Count = R10 .def Servo1 = R26 ; .def Servo2 = R27 ; .def Servo3 = R28 ; .def Servo4 = R29 ; ; ; Enable interrupts. ; .set MCUCR_INIT=MCUCR_INIT | (1<