c64: updated examples

This commit is contained in:
Steven Hugg 2023-11-14 10:52:33 -06:00
parent 12957d7740
commit 19e3bbbea3
3 changed files with 52 additions and 5 deletions

16
presets/c64/helloc.c Normal file
View File

@ -0,0 +1,16 @@
#include <stdio.h>
#include <conio.h>
#include <c64.h>
#include <cbm_petscii_charmap.h>
void main(void) {
clrscr(); // clear screen
puts("Hello World!\n"); // write message at cursor
chline(12); // horizontal line
bordercolor(COLOR_LIGHTBLUE); // set color to blue
bgcolor(COLOR_GREEN); // set background color
textcolor(COLOR_YELLOW); // set text color
puts("\nThis text is yellow!\n"); // write message
cgetc(); // wait for input
}

29
presets/c64/screen_ram.c Normal file
View File

@ -0,0 +1,29 @@
#include "common.h"
//#link "common.c"
#include <cbm_screen_charmap.h>
void main(void) {
unsigned int i;
clrscr(); // clear the screen
POKE(0x400, 'A'); // write to first byte of screen memory
POKE(0x400, 65); // character code for 'A'
POKE(0x400 + 40*24 + 39, 'Z'); // row 24, column 39
// fill with random characters
for (i=0; i<40*25; i++)
POKE(0x400 + i, 205 + (rand() & 1));
// set character set to uppercase + graphics characters
SET_VIC_BITMAP(0x1000);
// set color map underlying characters
for (i=0; i<40*25; i++)
COLOR_RAM[i] = COLOR_GREEN;
// infinite loop (avoid "ready" prompt)
while (1);
}

View File

@ -5,11 +5,8 @@ import { PLATFORMS } from "../common/emu";
import { BaseMAME6502Platform } from "../common/mameplatform";
const C64_PRESETS = [
{id:'hello.dasm', name:'Hello World (ASM)'},
{id:'23matches.c', name:'23 Matches'},
{id:'tgidemo.c', name:'TGI Graphics Demo'},
{id:'upandaway.c', name:'Up, Up and Away'},
{id:'siegegame.c', name:'Siege Game'},
{id:'helloc.c', name:'Hello World'},
{id:'screen_ram.c', name:'Screen RAM'},
{id:'joymove.c', name:'Sprite Movement'},
{id:'sprite_collision.c', name:'Sprite Collision'},
{id:'scroll1.c', name:'Scrolling (Single Buffer)'},
@ -34,6 +31,11 @@ const C64_PRESETS = [
{id:'test_border_sprites.c', name:'Sprites in the Borders'},
{id:'sprite_stretch.c', name:'Sprite Stretching'},
{id:'plasma.c', name:'Plasma Demo'},
{id:'siegegame.c', name:'Siege Game'},
{id:'23matches.c', name:'23 Matches'},
{id:'tgidemo.c', name:'TGI Graphics Demo'},
{id:'upandaway.c', name:'Up, Up and Away'},
{id:'hello.dasm', name:'Hello World (DASM)'},
{id:'hello.wiz', name:'Hello Wiz (Wiz)'},
];