Created
February 15, 2013 03:36
-
-
Save blondie7575/4958409 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////// | |
// CPU Interrupt Service Routine | |
// | |
INT2_vect: | |
// Save registers | |
push accum | |
in accum,SREG | |
push accum | |
in accum,PORTD | |
push accum | |
in accum,DDRD | |
push accum | |
push XL | |
push XH | |
// Enable the CPU's bus access | |
cbi PORTB,cpuBusAllow | |
// Read the data from the CPU | |
ldi accum,0x00 | |
out DDRD,accum | |
ldi accum,0xff | |
out PORTD,accum | |
nop | |
in accum,PIND | |
// Enqueue to command buffer | |
lds XL,CMDBUFFER_E | |
ldi XH,CMDBUFFER_H | |
st X,accum | |
inc XL | |
sts CMDBUFFER_E,XL | |
// Disable the CPU's bus access | |
sbi PORTB,cpuBusAllow | |
// Restore registers | |
pop XH | |
pop XL | |
pop accum | |
out DDRD,accum | |
pop accum | |
out PORTD,accum | |
pop accum | |
out SREG,accum | |
pop accum | |
reti |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment