diff --git a/.gitignore b/.gitignore index 0a87f1e..98abbfa 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ *.vpw *.vpwhistxml *.vtg +dep/ +lst/ +obj/ diff --git a/Makefile b/Makefile index ed508b9..fce8edc 100644 --- a/Makefile +++ b/Makefile @@ -96,6 +96,10 @@ OBJS += system.o OBJS += sysvid.o OBJS += util.o OBJS += f256.o +OBJS += dat_spritesJR.o + +# Data Objects +#OBJS += splash.o # change list of .o's into a list of .d's @@ -105,6 +109,7 @@ DEPS := $(OBJS:%.o=%.d) AS = merlin32 CC = mos-f256k-clang LD = mos-f256k-clang +OBJCOPY = llvm-objcopy RM = /bin/rm -rfv CFLAGS = -Os -Wall -Werror -Wa,-al -fno-common @@ -136,6 +141,10 @@ $(TARGET): $(DEPS) $(OBJS) $(LIBS) .cc.o: $(CC) $(CXXFLAGS) $(TMPFLAGS) $(INCCMD) -c $< -o $(OBJDIR)/$*.o > $(LSTDIR)/$*.lst +#.256.o: +# $(LD) -r -o $(OBJDIR)/$*.o -z noexecstack --format=binary $< + + # Dependencie Rules # # for now just touch, to create the file if its not defined @@ -143,6 +152,9 @@ $(TARGET): $(DEPS) $(OBJS) $(LIBS) .s.d: touch $(DEPDIR)/$*.d +#.256.d: +# touch $(DEPDIR)/$*.d + .c.d: set -e; $(CC) -M $(CFLAGS) $(TMPFLAGS) $(INCCMD) $< \ | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $(DEPDIR)/$@; \ diff --git a/rickjr.ld b/rickjr.ld index 4d309b8..ebfab73 100644 --- a/rickjr.ld +++ b/rickjr.ld @@ -2,6 +2,16 @@ */ +/* +TARGET(binary) +INPUT(./data/congrats.256) +INPUT(./data/haf.256) +INPUT(./data/splash.256) +INPUT(./data/sprites_data.256) +INPUT(./data/tiles_data.256) +*/ + + /* fake C Stack */ PROVIDE(__stack = 0xA000); /* entry point to my program */ @@ -24,25 +34,32 @@ MEMORY { } /* LMAs */ -__block8_lma = 0x08a000; -__block9_lma = 0x09a000; -__block10_lma = 0x0Aa000; -__block11_lma = 0x0Ba000; -__block12_lma = 0x0Ca000; -__block13_lma = 0x0Da000; -__block14_lma = 0x0Ea000; -__block15_lma = 0x0Fa000; -__block16_lma = 0x10a000; -__block17_lma = 0x11a000; -__block18_lma = 0x12a000; -__block19_lma = 0x13a000; -__block20_lma = 0x14a000; -__block21_lma = 0x15a000; -__block22_lma = 0x16a000; -__block23_lma = 0x17a000; +__block8_lma = 0x08000000|__SLOT_ADDR; +__block9_lma = 0x09000000|__SLOT_ADDR; +__block10_lma = 0x0A000000|__SLOT_ADDR; +__block11_lma = 0x0B000000|__SLOT_ADDR; +__block12_lma = 0x0C000000|__SLOT_ADDR; +__block13_lma = 0x0D000000|__SLOT_ADDR; +__block14_lma = 0x0E000000|__SLOT_ADDR; +__block15_lma = 0x0F000000|__SLOT_ADDR; +__block16_lma = 0x10000000|__SLOT_ADDR; +__block17_lma = 0x11000000|__SLOT_ADDR; +__block18_lma = 0x12000000|__SLOT_ADDR; +__block19_lma = 0x13000000|__SLOT_ADDR; +__block20_lma = 0x14000000|__SLOT_ADDR; +__block21_lma = 0x15000000|__SLOT_ADDR; +__block22_lma = 0x16000000|__SLOT_ADDR; +__block23_lma = 0x17000000|__SLOT_ADDR; + +/* Stash preloaded binary data */ +__binarydata_lma = 0x70000; /* At least now, its less than 64k */ +__BINARYDATA_SIZE = 0x10000; MEMORY { + + binarydata : ORIGIN = __binarydata_lma, LENGTH = __BINARYDATA_SIZE + block8 : ORIGIN = __block8_lma, LENGTH = __BLOCK_SIZE block9 : ORIGIN = __block9_lma, LENGTH = __BLOCK_SIZE block10 : ORIGIN = __block10_lma, LENGTH = __BLOCK_SIZE @@ -70,6 +87,8 @@ SECTIONS { INCLUDE c.ld + .binarydata : { *(.binarydata .binarydata.*) } >binarydata end_binarydata = .; + .block8 : { *(.block8 .block8.*) } >block8 end_block8 = .; .block9 : { *(.block9 .block9.*) } >block9 end_block9 = .; .block10 : { *(.block10 .block10.*) } >block10 end_block10 = .; @@ -101,24 +120,29 @@ OUTPUT_FORMAT { TRIM(ram) /* block8 */ - SHORT(ORIGIN(block8)) + SHORT(8*0x2000) BYTE(8/8) /* block#/8 = the actual system high byte */ SHORT(end_block8 - __block8_lma) + BYTE(0x00) TRIM(block8) /* block9 */ - SHORT(ORIGIN(block9)) + SHORT(9*0x2000) BYTE(9/8) /* block#/8 = the actual system high byte */ SHORT(end_block9 - __block9_lma) + BYTE(0x00) TRIM(block9) /* block10 */ - SHORT(ORIGIN(block10)) + SHORT(10*0x2000) BYTE(10/8) /* block#/8 = the actual system high byte */ SHORT(end_block10 - __block10_lma) + BYTE(0x00) TRIM(block10) /* + Empty Blocks are not allowed, bring these in as you use them + TRIM(block11) TRIM(block12) TRIM(block13) @@ -134,6 +158,13 @@ OUTPUT_FORMAT { TRIM(block23) */ +/* Compressed Data */ + SHORT(ORIGIN(binarydata)) + BYTE(ORIGIN(binarydata)>>16) + SHORT(end_binarydata - __binarydata_lma) + BYTE((end_binarydata - __binarydata_lma)>>16) + TRIM(binarydata) + /* Launch the program, at _start */ SHORT(_start) LONG(0) diff --git a/src/dat_spritesJR.c b/src/dat_spritesJR.c new file mode 100644 index 0000000..0a80709 --- /dev/null +++ b/src/dat_spritesJR.c @@ -0,0 +1,49 @@ +/* + * xrick/data/dat-sprites.c + * + * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). All rights reserved. + * + * The use and distribution terms for this software are contained in the file + * named README, which can be found in the root of this distribution. By + * using this software in any fashion, you are agreeing to be bound by the + * terms of this license. + * + * You must not remove this notice, or any other, from this software. + */ + +#include "config.h" + +#ifdef GFXF256 + +#define STR2(x) #x +#define STR(x) STR2(x) + +//#ifdef _WIN32 +//#define INCBIN_SECTION ".rdata, \"dr\"" +//#else +//#define INCBIN_SECTION ".rodata" +//#endif + +// this aligns start address to 16 and terminates byte array with explict 0 +// which is not really needed, feel free to change it to whatever you want/need +#define INCBIN(INCBIN_SECTION, name, file) \ + __asm__(".section " INCBIN_SECTION ",\"aR\" \n" \ + ".global incbin_" STR(name) "_start\n" \ + ".balign 16\n" \ + "incbin_" STR(name) "_start:\n" \ + ".incbin \"" file "\"\n" \ + \ + ".global incbin_" STR(name) "_end\n" \ + ".balign 1\n" \ + "incbin_" STR(name) "_end:\n" \ + ".byte 0\n" \ + ); \ + extern __attribute__((aligned(16))) const char incbin_ ## name ## _start[]; \ + extern const char incbin_ ## name ## _end[] + +INCBIN(".binarydata.sprites", sprites_data_256, "data/sprites_data.256"); + +#endif /* GFXF256 */ + +/* eof */ + diff --git a/src/scr_credit.c b/src/scr_credit.c index ea4a809..a4d8dd8 100644 --- a/src/scr_credit.c +++ b/src/scr_credit.c @@ -14,11 +14,15 @@ segment "screen"; extern char credits_lz4; +extern char incbin_sprites_data_256_start[]; + CODE_BLOCK(8) void scr_credit() { #ifdef F256 //$$JGA TODO - fix this - *((char*)0x300) = 0; + *((char*)0x200) = (char)((long)(&incbin_sprites_data_256_start)); + *((char*)0x201) = (char)((long)(&incbin_sprites_data_256_start)>>8); + *((char*)0x202) = (char)((long)(&incbin_sprites_data_256_start)>>16); #endif #ifdef IIGS