From cce17fefd6e042c0a40a9af3bdfdbb6bc11ded34 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 11 Oct 2013 09:38:08 +0100 Subject: 800x600 --- software/Makefile | 4 ++-- software/pong3/GPU.h | 29 +++++++++++++++++++++++ software/pong3/pong3.c | 52 ++++++++++++++++++----------------------- software/pong3_bsp/settings.bsp | 4 ++-- 4 files changed, 56 insertions(+), 33 deletions(-) create mode 100644 software/pong3/GPU.h (limited to 'software') diff --git a/software/Makefile b/software/Makefile index 13116c7..ffbafea 100644 --- a/software/Makefile +++ b/software/Makefile @@ -28,13 +28,13 @@ elf.flash: ${ELFDIR}/${ELF} sof.flash -load_elf.stamp:load_sof.stamp ${ELFDIR}/${ELF} +load_elf.stamp:${ELFDIR}/${ELF} load_sof.stamp ./wrap.sh nios2-download ${ELFDIR}/${ELF} -g load_sof.stamp: ${SOF} ./wrap.sh quartus_pgm -m JTAG -o 'p;../pong3.sof' -${ELFDIR}/${ELF}: ${BSPDIR}/libhal_bsp.a +${ELFDIR}/${ELF}: ${BSPDIR}/libhal_bsp.a $(wildcard ${ELFDIR}/*.[chHC]) ./wrap.sh ${MAKE} -C ${ELFDIR} diff --git a/software/pong3/GPU.h b/software/pong3/GPU.h new file mode 100644 index 0000000..3883381 --- /dev/null +++ b/software/pong3/GPU.h @@ -0,0 +1,29 @@ +/* + * GPU.h + * + * Created on: Oct 11, 2013 + * Author: root + */ + +#ifndef GPU_H_ +#define GPU_H_ + +#define GPU_OFFSET 0x80 +#if 0 +#define GPU_WIDTH 640 +#define GPU_HEIGHT 480 +#else +#define GPU_WIDTH 800 +#define GPU_HEIGHT 600 +#endif + +#define GPU_REG_BLANK 0x0 +#define GPU_REG_SPRITE_X 0x1 +#define GPU_REG_SPRITE_Y 0x2 +#define GPU_REG_BAT0_Y 0x3 +#define GPU_REG_BAT1_Y 0x4 +#define GPU_REG_SPRITE_COLOUR 0x5 +#define GPU_REG_SPRITE_BASE 0x10 + + +#endif /* GPU_H_ */ diff --git a/software/pong3/pong3.c b/software/pong3/pong3.c index 0e88ac8..39ee99c 100644 --- a/software/pong3/pong3.c +++ b/software/pong3/pong3.c @@ -3,10 +3,14 @@ #include #include #include +#include #include "system.h" +#include "GPU.h" + #define msleep(msec) usleep(1000*msec); + static void gpu_write (unsigned int reg, unsigned int data) { @@ -16,27 +20,17 @@ gpu_write (unsigned int reg, unsigned int data) static void load_sprite (void) { + const uint16_t sprite[16]={ 0x00C0, 0x03E0, 0x0FF8, 0x1FFE, 0x3FC7, 0x3F83, 0x3933, 0x3987, 0x3D37, 0x3D37, 0x3D87, 0x3FFF, 0x1FFE, 0x07F8, 0x01E0, 0x00C0 }; + const unsigned int n=sizeof(sprite)/sizeof(uint16_t); + unsigned int i; + // RRR GGG BBB // set the sprite color 111 010 000 - orange - gpu_write (5, 0x01D0); + gpu_write (GPU_REG_SPRITE_COLOUR, 0x01D0); // squirt the bromium logo into the sprite - gpu_write (0x10, 0x00C0); - gpu_write (0x11, 0x03E0); - gpu_write (0x12, 0x0FF8); - gpu_write (0x13, 0x1FFE); - gpu_write (0x14, 0x3FC7); - gpu_write (0x15, 0x3F83); - gpu_write (0x16, 0x3933); - gpu_write (0x17, 0x3987); - gpu_write (0x18, 0x3D37); - gpu_write (0x19, 0x3D37); - gpu_write (0x1a, 0x3D87); - gpu_write (0x1b, 0x3FFF); - gpu_write (0x1c, 0x1FFE); - gpu_write (0x1d, 0x07F8); - gpu_write (0x1e, 0x01E0); - gpu_write (0x1f, 0x00C0); + for (i=0;i hal default - Oct 10, 2013 11:06:28 PM - 1381442788161 + Oct 11, 2013 9:35:07 AM + 1381480507860 /home/root/projects/altera/pong3/software/pong3_bsp ./settings.bsp ../../my_sys.sopcinfo -- cgit v1.2.3