Windows installer in beta!

This commit is contained in:
Scott Duensing 2024-04-29 20:03:36 -05:00
parent 0c83e2a535
commit 8536240e75
74 changed files with 307 additions and 657 deletions

View file

@ -23,6 +23,14 @@
#
#
# NOTE: This script depends on "Toolchains" bein installed in a parallel
# directory to the directory that contains this script.
#
# https://skunkworks.kangaroopunch.com/skunkworks/toolchains
#
ROOT=$(pwd)
INSTALL=${ROOT}/llvm-mos
@ -40,6 +48,8 @@ function buildOverlayTool() {
pushd tools/overlay
${CC} overlay.c ../shared/util.o -o ${TARGET} -lm
popd
rm tools/shared/util.o
}
@ -68,6 +78,10 @@ pushd distro
cp -Rf ${ROOT}/f256lib .
cp -Rf ${ROOT}/include .
cp -f ${ROOT}/f256lib.h .
cp -f ${ROOT}/pgz-thunk.py .
cp -f ../f256build.bat .
cp -f ../f256run.bat .
buildOverlayTool linux x86_64 $(pwd)/overlay.linux
buildOverlayTool macos aarch64 $(pwd)/overlay.macos

View file

@ -26,7 +26,8 @@
TARGET=f256lib.h
cat f256lib/stddclmr.h > ${TARGET}
cat f256lib/docs.h > ${TARGET}
cat f256lib/stddclmr.h >> ${TARGET}
echo "#ifndef F256LIB_AMALGAMATED_BUILD" >> ${TARGET}
echo "#define F256LIB_AMALGAMATED_BUILD" >> ${TARGET}

View file

@ -37,12 +37,37 @@ set LOCAL2=llvm-mos-f256.7z
set REMOTE3=https://aka.ms/vs/16/release/vc_redist.x64.exe
set LOCAL3=vc_redist.x64.exe
set REMOTE4=https://github.com/pweingar/FoenixMgr/archive/refs/heads/master.zip
set LOCAL4=master.zip
if exist llvm-mos\ (
echo You already have an llvm-mos directory. Exiting.
exit /B
)
if exist "%ProgramFiles%\7-Zip\7z.exe" (
set UNPACK="%ProgramFiles%\7-Zip\7z.exe"
) else (
if exist "%ProgramFiles%\WinRAR\WinRAR.exe" (
set UNPACK="%ProgramFiles%\WinRAR\WinRAR.exe"
) else (
echo Unable to find 7-Zip or WinRAR. Exiting.
exit /B
)
)
where /q python.exe
if errorlevel 1 (
echo Unable to find Python. Exiting.
exit /B
)
where /q pip.exe
if errorlevel 1 (
echo Unable to find Python. Exiting.
exit /B
)
where /q curl.exe
if errorlevel 1 (
where /q bitsadmin.exe
@ -53,39 +78,38 @@ if errorlevel 1 (
bitsadmin.exe /transfer GoGoWindows /download /priority normal %REMOTE1% "%~dp0%LOCAL1%"
bitsadmin.exe /transfer GoGoWindows /download /priority normal %REMOTE2% "%~dp0%LOCAL2%"
bitsadmin.exe /transfer GoGoWindows /download /priority normal %REMOTE3% "%~dp0%LOCAL3%"
bitsadmin.exe /transfer GoGoWindows /download /priority normal %REMOTE4% "%~dp0%LOCAL4%"
)
) else (
curl.exe -L %REMOTE1% > %LOCAL1%
curl.exe -L %REMOTE2% > %LOCAL2%
curl.exe -L %REMOTE3% > %LOCAL3%
curl.exe -L %REMOTE4% > %LOCAL4%
)
%LOCAL3% /install /passive
if exist "%ProgramFiles%\7-Zip\7z.exe" (
"%ProgramFiles%\7-Zip\7z.exe" x %LOCAL1%
"%ProgramFiles%\7-Zip\7z.exe" x %LOCAL2%
) else (
if exist "%ProgramFiles%\WinRAR\WinRAR.exe" (
"%ProgramFiles%\WinRAR\WinRAR.exe" x %LOCAL1%
"%ProgramFiles%\WinRAR\WinRAR.exe" x %LOCAL2%
) else (
echo Unable to find 7-Zip or WinRAR. Exiting.
del %LOCAL1%
del %LOCAL2%
del %LOCAL3%
exit /B
)
)
%UNPACK% x -y %LOCAL1%
%UNPACK% x -y %LOCAL2%
%UNPACK% x -y %LOCAL4%
del %LOCAL1%
del %LOCAL2%
del %LOCAL3%
del %LOCAL4%
del overlay.linux
del overlay.macos
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 @"%%~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
@ -100,6 +124,9 @@ echo.
echo -----------------------------------------------------------------------------
echo Installation complete!
echo.
echo Please visit https://github.com/pweingar/FoenixMgr to learn how to configure
echo FoenixMgr for your machine. Edit the foenixmgr.ini file in this directory.
echo.
echo NOTE: The following has been added to your PATH:
echo %~dp0llvm-mos\bin
echo -----------------------------------------------------------------------------

62
distro/f256build.bat Normal file
View file

@ -0,0 +1,62 @@
@echo off
goto top
#
# 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.
#
:top
set ROOT=%cd%
if "%~1%" neq "" goto checkSrc
echo.
echo No project folder provided.
exit /b
:checkSrc
if exist "%1%\src\*.c" goto foundSrc
echo.
echo No src folder containing C files found.
exit /b
:foundSrc
set PROJECT=%ROOT%\%1%
set SOURCE=%PROJECT%\src
set BUILD=%PROJECT%\.builddir
if "%PROJECT:~-1%" == "\" set "PROJECT=%PROJECT:~0,-1%"
for %%f in ("%PROJECT%") do set "NAME=%%~nxf"
pushd "%PROJECT%"
if exist .builddir rd /s /q .builddir
mkdir .builddir
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
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
move %NAME%.pgz ..\. > NUL
:failed
popd

46
distro/f256run.bat Normal file
View file

@ -0,0 +1,46 @@
@echo off
goto top
#
# 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.
#
:top
set ROOT=%cd%
if "%~1%" neq "" goto checkPgz
echo.
echo No project folder provided.
exit /b
:checkPgz
set PROJECT=%ROOT%\%1%
if "%PROJECT:~-1%" == "\" set "PROJECT=%PROJECT:~0,-1%"
for %%f in ("%PROJECT%") do set "NAME=%%~nxf"
if exist "%PROJECT%\%NAME%.pgz" goto foundPgz
echo.
echo No PGZ found.
exit /b
:foundPgz
python.exe "%ROOT%/FoenixMgr/FoenixMgr/fnxmgr.py --run-pgz "%PROJECT%\%NAME%.pgz"

View file

@ -1,50 +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(cube)
set(DEFINES ${CMAKE_SOURCE_DIR}/../../include)
set(F256LIB ${CMAKE_SOURCE_DIR}/../../f256lib)
set(CUBE_SOURCE
${F256LIB}/f256.h
${F256LIB}/f256.c
cube.c
)
add_executable(${CMAKE_PROJECT_NAME}
${CUBE_SOURCE}
)
target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC
${CMAKE_SOURCE_DIR}
${DEFINES}
${F256LIB}
)

View file

@ -1,53 +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=cube
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}
#llvm-nm ${PROJECT}.elf > ${PROJECT}.lst
llvm-objdump -d --print-imm-hex ${PROJECT}.elf > ${PROJECT}.lst
hexdump -C ${PROJECT}.pgz > ${PROJECT}.hex

View file

@ -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 cube.pgz

View file

@ -24,7 +24,8 @@
// Ported from https://github.com/root42/doscube
#include "f256.h"
#define F256LIB_IMPLEMENTATION
#include "f256lib.h"
#define FIX_PREC 9
@ -172,12 +173,13 @@ void draw_cube(byte p, int16_t t) {
}
int main(void) {
int main(int argc, char *argv[]) {
byte i;
int16_t t = 0;
byte p = 0;
f256Init();
(void)argc;
(void)argv;
textSetCursor(0); // No cursor.

View file

@ -1,50 +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(lines)
set(DEFINES ${CMAKE_SOURCE_DIR}/../../include)
set(F256LIB ${CMAKE_SOURCE_DIR}/../../f256lib)
set(LINES_SOURCE
${F256LIB}/f256.h
${F256LIB}/f256.c
lines.c
)
add_executable(${CMAKE_PROJECT_NAME}
${LINES_SOURCE}
)
target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC
${CMAKE_SOURCE_DIR}
${DEFINES}
${F256LIB}
)

View file

@ -1,52 +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=lines
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}
#llvm-nm ${PROJECT}.elf > ${PROJECT}.lst
llvm-objdump -d --print-imm-hex ${PROJECT}.elf > ${PROJECT}.lst
hexdump -C ${PROJECT}.pgz > ${PROJECT}.hex

View file

@ -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 lines.pgz

View file

@ -21,10 +21,11 @@
*/
#include "f256.h"
#define F256LIB_IMPLEMENTATION
#include "f256lib.h"
int main(void) {
int main(int argc, char *argv[]) {
uint16_t x;
uint16_t y;
uint16_t x2;
@ -34,7 +35,8 @@ int main(void) {
byte l;
byte c = 0;
f256Init();
(void)argc;
(void)argv;
for (l=0; l<TEXTCOLORS_COUNT; l++) {
graphicsDefineColor(0, l, textColors[l].r, textColors[l].g, textColors[l].b);

View file

@ -1,54 +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(overlay)
set(DEFINES ${CMAKE_SOURCE_DIR}/../../include)
set(F256LIB ${CMAKE_SOURCE_DIR}/../../f256lib)
set(OVERLAY_SOURCE
${F256LIB}/f256.h
${F256LIB}/f256.c
overlay.c
)
add_executable(${CMAKE_PROJECT_NAME}
${OVERLAY_SOURCE}
)
target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC
${CMAKE_SOURCE_DIR}
${DEFINES}
${F256LIB}
)
#target_link_libraries(${CMAKE_PROJECT_NAME}
# -lm
#)

View file

@ -1,60 +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=overlay
F256=$(readlink -f $(pwd)/../..)
LLVM=${F256}/llvm-mos
PATH=${LLVM}/bin:${PATH}
CLANG="mos-f256k-clang -I${F256}/include -I${F256}/f256lib -Os"
pushd ${F256}
./build-tools.sh
popd
[[ -d .builddir ]] && rm -rf .builddir
mkdir -p .builddir
# Do not use relative paths.
${F256}/overlay 5 ${F256}/examples/overlay/.builddir ${F256}/examples/overlay
pushd .builddir
${CLANG} -c ${PROJECT}.c
${CLANG} -T ../f256.ld \
-Wl,-Map=overlay.map \
-o ${PROJECT} \
${PROJECT}.o
mv ${PROJECT} ${PROJECT}.pgz
llvm-nm ${PROJECT}.elf > ${PROJECT}.sym
llvm-objdump -d --print-imm-hex ${PROJECT}.elf > ${PROJECT}.lst
hexdump -C ${PROJECT}.pgz > ${PROJECT}.hex
python ${F256}/pgz-thunk.py ${PROJECT}.pgz
mv ${PROJECT}.pgz ../.
popd

View file

@ -1,96 +0,0 @@
/* fake C Stack */
PROVIDE(__stack = 0xA000);
/* entry point to my program */
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 = 0xA000-__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;
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
}
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 = .;
}
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)
INCLUDE output.ld
/* Launch the program, at _start */
SHORT(_start)
LONG(0)
}

View file

@ -1,72 +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.
*/
#include "f256.h"
#include "f256.c"
void firstSegment(int arg1, int arg2);
void secondSegment(int arg1, int arg2);
void moreFirstSegment(int arg1, int arg2);
// This is the first segment we've defined. The linker will place this code in
// the first available far memory slot (default 0x10000).
#define SEGMENT_FIRST
void firstSegment(int arg1, int arg2) {
printf("firstSegment = %d\n", arg1 + arg2);
secondSegment(arg1, arg2);
}
// This is the second segment we've defined. The linker will place this code in
// the next available far memory slot (default 0x12000).
#define SEGMENT_SECOND
void secondSegment(int arg1, int arg2) {
printf("secondSegment = %d\n", arg1 + arg2);
moreFirstSegment(arg1, arg2);
}
// Back to the first segment. The linker will place this code immediately
// after the previous first segment code.
#define SEGMENT_FIRST
void moreFirstSegment(int arg1, int arg2) {
printf("moreFirstSegment = %d\n", arg1 + arg2);
}
// Back to near memory, the 64k visible to the processor. By default, this
// segment begins at 0x300.
#define SEGMENT_MAIN
int main(int argc, char *argv[]) {
// The overlay tool will generate trampoline macros for each function
// that is located in a far segment so no code changes are required.
firstSegment(1, 2);
// Spin.
for (;;);
return 0;
}

View file

@ -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 overlay.pgz

Binary file not shown.

117
f256lib/docs.h Normal file
View file

@ -0,0 +1,117 @@
/*
* 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.
*/
/*
* Configuration DEFINEs
*
* Before including this file, you may define one or more of the following
* to customize the library for your application:
*
* SWAP_RESTORE
*
* When using functions such as FAR_PEEK or bitmap features, return the
* swap slot back to it's original memory location before returning. By
* default, the swap slot is left in whatever state the last function that
* used it switched it to.
*
* WITHOUT_GRAPHICS
*
* Shortcut for WITHOUT_BITMAP, WITHOUT_TILE, and WITHOUT_SPRITE.
*
* WITHOUT_BITMAP
*
* Disables bitmap functions.
*
* WITHOUT_TILE
*
* Disables tilemap functions.
*
* WITHOUT_SPRITE
*
* Disables sprite functions.
*
* WITHOUT_FILE
*
* Disables file handling support.
*
* WITHOUT_KERNEL
*
* Disables microkernel support. Also disables FILE, PLATFORM, and MAIN.
*
* WITHOUT_TEXT
*
* Disables text functions. Also disables PLATFORM.
*
* WITHOUT_MATH
*
* Disables math coprocessor support. Also disables TEXT, PLATFORM and
* BITMAP.
*
* WITHOUT_MAIN
*
* Removes support for the standardized "int main(int argc, char *argv[])"
* function and replaces it with "int main(void)". You must also manually
* call "f256Init()" at the start of your program.
*
* WITHOUT_PLATFORM
*
* Removes basic C library I/O support for "getchar()" and "__putchar()".
* This removes printf().
*
* WITHOUT_DMA
*
* Removes DMA support. In the future, will also disable BITMAP.
*
*/
/*
* Usage Example:
*
* #define WITHOUT_FILE
* #define WITHOUT_SPRITE
* #define WITHOUT_TILE
* #define F256LIB_IMPLEMENTATION
* #include "f256lib.h"
*
* int main(int argc, char *argv[]) {
* return 0;
* }
*
*/
/*
* Library documentation at this point is basically "Use the Source, Luke!"
* Each section of the library has it's own header file in the non-amalgamated
* build. Look through the headers in the "include/" and "f256lib/"
* directories.
*
* Examples of using the various features of the library are in the "examples/"
* directory. Source code for helpful utilities and tools that run on the
* host computer can be found in "tools/".
*
*/
#define END_OF_DOCS__BEYOND_LIE_DRAGONS

View file

@ -21,70 +21,6 @@
*/
/*
* Configuration DEFINEs
*
* Before including this file, you may define one or more of the following
* to customize the library for your application:
*
* SWAP_RESTORE
*
* When using functions such as FAR_PEEK or bitmap features, return the
* swap slot back to it's original memory location before returning. By
* default, the swap slot is left in whatever state the last function that
* used it switched it to.
*
* WITHOUT_GRAPHICS
*
* Shortcut for WITHOUT_BITMAP, WITHOUT_TILE, and WITHOUT_SPRITE.
*
* WITHOUT_BITMAP
*
* Disables bitmap functions.
*
* WITHOUT_TILE
*
* Disables tilemap functions.
*
* WITHOUT_SPRITE
*
* Disables sprite functions.
*
* WITHOUT_FILE
*
* Disables file handling support.
*
* WITHOUT_KERNEL
*
* Disables microkernel support. Also disables FILE, PLATFORM, and MAIN.
*
* WITHOUT_TEXT
*
* Disables text functions. Also disables PLATFORM.
*
* WITHOUT_MATH
*
* Disables math coprocessor support. Also disables TEXT, PLATFORM and
* BITMAP.
*
* WITHOUT_MAIN
*
* Removes support for the standardized "int main(int argc, char *argv[])"
* function and replaces it with "int main(void)". You must also manually
* call "f256Init()" at the start of your program.
*
* WITHOUT_PLATFORM
*
* Removes basic C library I/O support for "getchar()" and "__putchar()".
* This removes printf().
*
* WITHOUT_DMA
*
* Removes DMA support. In the future, will also disable BITMAP.
*
*/
#ifndef F256_H
#define F256_H
@ -100,6 +36,7 @@ extern "C"
#ifndef F256LIB_AMALGAMATED_BUILD
#include "docs.h"
#include "stddclmr.h"
#include "f_api.h"
#include "f256_dma.h"

View file

@ -28,6 +28,7 @@
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include "../shared/util.h"
@ -323,6 +324,7 @@ void trimEnd(char *string) {
int main(int argc, char *argv[]) {
FILE *out;
int x;
int r;
int nearSlot;
char *targetDir;
char *sourceDir;
@ -335,7 +337,7 @@ int main(int argc, char *argv[]) {
int thisOffset;
DIR *dir;
struct dirent *dirent;
struct stat sb;
struct stat fileStat;
/*
* Command line:
@ -414,15 +416,17 @@ int main(int argc, char *argv[]) {
}
for (;;) {
if ((dirent = readdir(dir)) == NULL) break;
stat(dirent->d_name, &sb);
cFile = utilCreateString("%s%s", sourceDir, dirent->d_name); // May not be a C file. We check later.
r = stat(cFile, &fileStat);
if (r < 0) printf("stat() failed with %d! %s\n", r, strerror(errno));
#ifdef _WIN32
if (S_ISREG(sb.st_mode)) {
//printf("%s = %d\n", dirent->d_name, S_ISREG(fileStat.st_mode));
if (S_ISREG(fileStat.st_mode)) {
#else
if (S_ISREG(sb.st_mode) || S_ISLNK(sb.st_mode)) {
if (S_ISREG(fileStat.st_mode) || S_ISLNK(fileStat.st_mode)) {
#endif
// Is this a C file?
if ((dirent->d_name[strlen(dirent->d_name) - 2] == '.') && (dirent->d_name[strlen(dirent->d_name) - 1] == 'c')) {
cFile = utilCreateString("%s%s", sourceDir, dirent->d_name);
targetFile = utilCreateString("%s%s%s", targetDir, &sourceDir[sourceDirOffset], dirent->d_name);
thisDir = utilGetUpToLastPathComponent(targetFile);
utilFixPathSeparators(&thisDir, false);
@ -439,10 +443,10 @@ int main(int argc, char *argv[]) {
free(thisDir);
parseCFile(cFile, targetFile, out, trampolineFile, nearSlot + 8);
//printf("%s --> %s\n", cFile, targetFile);
free(cFile);
free(targetFile);
}
}
free(cFile);
}
closedir(dir);
free(sourceDir);

BIN
work/sprites/assets/apache.xcf (Stored with Git LFS) Normal file

Binary file not shown.