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
// Configure INT2 (interrupt 2, on line PB2) to be a rising | |
// edge interrupt that we'll get from the CPU | |
// See ATmega324PA datasheet p68 | |
cbi EIMSK,INT2_BIT | |
ldi accum,EICRA | |
ori accum,_BV(ISC20) | _BV(ISC21) | |
sts EICRA,accum | |
cbi EIFR,INTF2 | |
sbi EIMSK,INT2_BIT |
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
INT2_vect: | |
// Get ourselves completely off the bus | |
clr accum | |
out PORTD,accum | |
out DDRD,accum | |
out DDRC,accum | |
out DDRA,accum | |
sbi PORTB,vramWrite |
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
// Plot a red pixel | |
testRender1: | |
// Take control of VRAM | |
EnableVRAMWrite | |
// Load a reasonable VRAM address | |
ldi accum,0x58 | |
out PORTC,accum | |
ldi accum,0x1C |
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
# Makefile | |
# | |
# Parts of this are borrowed from http://electrons.psychogenic.com | |
# | |
DEVICE=atmega324pa | |
CLOCK = 20000000UL | |
PROGRAMMER = usbtiny | |
FUSES = -U lfuse:w:0xe0:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m |
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
define(EnableVRAMWrite, ` | |
sbi PORTB,vramOE | |
ldi accum,0xff | |
out DDRD,accum | |
') | |
define(DisableVRAMWrite, ` | |
clr accum | |
out DDRD,accum | |
out PORTD,accum |
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
ldy #$ff | |
OUTER: | |
ldx $ff | |
INNER: | |
nop | |
nop | |
nop | |
nop | |
nop | |
nop |
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
0xAD,0xFF,0xEF, // LDA $EFFF : FE00 | |
0xC9,0xFF, // CMP #$FF | |
0xF0,0xF9, // BEQ $FE00 | |
0xAD,0xFF,0xEF, // LDA $EFFF : FE07 | |
0xC9,0xFF, // CMP #$FF | |
0xD0,0xF9, // BNE $FE07 | |
0xA9,0x04, // LDA #$04 | |
0x8D,0xFF,0xEF, // STA $EFFF | |
0xA9,0x01, // LDA #$01 |
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
0xAD,0xFF,0xEF, // LDA $EFFF : FE00 | |
0xC9,0xFF, // CMP #$FF | |
0xF0,0xF9, // BEQ $FE00 | |
0xAD,0xFF,0xEF, // LDA $EFFF : FE07 | |
0xC9,0xFF, // CMP #$FF | |
0xD0,0xF9, // BNE $FE07 | |
0xA9,0x04, // LDA #$04 | |
0x8D,0xFF,0xEF, // STA $EFFF | |
0xA9,0x01, // LDA #$01 |
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 |
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
mainloop: | |
// Wait for VBL to process commands | |
sbrs VBL,0 | |
rjmp mainloop | |
// See if there's a command pending | |
lds regS,CMDBUFFER_S | |
lds regT,CMDBUFFER_E |
OlderNewer