-/*****************************************************************************
- * fire test program for cc65. *
- * *
- * (w)2002 by groepaz/hitmen *
- * *
- * Cleanup and porting by Ullrich von Bassewitz. *
- * *
- *****************************************************************************/
+/*****************************************************************************\
+** fire test program for cc65. **
+** **
+** (w)2002 by groepaz/hitmen **
+** **
+** Cleanup and porting by Ullrich von Bassewitz. **
+** 2004-06-08, Greg King **
+** **
+\*****************************************************************************/
/* sync page-flipping to vertical blank */
-//#define DOVSYNC
+/* #define DOVSYNC */
#include <stdlib.h>
#include <string.h> /* for memset */
#include <time.h>
#include <conio.h>
+#include <cbm.h>
# define SCREEN2 0xE400
# define CHARSET 0xE800
# define COLORRAM 0xD800
-# define outb(addr,val) (*(addr)) = (val)
+# define outb(addr,val) (*(addr) = (val))
# define inb(addr) (*(addr))
#elif defined(__C128__)
+# define BUFFER 0x0400
# define SCREEN1 0xE000
# define SCREEN2 0xE400
# define CHARSET 0xE800
# define COLORRAM 0xD800
-# define outb(addr,val) (*(addr)) = (val)
+# define outb(addr,val) (*(addr) = (val))
# define inb(addr) (*(addr))
#elif defined(__CBM510__)
# define BUFFER 0xF800
/* Use static local variables for speed */
-#pragma staticlocals (1);
+#pragma static-locals (1);
#ifdef DOVSYNC
-# define waitvsync() while(VIC.ctrl1 < 0x80) {}
+# define WAITVSYNC() waitvsync()
#else
-# define waitvsync()
+# define WAITVSYNC()
#endif
static void makechar (void)
{
- char *font;
-
static const unsigned char bittab[8] = {
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
};
- unsigned char i, ii, b;
- int c;
- int s,bc;
+ register char *font;
+ register unsigned char i, ii, b, bc;
+ unsigned char c;
gotoxy (0, 1);
for (c = 0; c < 0x40; ++c) {
- s = c;
bc = 0;
for (i = 0; i < 8; i++){
b = 0;
for (ii = 0; ii < 8; ii++) {
- bc += s;
+ bc += c;
if (bc > 0x3f) {
bc = bc - 0x40;
b += bittab[(ii + (i & 1)) & 0x7];
outb (&CIA2.pra, (block & 0xFC) | ((SCREEN1 >> 14) ^ 0x03));
#endif
#if defined(__C128__)
- /* Save and change some flags, so that kernal/basic interupt handler will
- * not interfere with our routine.
- */
+ /* Save and change some flags, so that kernal/basic interrupt handler will
+ ** not interfere with our routine.
+ */
initflag = *(unsigned char*) 0xA04;
*(unsigned char*) 0xA04 &= 0xFE;
graphflag = *(unsigned char*) 0xD8;
/* Run the demo until a key was hit */
t = clock ();
while (!kbhit()) {
- /* Build page 1, then make it visible */
+ /* Build page 1, then make it visible */
fire (SCREEN1);
- waitvsync ();
+ WAITVSYNC ();
outb (&VIC.addr, PAGE1);
/* Build page 2, then make it visible */
fire (SCREEN2);
- waitvsync ();
+ WAITVSYNC ();
outb (&VIC.addr, PAGE2);
/* Count frames */