diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index c755a45..47545a2 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1 +1,21 @@ +add_subdirectory(vga_ants) +add_subdirectory(vga_balloons) +add_subdirectory(vga_draw) +add_subdirectory(vga_earth) +add_subdirectory(vga_eggs) +add_subdirectory(vga_fifteen) +add_subdirectory(vga_flag) +add_subdirectory(vga_ghostracing) +add_subdirectory(vga_gingerhouse) add_subdirectory(vga_hello) +add_subdirectory(vga_hypno) +add_subdirectory(vga_levelmeter) +add_subdirectory(vga_life) +add_subdirectory(vga_lines) +add_subdirectory(vga_mandelbrot) +add_subdirectory(vga_matrixrain) +add_subdirectory(vga_maze) +add_subdirectory(vga_monoscope) +add_subdirectory(vga_oscilloscope) +add_subdirectory(vga_pacman) +add_subdirectory(vga_pi) diff --git a/examples/vga_ants/CMakeLists.txt b/examples/vga_ants/CMakeLists.txt new file mode 100644 index 0000000..31b8148 --- /dev/null +++ b/examples/vga_ants/CMakeLists.txt @@ -0,0 +1,49 @@ +add_executable(vga_ants + src/main.cpp + src/game.cpp + img/background.cpp + img/blacksreds.cpp + img/cards.cpp + img/castle.cpp + img/castle_shadow.cpp + img/cloud.cpp + img/cursor.cpp + img/fence.cpp + img/fence_shadow.cpp + img/flags.cpp + img/grass.cpp + img/open.cpp + img/open_sel.cpp + img/open_sel2.cpp + img/select.cpp + img/state.cpp + img/title.cpp + img/title2.cpp + img/trumpet.cpp + img/win.cpp + snd/applause.cpp + snd/birds.cpp + snd/build_castle.cpp + snd/build_fence.cpp + snd/card.cpp + snd/curse.cpp + snd/decrease_stocks.cpp + snd/fanfares.cpp + snd/increase_power.cpp + snd/increase_stocks.cpp + snd/ruin_castle.cpp + snd/ruin_fence.cpp +) + +add_picovga(vga_ants) + +# for vga_config.h include +target_include_directories(vga_ants PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_ants) + +# Allow stdio to USB +pico_enable_stdio_usb(vga_ants 1) \ No newline at end of file diff --git a/examples/vga_ants/img/background.cpp b/examples/vga_ants/img/background.cpp index 4bca377..af87254 100644 --- a/examples/vga_ants/img/background.cpp +++ b/examples/vga_ants/img/background.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 512 pixels diff --git a/examples/vga_ants/img/blacksreds.cpp b/examples/vga_ants/img/blacksreds.cpp index 82056d4..372c0bc 100644 --- a/examples/vga_ants/img/blacksreds.cpp +++ b/examples/vga_ants/img/blacksreds.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels diff --git a/examples/vga_ants/img/cards.cpp b/examples/vga_ants/img/cards.cpp index 3f58076..7688c3f 100644 --- a/examples/vga_ants/img/cards.cpp +++ b/examples/vga_ants/img/cards.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 2112 pixels diff --git a/examples/vga_ants/img/castle.cpp b/examples/vga_ants/img/castle.cpp index 701b2a2..e6d8d56 100644 --- a/examples/vga_ants/img/castle.cpp +++ b/examples/vga_ants/img/castle.cpp @@ -1,5 +1,4 @@ -#include "include.h" - +#include "main.h" // format: 8-bit pixel graphics // image width: 256 pixels // image height: 232 lines diff --git a/examples/vga_ants/img/castle_shadow.cpp b/examples/vga_ants/img/castle_shadow.cpp index 2ba471c..fc1714d 100644 --- a/examples/vga_ants/img/castle_shadow.cpp +++ b/examples/vga_ants/img/castle_shadow.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 228 pixels diff --git a/examples/vga_ants/img/cloud.cpp b/examples/vga_ants/img/cloud.cpp index 3e563a6..8830d90 100644 --- a/examples/vga_ants/img/cloud.cpp +++ b/examples/vga_ants/img/cloud.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 32 pixels diff --git a/examples/vga_ants/img/cursor.cpp b/examples/vga_ants/img/cursor.cpp index 19683b4..9430d1a 100644 --- a/examples/vga_ants/img/cursor.cpp +++ b/examples/vga_ants/img/cursor.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 32 pixels diff --git a/examples/vga_ants/img/fence.cpp b/examples/vga_ants/img/fence.cpp index eb46547..154ba7d 100644 --- a/examples/vga_ants/img/fence.cpp +++ b/examples/vga_ants/img/fence.cpp @@ -1,5 +1,4 @@ -#include "include.h" - +#include "main.h" // format: 8-bit pixel graphics // image width: 8 pixels // image height: 216 lines diff --git a/examples/vga_ants/img/fence_shadow.cpp b/examples/vga_ants/img/fence_shadow.cpp index 1f3e3fd..bace4fc 100644 --- a/examples/vga_ants/img/fence_shadow.cpp +++ b/examples/vga_ants/img/fence_shadow.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 100 pixels diff --git a/examples/vga_ants/img/flags.cpp b/examples/vga_ants/img/flags.cpp index 1a98644..7d1e2d5 100644 --- a/examples/vga_ants/img/flags.cpp +++ b/examples/vga_ants/img/flags.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 256 pixels diff --git a/examples/vga_ants/img/grass.cpp b/examples/vga_ants/img/grass.cpp index b751e17..6134e98 100644 --- a/examples/vga_ants/img/grass.cpp +++ b/examples/vga_ants/img/grass.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 160 pixels diff --git a/examples/vga_ants/img/open.cpp b/examples/vga_ants/img/open.cpp index f001a64..d6b87c9 100644 --- a/examples/vga_ants/img/open.cpp +++ b/examples/vga_ants/img/open.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 384 pixels diff --git a/examples/vga_ants/img/open_sel.cpp b/examples/vga_ants/img/open_sel.cpp index 7f35fa9..1fbad52 100644 --- a/examples/vga_ants/img/open_sel.cpp +++ b/examples/vga_ants/img/open_sel.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 512 pixels diff --git a/examples/vga_ants/img/open_sel2.cpp b/examples/vga_ants/img/open_sel2.cpp index 2eedeb8..2e2ae54 100644 --- a/examples/vga_ants/img/open_sel2.cpp +++ b/examples/vga_ants/img/open_sel2.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels diff --git a/examples/vga_ants/img/select.cpp b/examples/vga_ants/img/select.cpp index 6e46cb4..6c9fcc7 100644 --- a/examples/vga_ants/img/select.cpp +++ b/examples/vga_ants/img/select.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 216 pixels diff --git a/examples/vga_ants/img/state.cpp b/examples/vga_ants/img/state.cpp index 64a2a4a..b892e56 100644 --- a/examples/vga_ants/img/state.cpp +++ b/examples/vga_ants/img/state.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 72 pixels diff --git a/examples/vga_ants/img/title.cpp b/examples/vga_ants/img/title.cpp index 248c5a6..82602ab 100644 --- a/examples/vga_ants/img/title.cpp +++ b/examples/vga_ants/img/title.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 224 pixels diff --git a/examples/vga_ants/img/title2.cpp b/examples/vga_ants/img/title2.cpp index 3cbaab4..958e4a3 100644 --- a/examples/vga_ants/img/title2.cpp +++ b/examples/vga_ants/img/title2.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 96 pixels diff --git a/examples/vga_ants/img/trumpet.cpp b/examples/vga_ants/img/trumpet.cpp index e804daf..382316c 100644 --- a/examples/vga_ants/img/trumpet.cpp +++ b/examples/vga_ants/img/trumpet.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 64 pixels diff --git a/examples/vga_ants/img/win.cpp b/examples/vga_ants/img/win.cpp index 0c5bf59..e8fb241 100644 --- a/examples/vga_ants/img/win.cpp +++ b/examples/vga_ants/img/win.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 1024 pixels diff --git a/examples/vga_ants/snd/applause.cpp b/examples/vga_ants/snd/applause.cpp index 21da2a0..f00e9b3 100644 --- a/examples/vga_ants/snd/applause.cpp +++ b/examples/vga_ants/snd/applause.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 ApplauseSnd[29304] = { diff --git a/examples/vga_ants/snd/birds.cpp b/examples/vga_ants/snd/birds.cpp index beceb18..edc6975 100644 --- a/examples/vga_ants/snd/birds.cpp +++ b/examples/vga_ants/snd/birds.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 BirdsSnd[192184] = { diff --git a/examples/vga_ants/snd/build_castle.cpp b/examples/vga_ants/snd/build_castle.cpp index 82c1a05..aba503c 100644 --- a/examples/vga_ants/snd/build_castle.cpp +++ b/examples/vga_ants/snd/build_castle.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 BuildCastleSnd[19444] = { diff --git a/examples/vga_ants/snd/build_fence.cpp b/examples/vga_ants/snd/build_fence.cpp index c75b167..621a89b 100644 --- a/examples/vga_ants/snd/build_fence.cpp +++ b/examples/vga_ants/snd/build_fence.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 BuildFenceSnd[10618] = { diff --git a/examples/vga_ants/snd/card.cpp b/examples/vga_ants/snd/card.cpp index af8bbe5..d81b4a0 100644 --- a/examples/vga_ants/snd/card.cpp +++ b/examples/vga_ants/snd/card.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 CardSnd[2388] = { diff --git a/examples/vga_ants/snd/curse.cpp b/examples/vga_ants/snd/curse.cpp index 5aa8060..9761ab6 100644 --- a/examples/vga_ants/snd/curse.cpp +++ b/examples/vga_ants/snd/curse.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 CurseSnd[35080] = { diff --git a/examples/vga_ants/snd/decrease_stocks.cpp b/examples/vga_ants/snd/decrease_stocks.cpp index 8f0fbce..fdb190c 100644 --- a/examples/vga_ants/snd/decrease_stocks.cpp +++ b/examples/vga_ants/snd/decrease_stocks.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 DecreaseStocksSnd[12210] = { diff --git a/examples/vga_ants/snd/fanfares.cpp b/examples/vga_ants/snd/fanfares.cpp index 07147f6..7db0126 100644 --- a/examples/vga_ants/snd/fanfares.cpp +++ b/examples/vga_ants/snd/fanfares.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 FanfaresSnd[59678] = { diff --git a/examples/vga_ants/snd/increase_power.cpp b/examples/vga_ants/snd/increase_power.cpp index 9777c6a..58b56f9 100644 --- a/examples/vga_ants/snd/increase_power.cpp +++ b/examples/vga_ants/snd/increase_power.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 IncreasePowerSnd[24338] = { diff --git a/examples/vga_ants/snd/increase_stocks.cpp b/examples/vga_ants/snd/increase_stocks.cpp index f413445..cb48f51 100644 --- a/examples/vga_ants/snd/increase_stocks.cpp +++ b/examples/vga_ants/snd/increase_stocks.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 IncreaseStocksSnd[16588] = { diff --git a/examples/vga_ants/snd/ruin_castle.cpp b/examples/vga_ants/snd/ruin_castle.cpp index 8ae79eb..174b559 100644 --- a/examples/vga_ants/snd/ruin_castle.cpp +++ b/examples/vga_ants/snd/ruin_castle.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 RuinCastleSnd[23724] = { diff --git a/examples/vga_ants/snd/ruin_fence.cpp b/examples/vga_ants/snd/ruin_fence.cpp index 4f58622..768a137 100644 --- a/examples/vga_ants/snd/ruin_fence.cpp +++ b/examples/vga_ants/snd/ruin_fence.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 RuinFenceSnd[9134] = { diff --git a/examples/vga_ants/src/game.cpp b/examples/vga_ants/src/game.cpp index af5bc3e..1afa94c 100644 --- a/examples/vga_ants/src/game.cpp +++ b/examples/vga_ants/src/game.cpp @@ -5,7 +5,9 @@ // // **************************************************************************** -#include "include.h" +#include "picovga.h" +#include "game.h" +#include "main.h" const int CastleX[2] = { 72+16, WIDTH-72-16-128 }; // castle X coordinate const int FenceX[2] = { 72+160, WIDTH-72-160-8 }; // fence X coordinate diff --git a/examples/vga_ants/src/include.h b/examples/vga_ants/src/include.h deleted file mode 100644 index 1abe335..0000000 --- a/examples/vga_ants/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../../global.h" // global common definitions - -// main -#include "main.h" // main code -#include "game.h" // game engine diff --git a/examples/vga_ants/src/main.cpp b/examples/vga_ants/src/main.cpp index 442581d..68654cb 100644 --- a/examples/vga_ants/src/main.cpp +++ b/examples/vga_ants/src/main.cpp @@ -5,7 +5,9 @@ // // **************************************************************************** -#include "include.h" +#include "pico/printf.h" +#include "main.h" // main code +#include "game.h" // game engine // draw box ALIGNED u8 Box[WIDTH*HEIGHT]; @@ -258,8 +260,7 @@ void DispOpen() DrawImg(&Canvas, &Title2Canvas, 210, 92, 0, 0, 96, 80); // display open text - int y = 192; - int i; + uint i; for (i = 0; i < count_of(OpenText); i++) { DrawText(&Canvas, OpenText[i], 8, 192+i*10, COL_WHITE, FontBold8x8); diff --git a/examples/vga_ants/src/main.h b/examples/vga_ants/src/main.h index 6f5a992..e34b89e 100644 --- a/examples/vga_ants/src/main.h +++ b/examples/vga_ants/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + #define WIDTH 512 // screen width #define HEIGHT 400 // screen height diff --git a/examples/vga_balloons/CMakeLists.txt b/examples/vga_balloons/CMakeLists.txt new file mode 100644 index 0000000..a3cbe19 --- /dev/null +++ b/examples/vga_balloons/CMakeLists.txt @@ -0,0 +1,22 @@ +add_executable(vga_balloons + src/main.cpp + img/clouds.cpp + img/hotair.cpp + img/blue.cpp + img/green.cpp + img/red.cpp + img/yellow.cpp +) + +add_picovga(vga_balloons) + +# for vga_config.h include +target_include_directories(vga_balloons PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_balloons) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file diff --git a/examples/vga_balloons/Makefile b/examples/vga_balloons/Makefile deleted file mode 100644 index 36ba5da..0000000 --- a/examples/vga_balloons/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp -SRC += img/clouds.cpp -SRC += img/hotair.cpp -SRC += img/blue.cpp -SRC += img/green.cpp -SRC += img/red.cpp -SRC += img/yellow.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -#DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_balloons/img/blue.cpp b/examples/vga_balloons/img/blue.cpp index 97bd8e9..bc1b1c9 100644 --- a/examples/vga_balloons/img/blue.cpp +++ b/examples/vga_balloons/img/blue.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 64 pixels diff --git a/examples/vga_balloons/img/clouds.cpp b/examples/vga_balloons/img/clouds.cpp index 17f8c9f..ac4110c 100644 --- a/examples/vga_balloons/img/clouds.cpp +++ b/examples/vga_balloons/img/clouds.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 440 pixels diff --git a/examples/vga_balloons/img/green.cpp b/examples/vga_balloons/img/green.cpp index a3616d7..fd5358e 100644 --- a/examples/vga_balloons/img/green.cpp +++ b/examples/vga_balloons/img/green.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 64 pixels diff --git a/examples/vga_balloons/img/hotair.cpp b/examples/vga_balloons/img/hotair.cpp index 4c1b152..c5d79b3 100644 --- a/examples/vga_balloons/img/hotair.cpp +++ b/examples/vga_balloons/img/hotair.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels diff --git a/examples/vga_balloons/img/red.cpp b/examples/vga_balloons/img/red.cpp index 12b8ed8..ac69cad 100644 --- a/examples/vga_balloons/img/red.cpp +++ b/examples/vga_balloons/img/red.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 64 pixels diff --git a/examples/vga_balloons/img/yellow.cpp b/examples/vga_balloons/img/yellow.cpp index bb04261..00eee1b 100644 --- a/examples/vga_balloons/img/yellow.cpp +++ b/examples/vga_balloons/img/yellow.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 64 pixels diff --git a/examples/vga_balloons/src/include.h b/examples/vga_balloons/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_balloons/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_balloons/src/main.cpp b/examples/vga_balloons/src/main.cpp index dde9323..3c60ea3 100644 --- a/examples/vga_balloons/src/main.cpp +++ b/examples/vga_balloons/src/main.cpp @@ -5,7 +5,8 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include // clouds copy ALIGNED u8 CloudsImg_Copy[sizeof(CloudsImg)]; @@ -205,7 +206,7 @@ int main() CopyWhiteImg(YellowImg_Copy, YellowImg, sizeof(YellowImg)); // run VGA core - multicore_launch_core1(VgaCore); + StartVgaCore(); // initialize videomode VideoInit(); diff --git a/examples/vga_balloons/src/main.h b/examples/vga_balloons/src/main.h index 9ab6ae4..74eae73 100644 --- a/examples/vga_balloons/src/main.h +++ b/examples/vga_balloons/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + // screen resolution #define WIDTH 640 // screen width #define HEIGHT 480 // screen height diff --git a/examples/vga_draw/CMakeLists.txt b/examples/vga_draw/CMakeLists.txt new file mode 100644 index 0000000..d999951 --- /dev/null +++ b/examples/vga_draw/CMakeLists.txt @@ -0,0 +1,25 @@ +add_executable(vga_draw + img/rpi1.cpp + img/rpi2.cpp + img/rpi4.cpp + img/rpi8.cpp + img/peter1.cpp + img/peter2.cpp + img/peter4.cpp + img/peter8.cpp + + src/main.cpp +) + +add_picovga(vga_draw) + +# for vga_config.h include +target_include_directories(vga_draw PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_draw) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_draw 1) \ No newline at end of file diff --git a/examples/vga_draw/img/peter1.cpp b/examples/vga_draw/img/peter1.cpp index c6a7456..dae792b 100644 --- a/examples/vga_draw/img/peter1.cpp +++ b/examples/vga_draw/img/peter1.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 1-bit pixel graphics // image width: 32 pixels diff --git a/examples/vga_draw/img/peter2.cpp b/examples/vga_draw/img/peter2.cpp index 93444c9..844d7a5 100644 --- a/examples/vga_draw/img/peter2.cpp +++ b/examples/vga_draw/img/peter2.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 2-bit pixel graphics // image width: 32 pixels diff --git a/examples/vga_draw/img/peter4.cpp b/examples/vga_draw/img/peter4.cpp index a103341..46c1b73 100644 --- a/examples/vga_draw/img/peter4.cpp +++ b/examples/vga_draw/img/peter4.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 4-bit pixel graphics // image width: 32 pixels diff --git a/examples/vga_draw/img/peter8.cpp b/examples/vga_draw/img/peter8.cpp index 26959f4..198a72c 100644 --- a/examples/vga_draw/img/peter8.cpp +++ b/examples/vga_draw/img/peter8.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 32 pixels diff --git a/examples/vga_draw/img/rpi1.cpp b/examples/vga_draw/img/rpi1.cpp index a98134e..278f3c6 100644 --- a/examples/vga_draw/img/rpi1.cpp +++ b/examples/vga_draw/img/rpi1.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 1-bit pixel graphics // image width: 32 pixels diff --git a/examples/vga_draw/img/rpi2.cpp b/examples/vga_draw/img/rpi2.cpp index e94ca29..9793e6a 100644 --- a/examples/vga_draw/img/rpi2.cpp +++ b/examples/vga_draw/img/rpi2.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 2-bit pixel graphics // image width: 32 pixels diff --git a/examples/vga_draw/img/rpi4.cpp b/examples/vga_draw/img/rpi4.cpp index 8becd3e..46720f4 100644 --- a/examples/vga_draw/img/rpi4.cpp +++ b/examples/vga_draw/img/rpi4.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 4-bit pixel graphics // image width: 32 pixels diff --git a/examples/vga_draw/img/rpi8.cpp b/examples/vga_draw/img/rpi8.cpp index e2c7f88..654a336 100644 --- a/examples/vga_draw/img/rpi8.cpp +++ b/examples/vga_draw/img/rpi8.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 32 pixels diff --git a/examples/vga_draw/src/include.h b/examples/vga_draw/src/include.h deleted file mode 100644 index 9ac0db4..0000000 --- a/examples/vga_draw/src/include.h +++ /dev/null @@ -1,66 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// images - -// format: 1-bit pixel graphics -// image width: 32 pixels -// image height: 40 lines -// image pitch: 4 bytes -extern const u8 RPi1Img[160] __attribute__ ((aligned(4))); - -// format: 2-bit pixel graphics -// image width: 32 pixels -// image height: 40 lines -// image pitch: 8 bytes -extern const u8 RPi2Img[320] __attribute__ ((aligned(4))); - -// format: 4-bit pixel graphics -// image width: 32 pixels -// image height: 40 lines -// image pitch: 16 bytes -extern const u8 RPi4Img[640] __attribute__ ((aligned(4))); - -// format: 8-bit pixel graphics -// image width: 32 pixels -// image height: 40 lines -// image pitch: 32 bytes -extern const u8 RPi8Img[1280] __attribute__ ((aligned(4))); - -// format: 1-bit pixel graphics -// image width: 32 pixels -// image height: 32 lines -// image pitch: 4 bytes -extern const u8 Peter1Img[128] __attribute__ ((aligned(4))); - -// format: 2-bit pixel graphics -// image width: 32 pixels -// image height: 32 lines -// image pitch: 8 bytes -extern const u8 Peter2Img[256] __attribute__ ((aligned(4))); - -// format: 4-bit pixel graphics -// image width: 32 pixels -// image height: 32 lines -// image pitch: 16 bytes -extern const u8 Peter4Img[512] __attribute__ ((aligned(4))); - -// format: 8-bit pixel graphics -// image width: 32 pixels -// image height: 32 lines -// image pitch: 32 bytes -extern const u8 Peter8Img[1024] __attribute__ ((aligned(4))); - -// main -#include "main.h" // main code diff --git a/examples/vga_draw/src/main.cpp b/examples/vga_draw/src/main.cpp index b904f74..23a9994 100644 --- a/examples/vga_draw/src/main.cpp +++ b/examples/vga_draw/src/main.cpp @@ -5,7 +5,8 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include // Draw box #if FORMAT==CANVAS_PLANE2 @@ -133,7 +134,7 @@ int main() u32 t, t2; // run VGA core - multicore_launch_core1(VgaCore); + StartVgaCore(); // initialize videomode VideoInit(); diff --git a/examples/vga_draw/src/main.h b/examples/vga_draw/src/main.h index ec9e524..73f3703 100644 --- a/examples/vga_draw/src/main.h +++ b/examples/vga_draw/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + // used canvas format #define FORMAT CANVAS_8 // 8-bit pixels //#define FORMAT CANVAS_4 // 4-bit pixels @@ -60,4 +62,53 @@ #define IMG2HEIGHT 32 // image 2 height #define IMG2WIDTHBYTE (IMG2WIDTH/(WIDTH/WIDTHBYTE)) // bytes per line of image 2 +// format: 1-bit pixel graphics +// image width: 32 pixels +// image height: 40 lines +// image pitch: 4 bytes +extern const u8 RPi1Img[160] __attribute__ ((aligned(4))); + +// format: 2-bit pixel graphics +// image width: 32 pixels +// image height: 40 lines +// image pitch: 8 bytes +extern const u8 RPi2Img[320] __attribute__ ((aligned(4))); + +// format: 4-bit pixel graphics +// image width: 32 pixels +// image height: 40 lines +// image pitch: 16 bytes +extern const u8 RPi4Img[640] __attribute__ ((aligned(4))); + +// format: 8-bit pixel graphics +// image width: 32 pixels +// image height: 40 lines +// image pitch: 32 bytes +extern const u8 RPi8Img[1280] __attribute__ ((aligned(4))); + +// format: 1-bit pixel graphics +// image width: 32 pixels +// image height: 32 lines +// image pitch: 4 bytes +extern const u8 Peter1Img[128] __attribute__ ((aligned(4))); + +// format: 2-bit pixel graphics +// image width: 32 pixels +// image height: 32 lines +// image pitch: 8 bytes +extern const u8 Peter2Img[256] __attribute__ ((aligned(4))); + +// format: 4-bit pixel graphics +// image width: 32 pixels +// image height: 32 lines +// image pitch: 16 bytes +extern const u8 Peter4Img[512] __attribute__ ((aligned(4))); + +// format: 8-bit pixel graphics +// image width: 32 pixels +// image height: 32 lines +// image pitch: 32 bytes +extern const u8 Peter8Img[1024] __attribute__ ((aligned(4))); + + #endif // _MAIN_H diff --git a/examples/vga_earth/CMakeLists.txt b/examples/vga_earth/CMakeLists.txt new file mode 100644 index 0000000..233cad4 --- /dev/null +++ b/examples/vga_earth/CMakeLists.txt @@ -0,0 +1,18 @@ +add_executable(vga_earth + src/main.cpp + img/earth1.cpp + img/earth2.cpp +) + +add_picovga(vga_earth) + +# for vga_config.h include +target_include_directories(vga_earth PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_earth) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_earth 1) \ No newline at end of file diff --git a/examples/vga_earth/Makefile b/examples/vga_earth/Makefile deleted file mode 100644 index 7d2c9f0..0000000 --- a/examples/vga_earth/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp -SRC += img/earth1.cpp -SRC += img/earth2.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -#DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_earth/img/earth1.cpp b/examples/vga_earth/img/earth1.cpp index 54781dc..1721932 100644 --- a/examples/vga_earth/img/earth1.cpp +++ b/examples/vga_earth/img/earth1.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 1024 pixels diff --git a/examples/vga_earth/img/earth2.cpp b/examples/vga_earth/img/earth2.cpp index 0878e15..828ed21 100644 --- a/examples/vga_earth/img/earth2.cpp +++ b/examples/vga_earth/img/earth2.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 1024 pixels diff --git a/examples/vga_earth/src/include.h b/examples/vga_earth/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_earth/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_earth/src/main.cpp b/examples/vga_earth/src/main.cpp index 1adbfc4..b48f4ab 100644 --- a/examples/vga_earth/src/main.cpp +++ b/examples/vga_earth/src/main.cpp @@ -5,7 +5,8 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include #define USERANDSHADOW 1 // 1=use random shadow (or rastered shadow otherwise) diff --git a/examples/vga_earth/src/main.h b/examples/vga_earth/src/main.h index c7c36ae..b8d319c 100644 --- a/examples/vga_earth/src/main.h +++ b/examples/vga_earth/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + // screen resolution #define WIDTH 512 // screen width #define HEIGHT 400 // screen height diff --git a/examples/vga_eggs/CMakeLists.txt b/examples/vga_eggs/CMakeLists.txt new file mode 100644 index 0000000..3ec9120 --- /dev/null +++ b/examples/vga_eggs/CMakeLists.txt @@ -0,0 +1,25 @@ +add_executable(vga_eggs + src/main.cpp + snd/fanfare.cpp + snd/mapple.cpp + snd/beep.cpp + snd/beep2.cpp + img/computer.cpp + img/frame.cpp + img/open.cpp + img/select.cpp + img/tiles.cpp +) + +add_picovga(vga_eggs) + +# for vga_config.h include +target_include_directories(vga_eggs PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_eggs) + +# Allow stdio to USB +pico_enable_stdio_usb(vga_eggs 1) \ No newline at end of file diff --git a/examples/vga_eggs/img/computer.cpp b/examples/vga_eggs/img/computer.cpp index e9d2851..7b723a4 100644 --- a/examples/vga_eggs/img/computer.cpp +++ b/examples/vga_eggs/img/computer.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 16 pixels diff --git a/examples/vga_eggs/img/frame.cpp b/examples/vga_eggs/img/frame.cpp index 03a266c..6f66bf4 100644 --- a/examples/vga_eggs/img/frame.cpp +++ b/examples/vga_eggs/img/frame.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels diff --git a/examples/vga_eggs/img/open.cpp b/examples/vga_eggs/img/open.cpp index 7256b9e..a2e6ceb 100644 --- a/examples/vga_eggs/img/open.cpp +++ b/examples/vga_eggs/img/open.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 512 pixels diff --git a/examples/vga_eggs/img/select.cpp b/examples/vga_eggs/img/select.cpp index 60ef1a0..b32a13e 100644 --- a/examples/vga_eggs/img/select.cpp +++ b/examples/vga_eggs/img/select.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels diff --git a/examples/vga_eggs/img/tiles.cpp b/examples/vga_eggs/img/tiles.cpp index 75241a9..c98519e 100644 --- a/examples/vga_eggs/img/tiles.cpp +++ b/examples/vga_eggs/img/tiles.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 32 pixels diff --git a/examples/vga_eggs/snd/beep.cpp b/examples/vga_eggs/snd/beep.cpp index ed3d9c9..fa41a24 100644 --- a/examples/vga_eggs/snd/beep.cpp +++ b/examples/vga_eggs/snd/beep.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 BeepSnd[1102] = { diff --git a/examples/vga_eggs/snd/beep2.cpp b/examples/vga_eggs/snd/beep2.cpp index 72b4d68..6afa51c 100644 --- a/examples/vga_eggs/snd/beep2.cpp +++ b/examples/vga_eggs/snd/beep2.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 Beep2Snd[1764] = { diff --git a/examples/vga_eggs/snd/fanfare.cpp b/examples/vga_eggs/snd/fanfare.cpp index 0fdf152..7b51734 100644 --- a/examples/vga_eggs/snd/fanfare.cpp +++ b/examples/vga_eggs/snd/fanfare.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 FanfareSnd[74871] = { diff --git a/examples/vga_eggs/snd/mapple.cpp b/examples/vga_eggs/snd/mapple.cpp index 88c5eb4..2b0dbf4 100644 --- a/examples/vga_eggs/snd/mapple.cpp +++ b/examples/vga_eggs/snd/mapple.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 MappleSnd[384007] = { diff --git a/examples/vga_eggs/src/include.h b/examples/vga_eggs/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_eggs/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_eggs/src/main.cpp b/examples/vga_eggs/src/main.cpp index 9ffd2ae..53dfccd 100644 --- a/examples/vga_eggs/src/main.cpp +++ b/examples/vga_eggs/src/main.cpp @@ -5,7 +5,9 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include +#include "pico/printf.h" // Draw box ALIGNED u8 Box[WIDTH*HEIGHT]; @@ -151,7 +153,7 @@ u8 GetStones(s8 x, s8 y) void DispPos() { s8 x, y; - u8 stones; + // u8 stones; u8 c; // clear number of possible positions diff --git a/examples/vga_eggs/src/main.h b/examples/vga_eggs/src/main.h index da49066..fa008f9 100644 --- a/examples/vga_eggs/src/main.h +++ b/examples/vga_eggs/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + // control keys #define KEY_R 'L' // right #define KEY_U 'I' // up diff --git a/examples/vga_fifteen/CMakeLists.txt b/examples/vga_fifteen/CMakeLists.txt new file mode 100644 index 0000000..882ea47 --- /dev/null +++ b/examples/vga_fifteen/CMakeLists.txt @@ -0,0 +1,21 @@ +add_executable(vga_fifteen + src/main.cpp + img/tiles.cpp + snd/move.cpp + snd/bump.cpp + snd/shuffling.cpp + snd/fanfare.cpp +) + +add_picovga(vga_fifteen) + +# for vga_config.h include +target_include_directories(vga_fifteen PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_fifteen) + +# Allow stdio to USB +pico_enable_stdio_usb(vga_fifteen 1) \ No newline at end of file diff --git a/examples/vga_fifteen/Makefile b/examples/vga_fifteen/Makefile deleted file mode 100644 index 0335f88..0000000 --- a/examples/vga_fifteen/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp -SRC += img/tiles.cpp -SRC += snd/move.cpp -SRC += snd/bump.cpp -SRC += snd/shuffling.cpp -SRC += snd/fanfare.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_fifteen/img/tiles.cpp b/examples/vga_fifteen/img/tiles.cpp index 5e550ad..e753e04 100644 --- a/examples/vga_fifteen/img/tiles.cpp +++ b/examples/vga_fifteen/img/tiles.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 48 pixels diff --git a/examples/vga_fifteen/snd/bump.cpp b/examples/vga_fifteen/snd/bump.cpp index 23059d7..f2ce0ff 100644 --- a/examples/vga_fifteen/snd/bump.cpp +++ b/examples/vga_fifteen/snd/bump.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 BumpSnd[1012] = { diff --git a/examples/vga_fifteen/snd/fanfare.cpp b/examples/vga_fifteen/snd/fanfare.cpp index 0fdf152..7b51734 100644 --- a/examples/vga_fifteen/snd/fanfare.cpp +++ b/examples/vga_fifteen/snd/fanfare.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 FanfareSnd[74871] = { diff --git a/examples/vga_fifteen/snd/move.cpp b/examples/vga_fifteen/snd/move.cpp index 7987f66..da2d5a6 100644 --- a/examples/vga_fifteen/snd/move.cpp +++ b/examples/vga_fifteen/snd/move.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 MoveSnd[2354] = { diff --git a/examples/vga_fifteen/snd/shuffling.cpp b/examples/vga_fifteen/snd/shuffling.cpp index 72eec2f..b1b5ded 100644 --- a/examples/vga_fifteen/snd/shuffling.cpp +++ b/examples/vga_fifteen/snd/shuffling.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 ShufflingSnd[5620] = { diff --git a/examples/vga_fifteen/src/include.h b/examples/vga_fifteen/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_fifteen/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_fifteen/src/main.cpp b/examples/vga_fifteen/src/main.cpp index 64d04b0..379e60c 100644 --- a/examples/vga_fifteen/src/main.cpp +++ b/examples/vga_fifteen/src/main.cpp @@ -5,7 +5,9 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include "pico/printf.h" +#include // copy of tiles images ALIGNED u8 TilesImg_Copy[sizeof(TilesImg)]; diff --git a/examples/vga_fifteen/src/main.h b/examples/vga_fifteen/src/main.h index 6c5095f..ac2cab8 100644 --- a/examples/vga_fifteen/src/main.h +++ b/examples/vga_fifteen/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + #define WIDTH 256 // width of screen #define HEIGHT 192 // screen height #define TILEW 48 // tile width diff --git a/examples/vga_flag/CMakeLists.txt b/examples/vga_flag/CMakeLists.txt new file mode 100644 index 0000000..3da159b --- /dev/null +++ b/examples/vga_flag/CMakeLists.txt @@ -0,0 +1,19 @@ +add_executable(vga_flag + src/main.cpp + img/clouds.cpp + img/flag.cpp + img/mast.cpp +) + +add_picovga(vga_flag) + +# for vga_config.h include +target_include_directories(vga_flag PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_flag) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file diff --git a/examples/vga_flag/Makefile b/examples/vga_flag/Makefile deleted file mode 100644 index c06ed28..0000000 --- a/examples/vga_flag/Makefile +++ /dev/null @@ -1,68 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp -SRC += img/clouds.cpp -SRC += img/flag.cpp -SRC += img/mast.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -#DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_flag/img/clouds.cpp b/examples/vga_flag/img/clouds.cpp index c1c0e61..bf109e5 100644 --- a/examples/vga_flag/img/clouds.cpp +++ b/examples/vga_flag/img/clouds.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 512 pixels diff --git a/examples/vga_flag/img/flag.cpp b/examples/vga_flag/img/flag.cpp index 21bdf75..35c0796 100644 --- a/examples/vga_flag/img/flag.cpp +++ b/examples/vga_flag/img/flag.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 360 pixels diff --git a/examples/vga_flag/img/mast.cpp b/examples/vga_flag/img/mast.cpp index 7a65472..97b3aa5 100644 --- a/examples/vga_flag/img/mast.cpp +++ b/examples/vga_flag/img/mast.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 24 pixels diff --git a/examples/vga_flag/src/include.h b/examples/vga_flag/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_flag/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_flag/src/main.cpp b/examples/vga_flag/src/main.cpp index 93b2ac9..443b00e 100644 --- a/examples/vga_flag/src/main.cpp +++ b/examples/vga_flag/src/main.cpp @@ -5,7 +5,8 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include // Draw box ALIGNED u8 Box[WIDTH*HEIGHT]; diff --git a/examples/vga_flag/src/main.h b/examples/vga_flag/src/main.h index fd84ce7..81919be 100644 --- a/examples/vga_flag/src/main.h +++ b/examples/vga_flag/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + // screen resolution #define WIDTH 512 // screen width #define HEIGHT 400 // screen height diff --git a/examples/vga_ghostracing/CMakeLists.txt b/examples/vga_ghostracing/CMakeLists.txt new file mode 100644 index 0000000..a5daa95 --- /dev/null +++ b/examples/vga_ghostracing/CMakeLists.txt @@ -0,0 +1,27 @@ +add_executable(vga_ghostracing + img/tiles.cpp + img/skyline.cpp + img/car1.cpp + img/car2.cpp + img/car3.cpp + img/ghost1.cpp + img/ghost2.cpp + img/ghost3.cpp + img/ghost4.cpp + snd/engine.cpp + + src/main.cpp +) + +add_picovga(vga_ghostracing) + +# for vga_config.h include +target_include_directories(vga_ghostracing PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_ghostracing) + +# Allow stdio to USB +pico_enable_stdio_usb(vga_ghostracing 1) diff --git a/examples/vga_ghostracing/img/car1.cpp b/examples/vga_ghostracing/img/car1.cpp index e925dd3..c38ff53 100644 --- a/examples/vga_ghostracing/img/car1.cpp +++ b/examples/vga_ghostracing/img/car1.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels diff --git a/examples/vga_ghostracing/img/car2.cpp b/examples/vga_ghostracing/img/car2.cpp index 50e9b90..3eca6b0 100644 --- a/examples/vga_ghostracing/img/car2.cpp +++ b/examples/vga_ghostracing/img/car2.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels diff --git a/examples/vga_ghostracing/img/car3.cpp b/examples/vga_ghostracing/img/car3.cpp index ae2475f..95a45fb 100644 --- a/examples/vga_ghostracing/img/car3.cpp +++ b/examples/vga_ghostracing/img/car3.cpp @@ -1,5 +1,4 @@ -#include "include.h" - +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels // image height: 128 lines diff --git a/examples/vga_ghostracing/img/ghost1.cpp b/examples/vga_ghostracing/img/ghost1.cpp index 5ef87c3..8172708 100644 --- a/examples/vga_ghostracing/img/ghost1.cpp +++ b/examples/vga_ghostracing/img/ghost1.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels diff --git a/examples/vga_ghostracing/img/ghost2.cpp b/examples/vga_ghostracing/img/ghost2.cpp index 0a06d84..f5f5fb5 100644 --- a/examples/vga_ghostracing/img/ghost2.cpp +++ b/examples/vga_ghostracing/img/ghost2.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels diff --git a/examples/vga_ghostracing/img/ghost3.cpp b/examples/vga_ghostracing/img/ghost3.cpp index 84a15d1..e91dc7c 100644 --- a/examples/vga_ghostracing/img/ghost3.cpp +++ b/examples/vga_ghostracing/img/ghost3.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels diff --git a/examples/vga_ghostracing/img/ghost4.cpp b/examples/vga_ghostracing/img/ghost4.cpp index 8cf0168..539122e 100644 --- a/examples/vga_ghostracing/img/ghost4.cpp +++ b/examples/vga_ghostracing/img/ghost4.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels diff --git a/examples/vga_ghostracing/img/skyline.cpp b/examples/vga_ghostracing/img/skyline.cpp index 43b6aff..99d24ff 100644 --- a/examples/vga_ghostracing/img/skyline.cpp +++ b/examples/vga_ghostracing/img/skyline.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 640 pixels diff --git a/examples/vga_ghostracing/img/tiles.cpp b/examples/vga_ghostracing/img/tiles.cpp index 897d3a8..55fc657 100644 --- a/examples/vga_ghostracing/img/tiles.cpp +++ b/examples/vga_ghostracing/img/tiles.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 64 pixels diff --git a/examples/vga_ghostracing/snd/engine.cpp b/examples/vga_ghostracing/snd/engine.cpp index 1a9b929..85226c9 100644 --- a/examples/vga_ghostracing/snd/engine.cpp +++ b/examples/vga_ghostracing/snd/engine.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 EngineSnd[6062] = { diff --git a/examples/vga_ghostracing/src/include.h b/examples/vga_ghostracing/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_ghostracing/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_ghostracing/src/main.cpp b/examples/vga_ghostracing/src/main.cpp index 38d0fae..2ef3824 100644 --- a/examples/vga_ghostracing/src/main.cpp +++ b/examples/vga_ghostracing/src/main.cpp @@ -5,7 +5,9 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include "pico/printf.h" +#include u8 Text[TEXTMAX]; // row of text ALIGNED u8 TextCol[TEXTMAX*8]; // text color gradient @@ -342,7 +344,7 @@ int main() CopyWhiteImg(Ghost4Img_Copy, Ghost4Img, sizeof(Ghost4Img)); // run VGA core - multicore_launch_core1(VgaCore); + StartVgaCore(); // initialize videomode VideoInit(170000); diff --git a/examples/vga_ghostracing/src/main.h b/examples/vga_ghostracing/src/main.h index 7d8ecac..fdb841c 100644 --- a/examples/vga_ghostracing/src/main.h +++ b/examples/vga_ghostracing/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + // screen resolution #define WIDTH 640 // screen width #define HEIGHT 480 // screen height diff --git a/examples/vga_gingerhouse/CMakeLists.txt b/examples/vga_gingerhouse/CMakeLists.txt new file mode 100644 index 0000000..12612fb --- /dev/null +++ b/examples/vga_gingerhouse/CMakeLists.txt @@ -0,0 +1,38 @@ +add_executable(vga_gingerhouse + img/01.cpp + img/02.cpp + img/03.cpp + img/04.cpp + img/05.cpp + img/06.cpp + img/07.cpp + img/08.cpp + img/09.cpp + img/10.cpp + img/11.cpp + img/12.cpp + img/13.cpp + img/14.cpp + img/15.cpp + img/16.cpp + img/17.cpp + img/18.cpp + img/19.cpp + img/20.cpp + img/22.cpp + + src/main.cpp +) + +add_picovga(vga_gingerhouse) + +# for vga_config.h include +target_include_directories(vga_gingerhouse PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_gingerhouse) + +# Allow stdio to USB +pico_enable_stdio_usb(vga_gingerhouse 1) diff --git a/examples/vga_gingerhouse/img/01.cpp b/examples/vga_gingerhouse/img/01.cpp index 4822c7e..8baac6e 100644 --- a/examples/vga_gingerhouse/img/01.cpp +++ b/examples/vga_gingerhouse/img/01.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/02.cpp b/examples/vga_gingerhouse/img/02.cpp index 3b1819d..c284b21 100644 --- a/examples/vga_gingerhouse/img/02.cpp +++ b/examples/vga_gingerhouse/img/02.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/03.cpp b/examples/vga_gingerhouse/img/03.cpp index 35bab45..8a8fbe3 100644 --- a/examples/vga_gingerhouse/img/03.cpp +++ b/examples/vga_gingerhouse/img/03.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/04.cpp b/examples/vga_gingerhouse/img/04.cpp index 79cac1c..496665c 100644 --- a/examples/vga_gingerhouse/img/04.cpp +++ b/examples/vga_gingerhouse/img/04.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/05.cpp b/examples/vga_gingerhouse/img/05.cpp index e42b410..038a27e 100644 --- a/examples/vga_gingerhouse/img/05.cpp +++ b/examples/vga_gingerhouse/img/05.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/06.cpp b/examples/vga_gingerhouse/img/06.cpp index a02a472..d650a40 100644 --- a/examples/vga_gingerhouse/img/06.cpp +++ b/examples/vga_gingerhouse/img/06.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/07.cpp b/examples/vga_gingerhouse/img/07.cpp index c9a6bba..7d4de5d 100644 --- a/examples/vga_gingerhouse/img/07.cpp +++ b/examples/vga_gingerhouse/img/07.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/08.cpp b/examples/vga_gingerhouse/img/08.cpp index 6e8a9bb..80d9198 100644 --- a/examples/vga_gingerhouse/img/08.cpp +++ b/examples/vga_gingerhouse/img/08.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/09.cpp b/examples/vga_gingerhouse/img/09.cpp index e3a60fd..3f90d25 100644 --- a/examples/vga_gingerhouse/img/09.cpp +++ b/examples/vga_gingerhouse/img/09.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/10.cpp b/examples/vga_gingerhouse/img/10.cpp index baa7ef9..2360133 100644 --- a/examples/vga_gingerhouse/img/10.cpp +++ b/examples/vga_gingerhouse/img/10.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/11.cpp b/examples/vga_gingerhouse/img/11.cpp index 2f6e6f3..5085d21 100644 --- a/examples/vga_gingerhouse/img/11.cpp +++ b/examples/vga_gingerhouse/img/11.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/12.cpp b/examples/vga_gingerhouse/img/12.cpp index 9aa8338..a708991 100644 --- a/examples/vga_gingerhouse/img/12.cpp +++ b/examples/vga_gingerhouse/img/12.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/13.cpp b/examples/vga_gingerhouse/img/13.cpp index 2be554c..68bacb6 100644 --- a/examples/vga_gingerhouse/img/13.cpp +++ b/examples/vga_gingerhouse/img/13.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/14.cpp b/examples/vga_gingerhouse/img/14.cpp index ffbe3e1..2bd6dda 100644 --- a/examples/vga_gingerhouse/img/14.cpp +++ b/examples/vga_gingerhouse/img/14.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/15.cpp b/examples/vga_gingerhouse/img/15.cpp index 4f20f7f..9f4ae5f 100644 --- a/examples/vga_gingerhouse/img/15.cpp +++ b/examples/vga_gingerhouse/img/15.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/16.cpp b/examples/vga_gingerhouse/img/16.cpp index b9181ec..435bb5c 100644 --- a/examples/vga_gingerhouse/img/16.cpp +++ b/examples/vga_gingerhouse/img/16.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/17.cpp b/examples/vga_gingerhouse/img/17.cpp index 3bf6d79..76bfbbd 100644 --- a/examples/vga_gingerhouse/img/17.cpp +++ b/examples/vga_gingerhouse/img/17.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/18.cpp b/examples/vga_gingerhouse/img/18.cpp index 61d5d15..5a5b454 100644 --- a/examples/vga_gingerhouse/img/18.cpp +++ b/examples/vga_gingerhouse/img/18.cpp @@ -1,5 +1,4 @@ -#include "include.h" - +#include "main.h" // format: RLE compression // no transparency // image width: 640 pixels diff --git a/examples/vga_gingerhouse/img/19.cpp b/examples/vga_gingerhouse/img/19.cpp index 434e898..456c983 100644 --- a/examples/vga_gingerhouse/img/19.cpp +++ b/examples/vga_gingerhouse/img/19.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/20.cpp b/examples/vga_gingerhouse/img/20.cpp index 0a69bf2..9a6206c 100644 --- a/examples/vga_gingerhouse/img/20.cpp +++ b/examples/vga_gingerhouse/img/20.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/22.cpp b/examples/vga_gingerhouse/img/22.cpp index 78c2973..8b5270c 100644 --- a/examples/vga_gingerhouse/img/22.cpp +++ b/examples/vga_gingerhouse/img/22.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_gingerhouse/img/RaspPicoRle.exe b/examples/vga_gingerhouse/img/RaspPicoRle.exe deleted file mode 100644 index 9e7c425..0000000 Binary files a/examples/vga_gingerhouse/img/RaspPicoRle.exe and /dev/null differ diff --git a/examples/vga_gingerhouse/src/include.h b/examples/vga_gingerhouse/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_gingerhouse/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_gingerhouse/src/main.cpp b/examples/vga_gingerhouse/src/main.cpp index 93dc26e..46567fc 100644 --- a/examples/vga_gingerhouse/src/main.cpp +++ b/examples/vga_gingerhouse/src/main.cpp @@ -5,7 +5,10 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include "pico/printf.h" +#include "hardware/clocks.h" +#include // page list const u16* const ImgRowsList[PAGES] = { // list of rows @@ -297,7 +300,7 @@ int main() memcpy(Font_Copy, FontBold8x8, sizeof(FontBold8x8)); // run VGA core - multicore_launch_core1(VgaCore); + StartVgaCore(); // initialize videomode (and open first page) VideoInit(); diff --git a/examples/vga_gingerhouse/src/main.h b/examples/vga_gingerhouse/src/main.h index 36c3be1..f5c92c2 100644 --- a/examples/vga_gingerhouse/src/main.h +++ b/examples/vga_gingerhouse/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + // screen resolution #define WIDTH 640 // screen width #define HEIGHT 480 // screen height diff --git a/examples/vga_hypno/CMakeLists.txt b/examples/vga_hypno/CMakeLists.txt new file mode 100644 index 0000000..f5bbefc --- /dev/null +++ b/examples/vga_hypno/CMakeLists.txt @@ -0,0 +1,16 @@ +add_executable(vga_hypno + src/main.cpp +) + +add_picovga(vga_hypno) + +# for vga_config.h include +target_include_directories(vga_hypno PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_hypno) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file diff --git a/examples/vga_hypno/Makefile b/examples/vga_hypno/Makefile deleted file mode 100644 index 87b6ac1..0000000 --- a/examples/vga_hypno/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -#DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_hypno/src/include.h b/examples/vga_hypno/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_hypno/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_hypno/src/main.cpp b/examples/vga_hypno/src/main.cpp index 2ab0a8f..8b7b976 100644 --- a/examples/vga_hypno/src/main.cpp +++ b/examples/vga_hypno/src/main.cpp @@ -12,7 +12,7 @@ // does not display memory outside valid buffer limits, otherwise program will // crash on hardfault. -#include "include.h" +#include "main.h" // draw box ALIGNED u8 Box[IMGW*IMGH]; @@ -69,7 +69,7 @@ int main() SetMat(0); // run VGA core - multicore_launch_core1(VgaCore); + StartVgaCore(); // initialize videomode (and open first page) VideoInit(); diff --git a/examples/vga_hypno/src/main.h b/examples/vga_hypno/src/main.h index a74d1b2..6191ae8 100644 --- a/examples/vga_hypno/src/main.h +++ b/examples/vga_hypno/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + // screen #define WIDTH 512 // screen width #define HEIGHT 400 // screen height diff --git a/examples/vga_levelmeter/CMakeLists.txt b/examples/vga_levelmeter/CMakeLists.txt new file mode 100644 index 0000000..b806ac3 --- /dev/null +++ b/examples/vga_levelmeter/CMakeLists.txt @@ -0,0 +1,20 @@ +add_executable(vga_levelmeter + src/main.cpp + img/repro1.cpp + img/repro2.cpp + img/repro3.cpp + snd/test.cpp +) + +add_picovga(vga_levelmeter) + +# for vga_config.h include +target_include_directories(vga_levelmeter PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_levelmeter) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_levelmeter 1) \ No newline at end of file diff --git a/examples/vga_levelmeter/img/repro1.cpp b/examples/vga_levelmeter/img/repro1.cpp index 6c04a43..38a9327 100644 --- a/examples/vga_levelmeter/img/repro1.cpp +++ b/examples/vga_levelmeter/img/repro1.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 192 pixels diff --git a/examples/vga_levelmeter/img/repro2.cpp b/examples/vga_levelmeter/img/repro2.cpp index 000bfb2..268e3f0 100644 --- a/examples/vga_levelmeter/img/repro2.cpp +++ b/examples/vga_levelmeter/img/repro2.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 192 pixels diff --git a/examples/vga_levelmeter/img/repro3.cpp b/examples/vga_levelmeter/img/repro3.cpp index 232a262..5d3b77c 100644 --- a/examples/vga_levelmeter/img/repro3.cpp +++ b/examples/vga_levelmeter/img/repro3.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 100 pixels diff --git a/examples/vga_levelmeter/snd/test.cpp b/examples/vga_levelmeter/snd/test.cpp index 234a5b8..303fa67 100644 --- a/examples/vga_levelmeter/snd/test.cpp +++ b/examples/vga_levelmeter/snd/test.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 TestSnd[154512] = { diff --git a/examples/vga_levelmeter/src/include.h b/examples/vga_levelmeter/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_levelmeter/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_levelmeter/src/main.cpp b/examples/vga_levelmeter/src/main.cpp index 34df4b2..815e143 100644 --- a/examples/vga_levelmeter/src/main.cpp +++ b/examples/vga_levelmeter/src/main.cpp @@ -5,7 +5,8 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include // copy of images ALIGNED u8 Repro1Img_Copy[sizeof(Repro1Img)]; @@ -121,7 +122,7 @@ int main() CopyWhiteImg(Repro3Img_Copy, Repro3Img, sizeof(Repro3Img)); // run VGA core - multicore_launch_core1(VgaCore); + StartVgaCore(); // initialize videomode VideoInit(); diff --git a/examples/vga_levelmeter/src/main.h b/examples/vga_levelmeter/src/main.h index 94530b5..d64f84a 100644 --- a/examples/vga_levelmeter/src/main.h +++ b/examples/vga_levelmeter/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + // screen resolution #define WIDTH 512 // screen width #define HEIGHT 336 // screen height diff --git a/examples/vga_life/CMakeLists.txt b/examples/vga_life/CMakeLists.txt new file mode 100644 index 0000000..46a61b4 --- /dev/null +++ b/examples/vga_life/CMakeLists.txt @@ -0,0 +1,18 @@ +add_executable(vga_life + src/main.cpp + #img/tiles32.cpp + img/tiles16.cpp +) + +add_picovga(vga_life) + +# for vga_config.h include +target_include_directories(vga_life PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_life) + +# Allow stdio to USB +pico_enable_stdio_usb(vga_life 1) \ No newline at end of file diff --git a/examples/vga_life/Makefile b/examples/vga_life/Makefile deleted file mode 100644 index 4de626b..0000000 --- a/examples/vga_life/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp -#SRC += img/tiles32.cpp -SRC += img/tiles16.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_life/img/tiles16.cpp b/examples/vga_life/img/tiles16.cpp index 321d00a..2c95f2f 100644 --- a/examples/vga_life/img/tiles16.cpp +++ b/examples/vga_life/img/tiles16.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 16 pixels diff --git a/examples/vga_life/src/include.h b/examples/vga_life/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_life/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_life/src/main.cpp b/examples/vga_life/src/main.cpp index c5cb072..3293eaf 100644 --- a/examples/vga_life/src/main.cpp +++ b/examples/vga_life/src/main.cpp @@ -5,7 +5,9 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include "pico/printf.h" +#include // copy of tiles images u8 TilesImg_Copy[sizeof(Tiles16Img)] __attribute__ ((aligned(4))); @@ -362,7 +364,7 @@ int main() LoadSlot(); // run VGA core -// multicore_launch_core1(VgaCore); +// StartVgaCore(); // initialize videomode // VideoInit(); diff --git a/examples/vga_life/src/main.h b/examples/vga_life/src/main.h index 44dd433..1622d83 100644 --- a/examples/vga_life/src/main.h +++ b/examples/vga_life/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + //#define DRV VideoVGA // timings #define WIDTH 640 // screen width #define HEIGHT 480 // screen height diff --git a/examples/vga_lines/CMakeLists.txt b/examples/vga_lines/CMakeLists.txt new file mode 100644 index 0000000..0370c2f --- /dev/null +++ b/examples/vga_lines/CMakeLists.txt @@ -0,0 +1,16 @@ +add_executable(vga_lines + src/main.cpp +) + +add_picovga(vga_lines) + +# for vga_config.h include +target_include_directories(vga_lines PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_lines) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_lines 1) \ No newline at end of file diff --git a/examples/vga_lines/src/include.h b/examples/vga_lines/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_lines/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_lines/src/main.cpp b/examples/vga_lines/src/main.cpp index a8d8302..5b6203b 100644 --- a/examples/vga_lines/src/main.cpp +++ b/examples/vga_lines/src/main.cpp @@ -5,7 +5,8 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include #define LINENUM 70 // number of lines #define SPEEDMIN 3.0f // minimal speed @@ -90,7 +91,7 @@ int main() Video(DEV_VGA, RES_EGA, FORM_8BIT, Box); // run VGA core -// multicore_launch_core1(VgaCore); +// StartVgaCore(); // initialize videomode // VideoInit(); diff --git a/examples/vga_lines/src/main.h b/examples/vga_lines/src/main.h index 3137206..071f23e 100644 --- a/examples/vga_lines/src/main.h +++ b/examples/vga_lines/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + // used canvas format //#define FORMAT CANVAS_8 // 8-bit pixels //#define WIDTH 532 // screen width diff --git a/examples/vga_mandelbrot/CMakeLists.txt b/examples/vga_mandelbrot/CMakeLists.txt new file mode 100644 index 0000000..8650202 --- /dev/null +++ b/examples/vga_mandelbrot/CMakeLists.txt @@ -0,0 +1,17 @@ +add_executable(vga_mandelbrot + src/fixed.S + src/main.cpp +) + +add_picovga(vga_mandelbrot) + +# for vga_config.h include +target_include_directories(vga_mandelbrot PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_mandelbrot) + +# Allow stdio to USB +pico_enable_stdio_usb(vga_mandelbrot 1) \ No newline at end of file diff --git a/examples/vga_mandelbrot/Makefile b/examples/vga_mandelbrot/Makefile deleted file mode 100644 index a85a69a..0000000 --- a/examples/vga_mandelbrot/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += src/fixed.S - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_mandelbrot/src/fixed.h b/examples/vga_mandelbrot/src/fixed.h index 09d139a..1ac6d50 100644 --- a/examples/vga_mandelbrot/src/fixed.h +++ b/examples/vga_mandelbrot/src/fixed.h @@ -10,6 +10,8 @@ #ifndef _FIXED_H #define _FIXED_H +#include "picovga.h" + // multiply two 64-bit integers with 64-bit result (signed or unsigned) extern "C" s64 Mul64(s64 a, s64 b); diff --git a/examples/vga_mandelbrot/src/include.h b/examples/vga_mandelbrot/src/include.h deleted file mode 100644 index b84e9c7..0000000 --- a/examples/vga_mandelbrot/src/include.h +++ /dev/null @@ -1,17 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "fixed.h" // fixed point number -#include "main.h" // main code diff --git a/examples/vga_mandelbrot/src/main.cpp b/examples/vga_mandelbrot/src/main.cpp index 5250126..8b8ac1f 100644 --- a/examples/vga_mandelbrot/src/main.cpp +++ b/examples/vga_mandelbrot/src/main.cpp @@ -28,7 +28,10 @@ Need 6 bits for integer part of number + 1 bit for sign. We will use 32-bit integer with highest 7 bits as integer part and 25 lower bits as decimal part. */ -#include "include.h" +#include "main.h" +#include "fixed.h" +#include "pico/printf.h" +#include #define USE_INT 0 // use integer arithmetics #define USE_FLT 1 // use float arithmetics @@ -379,7 +382,7 @@ int main() int c; // run VGA core - multicore_launch_core1(VgaCore); + StartVgaCore(); // setup videomode Init(); diff --git a/examples/vga_mandelbrot/src/main.h b/examples/vga_mandelbrot/src/main.h index ee9dfb0..a3c5b92 100644 --- a/examples/vga_mandelbrot/src/main.h +++ b/examples/vga_mandelbrot/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + #define WIDTH 528 // image width, high resolution #define HEIGHT 400 // image height, high resolution diff --git a/examples/vga_matrixrain/CMakeLists.txt b/examples/vga_matrixrain/CMakeLists.txt new file mode 100644 index 0000000..f206034 --- /dev/null +++ b/examples/vga_matrixrain/CMakeLists.txt @@ -0,0 +1,16 @@ +add_executable(vga_matrixrain + src/main.cpp +) + +add_picovga(vga_matrixrain) + +# for vga_config.h include +target_include_directories(vga_matrixrain PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_matrixrain) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_matrixrain 1) \ No newline at end of file diff --git a/examples/vga_matrixrain/Makefile b/examples/vga_matrixrain/Makefile deleted file mode 100644 index 87b6ac1..0000000 --- a/examples/vga_matrixrain/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -#DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_matrixrain/src/include.h b/examples/vga_matrixrain/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_matrixrain/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_matrixrain/src/main.cpp b/examples/vga_matrixrain/src/main.cpp index a1c1e56..29761b2 100644 --- a/examples/vga_matrixrain/src/main.cpp +++ b/examples/vga_matrixrain/src/main.cpp @@ -5,7 +5,8 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include #define DELAY 10 // delay in [ms] #define LEN_MIN 10 // minimal length of drop @@ -109,7 +110,7 @@ int main() memcpy(Font_Copy, FontBold8x8, sizeof(FontBold8x8)); // run VGA core - multicore_launch_core1(VgaCore); + StartVgaCore(); // initialize videomode VideoInit(); diff --git a/examples/vga_matrixrain/src/main.h b/examples/vga_matrixrain/src/main.h index 4416d35..b37cbe1 100644 --- a/examples/vga_matrixrain/src/main.h +++ b/examples/vga_matrixrain/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + #define WIDTH 640 // screen width in pixels #define HEIGHT 480 // screen height #define FONTW 8 // font width diff --git a/examples/vga_maze/CMakeLists.txt b/examples/vga_maze/CMakeLists.txt new file mode 100644 index 0000000..ef6461a --- /dev/null +++ b/examples/vga_maze/CMakeLists.txt @@ -0,0 +1,17 @@ +add_executable(vga_maze + src/main.cpp + img/tiles.cpp +) + +add_picovga(vga_maze) + +# for vga_config.h include +target_include_directories(vga_maze PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_maze) + +# Allow stdio to USB +pico_enable_stdio_usb(vga_maze 1) diff --git a/examples/vga_maze/Makefile b/examples/vga_maze/Makefile deleted file mode 100644 index 92c0ac9..0000000 --- a/examples/vga_maze/Makefile +++ /dev/null @@ -1,66 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp -SRC += img/tiles.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_maze/img/tiles.cpp b/examples/vga_maze/img/tiles.cpp index 008fc06..fa3fc34 100644 --- a/examples/vga_maze/img/tiles.cpp +++ b/examples/vga_maze/img/tiles.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 8 pixels diff --git a/examples/vga_maze/src/include.h b/examples/vga_maze/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_maze/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_maze/src/main.cpp b/examples/vga_maze/src/main.cpp index 35edc90..80bf256 100644 --- a/examples/vga_maze/src/main.cpp +++ b/examples/vga_maze/src/main.cpp @@ -7,7 +7,9 @@ // "wave" maze generator: https://www.itnetwork.cz/navrh/algoritmy/algoritmy-bludiste/algoritmus-tvorba-nahodneho-bludiste // - MAZEW and MAZEH must be odd numbers! -#include "include.h" +#include "main.h" +#include "pico/printf.h" +#include // copy of tiles images ALIGNED u8 TilesImg_Copy[sizeof(TilesImg)]; diff --git a/examples/vga_maze/src/main.h b/examples/vga_maze/src/main.h index 0a191fc..3c68533 100644 --- a/examples/vga_maze/src/main.h +++ b/examples/vga_maze/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + #define WIDTH 256 // screen width #define HEIGHT 192 // screen height #define TILESIZE 8 // tile size in number of pixels diff --git a/examples/vga_monoscope/CMakeLists.txt b/examples/vga_monoscope/CMakeLists.txt new file mode 100644 index 0000000..4b26bbd --- /dev/null +++ b/examples/vga_monoscope/CMakeLists.txt @@ -0,0 +1,43 @@ +add_executable(vga_monoscope + img/monoscope_256x192.cpp + img/monoscope_300x240.cpp + img/monoscope_320x200.cpp + img/monoscope_320x240.cpp + img/monoscope_360x288.cpp + img/monoscope_384x288.cpp + img/monoscope_424x240.cpp + img/monoscope_400x300.cpp + img/monoscope_500x400.cpp + img/monoscope_512x288.cpp + img/monoscope_528x400.cpp + img/monoscope_600x480.cpp + img/monoscope_640x400.cpp + img/monoscope_640x480.cpp + img/monoscope_704x400.cpp + img/monoscope_720x576.cpp + img/monoscope_768x576.cpp + img/monoscope_800x600.cpp + img/monoscope_848x480.cpp + img/monoscope_1024x576.cpp + img/monoscope_1024x768.cpp + img/monoscope_1064x600.cpp + img/monoscope_1152x864.cpp + img/monoscope_1360x768.cpp + img/monoscope_1280x960.cpp + img/pi-monoscope.cpp + + src/main.cpp +) + +add_picovga(vga_monoscope) + +# for vga_config.h include +target_include_directories(vga_monoscope PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_monoscope) + +# Allow stdio to USB +pico_enable_stdio_usb(vga_monoscope 1) \ No newline at end of file diff --git a/examples/vga_monoscope/Makefile b/examples/vga_monoscope/Makefile deleted file mode 100644 index a1c8bfb..0000000 --- a/examples/vga_monoscope/Makefile +++ /dev/null @@ -1,92 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += img/monoscope_256x192.cpp -SRC += img/monoscope_300x240.cpp -SRC += img/monoscope_320x200.cpp -SRC += img/monoscope_320x240.cpp -SRC += img/monoscope_360x288.cpp -SRC += img/monoscope_384x288.cpp -SRC += img/monoscope_424x240.cpp -SRC += img/monoscope_400x300.cpp -SRC += img/monoscope_500x400.cpp -SRC += img/monoscope_512x288.cpp -SRC += img/monoscope_528x400.cpp -SRC += img/monoscope_600x480.cpp -SRC += img/monoscope_640x400.cpp -SRC += img/monoscope_640x480.cpp -SRC += img/monoscope_704x400.cpp -SRC += img/monoscope_720x576.cpp -SRC += img/monoscope_768x576.cpp -SRC += img/monoscope_800x600.cpp -SRC += img/monoscope_848x480.cpp -SRC += img/monoscope_1024x576.cpp -SRC += img/monoscope_1024x768.cpp -SRC += img/monoscope_1064x600.cpp -SRC += img/monoscope_1152x864.cpp -SRC += img/monoscope_1360x768.cpp -SRC += img/monoscope_1280x960.cpp -SRC += img/pi-monoscope.cpp - -SRC += src/main.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_monoscope/img/RaspPicoRle.exe b/examples/vga_monoscope/img/RaspPicoRle.exe deleted file mode 100644 index 9e7c425..0000000 Binary files a/examples/vga_monoscope/img/RaspPicoRle.exe and /dev/null differ diff --git a/examples/vga_monoscope/img/monoscope_1024x576.cpp b/examples/vga_monoscope/img/monoscope_1024x576.cpp index 2483eca..5b3243f 100644 --- a/examples/vga_monoscope/img/monoscope_1024x576.cpp +++ b/examples/vga_monoscope/img/monoscope_1024x576.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_1024x768.cpp b/examples/vga_monoscope/img/monoscope_1024x768.cpp index 84f4701..d10685a 100644 --- a/examples/vga_monoscope/img/monoscope_1024x768.cpp +++ b/examples/vga_monoscope/img/monoscope_1024x768.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_1064x600.cpp b/examples/vga_monoscope/img/monoscope_1064x600.cpp index fba84e6..6713702 100644 --- a/examples/vga_monoscope/img/monoscope_1064x600.cpp +++ b/examples/vga_monoscope/img/monoscope_1064x600.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_1152x864.cpp b/examples/vga_monoscope/img/monoscope_1152x864.cpp index 25550ea..908797e 100644 --- a/examples/vga_monoscope/img/monoscope_1152x864.cpp +++ b/examples/vga_monoscope/img/monoscope_1152x864.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_1280x960.cpp b/examples/vga_monoscope/img/monoscope_1280x960.cpp index 2bfad1e..f875461 100644 --- a/examples/vga_monoscope/img/monoscope_1280x960.cpp +++ b/examples/vga_monoscope/img/monoscope_1280x960.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_1360x768.cpp b/examples/vga_monoscope/img/monoscope_1360x768.cpp index 2adfa08..2618806 100644 --- a/examples/vga_monoscope/img/monoscope_1360x768.cpp +++ b/examples/vga_monoscope/img/monoscope_1360x768.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_256x192.cpp b/examples/vga_monoscope/img/monoscope_256x192.cpp index 47913e3..4010ac7 100644 --- a/examples/vga_monoscope/img/monoscope_256x192.cpp +++ b/examples/vga_monoscope/img/monoscope_256x192.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_300x240.cpp b/examples/vga_monoscope/img/monoscope_300x240.cpp index 184e581..8c3a4a7 100644 --- a/examples/vga_monoscope/img/monoscope_300x240.cpp +++ b/examples/vga_monoscope/img/monoscope_300x240.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_320x200.cpp b/examples/vga_monoscope/img/monoscope_320x200.cpp index 754cfb5..31b4f66 100644 --- a/examples/vga_monoscope/img/monoscope_320x200.cpp +++ b/examples/vga_monoscope/img/monoscope_320x200.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_320x240.cpp b/examples/vga_monoscope/img/monoscope_320x240.cpp index af570f0..d8552cb 100644 --- a/examples/vga_monoscope/img/monoscope_320x240.cpp +++ b/examples/vga_monoscope/img/monoscope_320x240.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_360x288.cpp b/examples/vga_monoscope/img/monoscope_360x288.cpp index 665b4f0..ca6b62e 100644 --- a/examples/vga_monoscope/img/monoscope_360x288.cpp +++ b/examples/vga_monoscope/img/monoscope_360x288.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_384x288.cpp b/examples/vga_monoscope/img/monoscope_384x288.cpp index f5607f4..8c49d1d 100644 --- a/examples/vga_monoscope/img/monoscope_384x288.cpp +++ b/examples/vga_monoscope/img/monoscope_384x288.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_400x300.cpp b/examples/vga_monoscope/img/monoscope_400x300.cpp index e48e191..36c98a7 100644 --- a/examples/vga_monoscope/img/monoscope_400x300.cpp +++ b/examples/vga_monoscope/img/monoscope_400x300.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_424x240.cpp b/examples/vga_monoscope/img/monoscope_424x240.cpp index 6367651..d136981 100644 --- a/examples/vga_monoscope/img/monoscope_424x240.cpp +++ b/examples/vga_monoscope/img/monoscope_424x240.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_500x400.cpp b/examples/vga_monoscope/img/monoscope_500x400.cpp index 5f55b5f..5a859bb 100644 --- a/examples/vga_monoscope/img/monoscope_500x400.cpp +++ b/examples/vga_monoscope/img/monoscope_500x400.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_512x288.cpp b/examples/vga_monoscope/img/monoscope_512x288.cpp index f6284c1..9f98f13 100644 --- a/examples/vga_monoscope/img/monoscope_512x288.cpp +++ b/examples/vga_monoscope/img/monoscope_512x288.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_528x400.cpp b/examples/vga_monoscope/img/monoscope_528x400.cpp index fcd8ad9..2e85c31 100644 --- a/examples/vga_monoscope/img/monoscope_528x400.cpp +++ b/examples/vga_monoscope/img/monoscope_528x400.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_600x480.cpp b/examples/vga_monoscope/img/monoscope_600x480.cpp index 27b780b..19a2bf6 100644 --- a/examples/vga_monoscope/img/monoscope_600x480.cpp +++ b/examples/vga_monoscope/img/monoscope_600x480.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_640x400.cpp b/examples/vga_monoscope/img/monoscope_640x400.cpp index 9deaff6..fe8a06f 100644 --- a/examples/vga_monoscope/img/monoscope_640x400.cpp +++ b/examples/vga_monoscope/img/monoscope_640x400.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_640x480.cpp b/examples/vga_monoscope/img/monoscope_640x480.cpp index 57efe87..445709e 100644 --- a/examples/vga_monoscope/img/monoscope_640x480.cpp +++ b/examples/vga_monoscope/img/monoscope_640x480.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_704x400.cpp b/examples/vga_monoscope/img/monoscope_704x400.cpp index 0798237..bbfb4c4 100644 --- a/examples/vga_monoscope/img/monoscope_704x400.cpp +++ b/examples/vga_monoscope/img/monoscope_704x400.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_720x576.cpp b/examples/vga_monoscope/img/monoscope_720x576.cpp index 49929e0..f4362fb 100644 --- a/examples/vga_monoscope/img/monoscope_720x576.cpp +++ b/examples/vga_monoscope/img/monoscope_720x576.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_768x576.cpp b/examples/vga_monoscope/img/monoscope_768x576.cpp index cb143da..510056b 100644 --- a/examples/vga_monoscope/img/monoscope_768x576.cpp +++ b/examples/vga_monoscope/img/monoscope_768x576.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_800x600.cpp b/examples/vga_monoscope/img/monoscope_800x600.cpp index 04183d2..58ea46c 100644 --- a/examples/vga_monoscope/img/monoscope_800x600.cpp +++ b/examples/vga_monoscope/img/monoscope_800x600.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/monoscope_848x480.cpp b/examples/vga_monoscope/img/monoscope_848x480.cpp index 928e09a..97b3815 100644 --- a/examples/vga_monoscope/img/monoscope_848x480.cpp +++ b/examples/vga_monoscope/img/monoscope_848x480.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/img/pi-monoscope.cpp b/examples/vga_monoscope/img/pi-monoscope.cpp index 4b919bf..f4e1ae9 100644 --- a/examples/vga_monoscope/img/pi-monoscope.cpp +++ b/examples/vga_monoscope/img/pi-monoscope.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: RLE compression // no transparency diff --git a/examples/vga_monoscope/src/include.h b/examples/vga_monoscope/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_monoscope/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_monoscope/src/main.cpp b/examples/vga_monoscope/src/main.cpp index ad54178..1cd86e4 100644 --- a/examples/vga_monoscope/src/main.cpp +++ b/examples/vga_monoscope/src/main.cpp @@ -45,7 +45,11 @@ #define PI_MONOSCOPE 31 -#include "include.h" +#include "main.h" +#include "pico/printf.h" +#include +#include "hardware/clocks.h" + u16 Rows[962]; // RLE rows u8 Img[180000] __attribute__ ((aligned(4))); // RLE image @@ -257,7 +261,7 @@ int main() int i; // run VGA core - multicore_launch_core1(VgaCore); + StartVgaCore(); // run default video mode VGA 640x480 MonoInit(22); diff --git a/examples/vga_monoscope/src/main.h b/examples/vga_monoscope/src/main.h index f7aaa00..626c63c 100644 --- a/examples/vga_monoscope/src/main.h +++ b/examples/vga_monoscope/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + #define IMG_LAYER 1 // overlapped layer with RLE image extern const u16 Monoscope256x192_rows[193]; diff --git a/examples/vga_oscilloscope/CMakeLists.txt b/examples/vga_oscilloscope/CMakeLists.txt new file mode 100644 index 0000000..4bbf4bc --- /dev/null +++ b/examples/vga_oscilloscope/CMakeLists.txt @@ -0,0 +1,23 @@ +add_executable(vga_oscilloscope + src/main.cpp + img/grid.cpp + img/oscilA.cpp + img/oscilB1.cpp + img/oscilB2.cpp + img/oscilC1.cpp + img/oscilC2.cpp + img/oscilD.cpp +) + +add_picovga(vga_oscilloscope) + +# for vga_config.h include +target_include_directories(vga_oscilloscope PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_oscilloscope) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_oscilloscope 1) \ No newline at end of file diff --git a/examples/vga_oscilloscope/Makefile b/examples/vga_oscilloscope/Makefile deleted file mode 100644 index 3cc41e3..0000000 --- a/examples/vga_oscilloscope/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp -SRC += img/grid.cpp -SRC += img/oscilA.cpp -SRC += img/oscilB1.cpp -SRC += img/oscilB2.cpp -SRC += img/oscilC1.cpp -SRC += img/oscilC2.cpp -SRC += img/oscilD.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -#DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_oscilloscope/img/grid.cpp b/examples/vga_oscilloscope/img/grid.cpp index 207d08c..b2d1333 100644 --- a/examples/vga_oscilloscope/img/grid.cpp +++ b/examples/vga_oscilloscope/img/grid.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 1-bit pixel graphics // image width: 288 pixels diff --git a/examples/vga_oscilloscope/img/oscilA.cpp b/examples/vga_oscilloscope/img/oscilA.cpp index 658c159..d8aa489 100644 --- a/examples/vga_oscilloscope/img/oscilA.cpp +++ b/examples/vga_oscilloscope/img/oscilA.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 640 pixels diff --git a/examples/vga_oscilloscope/img/oscilB1.cpp b/examples/vga_oscilloscope/img/oscilB1.cpp index ca11376..78cb166 100644 --- a/examples/vga_oscilloscope/img/oscilB1.cpp +++ b/examples/vga_oscilloscope/img/oscilB1.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 64 pixels diff --git a/examples/vga_oscilloscope/img/oscilB2.cpp b/examples/vga_oscilloscope/img/oscilB2.cpp index 7bbf61d..3f73774 100644 --- a/examples/vga_oscilloscope/img/oscilB2.cpp +++ b/examples/vga_oscilloscope/img/oscilB2.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 64 pixels diff --git a/examples/vga_oscilloscope/img/oscilC1.cpp b/examples/vga_oscilloscope/img/oscilC1.cpp index cd48641..3beb40d 100644 --- a/examples/vga_oscilloscope/img/oscilC1.cpp +++ b/examples/vga_oscilloscope/img/oscilC1.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 312 pixels diff --git a/examples/vga_oscilloscope/img/oscilC2.cpp b/examples/vga_oscilloscope/img/oscilC2.cpp index ed198e0..d232a5c 100644 --- a/examples/vga_oscilloscope/img/oscilC2.cpp +++ b/examples/vga_oscilloscope/img/oscilC2.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 312 pixels diff --git a/examples/vga_oscilloscope/img/oscilD.cpp b/examples/vga_oscilloscope/img/oscilD.cpp index abe8823..ee65b01 100644 --- a/examples/vga_oscilloscope/img/oscilD.cpp +++ b/examples/vga_oscilloscope/img/oscilD.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 640 pixels diff --git a/examples/vga_oscilloscope/src/include.h b/examples/vga_oscilloscope/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_oscilloscope/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_oscilloscope/src/main.cpp b/examples/vga_oscilloscope/src/main.cpp index 4c70767..2660084 100644 --- a/examples/vga_oscilloscope/src/main.cpp +++ b/examples/vga_oscilloscope/src/main.cpp @@ -5,7 +5,9 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include + // copy of images ALIGNED u8 OscilAImg_Copy[sizeof(OscilAImg)]; @@ -96,7 +98,7 @@ int main() memcpy(GridImg_Copy, GridImg, sizeof(GridImg)); // run VGA core - multicore_launch_core1(VgaCore); + StartVgaCore(); // initialize videomode VideoInit(); diff --git a/examples/vga_oscilloscope/src/main.h b/examples/vga_oscilloscope/src/main.h index 7ab4aa6..5503ad5 100644 --- a/examples/vga_oscilloscope/src/main.h +++ b/examples/vga_oscilloscope/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + // oscil image // AAAAAAAAAAAAAAA // B1 1111111 C1C1 diff --git a/examples/vga_pacman/CMakeLists.txt b/examples/vga_pacman/CMakeLists.txt new file mode 100644 index 0000000..41e631b --- /dev/null +++ b/examples/vga_pacman/CMakeLists.txt @@ -0,0 +1,34 @@ +add_executable(vga_pacman + src/data.cpp + src/game.cpp + src/main.cpp + src/open.cpp + + img/logo.cpp + img/tiles.cpp + img/sprites.cpp + img/status.cpp + + snd/startsnd.cpp + snd/siren.cpp + snd/wakka.cpp + snd/frighten.cpp + snd/eatghost.cpp + snd/eatfruit.cpp + snd/death.cpp + snd/extrapac.cpp + snd/intermission.cpp +) + +add_picovga(vga_pacman) + +# for vga_config.h include +target_include_directories(vga_pacman PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_pacman) + +# Allow stdio to USB +pico_enable_stdio_usb(vga_pacman 1) diff --git a/examples/vga_pacman/Makefile b/examples/vga_pacman/Makefile deleted file mode 100644 index f48dd0e..0000000 --- a/examples/vga_pacman/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/data.cpp -SRC += src/game.cpp -SRC += src/main.cpp -SRC += src/open.cpp - -SRC += img/logo.cpp -SRC += img/tiles.cpp -SRC += img/sprites.cpp -SRC += img/status.cpp - -SRC += snd/startsnd.cpp -SRC += snd/siren.cpp -SRC += snd/wakka.cpp -SRC += snd/frighten.cpp -SRC += snd/eatghost.cpp -SRC += snd/eatfruit.cpp -SRC += snd/death.cpp -SRC += snd/extrapac.cpp -SRC += snd/intermission.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_pacman/img/logo.cpp b/examples/vga_pacman/img/logo.cpp index f4353b0..14a5c9e 100644 --- a/examples/vga_pacman/img/logo.cpp +++ b/examples/vga_pacman/img/logo.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "data.h" // format: 8-bit pixel graphics // image width: 144 pixels diff --git a/examples/vga_pacman/img/sprites.cpp b/examples/vga_pacman/img/sprites.cpp index ea2b420..6ce6153 100644 --- a/examples/vga_pacman/img/sprites.cpp +++ b/examples/vga_pacman/img/sprites.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "data.h" // format: 8-bit pixel graphics // image width: 1536 pixels diff --git a/examples/vga_pacman/img/status.cpp b/examples/vga_pacman/img/status.cpp index 67ac08e..d461687 100644 --- a/examples/vga_pacman/img/status.cpp +++ b/examples/vga_pacman/img/status.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "data.h" // format: 8-bit pixel graphics // image width: 144 pixels diff --git a/examples/vga_pacman/img/tiles.cpp b/examples/vga_pacman/img/tiles.cpp index 744b376..ca28833 100644 --- a/examples/vga_pacman/img/tiles.cpp +++ b/examples/vga_pacman/img/tiles.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "data.h" // format: 8-bit pixel graphics // image width: 516 pixels diff --git a/examples/vga_pacman/snd/death.cpp b/examples/vga_pacman/snd/death.cpp index 4011385..f389e66 100644 --- a/examples/vga_pacman/snd/death.cpp +++ b/examples/vga_pacman/snd/death.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "data.h" // sound format: PCM mono 8-bit 22050Hz const u8 DeathSnd[33832] = { diff --git a/examples/vga_pacman/snd/eatfruit.cpp b/examples/vga_pacman/snd/eatfruit.cpp index 3e5b814..bc21860 100644 --- a/examples/vga_pacman/snd/eatfruit.cpp +++ b/examples/vga_pacman/snd/eatfruit.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "data.h" // sound format: PCM mono 8-bit 22050Hz const u8 EatFruitSnd[9690] = { diff --git a/examples/vga_pacman/snd/eatghost.cpp b/examples/vga_pacman/snd/eatghost.cpp index 64dcb1e..cfdc893 100644 --- a/examples/vga_pacman/snd/eatghost.cpp +++ b/examples/vga_pacman/snd/eatghost.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "data.h" // sound format: PCM mono 8-bit 22050Hz const u8 EatGhostSnd[12879] = { diff --git a/examples/vga_pacman/snd/extrapac.cpp b/examples/vga_pacman/snd/extrapac.cpp index dccacf9..4b93da3 100644 --- a/examples/vga_pacman/snd/extrapac.cpp +++ b/examples/vga_pacman/snd/extrapac.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "data.h" // sound format: PCM mono 8-bit 22050Hz const u8 ExtraPacSnd[41880] = { diff --git a/examples/vga_pacman/snd/frighten.cpp b/examples/vga_pacman/snd/frighten.cpp index 9f5a800..d839d35 100644 --- a/examples/vga_pacman/snd/frighten.cpp +++ b/examples/vga_pacman/snd/frighten.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "data.h" // sound format: PCM mono 8-bit 22050Hz const u8 FrightenSnd[5872] = { diff --git a/examples/vga_pacman/snd/intermission.cpp b/examples/vga_pacman/snd/intermission.cpp index e3ed52b..f57c196 100644 --- a/examples/vga_pacman/snd/intermission.cpp +++ b/examples/vga_pacman/snd/intermission.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "data.h" // sound format: PCM mono 8-bit 22050Hz const u8 IntermissionSnd[114754] = { diff --git a/examples/vga_pacman/snd/siren.cpp b/examples/vga_pacman/snd/siren.cpp index 576e746..650a7b0 100644 --- a/examples/vga_pacman/snd/siren.cpp +++ b/examples/vga_pacman/snd/siren.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "data.h" // sound format: PCM mono 8-bit 22050Hz const u8 SirenSnd[9460] = { diff --git a/examples/vga_pacman/snd/startsnd.cpp b/examples/vga_pacman/snd/startsnd.cpp index bf5d99b..c696a06 100644 --- a/examples/vga_pacman/snd/startsnd.cpp +++ b/examples/vga_pacman/snd/startsnd.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "data.h" // sound format: PCM mono 8-bit 22050Hz const u8 StartSnd[94852] = { diff --git a/examples/vga_pacman/snd/wakka.cpp b/examples/vga_pacman/snd/wakka.cpp index abf5fe3..fa24f21 100644 --- a/examples/vga_pacman/snd/wakka.cpp +++ b/examples/vga_pacman/snd/wakka.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "data.h" // sound format: PCM mono 8-bit 22050Hz const u8 WakkaSnd[6391] = { diff --git a/examples/vga_pacman/src/data.cpp b/examples/vga_pacman/src/data.cpp index 8997b54..74b6f28 100644 --- a/examples/vga_pacman/src/data.cpp +++ b/examples/vga_pacman/src/data.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "data.h" // title row ALIGNED u8 Text[TEXTMAX*2]; // text row with attributes diff --git a/examples/vga_pacman/src/data.h b/examples/vga_pacman/src/data.h index 817baef..63c6ef1 100644 --- a/examples/vga_pacman/src/data.h +++ b/examples/vga_pacman/src/data.h @@ -8,6 +8,9 @@ #ifndef _DATA_H #define _DATA_H +#include "picovga.h" +#include "def.h" + // format: 8-bit pixel graphics // image width: 144 pixels // image height: 34 lines diff --git a/examples/vga_pacman/src/game.cpp b/examples/vga_pacman/src/game.cpp index 42c2ea1..778e619 100644 --- a/examples/vga_pacman/src/game.cpp +++ b/examples/vga_pacman/src/game.cpp @@ -5,7 +5,11 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include "game.h" +#include "def.h" +#include "data.h" + // shift X coordinate in direction (wrap coordinate and direction) s8 ShiftX(s8 x, s8 dir) diff --git a/examples/vga_pacman/src/game.h b/examples/vga_pacman/src/game.h index 180cc07..869967f 100644 --- a/examples/vga_pacman/src/game.h +++ b/examples/vga_pacman/src/game.h @@ -8,6 +8,8 @@ #ifndef _GAME_H #define _GAME_H +#include "picovga.h" + // shift X coordinate in direction (wrap coordinate and direction) s8 ShiftX(s8 x, s8 dir); diff --git a/examples/vga_pacman/src/include.h b/examples/vga_pacman/src/include.h deleted file mode 100644 index 178c2da..0000000 --- a/examples/vga_pacman/src/include.h +++ /dev/null @@ -1,20 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "def.h" // definitions -#include "data.h" // data and tables -#include "game.h" // game -#include "main.h" // main code -#include "open.h" // open screen diff --git a/examples/vga_pacman/src/main.cpp b/examples/vga_pacman/src/main.cpp index 01247aa..c2e753e 100644 --- a/examples/vga_pacman/src/main.cpp +++ b/examples/vga_pacman/src/main.cpp @@ -5,7 +5,14 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include "def.h" // definitions +#include "data.h" // data and tables +#include "game.h" // game +#include "main.h" // main code +#include "open.h" // open screen +#include "pico/printf.h" +#include // initialize buffers on program start void BufInit() @@ -202,7 +209,7 @@ int main() BufInit(); // run VGA core - multicore_launch_core1(VgaCore); + StartVgaCore(); // initialize videomode VideoInit(); diff --git a/examples/vga_pacman/src/main.h b/examples/vga_pacman/src/main.h index f06aab9..3d8c9c1 100644 --- a/examples/vga_pacman/src/main.h +++ b/examples/vga_pacman/src/main.h @@ -8,6 +8,8 @@ #ifndef _MAIN_H #define _MAIN_H +#include "picovga.h" + // initialize open screen void VideoOpenInit(); diff --git a/examples/vga_pacman/src/open.cpp b/examples/vga_pacman/src/open.cpp index 69bada6..dc5607a 100644 --- a/examples/vga_pacman/src/open.cpp +++ b/examples/vga_pacman/src/open.cpp @@ -5,7 +5,12 @@ // // **************************************************************************** -#include "include.h" +#include "open.h" +#include "picovga.h" +#include "def.h" +#include "main.h" +#include "data.h" +#include "game.h" const char* OpenCharName[4] = { "SHADOW", "SPEEDY", "BASHFUL", "POKEY" }; const char* OpenCharNick[4] = { "\"BLINKY\"", "\"PINKY\"", "\"INKY\"", "\"CLYDE\"" }; diff --git a/examples/vga_pi/CMakeLists.txt b/examples/vga_pi/CMakeLists.txt new file mode 100644 index 0000000..8e84e12 --- /dev/null +++ b/examples/vga_pi/CMakeLists.txt @@ -0,0 +1,16 @@ +add_executable(vga_pi + src/main.cpp +) + +add_picovga(vga_pi) + +# for vga_config.h include +target_include_directories(vga_pi PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_pi) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_pi 1) \ No newline at end of file diff --git a/examples/vga_pi/Makefile b/examples/vga_pi/Makefile deleted file mode 100644 index 87b6ac1..0000000 --- a/examples/vga_pi/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# make clean ... clean -# make all ... compile - -############################################################################## -# Input files - -# ASM source files -ASRC += - -# C source files -CSRC += - -# C++ source files -SRC += src/main.cpp - -############################################################################## -# Configuration - -# defines -DEFINE += -DCFG_TUSB_DEBUG=0 -DEFINE += -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DEFINE += -DCFG_TUSB_OS=OPT_OS_PICO -DEFINE += -DPICO_BIT_OPS_PICO=1 -DEFINE += -DPICO_BOARD=\"pico\" -DEFINE += -DPICO_BUILD=1 -DEFINE += -DPICO_CMAKE_BUILD_TYPE=\"Release\" -DEFINE += -DPICO_COPY_TO_RAM=0 -DEFINE += -DPICO_CXX_ENABLE_EXCEPTIONS=0 -DEFINE += -DPICO_DIVIDER_HARDWARE=1 -DEFINE += -DPICO_DOUBLE_PICO=1 -DEFINE += -DPICO_FLOAT_PICO=1 -DEFINE += -DPICO_INT64_OPS_PICO=1 -DEFINE += -DPICO_MEM_OPS_PICO=1 -DEFINE += -DPICO_NO_FLASH=0 -DEFINE += -DPICO_NO_HARDWARE=0 -DEFINE += -DPICO_ON_DEVICE=1 -DEFINE += -DPICO_PRINTF_PICO=1 -DEFINE += -DPICO_PROGRAM_URL=\"https://github.com/raspberrypi/pico-examples\" -DEFINE += -DPICO_TARGET_NAME=\"pico\" -DEFINE += -DPICO_USE_BLOCKED_RAM=0 -DEFINE += -DNDEBUG - -# stdio output (select one option) -#DEFINE += -DPICO_STDIO_UART=1 -#DEFINE += -DPICO_STDIO_SEMIHOSTING=1 -#DEFINE += -DPICO_STDIO_USB=1 - -# How to connect UART to Pico: -# +---USB---+ -# <-- UART0_TX GP0 |.1 40.|VBUS --- +5V power output to USB device -# --> UART0_RX GP1 |.2 39.|VSYS ---|<|--- +5V power input -# --- GND |.3 38.| GND K diode A -# GP2 |.4 37.| 3V3_EN -# GP3 |.5 36.| 3V3_OUT -# ...... -# -# USB/UART adaptor PL2303TA: -# red ......... +5V VSYS (39) -# black ....... GND (3) -# white RxD ... UART0_TX GP0 (1) -# green TxD ... UART0_RX GP1 (2) - -# Setup: 115200 Baud - -include ../Makefile.inc diff --git a/examples/vga_pi/src/include.h b/examples/vga_pi/src/include.h deleted file mode 100644 index 4f5dc18..0000000 --- a/examples/vga_pi/src/include.h +++ /dev/null @@ -1,16 +0,0 @@ - -// **************************************************************************** -// -// Common definitions -// -// **************************************************************************** - -// ---------------------------------------------------------------------------- -// Includes -// ---------------------------------------------------------------------------- - -#include "../../global.h" // global common definitions -#include "../vga.pio.h" // VGA PIO compilation - -// main -#include "main.h" // main code diff --git a/examples/vga_pi/src/main.cpp b/examples/vga_pi/src/main.cpp index 03cae84..01156f6 100644 --- a/examples/vga_pi/src/main.cpp +++ b/examples/vga_pi/src/main.cpp @@ -5,7 +5,10 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" +#include "picovga.h" +#include "hardware/clocks.h" +#include // text screen (mono character, format GF_MTEXT) ALIGNED u8 TextBuf[TEXTSIZE]; diff --git a/examples/vga_pixels/CMakeLists.txt b/examples/vga_pixels/CMakeLists.txt new file mode 100644 index 0000000..a3cbe19 --- /dev/null +++ b/examples/vga_pixels/CMakeLists.txt @@ -0,0 +1,22 @@ +add_executable(vga_balloons + src/main.cpp + img/clouds.cpp + img/hotair.cpp + img/blue.cpp + img/green.cpp + img/red.cpp + img/yellow.cpp +) + +add_picovga(vga_balloons) + +# for vga_config.h include +target_include_directories(vga_balloons PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_balloons) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file diff --git a/examples/vga_pixels/src/main.cpp b/examples/vga_pixels/src/main.cpp index dac0f01..272eee7 100644 --- a/examples/vga_pixels/src/main.cpp +++ b/examples/vga_pixels/src/main.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" // Draw box ALIGNED u8 Box[WIDTHBYTE*HEIGHT]; diff --git a/examples/vga_raytrace/CMakeLists.txt b/examples/vga_raytrace/CMakeLists.txt new file mode 100644 index 0000000..a3cbe19 --- /dev/null +++ b/examples/vga_raytrace/CMakeLists.txt @@ -0,0 +1,22 @@ +add_executable(vga_balloons + src/main.cpp + img/clouds.cpp + img/hotair.cpp + img/blue.cpp + img/green.cpp + img/red.cpp + img/yellow.cpp +) + +add_picovga(vga_balloons) + +# for vga_config.h include +target_include_directories(vga_balloons PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_balloons) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file diff --git a/examples/vga_raytrace/src/main.cpp b/examples/vga_raytrace/src/main.cpp index b75d98e..a398f9c 100644 --- a/examples/vga_raytrace/src/main.cpp +++ b/examples/vga_raytrace/src/main.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" // Draw box u8 Box[WIDTHBYTE*HEIGHT] __attribute__ ((aligned(4))); @@ -37,7 +37,7 @@ void VideoInit() int main() { // run VGA core -// multicore_launch_core1(VgaCore); +// StartVgaCore(); // initialize videomode // VideoInit(); diff --git a/examples/vga_raytrace/src/render.cpp b/examples/vga_raytrace/src/render.cpp index a6987ff..6f1ef30 100644 --- a/examples/vga_raytrace/src/render.cpp +++ b/examples/vga_raytrace/src/render.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" // list of spheres Sphere Spheres[] = { diff --git a/examples/vga_sokoban/CMakeLists.txt b/examples/vga_sokoban/CMakeLists.txt new file mode 100644 index 0000000..a3cbe19 --- /dev/null +++ b/examples/vga_sokoban/CMakeLists.txt @@ -0,0 +1,22 @@ +add_executable(vga_balloons + src/main.cpp + img/clouds.cpp + img/hotair.cpp + img/blue.cpp + img/green.cpp + img/red.cpp + img/yellow.cpp +) + +add_picovga(vga_balloons) + +# for vga_config.h include +target_include_directories(vga_balloons PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_balloons) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file diff --git a/examples/vga_sokoban/img/tiles12.cpp b/examples/vga_sokoban/img/tiles12.cpp index 90cfb9f..889b962 100644 --- a/examples/vga_sokoban/img/tiles12.cpp +++ b/examples/vga_sokoban/img/tiles12.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 276 pixels diff --git a/examples/vga_sokoban/img/tiles16.cpp b/examples/vga_sokoban/img/tiles16.cpp index 986408b..1f7a5ea 100644 --- a/examples/vga_sokoban/img/tiles16.cpp +++ b/examples/vga_sokoban/img/tiles16.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 368 pixels diff --git a/examples/vga_sokoban/img/tiles20.cpp b/examples/vga_sokoban/img/tiles20.cpp index 576715a..1d7cb94 100644 --- a/examples/vga_sokoban/img/tiles20.cpp +++ b/examples/vga_sokoban/img/tiles20.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 460 pixels diff --git a/examples/vga_sokoban/img/tiles24.cpp b/examples/vga_sokoban/img/tiles24.cpp index 537c5a7..cb4d9f1 100644 --- a/examples/vga_sokoban/img/tiles24.cpp +++ b/examples/vga_sokoban/img/tiles24.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 552 pixels diff --git a/examples/vga_sokoban/img/tiles28.cpp b/examples/vga_sokoban/img/tiles28.cpp index a86e980..ce2d83e 100644 --- a/examples/vga_sokoban/img/tiles28.cpp +++ b/examples/vga_sokoban/img/tiles28.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 644 pixels diff --git a/examples/vga_sokoban/img/tiles32.cpp b/examples/vga_sokoban/img/tiles32.cpp index 5c8c8f0..04dc7d1 100644 --- a/examples/vga_sokoban/img/tiles32.cpp +++ b/examples/vga_sokoban/img/tiles32.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 736 pixels diff --git a/examples/vga_sokoban/img/tiles8.cpp b/examples/vga_sokoban/img/tiles8.cpp index 4ba4a51..7e7d96b 100644 --- a/examples/vga_sokoban/img/tiles8.cpp +++ b/examples/vga_sokoban/img/tiles8.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 184 pixels diff --git a/examples/vga_sokoban/snd/yippee.cpp b/examples/vga_sokoban/snd/yippee.cpp index eca7e92..c0207ef 100644 --- a/examples/vga_sokoban/snd/yippee.cpp +++ b/examples/vga_sokoban/snd/yippee.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 YippeeSnd[17902] = { diff --git a/examples/vga_sokoban/src/game.cpp b/examples/vga_sokoban/src/game.cpp index be9e29b..4017731 100644 --- a/examples/vga_sokoban/src/game.cpp +++ b/examples/vga_sokoban/src/game.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" // buffers u8 Board[MAPWMAX*MAPHMAX]; // game board diff --git a/examples/vga_sokoban/src/levels.cpp b/examples/vga_sokoban/src/levels.cpp index 58b2da6..d5bda81 100644 --- a/examples/vga_sokoban/src/levels.cpp +++ b/examples/vga_sokoban/src/levels.cpp @@ -17,7 +17,7 @@ // @ or p = player // + or P = player on mark -#include "include.h" +#include "main.h" // intro level (tiles 32x32, board 20x15) const char* IntroLevel[] = { diff --git a/examples/vga_sokoban/src/levels_damgaard.cpp b/examples/vga_sokoban/src/levels_damgaard.cpp index b16b078..078d31e 100644 --- a/examples/vga_sokoban/src/levels_damgaard.cpp +++ b/examples/vga_sokoban/src/levels_damgaard.cpp @@ -8,7 +8,7 @@ // Copyright: Copyright (c) 2003 Brian Damgaard // These levels may be freely distributed provided they are credited with the author's name. -#include "include.h" +#include "main.h" // The YASGen Collection, (c) Brian Damgaard const char* DamgaardCol1[] = { diff --git a/examples/vga_sokoban/src/levels_domenech.cpp b/examples/vga_sokoban/src/levels_domenech.cpp index 77b4003..13b3c05 100644 --- a/examples/vga_sokoban/src/levels_domenech.cpp +++ b/examples/vga_sokoban/src/levels_domenech.cpp @@ -17,7 +17,7 @@ // License: Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported // http://creativecommons.org/licenses/by-nc-nd/3.0/ -#include "include.h" +#include "main.h" // Original remixed, (c) Jordi Domenech const char* DomenechCol1[] = { diff --git a/examples/vga_sokoban/src/levels_dzekic.cpp b/examples/vga_sokoban/src/levels_dzekic.cpp index 2835787..3491b07 100644 --- a/examples/vga_sokoban/src/levels_dzekic.cpp +++ b/examples/vga_sokoban/src/levels_dzekic.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" // Galadriel, (c) Marko Dzekic const char* DzekicCol1[] = { diff --git a/examples/vga_sokoban/src/levels_grigor.cpp b/examples/vga_sokoban/src/levels_grigor.cpp index 6a98b86..44c1ec6 100644 --- a/examples/vga_sokoban/src/levels_grigor.cpp +++ b/examples/vga_sokoban/src/levels_grigor.cpp @@ -20,7 +20,7 @@ // I shall be pleased, if you place them in the program or on the site. // Do not ask me the sanction. -#include "include.h" +#include "main.h" // Grigr 2001 const char* GrigorCol1[] = { diff --git a/examples/vga_sokoban/src/levels_haywood.cpp b/examples/vga_sokoban/src/levels_haywood.cpp index c873f61..4228120 100644 --- a/examples/vga_sokoban/src/levels_haywood.cpp +++ b/examples/vga_sokoban/src/levels_haywood.cpp @@ -29,7 +29,7 @@ // The later puzzles are extremely difficult. // The SokHard puzzles are sorted in release order. -#include "include.h" +#include "main.h" // SokEvo, (c) Lee J. Haywood const char* HaywoodCol1[] = { diff --git a/examples/vga_sokoban/src/levels_holland.cpp b/examples/vga_sokoban/src/levels_holland.cpp index 8c329e6..6651121 100644 --- a/examples/vga_sokoban/src/levels_holland.cpp +++ b/examples/vga_sokoban/src/levels_holland.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** // Author: David Holland -// These levels are © David Holland +// These levels are � David Holland // These levels may be distributed freely as long as this copyright message is retained. // // Author's note: @@ -24,7 +24,7 @@ // kind, but are nevertheless quite varied. The puzzles are in roughly ascending // order of difficulty. -#include "include.h" +#include "main.h" // DH1, (c) David Holland const char* HollandCol1[] = { diff --git a/examples/vga_sokoban/src/levels_loma.cpp b/examples/vga_sokoban/src/levels_loma.cpp index 79838c4..92e9d20 100644 --- a/examples/vga_sokoban/src/levels_loma.cpp +++ b/examples/vga_sokoban/src/levels_loma.cpp @@ -8,7 +8,7 @@ // Authors: Aymeric du Peloux, Francois Marques, David Skinner, Sven Egevad, Victor Kindermans, // Michael Steins, Frantisek Pokorny, Arpad Fekete, Roger Delaporte -#include "include.h" +#include "main.h" // Loma const char* LomaCol1[] = { diff --git a/examples/vga_sokoban/src/levels_martel.cpp b/examples/vga_sokoban/src/levels_martel.cpp index 931b880..12f0848 100644 --- a/examples/vga_sokoban/src/levels_martel.cpp +++ b/examples/vga_sokoban/src/levels_martel.cpp @@ -15,7 +15,7 @@ // Send comments and best solutions to : // sokomonk@laposte.net -#include "include.h" +#include "main.h" const char* MartelCol1[] = { diff --git a/examples/vga_sokoban/src/levels_murase.cpp b/examples/vga_sokoban/src/levels_murase.cpp index de5e5cb..7506b16 100644 --- a/examples/vga_sokoban/src/levels_murase.cpp +++ b/examples/vga_sokoban/src/levels_murase.cpp @@ -7,7 +7,7 @@ // Copyright (c) by Yoshio Murase. // Original level website: http://www.ne.jp/asahi/ai/yoshio/sokoban/ -#include "include.h" +#include "main.h" // Hand-Made, (c) Yoshio Murase const char* MuraseCol1[] = { diff --git a/examples/vga_sokoban/src/levels_peloux.cpp b/examples/vga_sokoban/src/levels_peloux.cpp index de7400b..bd3933b 100644 --- a/examples/vga_sokoban/src/levels_peloux.cpp +++ b/examples/vga_sokoban/src/levels_peloux.cpp @@ -11,7 +11,7 @@ // distributed for non-commercial use provided they remain unchanged, credited // with the author's name and original web site, and provided the author is notified. -#include "include.h" +#include "main.h" // MiniCosmos, (c) Aymeric du Peloux const char* PelouxCol1[] = { diff --git a/examples/vga_sokoban/src/levels_rabbit.cpp b/examples/vga_sokoban/src/levels_rabbit.cpp index 8461a30..4046148 100644 --- a/examples/vga_sokoban/src/levels_rabbit.cpp +++ b/examples/vga_sokoban/src/levels_rabbit.cpp @@ -6,7 +6,7 @@ // **************************************************************************** // (c) Thinking Rabbit -#include "include.h" +#include "main.h" // XSokoban, Original Levels & extras, (c) Thinking Rabbit const char* RabbitCol1[] = { diff --git a/examples/vga_sokoban/src/levels_skinner.cpp b/examples/vga_sokoban/src/levels_skinner.cpp index e4ffec2..9c71ecf 100644 --- a/examples/vga_sokoban/src/levels_skinner.cpp +++ b/examples/vga_sokoban/src/levels_skinner.cpp @@ -11,7 +11,7 @@ // These levels may be freely distributed provided they are credited // with the author's name and e-mail address. -#include "include.h" +#include "main.h" // Sasquatch, (c) David W. Skinner const char* SkinnerCol1[] = { diff --git a/examples/vga_sokoban/src/levels_sladkey.cpp b/examples/vga_sokoban/src/levels_sladkey.cpp index 62c5310..586bd84 100644 --- a/examples/vga_sokoban/src/levels_sladkey.cpp +++ b/examples/vga_sokoban/src/levels_sladkey.cpp @@ -29,7 +29,7 @@ // so that they can be played on a display with the size and aspect ratio of // a typical mobile phone without rotation. -#include "include.h" +#include "main.h" // The Warehouse Volume I - Vertical Mobility 1, (c) Rick Sladkey const char* SladkeyCol1[] = { diff --git a/examples/vga_sokoban/src/main.cpp b/examples/vga_sokoban/src/main.cpp index f4250a1..837d610 100644 --- a/examples/vga_sokoban/src/main.cpp +++ b/examples/vga_sokoban/src/main.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" // copy of tiles images ALIGNED u8 TilesImg_Copy[sizeof(Tiles32Img)]; @@ -144,7 +144,7 @@ int main() memcpy(Font_Copy, FontBoldB8x16, sizeof(FontBoldB8x16)); // run VGA core - multicore_launch_core1(VgaCore); + StartVgaCore(); // initialize videomode VideoInit(); diff --git a/examples/vga_sokoban/src/select.cpp b/examples/vga_sokoban/src/select.cpp index 112de55..5e5c6c8 100644 --- a/examples/vga_sokoban/src/select.cpp +++ b/examples/vga_sokoban/src/select.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" // print position //u8 PrintX, PrintY, PrintCol; diff --git a/examples/vga_spheres/CMakeLists.txt b/examples/vga_spheres/CMakeLists.txt new file mode 100644 index 0000000..a3cbe19 --- /dev/null +++ b/examples/vga_spheres/CMakeLists.txt @@ -0,0 +1,22 @@ +add_executable(vga_balloons + src/main.cpp + img/clouds.cpp + img/hotair.cpp + img/blue.cpp + img/green.cpp + img/red.cpp + img/yellow.cpp +) + +add_picovga(vga_balloons) + +# for vga_config.h include +target_include_directories(vga_balloons PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_balloons) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file diff --git a/examples/vga_spheres/src/main.cpp b/examples/vga_spheres/src/main.cpp index e64d647..868edf6 100644 --- a/examples/vga_spheres/src/main.cpp +++ b/examples/vga_spheres/src/main.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" // Draw box ALIGNED u8 Box[WIDTHBYTE*HEIGHT]; diff --git a/examples/vga_spots/CMakeLists.txt b/examples/vga_spots/CMakeLists.txt new file mode 100644 index 0000000..a3cbe19 --- /dev/null +++ b/examples/vga_spots/CMakeLists.txt @@ -0,0 +1,22 @@ +add_executable(vga_balloons + src/main.cpp + img/clouds.cpp + img/hotair.cpp + img/blue.cpp + img/green.cpp + img/red.cpp + img/yellow.cpp +) + +add_picovga(vga_balloons) + +# for vga_config.h include +target_include_directories(vga_balloons PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_balloons) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file diff --git a/examples/vga_spots/src/main.cpp b/examples/vga_spots/src/main.cpp index 57733f4..758681b 100644 --- a/examples/vga_spots/src/main.cpp +++ b/examples/vga_spots/src/main.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" // Draw box ALIGNED u8 Box[WIDTHBYTE*HEIGHT]; diff --git a/examples/vga_tetris/CMakeLists.txt b/examples/vga_tetris/CMakeLists.txt new file mode 100644 index 0000000..a3cbe19 --- /dev/null +++ b/examples/vga_tetris/CMakeLists.txt @@ -0,0 +1,22 @@ +add_executable(vga_balloons + src/main.cpp + img/clouds.cpp + img/hotair.cpp + img/blue.cpp + img/green.cpp + img/red.cpp + img/yellow.cpp +) + +add_picovga(vga_balloons) + +# for vga_config.h include +target_include_directories(vga_balloons PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_balloons) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file diff --git a/examples/vga_tetris/img/tiles.cpp b/examples/vga_tetris/img/tiles.cpp index 5754afd..8e59216 100644 --- a/examples/vga_tetris/img/tiles.cpp +++ b/examples/vga_tetris/img/tiles.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 24 pixels diff --git a/examples/vga_tetris/snd/brick.cpp b/examples/vga_tetris/snd/brick.cpp index d93c93d..353c842 100644 --- a/examples/vga_tetris/snd/brick.cpp +++ b/examples/vga_tetris/snd/brick.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 BrickSnd[2354] = { diff --git a/examples/vga_tetris/snd/gameover.cpp b/examples/vga_tetris/snd/gameover.cpp index 8b0f628..089b7aa 100644 --- a/examples/vga_tetris/snd/gameover.cpp +++ b/examples/vga_tetris/snd/gameover.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 GameOverSnd[14648] = { diff --git a/examples/vga_tetris/snd/levelup.cpp b/examples/vga_tetris/snd/levelup.cpp index 27df9a9..b381314 100644 --- a/examples/vga_tetris/snd/levelup.cpp +++ b/examples/vga_tetris/snd/levelup.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 LevelUpSnd[43971] = { diff --git a/examples/vga_tetris/snd/line.cpp b/examples/vga_tetris/snd/line.cpp index bda6171..00f47c5 100644 --- a/examples/vga_tetris/snd/line.cpp +++ b/examples/vga_tetris/snd/line.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 LineSnd[7330] = { diff --git a/examples/vga_tetris/src/main.cpp b/examples/vga_tetris/src/main.cpp index e3b4b7d..784c898 100644 --- a/examples/vga_tetris/src/main.cpp +++ b/examples/vga_tetris/src/main.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" #define BASEBRICKNUM 7 // number of basebricks #define BRICKTEMPNUM 19 // number of brick templates diff --git a/examples/vga_train/CMakeLists.txt b/examples/vga_train/CMakeLists.txt new file mode 100644 index 0000000..a3cbe19 --- /dev/null +++ b/examples/vga_train/CMakeLists.txt @@ -0,0 +1,22 @@ +add_executable(vga_balloons + src/main.cpp + img/clouds.cpp + img/hotair.cpp + img/blue.cpp + img/green.cpp + img/red.cpp + img/yellow.cpp +) + +add_picovga(vga_balloons) + +# for vga_config.h include +target_include_directories(vga_balloons PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_balloons) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file diff --git a/examples/vga_train/img/tiles.cpp b/examples/vga_train/img/tiles.cpp index 5a12d20..513bad1 100644 --- a/examples/vga_train/img/tiles.cpp +++ b/examples/vga_train/img/tiles.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 32 pixels diff --git a/examples/vga_train/snd/collect.cpp b/examples/vga_train/snd/collect.cpp index 0a8824d..f772247 100644 --- a/examples/vga_train/snd/collect.cpp +++ b/examples/vga_train/snd/collect.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 CollectSnd[3642] = { diff --git a/examples/vga_train/snd/crash.cpp b/examples/vga_train/snd/crash.cpp index 6775cbf..e08e0da 100644 --- a/examples/vga_train/snd/crash.cpp +++ b/examples/vga_train/snd/crash.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 CrashSnd[50146] = { diff --git a/examples/vga_train/snd/step.cpp b/examples/vga_train/snd/step.cpp index 1ef7d06..0731acb 100644 --- a/examples/vga_train/snd/step.cpp +++ b/examples/vga_train/snd/step.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 StepSnd[2243] = { diff --git a/examples/vga_train/snd/success.cpp b/examples/vga_train/snd/success.cpp index c071cf8..3331b9f 100644 --- a/examples/vga_train/snd/success.cpp +++ b/examples/vga_train/snd/success.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 SuccessSnd[32784] = { diff --git a/examples/vga_train/src/game.cpp b/examples/vga_train/src/game.cpp index 0114f1b..ad5d02e 100644 --- a/examples/vga_train/src/game.cpp +++ b/examples/vga_train/src/game.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" // buffers u8 Board[MAPSIZE]; // game board diff --git a/examples/vga_train/src/levels.cpp b/examples/vga_train/src/levels.cpp index b7b229c..f77174c 100644 --- a/examples/vga_train/src/levels.cpp +++ b/examples/vga_train/src/levels.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" // level scenes const u8 Levels[(LEVNUM+1)*MAPSIZE] = { diff --git a/examples/vga_train/src/main.cpp b/examples/vga_train/src/main.cpp index df12fc8..824b8e0 100644 --- a/examples/vga_train/src/main.cpp +++ b/examples/vga_train/src/main.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" u8 Text[TEXTMAX*2]; // 2 rows of text (2nd row is empty, it is used to center line vertically) u8 TextCol[TEXTMAX*2*8] __attribute__ ((aligned(4))); // text color gradient @@ -104,7 +104,7 @@ int main() memcpy(Font_Copy, FontBold8x8, sizeof(FontBold8x8)); // run VGA core - multicore_launch_core1(VgaCore); + StartVgaCore(); // clear info row InfoClear(); diff --git a/examples/vga_twister/CMakeLists.txt b/examples/vga_twister/CMakeLists.txt new file mode 100644 index 0000000..a3cbe19 --- /dev/null +++ b/examples/vga_twister/CMakeLists.txt @@ -0,0 +1,22 @@ +add_executable(vga_balloons + src/main.cpp + img/clouds.cpp + img/hotair.cpp + img/blue.cpp + img/green.cpp + img/red.cpp + img/yellow.cpp +) + +add_picovga(vga_balloons) + +# for vga_config.h include +target_include_directories(vga_balloons PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_balloons) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file diff --git a/examples/vga_twister/img/CobbleStone.cpp b/examples/vga_twister/img/CobbleStone.cpp index 5f84daf..aa234db 100644 --- a/examples/vga_twister/img/CobbleStone.cpp +++ b/examples/vga_twister/img/CobbleStone.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels diff --git a/examples/vga_twister/img/Fabric.cpp b/examples/vga_twister/img/Fabric.cpp index ea11a84..046517b 100644 --- a/examples/vga_twister/img/Fabric.cpp +++ b/examples/vga_twister/img/Fabric.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels diff --git a/examples/vga_twister/img/Soil.cpp b/examples/vga_twister/img/Soil.cpp index 3278203..685ff40 100644 --- a/examples/vga_twister/img/Soil.cpp +++ b/examples/vga_twister/img/Soil.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels diff --git a/examples/vga_twister/img/Wood.cpp b/examples/vga_twister/img/Wood.cpp index 95ae068..9566c7b 100644 --- a/examples/vga_twister/img/Wood.cpp +++ b/examples/vga_twister/img/Wood.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 128 pixels diff --git a/examples/vga_twister/src/main.cpp b/examples/vga_twister/src/main.cpp index 1e86cd5..7565aee 100644 --- a/examples/vga_twister/src/main.cpp +++ b/examples/vga_twister/src/main.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" // Draw box ALIGNED u8 Box[WIDTHBYTE*HEIGHT]; @@ -98,7 +98,7 @@ int main() memcpy(Img4, WoodImg, IMGSIZE); // run VGA core - multicore_launch_core1(VgaCore); + StartVgaCore(); // initialize videomode VideoInit(); diff --git a/examples/vga_watersurface/CMakeLists.txt b/examples/vga_watersurface/CMakeLists.txt new file mode 100644 index 0000000..a3cbe19 --- /dev/null +++ b/examples/vga_watersurface/CMakeLists.txt @@ -0,0 +1,22 @@ +add_executable(vga_balloons + src/main.cpp + img/clouds.cpp + img/hotair.cpp + img/blue.cpp + img/green.cpp + img/red.cpp + img/yellow.cpp +) + +add_picovga(vga_balloons) + +# for vga_config.h include +target_include_directories(vga_balloons PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src +) + +# create map/bin/hex file etc. +pico_add_extra_outputs(vga_balloons) + +# Allow stdio to USB +# pico_enable_stdio_usb(vga_balloons 1) \ No newline at end of file diff --git a/examples/vga_watersurface/img/duck.cpp b/examples/vga_watersurface/img/duck.cpp index 21f9f2d..38b0c6e 100644 --- a/examples/vga_watersurface/img/duck.cpp +++ b/examples/vga_watersurface/img/duck.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 512 pixels diff --git a/examples/vga_watersurface/img/forest.cpp b/examples/vga_watersurface/img/forest.cpp index 2bb0bb2..8ef3e62 100644 --- a/examples/vga_watersurface/img/forest.cpp +++ b/examples/vga_watersurface/img/forest.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // format: 8-bit pixel graphics // image width: 512 pixels diff --git a/examples/vga_watersurface/snd/river.cpp b/examples/vga_watersurface/snd/river.cpp index e199013..7a2bdf9 100644 --- a/examples/vga_watersurface/snd/river.cpp +++ b/examples/vga_watersurface/snd/river.cpp @@ -1,4 +1,4 @@ -#include "include.h" +#include "main.h" // sound format: PCM mono 8-bit 22050Hz const u8 RiverSnd[105000] = { diff --git a/examples/vga_watersurface/src/main.cpp b/examples/vga_watersurface/src/main.cpp index debe0cf..b480da2 100644 --- a/examples/vga_watersurface/src/main.cpp +++ b/examples/vga_watersurface/src/main.cpp @@ -5,7 +5,7 @@ // // **************************************************************************** -#include "include.h" +#include "main.h" // Draw box ALIGNED u8 Box[WIDTHBYTE*HEIGHT]; diff --git a/src/vga.cpp b/src/vga.cpp index 4064391..1aefc73 100644 --- a/src/vga.cpp +++ b/src/vga.cpp @@ -7,6 +7,7 @@ #include "pico/stdlib.h" #include "pico/printf.h" +#include "pico/multicore.h" #include "picovga.h" #include "vga.pio.h" @@ -1057,6 +1058,17 @@ void VgaCore() } } +/** + * @brief Starts the VGA core on core1 + */ +void StartVgaCore() +{ + // stop VGA core + multicore_reset_core1(); + // run VGA core + multicore_launch_core1(VgaCore); +} + // request to initialize VGA videomode, NULL=only stop driver (wait to initialization completes) void VgaInitReq(const sVmode* vmode) { diff --git a/src/vga.h b/src/vga.h index 3387740..1c3a006 100644 --- a/src/vga.h +++ b/src/vga.h @@ -114,8 +114,8 @@ void ScanlineTypePrint(const u8* scan, int lines); // - All layer modes must use same layer program (LAYERMODE_BASE = overlapped layers are OFF) void VgaInit(const sVmode* vmode); //, u8 layer1mode=LAYERMODE_BASE, u8 layer2mode=LAYERMODE_BASE, u8 layer3mode=LAYERMODE_BASE); -// VGA core -void VgaCore(); +// Start the VGA processing on core1 +void StartVgaCore(); // request to initialize VGA videomode, NULL=only stop driver (wait to initialization completes) void VgaInitReq(const sVmode* vmode); diff --git a/src/vga_vmode.cpp b/src/vga_vmode.cpp index efe3e4b..907ae8b 100644 --- a/src/vga_vmode.cpp +++ b/src/vga_vmode.cpp @@ -769,11 +769,8 @@ const u16 VideoResReq[RES_MAX*2] = // FORM_RLE: pointer to image rows (ALIGNED attribute, should be in RAM) void Video(u8 dev, u8 res, u8 form, u8* buf, const void* buf2 /* = FontBoldB8x16 */) { - // stop VGA core - multicore_reset_core1(); - // run VGA core - multicore_launch_core1(VgaCore); + StartVgaCore(); // prepare timings structure if (dev >= DEV_MAX) dev = DEV_VGA;