More examples, Several bug fixes. Start of docs.
This commit is contained in:
parent
8536240e75
commit
45ead870a1
36 changed files with 380 additions and 295 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -10,3 +10,4 @@
|
|||
*.clut filter=lfs diff=lfs merge=lfs -text
|
||||
*.indexed filter=lfs diff=lfs merge=lfs -text
|
||||
*.sprite filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
|
|
|
@ -80,6 +80,7 @@ pushd distro
|
|||
cp -f ${ROOT}/f256lib.h .
|
||||
cp -f ${ROOT}/pgz-thunk.py .
|
||||
|
||||
cp -f ../README .
|
||||
cp -f ../f256build.bat .
|
||||
cp -f ../f256run.bat .
|
||||
|
||||
|
|
106
distro/README
Normal file
106
distro/README
Normal file
|
@ -0,0 +1,106 @@
|
|||
_____ ____ ____ __ _ _
|
||||
| ___|___ \| ___| / /_ | | |_ ___ __ ___ _ __ ___ ___ ___
|
||||
| |_ __) |___ \| '_ \ | | \ \ / / '_ ` _ \ _____| '_ ` _ \ / _ \/ __|
|
||||
| _| / __/ ___) | (_) | | | |\ V /| | | | | |_____| | | | | | (_) \__ \
|
||||
|_| |_____|____/ \___/ |_|_| \_/ |_| |_| |_| |_| |_| |_|\___/|___/
|
||||
|
||||
Welcome to LLVM-MOS for the Foenix F256 family of computers!
|
||||
|
||||
|
||||
REQUIREMENTS
|
||||
============
|
||||
|
||||
The compiler toolchain and utilites will run on recent versions of Windows,
|
||||
Linux, and Apple Silicon MacOS. There is currently no support for Intel MacOS.
|
||||
|
||||
On Windows, you will need:
|
||||
|
||||
* WinRAR (https://www.rarlab.com/) or 7-Zip (https://www.7zip.com/) installed.
|
||||
* Python 3.x (https://www.python.org/) installed and in your PATH.
|
||||
|
||||
|
||||
INSTALLATION
|
||||
============
|
||||
|
||||
Download the appropriate installation script:
|
||||
|
||||
* 64 bit Intel Windows: f256-install-windows.bat
|
||||
* 64 bit Intel Linux: f256-install-linux.sh
|
||||
* 64 bit ARM MacOS: f256-install-macos.sh
|
||||
|
||||
Create a new, empty directory, with no spaces in the name (or in the names of
|
||||
the parent directories) and place this file into it. From that folder, execute
|
||||
the script. It will download additional dependencies and install them. Aside
|
||||
from some Python modules needed by FoenixManager, everything will stay inside
|
||||
this new folder. Uninstalling is just a matter of deleting it.
|
||||
|
||||
|
||||
CONFIGURATION
|
||||
=============
|
||||
|
||||
You will need to modify foenixmgr.ini in the main installation folder. The
|
||||
only thing that should need updated is the COM port used to communicate with
|
||||
your F256. See: https://github.com/pweingar/FoenixMgr
|
||||
|
||||
|
||||
ASSUMPTIONS
|
||||
===========
|
||||
|
||||
This package was designed to be easy to use for new programmers. As such, some
|
||||
liberties were taken that aren't entirely common practice. There are no
|
||||
project files, makefiles, or other build configuration systems. The included
|
||||
f256build and f256run scripts assume you have arranged your code in directories
|
||||
like the example programs. The main requirement is that each program have its
|
||||
own parent directory named for that program and inside it, a "src" directory
|
||||
where the actual code lives. Example:
|
||||
|
||||
C:\FOENIX\CODE\MYPROGRAM\SRC
|
||||
|
||||
This would be a project named "MYPROGRAM" located in a CODE folder under the
|
||||
folder you installed the toolkit in. (You do not have to locate your projects
|
||||
under the toolkit folder.) To build this, you would run f256build from the
|
||||
C:\FOENIX folder as follows:
|
||||
|
||||
f256build code\myprogram
|
||||
|
||||
UNIX folks, flip your slashes!
|
||||
|
||||
|
||||
USAGE
|
||||
=====
|
||||
|
||||
As shown above, f256build is used to build projects using the default linker
|
||||
settings. If you do not have linker settings in your project already, the
|
||||
defaults will be added (in a file named f256.ld in your project directory).
|
||||
Unless you need to use embedded binary data in your project, the defaults are
|
||||
all you need. Embedded data examples are included. See SPRITES and TILEMAP in
|
||||
the EXAMPLES folder. More details can be found in the f256lib documentation.
|
||||
|
||||
When building your project f256build will create a ".builddir" folder in your
|
||||
project directory. In here you will find copies of your source code that have
|
||||
been modified by the overlay tool (for creating programs larger than 64k),
|
||||
"trampoline" headers (again, generated by the overlay tool), intermediate
|
||||
binary files, symbol listings, assembler source listings, memory maps,
|
||||
additional linker information, and more. These can be safely ignored or used
|
||||
to assist in debugging your application.
|
||||
|
||||
To run your program on the F256 using a USB debug cable, use f256run just as
|
||||
you did f256build. Example:
|
||||
|
||||
f256run code\myprogram
|
||||
|
||||
If you do not have a debug cable, you can copy the PGZ for your program from
|
||||
its project directory to the SD card used in your F256.
|
||||
|
||||
|
||||
SUPPORT
|
||||
=======
|
||||
|
||||
Drop by the Foenix Retro Systems Discord! https://discord.gg/e32efF7FGy I am
|
||||
almost always online as "sduensin".
|
||||
|
||||
Additional information on the F256 family of computers can be found on the F256
|
||||
wiki: http://wiki.f256foenix.com/
|
||||
|
||||
As a last resort, you can email me, Scott Duensing, at scott@kangaroopunch.com
|
||||
and I'll probably ask you to join the Discord. :-)
|
|
@ -105,11 +105,17 @@ ren overlay.windows overlay.exe
|
|||
if exist *.sh del *.sh > NUL
|
||||
|
||||
ren FoenixMgr-master FoenixMgr
|
||||
copy FoenixMgr\foenixmgr.ini . > NUL
|
||||
pushd FoenixMgr
|
||||
pip.exe install -r requirements.txt
|
||||
popd
|
||||
|
||||
echo [DEFAULT] > foenixmgr.ini
|
||||
echo port=COM3 >> foenixmgr.ini
|
||||
echo labels=sample.lbl >> foenixmgr.ini
|
||||
echo flash_address=380000 >> foenixmgr.ini
|
||||
echo chunk_size=1024 >> foenixmgr.ini
|
||||
echo cpu=65c02 >> foenixmgr.ini
|
||||
|
||||
echo @"%%~dp0mos-clang++.exe" --config mos-f256.cfg %%* > llvm-mos\bin\mos-f256-clang++.bat
|
||||
echo @"%%~dp0mos-clang-cpp.exe" --config mos-f256.cfg %%* > llvm-mos\bin\mos-f256-clang-cpp.bat
|
||||
echo @"%%~dp0mos-clang.exe" --config mos-f256.cfg %%* > llvm-mos\bin\mos-f256-clang.bat
|
||||
|
|
|
@ -51,12 +51,12 @@ pushd "%PROJECT%"
|
|||
cd .builddir
|
||||
"%ROOT%\overlay.exe" 5 "%BUILD%" "%SOURCE%"
|
||||
if not exist "%PROJECT%\f256.ld" copy /y "%ROOT%\llvm-mos\mos-platform\f256\lib\link.ld" "%PROJECT%\f256.ld" > NUL
|
||||
call mos-f256-clang -T ..\f256.ld -Wl,-Map=%NAME%.map -o %NAME% -I"%ROOT%" -Wall -lm *.c
|
||||
call mos-f256-clang.bat -T ..\f256.ld -Wl,-Map=%NAME%.map -o %NAME% -I"%ROOT%" -Os -Wall -lm *.c
|
||||
if errorlevel 1 goto failed
|
||||
ren %NAME% %NAME%.pgz
|
||||
llvm-nm %NAME%.elf > %NAME%.sym
|
||||
llvm-objdump --syms -d --print-imm-hex %NAME%.elf > %NAME%.lst
|
||||
python %ROOT%\pgz-thunk.py %NAME%.pgz
|
||||
llvm-nm.exe %NAME%.elf > %NAME%.sym
|
||||
llvm-objdump.exe --syms -d --print-imm-hex %NAME%.elf > %NAME%.lst
|
||||
python.exe %ROOT%\pgz-thunk.py %NAME%.pgz
|
||||
move %NAME%.pgz ..\. > NUL
|
||||
:failed
|
||||
popd
|
||||
|
|
|
@ -43,4 +43,5 @@ echo No PGZ found.
|
|||
exit /b
|
||||
|
||||
:foundPgz
|
||||
python.exe "%ROOT%/FoenixMgr/FoenixMgr/fnxmgr.py --run-pgz "%PROJECT%\%NAME%.pgz"
|
||||
python.exe "%ROOT%\FoenixMgr\FoenixMgr\fnxmgr.py" --boot FLASH
|
||||
python.exe "%ROOT%\FoenixMgr\FoenixMgr\fnxmgr.py" --run-pgz "%PROJECT%\%NAME%.pgz"
|
||||
|
|
111
examples/sprites/f256.ld
Normal file
111
examples/sprites/f256.ld
Normal file
|
@ -0,0 +1,111 @@
|
|||
/* fake C Stack */
|
||||
PROVIDE(__stack = 0xA000);
|
||||
/* entry point to my program - 0x200 to 0x2ff are command line arguments */
|
||||
PROVIDE(__f256_start = 0x300);
|
||||
/* page size of a block of memory */
|
||||
PROVIDE(__BLOCK_SIZE = 0x2000);
|
||||
/* swappable block address */
|
||||
PROVIDE(__SLOT_ADDR = 0xA000);
|
||||
|
||||
/* f256k uses first 16 bytes of ZP for mmu control? */
|
||||
__rc0 = 0x10;
|
||||
INCLUDE imag-regs.ld
|
||||
ASSERT(__rc0 == 0x10, "Inconsistent zero page map.")
|
||||
ASSERT(__rc31 == 0x2f, "Inconsistent zero page map.")
|
||||
|
||||
MEMORY {
|
||||
/* kernel uses 0xf0-0xff for parameter passing */
|
||||
zp : ORIGIN = __rc31 + 1, LENGTH = 0xF0 - (__rc31 + 1)
|
||||
ram (rw) : ORIGIN = __f256_start, LENGTH = __stack-__f256_start
|
||||
}
|
||||
|
||||
/* LMAs */
|
||||
__block8_lma = ( 8<<24)|__SLOT_ADDR;
|
||||
__block9_lma = ( 9<<24)|__SLOT_ADDR;
|
||||
__block10_lma = (10<<24)|__SLOT_ADDR;
|
||||
__block11_lma = (11<<24)|__SLOT_ADDR;
|
||||
__block12_lma = (12<<24)|__SLOT_ADDR;
|
||||
__block13_lma = (13<<24)|__SLOT_ADDR;
|
||||
__block14_lma = (14<<24)|__SLOT_ADDR;
|
||||
__block15_lma = (15<<24)|__SLOT_ADDR;
|
||||
__block16_lma = (16<<24)|__SLOT_ADDR;
|
||||
__block17_lma = (17<<24)|__SLOT_ADDR;
|
||||
__block18_lma = (18<<24)|__SLOT_ADDR;
|
||||
__block19_lma = (19<<24)|__SLOT_ADDR;
|
||||
__block20_lma = (20<<24)|__SLOT_ADDR;
|
||||
__block21_lma = (21<<24)|__SLOT_ADDR;
|
||||
__block22_lma = (22<<24)|__SLOT_ADDR;
|
||||
__block23_lma = (23<<24)|__SLOT_ADDR;
|
||||
|
||||
/* Stash preloaded binary data */
|
||||
__binarydata_lma = 0x10000;
|
||||
__BINARYDATA_SIZE = 0xA081; /* Size of sprites.bin + 1 */
|
||||
|
||||
MEMORY {
|
||||
block8 : ORIGIN = __block8_lma, LENGTH = __BLOCK_SIZE
|
||||
block9 : ORIGIN = __block9_lma, LENGTH = __BLOCK_SIZE
|
||||
block10 : ORIGIN = __block10_lma, LENGTH = __BLOCK_SIZE
|
||||
block11 : ORIGIN = __block11_lma, LENGTH = __BLOCK_SIZE
|
||||
block12 : ORIGIN = __block12_lma, LENGTH = __BLOCK_SIZE
|
||||
block13 : ORIGIN = __block13_lma, LENGTH = __BLOCK_SIZE
|
||||
block14 : ORIGIN = __block14_lma, LENGTH = __BLOCK_SIZE
|
||||
block15 : ORIGIN = __block15_lma, LENGTH = __BLOCK_SIZE
|
||||
block16 : ORIGIN = __block16_lma, LENGTH = __BLOCK_SIZE
|
||||
block17 : ORIGIN = __block17_lma, LENGTH = __BLOCK_SIZE
|
||||
block18 : ORIGIN = __block18_lma, LENGTH = __BLOCK_SIZE
|
||||
block19 : ORIGIN = __block19_lma, LENGTH = __BLOCK_SIZE
|
||||
block20 : ORIGIN = __block20_lma, LENGTH = __BLOCK_SIZE
|
||||
block21 : ORIGIN = __block21_lma, LENGTH = __BLOCK_SIZE
|
||||
block22 : ORIGIN = __block22_lma, LENGTH = __BLOCK_SIZE
|
||||
block23 : ORIGIN = __block23_lma, LENGTH = __BLOCK_SIZE
|
||||
binarydata : ORIGIN = __binarydata_lma, LENGTH = __BINARYDATA_SIZE
|
||||
}
|
||||
|
||||
REGION_ALIAS("c_writeable", ram)
|
||||
REGION_ALIAS("c_readonly", ram)
|
||||
|
||||
SECTIONS {
|
||||
INCLUDE c.ld
|
||||
.block8 : { *(.block8 .block8.*) } >block8 end_block8 = .;
|
||||
.block9 : { *(.block9 .block9.*) } >block9 end_block9 = .;
|
||||
.block10 : { *(.block10 .block10.*) } >block10 end_block10 = .;
|
||||
.block11 : { *(.block11 .block11.*) } >block11 end_block11 = .;
|
||||
.block12 : { *(.block12 .block12.*) } >block12 end_block12 = .;
|
||||
.block13 : { *(.block13 .block13.*) } >block13 end_block13 = .;
|
||||
.block14 : { *(.block14 .block14.*) } >block14 end_block14 = .;
|
||||
.block15 : { *(.block15 .block15.*) } >block15 end_block15 = .;
|
||||
.block16 : { *(.block16 .block16.*) } >block16 end_block16 = .;
|
||||
.block17 : { *(.block17 .block17.*) } >block17 end_block17 = .;
|
||||
.block18 : { *(.block18 .block18.*) } >block18 end_block18 = .;
|
||||
.block19 : { *(.block19 .block19.*) } >block19 end_block19 = .;
|
||||
.block20 : { *(.block20 .block20.*) } >block20 end_block20 = .;
|
||||
.block21 : { *(.block21 .block21.*) } >block21 end_block21 = .;
|
||||
.block22 : { *(.block22 .block22.*) } >block22 end_block22 = .;
|
||||
.block23 : { *(.block23 .block23.*) } >block23 end_block23 = .;
|
||||
.binarydata : { *(.binarydata .binarydata.*) } >binarydata end_binarydata = .;
|
||||
}
|
||||
|
||||
OUTPUT_FORMAT {
|
||||
BYTE(0x5A) /* pgZ */
|
||||
|
||||
/* RAM Segment */
|
||||
SHORT(ORIGIN(ram)) /* where to load it, 24 bits */
|
||||
BYTE(0x00)
|
||||
SHORT(__bss_start-ORIGIN(ram)) /* size to load */
|
||||
BYTE(0x00)
|
||||
TRIM(ram)
|
||||
|
||||
/* Overlay Segments */
|
||||
INCLUDE output.ld
|
||||
|
||||
/* Binary 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)
|
||||
}
|
|
@ -15,7 +15,8 @@ function makeSprite() {
|
|||
mv assets/*.clut generated/.
|
||||
mv assets/*.indexed generated/.
|
||||
|
||||
cat generated/${NAME}-1x1.indexed \
|
||||
cat \
|
||||
generated/${NAME}-1x1.indexed \
|
||||
generated/${NAME}-2x1.indexed \
|
||||
generated/${NAME}-3x1.indexed \
|
||||
generated/${NAME}-4x1.indexed \
|
||||
|
@ -35,3 +36,11 @@ makeSprite apache-left
|
|||
makeSprite apache-left-front
|
||||
makeSprite apache-right-front
|
||||
makeSprite apache-right
|
||||
|
||||
cat \
|
||||
generated/apache-left.sprite \
|
||||
generated/apache-left-front.sprite \
|
||||
generated/apache-right-front.sprite \
|
||||
generated/apache-right.sprite \
|
||||
generated/apache-left.clut \
|
||||
> generated/sprites.bin
|
|
@ -21,7 +21,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "f256.h"
|
||||
#define F256LIB_IMPLEMENTATION
|
||||
#include "f256lib.h"
|
||||
|
||||
|
||||
#define SPRITE_COUNT 4
|
||||
|
@ -47,7 +48,9 @@
|
|||
#define TURN_SPEED 25
|
||||
|
||||
|
||||
static byte sprites[SPRITE_COUNT] = { SPR_LEFT, SPR_LEFT_FRONT, SPR_RIGHT_FRONT, SPR_RIGHT };
|
||||
EMBED(".binarydata.embedded", embedded, "../generated/sprites.bin");
|
||||
|
||||
|
||||
static uint32_t spriteStartAddrs[SPRITE_COUNT] = { SPR_LEFT_ADDR, SPR_LEFT_FRONT_ADDR, SPR_RIGHT_FRONT_ADDR, SPR_RIGHT_ADDR };
|
||||
static uint32_t spriteAddrs[SPRITE_COUNT][SPRITE_WIDTH][SPRITE_HEIGHT];
|
||||
static byte spriteIds[SPRITE_COUNT][SPRITE_WIDTH][SPRITE_HEIGHT];
|
||||
|
@ -255,8 +258,7 @@ void setup(void) {
|
|||
}
|
||||
|
||||
|
||||
int main(void) {
|
||||
f256Init();
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
setup();
|
||||
|
111
examples/tilemap/f256.ld
Normal file
111
examples/tilemap/f256.ld
Normal file
|
@ -0,0 +1,111 @@
|
|||
/* fake C Stack */
|
||||
PROVIDE(__stack = 0xA000);
|
||||
/* entry point to my program - 0x200 to 0x2ff are command line arguments */
|
||||
PROVIDE(__f256_start = 0x300);
|
||||
/* page size of a block of memory */
|
||||
PROVIDE(__BLOCK_SIZE = 0x2000);
|
||||
/* swappable block address */
|
||||
PROVIDE(__SLOT_ADDR = 0xA000);
|
||||
|
||||
/* f256k uses first 16 bytes of ZP for mmu control? */
|
||||
__rc0 = 0x10;
|
||||
INCLUDE imag-regs.ld
|
||||
ASSERT(__rc0 == 0x10, "Inconsistent zero page map.")
|
||||
ASSERT(__rc31 == 0x2f, "Inconsistent zero page map.")
|
||||
|
||||
MEMORY {
|
||||
/* kernel uses 0xf0-0xff for parameter passing */
|
||||
zp : ORIGIN = __rc31 + 1, LENGTH = 0xF0 - (__rc31 + 1)
|
||||
ram (rw) : ORIGIN = __f256_start, LENGTH = __stack-__f256_start
|
||||
}
|
||||
|
||||
/* LMAs */
|
||||
__block8_lma = ( 8<<24)|__SLOT_ADDR;
|
||||
__block9_lma = ( 9<<24)|__SLOT_ADDR;
|
||||
__block10_lma = (10<<24)|__SLOT_ADDR;
|
||||
__block11_lma = (11<<24)|__SLOT_ADDR;
|
||||
__block12_lma = (12<<24)|__SLOT_ADDR;
|
||||
__block13_lma = (13<<24)|__SLOT_ADDR;
|
||||
__block14_lma = (14<<24)|__SLOT_ADDR;
|
||||
__block15_lma = (15<<24)|__SLOT_ADDR;
|
||||
__block16_lma = (16<<24)|__SLOT_ADDR;
|
||||
__block17_lma = (17<<24)|__SLOT_ADDR;
|
||||
__block18_lma = (18<<24)|__SLOT_ADDR;
|
||||
__block19_lma = (19<<24)|__SLOT_ADDR;
|
||||
__block20_lma = (20<<24)|__SLOT_ADDR;
|
||||
__block21_lma = (21<<24)|__SLOT_ADDR;
|
||||
__block22_lma = (22<<24)|__SLOT_ADDR;
|
||||
__block23_lma = (23<<24)|__SLOT_ADDR;
|
||||
|
||||
/* Stash preloaded binary data */
|
||||
__binarydata_lma = 0x10000;
|
||||
__BINARYDATA_SIZE = 0x5f845; /* Size of tiles.bin + 1 */
|
||||
|
||||
MEMORY {
|
||||
block8 : ORIGIN = __block8_lma, LENGTH = __BLOCK_SIZE
|
||||
block9 : ORIGIN = __block9_lma, LENGTH = __BLOCK_SIZE
|
||||
block10 : ORIGIN = __block10_lma, LENGTH = __BLOCK_SIZE
|
||||
block11 : ORIGIN = __block11_lma, LENGTH = __BLOCK_SIZE
|
||||
block12 : ORIGIN = __block12_lma, LENGTH = __BLOCK_SIZE
|
||||
block13 : ORIGIN = __block13_lma, LENGTH = __BLOCK_SIZE
|
||||
block14 : ORIGIN = __block14_lma, LENGTH = __BLOCK_SIZE
|
||||
block15 : ORIGIN = __block15_lma, LENGTH = __BLOCK_SIZE
|
||||
block16 : ORIGIN = __block16_lma, LENGTH = __BLOCK_SIZE
|
||||
block17 : ORIGIN = __block17_lma, LENGTH = __BLOCK_SIZE
|
||||
block18 : ORIGIN = __block18_lma, LENGTH = __BLOCK_SIZE
|
||||
block19 : ORIGIN = __block19_lma, LENGTH = __BLOCK_SIZE
|
||||
block20 : ORIGIN = __block20_lma, LENGTH = __BLOCK_SIZE
|
||||
block21 : ORIGIN = __block21_lma, LENGTH = __BLOCK_SIZE
|
||||
block22 : ORIGIN = __block22_lma, LENGTH = __BLOCK_SIZE
|
||||
block23 : ORIGIN = __block23_lma, LENGTH = __BLOCK_SIZE
|
||||
binarydata : ORIGIN = __binarydata_lma, LENGTH = __BINARYDATA_SIZE
|
||||
}
|
||||
|
||||
REGION_ALIAS("c_writeable", ram)
|
||||
REGION_ALIAS("c_readonly", ram)
|
||||
|
||||
SECTIONS {
|
||||
INCLUDE c.ld
|
||||
.block8 : { *(.block8 .block8.*) } >block8 end_block8 = .;
|
||||
.block9 : { *(.block9 .block9.*) } >block9 end_block9 = .;
|
||||
.block10 : { *(.block10 .block10.*) } >block10 end_block10 = .;
|
||||
.block11 : { *(.block11 .block11.*) } >block11 end_block11 = .;
|
||||
.block12 : { *(.block12 .block12.*) } >block12 end_block12 = .;
|
||||
.block13 : { *(.block13 .block13.*) } >block13 end_block13 = .;
|
||||
.block14 : { *(.block14 .block14.*) } >block14 end_block14 = .;
|
||||
.block15 : { *(.block15 .block15.*) } >block15 end_block15 = .;
|
||||
.block16 : { *(.block16 .block16.*) } >block16 end_block16 = .;
|
||||
.block17 : { *(.block17 .block17.*) } >block17 end_block17 = .;
|
||||
.block18 : { *(.block18 .block18.*) } >block18 end_block18 = .;
|
||||
.block19 : { *(.block19 .block19.*) } >block19 end_block19 = .;
|
||||
.block20 : { *(.block20 .block20.*) } >block20 end_block20 = .;
|
||||
.block21 : { *(.block21 .block21.*) } >block21 end_block21 = .;
|
||||
.block22 : { *(.block22 .block22.*) } >block22 end_block22 = .;
|
||||
.block23 : { *(.block23 .block23.*) } >block23 end_block23 = .;
|
||||
.binarydata : { *(.binarydata .binarydata.*) } >binarydata end_binarydata = .;
|
||||
}
|
||||
|
||||
OUTPUT_FORMAT {
|
||||
BYTE(0x5A) /* pgZ */
|
||||
|
||||
/* RAM Segment */
|
||||
SHORT(ORIGIN(ram)) /* where to load it, 24 bits */
|
||||
BYTE(0x00)
|
||||
SHORT(__bss_start-ORIGIN(ram)) /* size to load */
|
||||
BYTE(0x00)
|
||||
TRIM(ram)
|
||||
|
||||
/* Overlay Segments */
|
||||
INCLUDE output.ld
|
||||
|
||||
/* Binary 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)
|
||||
}
|
|
@ -21,17 +21,21 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "f256.h"
|
||||
#define F256LIB_IMPLEMENTATION
|
||||
#include "f256lib.h"
|
||||
|
||||
|
||||
#define MAP_BRITANIA 0x10000
|
||||
#define MAP_UNDERWORLD 0x30000
|
||||
#define TILES_IMAGE_TOP 0x50000
|
||||
#define TILES_IMAGE_BOTTOM 0x60000
|
||||
#define TILES_CLUT 0x70000
|
||||
#define MAP_BRITANIA 0x10000 // Len: 0x1fc02
|
||||
#define MAP_UNDERWORLD 0x2fc02 // Len: 0x1fc02
|
||||
#define TILES_IMAGE_TOP 0x4f804 // Len: 0x20000
|
||||
#define TILES_IMAGE_BOTTOM 0x5f804 // Halfway through TILES_IMAGE_TOP
|
||||
#define TILES_CLUT 0x6f804 // Len: 0x40
|
||||
|
||||
|
||||
int main(void) {
|
||||
EMBED(".binarydata.embedded", embedded, "../tiles/tiles.bin");
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
byte x;
|
||||
byte r;
|
||||
byte g;
|
||||
|
@ -40,8 +44,6 @@ int main(void) {
|
|||
uint16_t xs = 75;
|
||||
uint16_t ys = 99;
|
||||
|
||||
f256Init();
|
||||
|
||||
// Set up CLUT0.
|
||||
c = TILES_CLUT;
|
||||
for (x=0; x<16; x++) {
|
||||
|
@ -55,7 +57,7 @@ int main(void) {
|
|||
graphicsSetLayerTile(0, 0);
|
||||
tileDefineTileSet(0, TILES_IMAGE_TOP, true);
|
||||
tileDefineTileSet(1, TILES_IMAGE_BOTTOM, true);
|
||||
tileDefineTileMap(0, MAP_BRITANIA, 16, 255, 255);
|
||||
tileDefineTileMap(0, MAP_BRITANIA, 16, 255, 255); // Change to MAP_UNDERWORLD for more fun.
|
||||
tileSetVisible(0, true);
|
||||
|
||||
tileSetScroll(0, 0, xs, 0, ys);
|
8
examples/tilemap/tiles/combine.sh
Executable file
8
examples/tilemap/tiles/combine.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
cat \
|
||||
brita.tiles \
|
||||
under.tiles \
|
||||
u5tiles.indexed \
|
||||
u5tiles.clut \
|
||||
> tiles.bin
|
|
@ -38,7 +38,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../../tools/shared/util.h"
|
||||
#include "../../../tools/shared/util.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
|
@ -1,52 +0,0 @@
|
|||
#
|
||||
# Copyright (c) 2024 Scott Duensing, scott@kangaroopunch.com
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
|
||||
|
||||
# This is only to make my IDE happy.
|
||||
# We can't actually build with it until I get llvm-mos integrated into
|
||||
# toolchains. -- SCD
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
set(CMAKE_C_STANDARD 17)
|
||||
project(helicopter)
|
||||
|
||||
set(F256DIR ${CMAKE_SOURCE_DIR}/../..)
|
||||
|
||||
set(DEFINES ${F256DIR}/include)
|
||||
set(F256LIB ${F256DIR}/f256lib)
|
||||
|
||||
set(HELICOPTER_SOURCE
|
||||
${F256LIB}/f256.h
|
||||
${F256LIB}/f256.c
|
||||
helicopter.c
|
||||
)
|
||||
|
||||
add_executable(${CMAKE_PROJECT_NAME}
|
||||
${HELICOPTER_SOURCE}
|
||||
)
|
||||
|
||||
target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${DEFINES}
|
||||
${F256LIB}
|
||||
)
|
|
@ -1,58 +0,0 @@
|
|||
#!/bin/bash -ex
|
||||
|
||||
#
|
||||
# Copyright (c) 2024 Scott Duensing, scott@kangaroopunch.com
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
|
||||
|
||||
PROJECT=helicopter
|
||||
START=0x200
|
||||
|
||||
|
||||
F256=../..
|
||||
LLVM=${F256}/llvm-mos
|
||||
SETTINGS=${LLVM}/mos-platform/f256k/lib/settings.ld
|
||||
PATH=${LLVM}/bin:${PATH}
|
||||
|
||||
echo "__f256_start = ${START};" > ${SETTINGS}
|
||||
|
||||
CLANG="mos-f256k-clang -I${F256}/include -I${F256}/f256lib -O3"
|
||||
|
||||
${CLANG} -c ${F256}/f256lib/f256.c
|
||||
${CLANG} -c ${PROJECT}.c
|
||||
${CLANG} -o ${PROJECT} ${PROJECT}.o f256.o
|
||||
|
||||
mv -f ${PROJECT} ${PROJECT}.bin
|
||||
|
||||
${F256}/header \
|
||||
pgz 24 \
|
||||
${PROJECT}.pgz \
|
||||
${START} \
|
||||
${PROJECT}.bin ${START} \
|
||||
generated/apache-left.sprite 0x10000 \
|
||||
generated/apache-left-front.sprite 0x12800 \
|
||||
generated/apache-right-front.sprite 0x15000 \
|
||||
generated/apache-right.sprite 0x17800 \
|
||||
generated/apache-left.clut 0x1a000
|
||||
|
||||
llvm-nm ${PROJECT}.elf > ${PROJECT}.sym
|
||||
llvm-objdump -d --print-imm-hex ${PROJECT}.elf > ${PROJECT}.lst
|
||||
hexdump -C ${PROJECT}.pgz > ${PROJECT}.hex
|
|
@ -1,26 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright (c) 2024 Scott Duensing, scott@kangaroopunch.com
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
|
||||
|
||||
python ../../FoenixMgr/FoenixMgr/fnxmgr.py --run-pgz helicopter.pgz
|
|
@ -1,55 +0,0 @@
|
|||
#
|
||||
# Copyright (c) 2024 Scott Duensing, scott@kangaroopunch.com
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
|
||||
|
||||
# This is only to make my IDE happy.
|
||||
# We can't actually build with it until I get llvm-mos integrated into
|
||||
# toolchains. -- SCD
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
set(CMAKE_C_STANDARD 17)
|
||||
project(u5map)
|
||||
|
||||
set(DEFINES ${CMAKE_SOURCE_DIR}/../../include)
|
||||
set(F256LIB ${CMAKE_SOURCE_DIR}/../../f256lib)
|
||||
|
||||
set(DATA_SOURCE
|
||||
${F256LIB}/f256.h
|
||||
${F256LIB}/f256.c
|
||||
u5map.c
|
||||
)
|
||||
|
||||
add_executable(${CMAKE_PROJECT_NAME}
|
||||
${DATA_SOURCE}
|
||||
makemap.c
|
||||
)
|
||||
|
||||
target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${DEFINES}
|
||||
${F256LIB}
|
||||
)
|
||||
|
||||
#target_link_libraries(${CMAKE_PROJECT_NAME}
|
||||
# -lm
|
||||
#)
|
|
@ -1,56 +0,0 @@
|
|||
#!/bin/bash -ex
|
||||
|
||||
#
|
||||
# Copyright (c) 2024 Scott Duensing, scott@kangaroopunch.com
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
|
||||
|
||||
PROJECT=u5map
|
||||
START=0x200
|
||||
|
||||
F256=$(pwd)/../..
|
||||
LLVM=${F256}/llvm-mos
|
||||
SETTINGS=${LLVM}/mos-platform/f256k/lib/settings.ld
|
||||
PATH=${LLVM}/bin:${PATH}
|
||||
|
||||
echo "__f256_start = ${START};" > ${SETTINGS}
|
||||
|
||||
CLANG="mos-f256k-clang -I${F256}/include -I${F256}/f256lib -O3"
|
||||
|
||||
${CLANG} -c ${F256}/f256lib/f256.c
|
||||
${CLANG} -c ${PROJECT}.c
|
||||
${CLANG} -o ${PROJECT} ${PROJECT}.o f256.o
|
||||
|
||||
mv -f ${PROJECT} ${PROJECT}.bin
|
||||
|
||||
${F256}/header \
|
||||
pgz 24 \
|
||||
${PROJECT}.pgz \
|
||||
${START} \
|
||||
${PROJECT}.bin ${START} \
|
||||
brita.tiles 0x10000 \
|
||||
under.tiles 0x30000 \
|
||||
u5tiles.indexed 0x50000 \
|
||||
u5tiles.clut 0x70000
|
||||
|
||||
#llvm-nm ${PROJECT}.elf > ${PROJECT}.lst
|
||||
llvm-objdump -d --print-imm-hex ${PROJECT}.elf > ${PROJECT}.lst
|
||||
hexdump -C ${PROJECT}.pgz > ${PROJECT}.hex
|
|
@ -1,26 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright (c) 2024 Scott Duensing, scott@kangaroopunch.com
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
|
||||
|
||||
python ../../FoenixMgr/FoenixMgr/fnxmgr.py --run-pgz u5map.pgz
|
Loading…
Add table
Reference in a new issue