tixiv
16 years ago
34 changed files with 396 additions and 170 deletions
@ -1,12 +0,0 @@ |
|||
TARGET = libanimations.a |
|||
TOPDIR = .. |
|||
|
|||
include $(TOPDIR)/defaults.mk |
|||
|
|||
|
|||
#ifeq ($(GAME_SNAKE),y)
|
|||
SRC += snake_game.c |
|||
#endif
|
|||
|
|||
|
|||
include $(TOPDIR)/rules.mk |
@ -0,0 +1,9 @@ |
|||
mainmenu_option next_comment |
|||
comment "Games" |
|||
|
|||
dep_bool "tetris" GAME_TETRIS $JOYSTICK_SUPPORT $RANDOM_SUPPORT |
|||
dep_bool "space invaders" GAME_SPACE_INVADERS $JOYSTICK_SUPPORT $RANDOM_SUPPORT |
|||
dep_bool "snake" GAME_SNAKE $JOYSTICK_SUPPORT $RANDOM_SUPPORT |
|||
|
|||
|
|||
endmenu |
@ -0,0 +1,12 @@ |
|||
|
|||
ifeq ($(GAME_TETRIS),y) |
|||
SUBDIRS += games/tetris |
|||
endif |
|||
|
|||
ifeq ($(GAME_SPACE_INVADERS),y) |
|||
SUBDIRS += games/space_invaders |
|||
endif |
|||
|
|||
ifeq ($(GAME_SNAKE),y) |
|||
SUBDIRS += games/snake |
|||
endif |
@ -0,0 +1,8 @@ |
|||
TARGET = |
|||
TOPDIR = ../.. |
|||
|
|||
include $(TOPDIR)/defaults.mk |
|||
|
|||
SRC = snake_game.c |
|||
|
|||
include $(TOPDIR)/rules.mk |
@ -1,11 +1,11 @@ |
|||
|
|||
#include "../config.h" |
|||
#include "../compat/pgmspace.h" |
|||
#include "../menu/menu.h" |
|||
#include "../pixel.h" |
|||
#include "../random/prng.h" |
|||
#include "../util.h" |
|||
#include "../joystick.h" |
|||
#include "../../config.h" |
|||
#include "../../compat/pgmspace.h" |
|||
#include "../../menu/menu.h" |
|||
#include "../../pixel.h" |
|||
#include "../../random/prng.h" |
|||
#include "../../util.h" |
|||
#include "../../joystick/joystick.h" |
|||
|
|||
// MSB is leftmost pixel
|
|||
static uint8_t icon[8] PROGMEM = |
@ -0,0 +1,8 @@ |
|||
TARGET = |
|||
TOPDIR = ../.. |
|||
|
|||
include $(TOPDIR)/defaults.mk |
|||
|
|||
SRC = invader_init.c invader_draw.c invader_proc.c invaders2.c |
|||
|
|||
include $(TOPDIR)/rules.mk |
@ -1,5 +1,7 @@ |
|||
#include <stdlib.h> |
|||
#include "prng.h" |
|||
#include "../../config.h" |
|||
#include "../../joystick/joystick.h" |
|||
#include "../../random/prng.h" |
|||
#include "invaders2.h" |
|||
|
|||
void procCannon(Cannon * cn, uPixel * shot) |
@ -1,25 +1,8 @@ |
|||
LD = avr-ld |
|||
TARGET = |
|||
TOPDIR = ../.. |
|||
|
|||
all: tetris.o |
|||
include $(TOPDIR)/defaults.mk |
|||
|
|||
tetris.o: piece.o playfield.o view.o logic.o input.o |
|||
$(LD) -r piece.o playfield.o view.o logic.o input.o -o tetris.o |
|||
SRC = piece.c playfield.c view.c logic.c input.c |
|||
|
|||
piece.o: piece.c piece.h |
|||
$(MCU_CC) $(CFLAGS) -c piece.c -o piece.o |
|||
|
|||
playfield.o: playfield.c playfield.h piece.h |
|||
$(MCU_CC) $(CFLAGS) -c playfield.c -o playfield.o |
|||
|
|||
view.o: view.c view.h logic.h piece.h playfield.h ../config.h ../pixel.h \ |
|||
../util.h ../scrolltext.h |
|||
$(MCU_CC) $(CFLAGS) -c view.c -o view.o |
|||
|
|||
logic.o: logic.c logic.h piece.h playfield.h input.h view.h |
|||
$(MCU_CC) $(CFLAGS) -c logic.c -o logic.o |
|||
|
|||
input.o: input.c input.h ../joystick.h ../util.h |
|||
$(MCU_CC) $(CFLAGS) -c input.c -o input.o |
|||
|
|||
clean: |
|||
rm -rf *.o *.d |
|||
include $(TOPDIR)/rules.mk |
|||
|
@ -1,13 +0,0 @@ |
|||
#include "joystick.h" |
|||
#include <avr/io.h> |
|||
|
|||
unsigned char waitForFire; |
|||
|
|||
|
|||
inline void joy_init(){ |
|||
DDRB &= ~((1<<BITUP)|(1<<BITDOWN)|(1<<BITLEFT)|(1<<BITRIGHT)); |
|||
PORTB |= (1<<BITUP)|(1<<BITDOWN)|(1<<BITLEFT)|(1<<BITRIGHT); |
|||
|
|||
DDRD &= ~(1<<BITFIRE); |
|||
PORTD |= (1<<BITFIRE); |
|||
} |
@ -1,33 +0,0 @@ |
|||
#ifndef JOYSTICK_H |
|||
#define JOYSTICK_H |
|||
|
|||
extern unsigned char waitForFire; |
|||
void joy_init(); |
|||
|
|||
#ifdef AVR |
|||
|
|||
#define BITFIRE PD3 |
|||
#define BITRIGHT PB3 |
|||
#define BITLEFT PB2 |
|||
#define BITDOWN PB1 |
|||
#define BITUP PB0 |
|||
|
|||
#define JOYISFIRE (!(PIND & (1<<BITFIRE))) |
|||
#define JOYISLEFT (!(PINB & (1<<BITLEFT))) |
|||
#define JOYISRIGHT (!(PINB & (1<<BITRIGHT))) |
|||
#define JOYISDOWN (!(PINB & (1<<BITDOWN))) |
|||
#define JOYISUP (!(PINB & (1<<BITUP))) |
|||
|
|||
#else |
|||
|
|||
extern unsigned char fakeport; |
|||
|
|||
#define JOYISFIRE (0x01 & fakeport) |
|||
#define JOYISLEFT (0x02 & fakeport) |
|||
#define JOYISRIGHT (0x04 & fakeport) |
|||
#define JOYISDOWN (0x08 & fakeport) |
|||
#define JOYISUP (0x10 & fakeport) |
|||
|
|||
#endif |
|||
|
|||
#endif // JOYSTICK_H
|
@ -0,0 +1,9 @@ |
|||
TARGET = |
|||
TOPDIR = .. |
|||
|
|||
include $(TOPDIR)/defaults.mk |
|||
|
|||
SRC = joystick.c |
|||
SRC_SIM = |
|||
|
|||
include $(TOPDIR)/rules.mk |
@ -0,0 +1,101 @@ |
|||
dep_bool_menu "joystick support" JOYSTICK_SUPPORT y |
|||
|
|||
###################### Parallel joystick menu ################################# |
|||
dep_bool_menu "parallel joystick support" PARALLEL_JOYSTICK_SUPPORT y |
|||
|
|||
choice 'Pin up' \ |
|||
"PINA PINA \ |
|||
PINB PINB \ |
|||
PINC PINC \ |
|||
PIND PIND" \ |
|||
'PINB' JOYSTICK_PIN_UP |
|||
|
|||
choice 'Bit up' \ |
|||
"Bit0 0 \ |
|||
Bit1 1 \ |
|||
Bit2 2 \ |
|||
Bit3 3 \ |
|||
Bit4 4 \ |
|||
Bit5 5 \ |
|||
Bit6 6 \ |
|||
Bit7 7" \ |
|||
'Bit0' JOYSTICK_BIT_UP |
|||
|
|||
choice 'Pin down' \ |
|||
"PINA PINA \ |
|||
PINB PINB \ |
|||
PINC PINC \ |
|||
PIND PIND" \ |
|||
'PINB' JOYSTICK_PIN_DOWN |
|||
|
|||
choice 'Bit down' \ |
|||
"Bit0 0 \ |
|||
Bit1 1 \ |
|||
Bit2 2 \ |
|||
Bit3 3 \ |
|||
Bit4 4 \ |
|||
Bit5 5 \ |
|||
Bit6 6 \ |
|||
Bit7 7" \ |
|||
'Bit1' JOYSTICK_BIT_DOWN |
|||
|
|||
choice 'Pin left' \ |
|||
"PINA PINA \ |
|||
PINB PINB \ |
|||
PINC PINC \ |
|||
PIND PIND" \ |
|||
'PINB' JOYSTICK_PIN_LEFT |
|||
|
|||
choice 'Bit left' \ |
|||
"Bit0 0 \ |
|||
Bit1 1 \ |
|||
Bit2 2 \ |
|||
Bit3 3 \ |
|||
Bit4 4 \ |
|||
Bit5 5 \ |
|||
Bit6 6 \ |
|||
Bit7 7" \ |
|||
'Bit2' JOYSTICK_BIT_LEFT |
|||
|
|||
choice 'Pin right' \ |
|||
"PINA PINA \ |
|||
PINB PINB \ |
|||
PINC PINC \ |
|||
PIND PIND" \ |
|||
'PINB' JOYSTICK_PIN_RIGHT |
|||
|
|||
choice 'Bit right' \ |
|||
"Bit0 0 \ |
|||
Bit1 1 \ |
|||
Bit2 2 \ |
|||
Bit3 3 \ |
|||
Bit4 4 \ |
|||
Bit5 5 \ |
|||
Bit6 6 \ |
|||
Bit7 7" \ |
|||
'Bit3' JOYSTICK_BIT_RIGHT |
|||
|
|||
choice 'Pin fire' \ |
|||
"PINA PINA \ |
|||
PINB PINB \ |
|||
PINC PINC \ |
|||
PIND PIND" \ |
|||
'PIND' JOYSTICK_PIN_FIRE |
|||
|
|||
choice 'Bit fire' \ |
|||
"Bit0 0 \ |
|||
Bit1 1 \ |
|||
Bit2 2 \ |
|||
Bit3 3 \ |
|||
Bit4 4 \ |
|||
Bit5 5 \ |
|||
Bit6 6 \ |
|||
Bit7 7" \ |
|||
'Bit3' JOYSTICK_BIT_FIRE |
|||
|
|||
endmenu |
|||
############################################################################### |
|||
|
|||
|
|||
|
|||
endmenu |
@ -0,0 +1,16 @@ |
|||
|
|||
#include "../config.h" |
|||
#include "../makros.h" |
|||
#include "joystick.h" |
|||
#include <avr/io.h> |
|||
|
|||
unsigned char waitForFire; |
|||
|
|||
|
|||
inline void joy_init(){ |
|||
PORT_FROM_PIN(JOYSTICK_PIN_UP ) |= (1<<JOYSTICK_BIT_UP ); |
|||
PORT_FROM_PIN(JOYSTICK_PIN_DOWN ) |= (1<<JOYSTICK_BIT_DOWN ); |
|||
PORT_FROM_PIN(JOYSTICK_PIN_LEFT ) |= (1<<JOYSTICK_BIT_LEFT ); |
|||
PORT_FROM_PIN(JOYSTICK_PIN_RIGHT) |= (1<<JOYSTICK_BIT_RIGHT); |
|||
PORT_FROM_PIN(JOYSTICK_PIN_FIRE ) |= (1<<JOYSTICK_BIT_FIRE ); |
|||
} |
@ -0,0 +1,29 @@ |
|||
#ifndef JOYSTICK_H |
|||
#define JOYSTICK_H |
|||
|
|||
extern unsigned char waitForFire; |
|||
void joy_init(); |
|||
|
|||
#ifdef AVR |
|||
|
|||
#include <avr/io.h> |
|||
|
|||
#define JOYISUP (!(JOYSTICK_PIN_UP & (1<<JOYSTICK_BIT_UP ))) |
|||
#define JOYISDOWN (!(JOYSTICK_PIN_DOWN & (1<<JOYSTICK_BIT_DOWN ))) |
|||
#define JOYISLEFT (!(JOYSTICK_PIN_LEFT & (1<<JOYSTICK_BIT_LEFT ))) |
|||
#define JOYISRIGHT (!(JOYSTICK_PIN_RIGHT & (1<<JOYSTICK_BIT_RIGHT))) |
|||
#define JOYISFIRE (!(JOYSTICK_PIN_FIRE & (1<<JOYSTICK_BIT_FIRE ))) |
|||
|
|||
#else |
|||
|
|||
extern unsigned char fakeport; |
|||
|
|||
#define JOYISUP (0x10 & fakeport) |
|||
#define JOYISDOWN (0x08 & fakeport) |
|||
#define JOYISLEFT (0x02 & fakeport) |
|||
#define JOYISRIGHT (0x04 & fakeport) |
|||
#define JOYISFIRE (0x01 & fakeport) |
|||
|
|||
#endif |
|||
|
|||
#endif // JOYSTICK_H
|
@ -1,2 +1,6 @@ |
|||
|
|||
#define DDR(port) (*(volatile uint8_t*)((&port)-1)) |
|||
|
|||
#define DDR_FROM_PIN(pin) (*(volatile uint8_t*)((&pin)+1)) |
|||
|
|||
#define PORT_FROM_PIN(pin) (*(volatile uint8_t*)((&pin)+2)) |
|||
|
@ -0,0 +1,77 @@ |
|||
# |
|||
# Automatically generated by make menuconfig: don't edit |
|||
# |
|||
|
|||
# |
|||
# General Setup |
|||
# |
|||
MCU=atmega32 |
|||
FREQ=16000000 |
|||
|
|||
# |
|||
# Borg Hardware |
|||
# |
|||
NUM_ROWS=16 |
|||
NUM_COLS=16 |
|||
NUMPLANE=3 |
|||
BORG_HW=HW_BORG_16 |
|||
|
|||
# |
|||
# Borg16 port setup |
|||
# |
|||
COLPORT1=PORTC |
|||
COLPORT2=PORTA |
|||
ROWPORT=PORTD |
|||
PIN_MCLR=4 |
|||
PIN_CLK=6 |
|||
PIN_DATA=7 |
|||
# REVERSE_COLS is not set |
|||
# INVERT_ROWS is not set |
|||
# INTERLACED_ROWS is not set |
|||
# INTERLACED_COLS is not set |
|||
|
|||
# |
|||
# Features |
|||
# |
|||
RANDOM_SUPPORT=y |
|||
SCROLLTEXT_SUPPORT=y |
|||
SCROLLTEXT_FONT=font_arial8 |
|||
SCROLLTEXT_BUFFER_SIZE=128 |
|||
SCROLL_X_SPEED=20 |
|||
SCROLL_Y_SPEED=20 |
|||
SCROLLTEXT_TEXT="</#www.das-labor.org" |
|||
JOYSTICK_SUPPORT=y |
|||
PARALLEL_JOYSTICK_SUPPORT=y |
|||
JOYSTICK_PIN_UP=PINB |
|||
JOYSTICK_BIT_UP=0 |
|||
JOYSTICK_PIN_DOWN=PINB |
|||
JOYSTICK_BIT_DOWN=1 |
|||
JOYSTICK_PIN_LEFT=PINB |
|||
JOYSTICK_BIT_LEFT=2 |
|||
JOYSTICK_PIN_RIGHT=PINB |
|||
JOYSTICK_BIT_RIGHT=3 |
|||
JOYSTICK_PIN_FIRE=PIND |
|||
JOYSTICK_BIT_FIRE=3 |
|||
MENU_SUPPORT=y |
|||
|
|||
# |
|||
# Games |
|||
# |
|||
GAME_TETRIS=y |
|||
GAME_SPACE_INVADERS=y |
|||
GAME_SNAKE=y |
|||
|
|||
# |
|||
# Animations |
|||
# |
|||
ANIMATION_SCROLLTEXT=y |
|||
ANIMATION_SPIRALE=y |
|||
ANIMATION_JOERN1=y |
|||
ANIMATION_SNAKE=y |
|||
ANIMATION_SCHACHBRETT=y |
|||
ANIMATION_FEUER=y |
|||
ANIMATION_MATRIX=y |
|||
ANIMATION_RANDOM_BRIGHT=y |
|||
ANIMATION_GAMEOFLIFE=y |
|||
ANIMATION_TESTS=y |
|||
ANIMATION_OFF=y |
Loading…
Reference in new issue