diff --git a/README b/README index bb3e3f8..10550d5 100644 --- a/README +++ b/README @@ -35,7 +35,7 @@ SCRIPTS build-aesprite.sh - Downloads and builds the latest Aesprite. -build-header-tool.sh - Builds the included header tool. See below. +build-tools.sh - Builds the included header and image conversion tools. build-llvm-mos.sh - Builds the latest llvm-mos toolchain. @@ -59,6 +59,16 @@ The included header tool allows you to add a KUP, PGX, or PGZ program header to a raw binary generated by llvm-mos or Merlin. Look at the examples for samples. +IMAGE CONVERTER +=============== + +The image converter loads images of various formats and attempts to convert them +into a format usable by TinyVicky. It's not very smart. Images need to be the +proper size for your intended use and have 256 or fewer colors. The result of +the conversion will be a "clut" file with the color lookup table in it as well +as an "indexed" file of the pixels in your image mapped to the color table. + + EXAMPLES ======== diff --git a/examples/lines/CMakeLists.txt b/examples/lines/CMakeLists.txt new file mode 100644 index 0000000..1654f9d --- /dev/null +++ b/examples/lines/CMakeLists.txt @@ -0,0 +1,50 @@ +# +# 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} +) diff --git a/examples/lines/build.sh b/examples/lines/build.sh new file mode 100755 index 0000000..755e1b5 --- /dev/null +++ b/examples/lines/build.sh @@ -0,0 +1,52 @@ +#!/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/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 diff --git a/examples/lines/foenixmgr.ini b/examples/lines/foenixmgr.ini new file mode 100644 index 0000000..c6ab319 --- /dev/null +++ b/examples/lines/foenixmgr.ini @@ -0,0 +1,7 @@ +[DEFAULT] +port=/dev/ttyUSB1 +labels=sample.lbl +flash_address=380000 +chunk_size=1024 +cpu=65c02 +data_rate=6000000 \ No newline at end of file diff --git a/examples/lines/lines.c b/examples/lines/lines.c new file mode 100644 index 0000000..a4bd54f --- /dev/null +++ b/examples/lines/lines.c @@ -0,0 +1,61 @@ +/* + * 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" + + +int main(void) { + uint16_t x; + uint16_t y; + uint16_t x2; + uint16_t y2; + uint16_t mx; + uint16_t my; + byte l; + byte c = 0; + + f256Init(); + + for (l=0; l