I've created a C bridge or wrapper around the SSS by Robert Hurst. It can be downloaded from the following location:
https://drive.google.com/open?id=0BypVx ... DRwVE9BUWM
The link is a .zip file that unpacks to a hello world project....
Everything is setup up to get you up and running quickly - it includes a copy of CC65 and VICSSS (but not VICE).
Inside the folder is a COMPILE.BAT that generates the above .PRG file. You will just need to change the path to the location of VICE on your machine
at the bottom of this file.
e.g.
Code: Select all
"c:\MyViceFolder\xvic.exe" -moncommands %~dp0\obj\%TITLE%.sym -memory 16k bin\%TITLE%.prg
The guts of the program is in the file main.c and should be self explanatory with the
//COMENTS and reading the included SSS pdf docs and a smattering of C knowledge.
Code: Select all
void main (void)
{
BYTE bigDudeSprite = 0;
BYTE idx = 0;
// Set the screen colours
textcolor (COLOR_RED);
bordercolor (COLOR_BLUE);
bgcolor (COLOR_BLACK);
// Init Vic SSS
SSSINIT();
// Start IRQ routine for optional frame rate lock
IrqSetup();
// Create the sprite
bigDudeSprite = SSSCREATE(16,SPRITEDEF_HEIGHT_16
| SPRITEDEF_WIDTH_16
| SPRITEDEF_FLOATY_FLOAT
| SPRITEDEF_FLOATX_FLOAT
| SPRITEDEF_ENABLED);
// Clear screen
SSSCLEAR(SSSNULL);
// Hello text..
SSSPRINTTEXT(4,10,"HELLO SSS-C \0");
SSSPRINTTEXT(2,12,"(SSS BY R.HURST)\0");
// Select sprite
SSSUSE(bigDudeSprite);
// Set sprite bitmap
SSSANIM(COLOR_RED, BIGDUDEBITS);
// LOOP forever..
while(TRUE)
{
for (idx = 16; idx < 192; idx++)
{
// Move sprite to x,y cords
SSSUSE(bigDudeSprite);
SSSMOVEXY(idx, idx);
SSSFLIP(1);
}
}
}
A brief explanation some of the other files that are not documented in SSS:
data.s - you can put sprite data etc in here
RasterSync.s - [Assembler SSS] IRQ handler for flicker free sprites
vis-sss-bridge.s -C compatible assembly wrappers for SSS
vis-sss-bridge.h - C header file for SSS function definitions and SYMBOLS
vic20-16k.cfg - linker configuration file. Describes the memory layout and where to put each code file.
You may find an IDE type environment useful. I use Notepad ++ [with NppExec / Explorer plugins] so I can edit files and save/compile/run with a simple Ctrl+F6. You may wish to use Visual Studio code or similar...
You may find my
Screen Designer will be useful for generating sprite data using the bitmap function...
There are plenty of tutorials for C on the web.
This zip file was developed under windows, but should be easy to change to other platforms. If anyone would like to produce and share a unix/mac variant that would be great...
Hoping this will encourage some people to progress from BASIC programming - those that don't want the tedium of writing assembly or writing a sprite library.
[I haven't tested all of the SSS API functions from C, but they should work. Let me know if you find a problem]
If there is enough interest I might extend this Hello World into a small game with some background music etc..
Any questions shout up..