CBM 5/6/700 - 500 Hi-Res Graphics

CBM 5/6/700 - 500 Hi-Res Graphics

I spent some time investigating the 500's video possibilities initially through BASIC. After that I developed two machine code programs, SPRITE 0400 and SPRITE D000, which provided a simpler interface to the 500's hi-res screen and sprites from BASIC through the use of a SYS call plus some easier to remember 2-character commands. These files, along with programs to use them (plus some original CBM demo files) are available for download in two formats: either as separate programs or as a disk image for use in the Vice emulator. The programs are:

500 HI-RES MODEMy first experimental program for hi-res mode. Not very pretty but it did prove to me that it could be done (however, it doesn't always initialise the hires mode properly on the Vice emulator).
SPRITE 0400
SPRITE D000
The two machine code routines.
DRAW DEMOA hi-res demo program using SPRITE 0400/D000 to plot points and lines.
HIRES DEMOA hi-res demo program using SPRITE 0400/D000 that loads a hi-res (well, it was hi-res back in 1987) image and sprite files.
SPRITES
C.MOON NIGHT
D.MOON NIGHT
P.MOON NIGHT
The files required by the above HIRES DEMO program.
CHAR GENERATORA character generator program to replace the default, built-in character ROM with your own set stored in RAM.
CS.C128 SET
CS.SQUARE
Two character sets that can be loaded by the above program. The first is a copy of the revised C128 set (the 500 had the same set as the C64) and a 'squared'-off set that I created using the above program.
500 DEMOThis is a demo program written (I presume) by Commodore to demonstrate the 500 off. It cycles indefinitely.
COL.B
PIC.01
PIC.02
PIC.03
PIC.04
The picture files required by the above program.

To use the image in Vice start up the emulator with:

  xcbm2 -model 510

The xcbm2 executable will, by default, start up as a 6/700 unless the model parameter is sent). As the 500 was quite a slow beast it is worth setting the emulator to 200% speed.

Next select Device settings from the Settings menu and attach the unzipped image to device 8. Select Drive settings from Settings and select the 8250 drive. Now you should be able to do a DIRECTORY on the default drive and load the files as normal.

If you examine any of the programs that use the SPRITE 0400/D000 files you will see that they always start off with something like:

  10 BANK 15 : IF PEEK (1024) <> 32 THEN BLOAD "SPRITE 0400",B15,P1024
  20 BANK 0 : IF PEEK (55296) <> 76 THEN BLOAD "SPRITE D000",B0,P55296
  30 Q=1024 : SYSQ,GS

Lines 10 and 20 load the two machine code routines and 30 sets Q to the entry point for all the SYS commands before setting up the new screen areas in Bank 0. Once this is done then the text screen no longer uses the Bank 15 memory at $D000 which is now taken over by the second part of the M/C routines. All of the new commands are called by a single SYS command (SYS1024 or, as above, SYSQ) and the two characters following on determine the actual command.

Here is the list of the commands provided:

The machine code sets up the video as follows:

$C000 - $CFFFCharacter set
$D000 - $D3E7Text screen
$D3F8 - $D3FFSprite mem ptrs (1)
$D400 - $D7E7M-Col colour area
$D7F8 - $D7FFSprite mem ptrs (2)
$D800 - $DBFFReserved for M/C
$DC00 - $DDFFSprite definition area for up to 8 sprites

Each sprite needs a 64-byte area for its definition. There are 256 possible areas in the 16k available to the VIC chip ($C000 - $FFFF). Those at $DC00 to $DDFF are numbered 112 to 119 internally though the SYSQ sprite commands above translate these to 1 to 8. Both sets of memory pointers point to these 8 areas. Set 1 is used when in text mode and the other is for when hi-res is turned on.