Skip to content

Instantly share code, notes, and snippets.

@omiq
Created December 14, 2020 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omiq/c006b3bac6bc5144f65fad1c7ef51bdd to your computer and use it in GitHub Desktop.
Save omiq/c006b3bac6bc5144f65fad1c7ef51bdd to your computer and use it in GitHub Desktop.
TRSE vic 20 hello world bounce
program MainProgram;
/*
Vic 20 8K Vic Bitmap Mode template
- can utilize up to 35K RAM under project settings
-------------------
Dev Note: Zero Page addresses have been defined in project settings
for the Vic 20 build.
_memoryzp - all zero page variables and resources
_constants - game constants & parameters
_memory - all main RAM variables
_lookup - read only look up tables
*/
var
//@define DEBUG 1 // uncomment to show debugging timings
// -------------------------------------------------------------------------------
@include "_constants.ras" // GAME PARAMETERS and CONSTANTS
@include "_memoryzp.ras" // variables in Zero Page and binary data
// -------------------------------------------------------------------------------
@startblock $2000 "GAME"
// -------------------------------------------------------------------------------
// look up data
@include "_memory.ras" // variables in main RAM
@include "_lookup.ras" // read only lookup tables
// -------------------------------------------------------------------------------
// source files // add your include files here
@include "vbl.ras" // vertical blank interrupt
// -------------------------------------------------------------------------------
// **** MAIN PROGRAM ****
begin
Vbl_Init(); // call before set display mode
vbmSetDisplayMode( 0 );
vbmclear( 0 );
vbmClearColor( BLUE );
AUX_COLOR_AND_VOLUME := %00000010;
SCREEN_BG_COLOR := BLACK + SCREEN_BG_BLACK;
// main game loop
while (true) offpage do
begin
vbmDrawSmallTextE( #strTitle, #font4, 8, y, 8 );
vbmDrawTextE( #strDesc, #font8, 0, y+10, 8 );
waitforraster(150);
y:=y+ydir;
if (y > SCREEN_MAX and ydir = 1) then
begin
ydir:=-1;
end;
if (y < 1 and ydir = -1) then
begin
ydir:=1;
end;
vbmDrawSmallTextE( #strTitle, #font4, 8, y, 8 );
vbmDrawTextE( #strDesc, #font8, 0, y+10, 8 );
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment