From 30c5a499dab7f9e3a827358a4f002d369d92aad5 Mon Sep 17 00:00:00 2001 From: tangstad Date: Tue, 8 Nov 2005 09:00:31 +0000 Subject: [PATCH] Added moving sprite on top of logo, currently just for testing. --- gba/logosplash/Makefile | 9 +++++++-- gba/logosplash/data/s_piece.bin | Bin 0 -> 64 bytes gba/logosplash/data/s_piece_orig.pcx | Bin 0 -> 931 bytes gba/logosplash/src/logosplash.c | 25 +++++++++++++++++++++++-- 4 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 gba/logosplash/data/s_piece.bin create mode 100644 gba/logosplash/data/s_piece_orig.pcx diff --git a/gba/logosplash/Makefile b/gba/logosplash/Makefile index 8782607..9b813f4 100644 --- a/gba/logosplash/Makefile +++ b/gba/logosplash/Makefile @@ -72,6 +72,7 @@ CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) PCXFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pcx))) +BINFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.bin))) #--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C @@ -87,7 +88,7 @@ else endif #--------------------------------------------------------------------------------- -export OFILES := $(PCXFILES:.pcx=.o) $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) +export OFILES := $(BINFILES:.bin=.o) $(PCXFILES:.pcx=.o) $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) #--------------------------------------------------------------------------------- # build a list of include paths @@ -126,7 +127,11 @@ $(OUTPUT).gba : $(OUTPUT).elf $(OUTPUT).elf : $(OFILES) -%.o : %.pcx +%.o : %.pcx + @echo $(notdir $<) + @$(bin2o) + +%.o : %.bin @echo $(notdir $<) @$(bin2o) diff --git a/gba/logosplash/data/s_piece.bin b/gba/logosplash/data/s_piece.bin new file mode 100644 index 0000000000000000000000000000000000000000..2d3ffe8b8395ea54512e89beeba982984fe7c467 GIT binary patch literal 64 ccmZQ%WMpJuU|?WpX9v>^4D1*pAbDIE01D&)I{*Lx literal 0 HcmV?d00001 diff --git a/gba/logosplash/data/s_piece_orig.pcx b/gba/logosplash/data/s_piece_orig.pcx new file mode 100644 index 0000000000000000000000000000000000000000..0cec504362dc1f0729c9a85d140d1947efbba61e GIT binary patch literal 931 zcmd;LW#nLBU|?WpU}w-_)L{g%Ny3aA45Vv9*ucnsi~)=fvmaqN%*cL(;Sd9aJj8f} z;RM481|G2D|C<;Xe0+Qu8X5jGFr=lWF--X1(7?-Zo*`@_+q`-6Hf>_~-_WpW)253T SFaH1kAFO4R7!85p5CQ<-Ng+A_ literal 0 HcmV?d00001 diff --git a/gba/logosplash/src/logosplash.c b/gba/logosplash/src/logosplash.c index 1b05893..d4f7a84 100644 --- a/gba/logosplash/src/logosplash.c +++ b/gba/logosplash/src/logosplash.c @@ -5,20 +5,25 @@ #include "gba_systemcalls.h" #include "gba_input.h" #include "gba_interrupt.h" +#include "gba_sprites.h" +#include "gba_dma.h" #include "pcx.h" #include "fade.h" #include +#include //--------------------------------------------------------------------------------- // header for binary data generated by bin2o macro in makefile //--------------------------------------------------------------------------------- #include "helds_logo_pcx.h" +#include "s_piece_bin.h" //--------------------------------------------------------------------------------- // storage space for palette data //--------------------------------------------------------------------------------- u16 PaletteBuffer[256]; +OBJATTR sprite; unsigned int frame; @@ -47,15 +52,31 @@ int main(void) // Allow Interrupts REG_IME = 1; - SetMode( MODE_4 | BG2_ON ); // screen mode & background to display + // screen mode, background and objects to display + SetMode( MODE_4 | BG2_ON | OBJ_ON ); DecodePCX(helds_logo_pcx, (u16*)VRAM , PaletteBuffer); - FadeToPalette( PaletteBuffer, 60); + CpuFastSet(s_piece_bin, BITMAP_OBJ_BASE_ADR, COPY32 | s_piece_bin_size/4); + CpuFastSet(PaletteBuffer, OBJ_COLORS, COPY32 | sizeof(PaletteBuffer)/4); + + memset(&sprite, 0, sizeof(sprite)); + sprite.attr0 = OBJ_256_COLOR | OBJ_Y(25); + sprite.attr1 = OBJ_X(120); + sprite.attr2 = OBJ_CHAR(512); + + u16 i; + u16* dst, *src; + while (1) { VBlankIntrWait(); + + sprite.attr0 = OBJ_256_COLOR | OBJ_Y(frame); + dst = (u16*)OAM; + src = (u16*)&sprite; + CpuFastSet(&sprite, OAM, COPY32 | sizeof(sprite)/4); } }