2 Commits

Author SHA1 Message Date
yair
315e2e4a9f Set vga_monoscope default boot mode to PAL 720x576 and add build instructions 2026-02-18 09:52:19 +02:00
Wayne Venables
f5a6ca0ce4 Move stdio_init_all() to before video initialization 2025-09-28 17:21:28 -07:00
17 changed files with 126 additions and 65 deletions

61
BUILD_INSTRUCTIONS.md Normal file
View File

@@ -0,0 +1,61 @@
# Build Instructions
This project uses CMake with the Raspberry Pi Pico SDK and an ARM cross-toolchain.
## Prerequisites (Ubuntu/Debian)
Install required packages:
```bash
sudo apt-get update
sudo apt-get install -y \
cmake \
ninja-build \
gcc-arm-none-eabi \
binutils-arm-none-eabi
```
## Configure
From the repository root:
```bash
cmake -S . -B build -G Ninja -DPICO_SDK_FETCH_FROM_GIT=ON
```
Notes:
- `PICO_SDK_FETCH_FROM_GIT=ON` automatically downloads the Pico SDK into `build/_deps`.
- If you already have a local Pico SDK, set `PICO_SDK_PATH` instead.
## Build the Monoscope Example
```bash
cmake --build build --target vga_monoscope -j
```
## Output Artifacts
After a successful build, files are generated here:
- `build/examples/vga_monoscope/vga_monoscope.uf2`
- `build/examples/vga_monoscope/vga_monoscope.hex`
- `build/examples/vga_monoscope/vga_monoscope.bin`
- `build/examples/vga_monoscope/build/vga_monoscope.elf`
## Rebuild
To rebuild after source changes:
```bash
cmake --build build --target vga_monoscope
```
## Clean Build
To start from a clean state:
```bash
rm -rf build
cmake -S . -B build -G Ninja -DPICO_SDK_FETCH_FROM_GIT=ON
cmake --build build --target vga_monoscope -j
```

View File

@@ -277,7 +277,10 @@ void DispOpenSel()
// main function // main function
int main() int main()
{ {
char ch; // initialize stdio
stdio_init_all();
char ch;
u32 t; u32 t;
// initialize random number generator // initialize random number generator
@@ -289,9 +292,6 @@ int main()
// initialize canvases // initialize canvases
InitImg(); InitImg();
// initialize stdio
stdio_init_all();
// initialize sound output // initialize sound output
PWMSndInit(); PWMSndInit();

View File

@@ -790,7 +790,10 @@ void PlayGame(Bool comp1, Bool comp2)
// main function // main function
int main() int main()
{ {
char ch; // initialize stdio
stdio_init_all();
char ch;
// copy tiles images // copy tiles images
memcpy(TilesImg_Copy, TilesImg, sizeof(TilesImg)); memcpy(TilesImg_Copy, TilesImg, sizeof(TilesImg));
@@ -805,9 +808,6 @@ int main()
// initialize videomode // initialize videomode
Video(DEV_VGA, RES_EGA, FORM_8BIT, Box); Video(DEV_VGA, RES_EGA, FORM_8BIT, Box);
// initialize stdio
stdio_init_all();
// initialize sound output // initialize sound output
PWMSndInit(); PWMSndInit();

View File

@@ -118,7 +118,10 @@ Bool Check()
// main function // main function
int main() int main()
{ {
int i; // initialize stdio
stdio_init_all();
int i;
// initialize random number generator // initialize random number generator
RandInitSeed(); RandInitSeed();
@@ -130,9 +133,6 @@ int main()
Video(DEV_VGA, RES_ZX, FORM_TILE48, Board, TilesImg_Copy); Video(DEV_VGA, RES_ZX, FORM_TILE48, Board, TilesImg_Copy);
pScreen->strip[0].seg[0].offx = -32; pScreen->strip[0].seg[0].offx = -32;
// initialize stdio
stdio_init_all();
// initialize sound output // initialize sound output
PWMSndInit(); PWMSndInit();

View File

@@ -329,7 +329,10 @@ void FlushChar()
int main() int main()
{ {
int t0, t2; // initialize stdio
stdio_init_all();
int t0, t2;
float dt; float dt;
// copy images // copy images
@@ -350,9 +353,6 @@ int main()
// initialize videomode // initialize videomode
VideoInit(170000); VideoInit(170000);
// initialize stdio
stdio_init_all();
// initialize sound output // initialize sound output
PWMSndInit(); PWMSndInit();

View File

@@ -294,7 +294,10 @@ void VideoInit()
int main() int main()
{ {
char ch; // initialize stdio
stdio_init_all();
char ch;
// copy font to RAM buffer // copy font to RAM buffer
memcpy(Font_Copy, FontBold8x8, sizeof(FontBold8x8)); memcpy(Font_Copy, FontBold8x8, sizeof(FontBold8x8));
@@ -309,9 +312,6 @@ int main()
Page = 0; Page = 0;
OpenPage(); OpenPage();
// initialize stdio
stdio_init_all();
// main loop // main loop
while (true) while (true)
{ {

View File

@@ -343,6 +343,9 @@ void InitSlot()
int main() int main()
{ {
// initialize stdio
stdio_init_all();
char ch; char ch;
// copy tiles images to RAM buffer (flash would be too slow) // copy tiles images to RAM buffer (flash would be too slow)
@@ -369,9 +372,6 @@ int main()
// VideoInit(); // VideoInit();
Video(DEV_VGA, RES_VGA, FORM_TILE16, Board, TilesImg_Copy); Video(DEV_VGA, RES_VGA, FORM_TILE16, Board, TilesImg_Copy);
// initialize stdio
stdio_init_all();
// display help // display help
DispHelp(); DispHelp();

View File

@@ -380,7 +380,10 @@ void Help()
int main() int main()
{ {
int c; // initialize stdio
stdio_init_all();
int c;
// run VGA core // run VGA core
StartVgaCore(); StartVgaCore();
@@ -388,9 +391,6 @@ int main()
// setup videomode // setup videomode
Init(); Init();
// initialize stdio
stdio_init_all();
// initialize debug LED // initialize debug LED
gpio_init(LED_PIN); gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT); gpio_set_dir(LED_PIN, GPIO_OUT);

View File

@@ -214,7 +214,10 @@ void Clear()
int main() int main()
{ {
int i; // initialize stdio
stdio_init_all();
int i;
char ch; char ch;
// initialize random number generator // initialize random number generator
@@ -228,9 +231,6 @@ int main()
if (MAZEW != MAPW) pScreen->strip[0].seg[0].offx = -4; // center image on the screen if (MAZEW != MAPW) pScreen->strip[0].seg[0].offx = -4; // center image on the screen
if (MAZEH != MAPH) pScreen->strip[0].seg[0].offy = -4; if (MAZEH != MAPH) pScreen->strip[0].seg[0].offy = -4;
// initialize stdio
stdio_init_all();
// display help // display help
DispHelp(); DispHelp();

View File

@@ -53,7 +53,7 @@
u16 Rows[962]; // RLE rows u16 Rows[962]; // RLE rows
u8 Img[180000] __attribute__ ((aligned(4))); // RLE image u8 Img[180000] __attribute__ ((aligned(4))); // RLE image
int MonoSel = 22; // selected videomode int MonoSel = 1; // selected videomode (PAL 720x576)
// monoscope descriptor // monoscope descriptor
typedef struct { typedef struct {
@@ -254,16 +254,16 @@ void MonoList()
int main() int main()
{ {
char c; // initialize stdio
stdio_init_all();
char c;
// run VGA core // run VGA core
StartVgaCore(); StartVgaCore();
// run default video mode VGA 640x480 // run default video mode PAL 720x576
MonoInit(22); MonoInit(1);
// initialize stdio
stdio_init_all();
while (true) while (true)
{ {

View File

@@ -200,7 +200,10 @@ void FlushChar()
int main() int main()
{ {
// initialize random number generator // initialize stdio
stdio_init_all();
// initialize random number generator
RandInitSeed(); RandInitSeed();
// initialize buffers on program start // initialize buffers on program start
@@ -212,9 +215,6 @@ int main()
// initialize videomode // initialize videomode
VideoInit(); VideoInit();
// initialize stdio
stdio_init_all();
// some internal checks // some internal checks
while ((sizeof(SpritesImg) != SPRITE_NUM*SPRITEW*SPRITEH) || while ((sizeof(SpritesImg) != SPRITE_NUM*SPRITEW*SPRITEH) ||
(sizeof(TilesImg) != TILE_NUM*TILESIZE*TILESIZE)) (sizeof(TilesImg) != TILE_NUM*TILESIZE*TILESIZE))

View File

@@ -143,7 +143,10 @@ void FlushChar()
int main() int main()
{ {
int i; // initialize stdio
stdio_init_all();
int i;
// initialize random number generator // initialize random number generator
RandInitSeed(); RandInitSeed();
@@ -157,9 +160,6 @@ int main()
// initialize videomode // initialize videomode
VideoInit(); VideoInit();
// initialize stdio
stdio_init_all();
// initialize sound output // initialize sound output
PWMSndInit(); PWMSndInit();

View File

@@ -1006,7 +1006,10 @@ void PlayDemo()
int main() int main()
{ {
// initialize random number generator // initialize stdio
stdio_init_all();
// initialize random number generator
RandInitSeed(); RandInitSeed();
// copy tiles images to RAM buffer // copy tiles images to RAM buffer
@@ -1022,10 +1025,7 @@ int main()
Canvas.wb = TILESIZE; Canvas.wb = TILESIZE;
Canvas.format = CANVAS_8; Canvas.format = CANVAS_8;
// initialize stdio // initialize sound output
stdio_init_all();
// initialize sound output
PWMSndInit(); PWMSndInit();
// display help // display help

View File

@@ -97,7 +97,10 @@ void FlushChar()
int main() int main()
{ {
int i; // initialize stdio
stdio_init_all();
int i;
// initialize random number generator // initialize random number generator
RandInitSeed(); RandInitSeed();
@@ -117,9 +120,6 @@ int main()
// initialize videomode // initialize videomode
VideoInit(); VideoInit();
// initialize stdio
stdio_init_all();
// initialize sound output // initialize sound output
PWMSndInit(); PWMSndInit();

View File

@@ -1 +1 @@
FLASH(rx) : ORIGIN = 0x10000000, LENGTH = (16 * 1024 * 1024) FLASH(rx) : ORIGIN = 0x10000000, LENGTH = (2 * 1024 * 1024)

View File

@@ -73,14 +73,14 @@ typedef unsigned char Bool;
// Constants // Constants
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#define B0 (1<<0) #define B0 (1U<<0)
#define B1 (1<<1) #define B1 (1U<<1)
#define B2 (1<<2) #define B2 (1U<<2)
#define B3 (1<<3) #define B3 (1U<<3)
#define B4 (1<<4) #define B4 (1U<<4)
#define B5 (1<<5) #define B5 (1U<<5)
#define B6 (1<<6) #define B6 (1U<<6)
#define B7 (1<<7) #define B7 (1U<<7)
#define B8 (1U<<8) #define B8 (1U<<8)
#define B9 (1U<<9) #define B9 (1U<<9)
#define B10 (1U<<10) #define B10 (1U<<10)

View File

@@ -54,7 +54,7 @@ extern u32 CtrlBuf2[CBUF_MAX]; // control pairs: u32 count, read address (must b
extern int CtrlBufSize[LAYERS_MAX]; // size of control buffers extern int CtrlBufSize[LAYERS_MAX]; // size of control buffers
// render font pixel mask // render font pixel mask
extern u32 RenderTextMask[512]; extern "C" u32 RenderTextMask[512];
// fill memory buffer with u32 words // fill memory buffer with u32 words
// buf ... data buffer, must be 32-bit aligned // buf ... data buffer, must be 32-bit aligned