1
0
mirror of https://github.com/cc65/cc65.git synced 2026-04-25 06:17:58 +00:00

Removed (pretty inconsistently used) tab chars from source code base.

This commit is contained in:
Oliver Schmidt
2013-05-09 13:56:54 +02:00
parent 44fd1082ae
commit 85885001b1
1773 changed files with 62864 additions and 62868 deletions
+74 -74
View File
@@ -19,103 +19,103 @@ Please note:
List of supplied sample programs:
-----------------------------------------------------------------------------
Name: ascii
Description: Shows the ASCII (or ATASCII, PETSCII) codes of typed
characters. Written and contributed by Greg King
<gngking@erols.com>.
Platforms: All platforms with conio or stdio (compile time configurable).
Name: ascii
Description: Shows the ASCII (or ATASCII, PETSCII) codes of typed
characters. Written and contributed by Greg King
<gngking@erols.com>.
Platforms: All platforms with conio or stdio (compile time configurable).
-----------------------------------------------------------------------------
Name: diodemo
Description: A disc copy program written and contributed by Oliver
Schmidt, <ol.sc@web.de>. Supports single or dual disc copy.
Platforms: The program does depend on conio and dio (direct disk i/o),
so it does currently compile for the Atari and Apple ][
machines.
Name: diodemo
Description: A disc copy program written and contributed by Oliver
Schmidt, <ol.sc@web.de>. Supports single or dual disc copy.
Platforms: The program does depend on conio and dio (direct disk i/o),
so it does currently compile for the Atari and Apple ][
machines.
-----------------------------------------------------------------------------
Name: enumdevdir
Description: Enumerates all devices, directories and files. Written and
contributed by Oliver Schmidt, <ol.sc@web.de>.
Platforms: All systems with device enumeration and directory access
(currently the C64, the C128 and the Apple ][).
Name: enumdevdir
Description: Enumerates all devices, directories and files. Written and
contributed by Oliver Schmidt, <ol.sc@web.de>.
Platforms: All systems with device enumeration and directory access
(currently the C64, the C128 and the Apple ][).
-----------------------------------------------------------------------------
Name: fire
Description: Another graphics demo written by groepaz/hitmen.
Platforms: The program is currently only running on the C64, but should
be portable to the C128 and CBM510 (and maybe more machines).
Name: fire
Description: Another graphics demo written by groepaz/hitmen.
Platforms: The program is currently only running on the C64, but should
be portable to the C128 and CBM510 (and maybe more machines).
-----------------------------------------------------------------------------
Name: gunzip65
Description: A gunzip utility for 6502 based machines written by Piotr
Fusik <fox@scene.pl>.
Platforms: Runs on all platforms with file I/O (currently the Atari, the
Apple ][ and most Commodore machines).
Name: gunzip65
Description: A gunzip utility for 6502 based machines written by Piotr
Fusik <fox@scene.pl>.
Platforms: Runs on all platforms with file I/O (currently the Atari, the
Apple ][ and most Commodore machines).
-----------------------------------------------------------------------------
Name: hello
Description: A nice "Hello world" type program that uses the conio
console I/O library for output.
Platforms: Runs on all platforms that support conio, which means:
Apple ][, Atari, C16, C64, C128, CBM510, CBM610, PET, Plus/4
Name: hello
Description: A nice "Hello world" type program that uses the conio
console I/O library for output.
Platforms: Runs on all platforms that support conio, which means:
Apple ][, Atari, C16, C64, C128, CBM510, CBM610, PET, Plus/4
-----------------------------------------------------------------------------
Name: mandelbrot
Description: A mandelbrot demo using integer arithmetic. The demo was
written by groepaz/hitmen and converted to cc65 using TGI
graphics by Stephan Haubenthal.
Platforms: Runs on all platforms that have TGI support:
Apple ][, C64, C128, Oric Atmos, Geos and Lynx.
Name: mandelbrot
Description: A mandelbrot demo using integer arithmetic. The demo was
written by groepaz/hitmen and converted to cc65 using TGI
graphics by Stephan Haubenthal.
Platforms: Runs on all platforms that have TGI support:
Apple ][, C64, C128, Oric Atmos, Geos and Lynx.
-----------------------------------------------------------------------------
Name: mousedemo
Description: Shows how to use the mouse.
Platforms: All systems with mouse and conio support:
C64, C128, CBM510, Atari, Apple ][
Name: mousedemo
Description: Shows how to use the mouse.
Platforms: All systems with mouse and conio support:
C64, C128, CBM510, Atari, Apple ][
-----------------------------------------------------------------------------
Name: multidemo
Description: Shows how to combine multiple cc65 features incl. overlays
and extended memory drivers. Written and contributed by
Oliver Schmidt, <ol.sc@web.de>.
Platforms: All systems with an overlay linker config, disk directory
access and EMD support (currently the C64, the C128,
the Atari and the Apple ][).
Name: multidemo
Description: Shows how to combine multiple cc65 features incl. overlays
and extended memory drivers. Written and contributed by
Oliver Schmidt, <ol.sc@web.de>.
Platforms: All systems with an overlay linker config, disk directory
access and EMD support (currently the C64, the C128,
the Atari and the Apple ][).
-----------------------------------------------------------------------------
Name: nachtm
Description: Plays "Eine kleine Nachtmusik" by Wolfgang Amadeus Mozart
Platforms: All systems that have the Commodore SID (Sound Interface
Device):
C64, C128, CBM510, CBM610
Name: nachtm
Description: Plays "Eine kleine Nachtmusik" by Wolfgang Amadeus Mozart
Platforms: All systems that have the Commodore SID (Sound Interface
Device):
C64, C128, CBM510, CBM610
-----------------------------------------------------------------------------
Name: overlaydemo
Description: Shows how to load overlay files from disk. Written and
contributed by Oliver Schmidt, <ol.sc@web.de>.
Platforms: All systems with an overlay linker config (currently the C64,
the C128, the Atari and the Apple ][).
Name: overlaydemo
Description: Shows how to load overlay files from disk. Written and
contributed by Oliver Schmidt, <ol.sc@web.de>.
Platforms: All systems with an overlay linker config (currently the C64,
the C128, the Atari and the Apple ][).
-----------------------------------------------------------------------------
Name: plasma
Description: A fancy graphics demo written by groepaz/hitmen.
Platforms: The program needs a VIC, or a TED, so it runs on the following
systems:
C64, C128, CBM510, Plus/4
Name: plasma
Description: A fancy graphics demo written by groepaz/hitmen.
Platforms: The program needs a VIC, or a TED, so it runs on the following
systems:
C64, C128, CBM510, Plus/4
-----------------------------------------------------------------------------
Name: sieve
Description: Implements the "Sieve of Eratosthenes" as a way to find all
prime numbers in a specific number interval. Often used as
a benchmark program.
Platforms: All systems with conio and clock support:
Atari, C16, C64, C128, CBM510, CBM610, PET, Plus/4,
Apple ][ (without timing due to missing clock support)
Name: sieve
Description: Implements the "Sieve of Eratosthenes" as a way to find all
prime numbers in a specific number interval. Often used as
a benchmark program.
Platforms: All systems with conio and clock support:
Atari, C16, C64, C128, CBM510, CBM610, PET, Plus/4,
Apple ][ (without timing due to missing clock support)
-----------------------------------------------------------------------------
Name: tgidemo
Description: Shows some of the graphics capabilities of the "tiny graphics
interface".
Platforms: Runs on all platforms that have TGI support:
Apple ][, C64, C128, Oric Atmos, Geos and Lynx.
Name: tgidemo
Description: Shows some of the graphics capabilities of the "tiny graphics
interface".
Platforms: Runs on all platforms that have TGI support:
Apple ][, C64, C128, Oric Atmos, Geos and Lynx.
+45 -45
View File
@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <stdbool.h>
#define QUIT 'Q'
#define QUIT 'Q'
/* r -- row. t -- table-column.
*/
@@ -28,63 +28,63 @@ static int c;
#ifndef USE_STDIO
# define PRINT cprintf
# define PUT(c) cputc((char)(c))
# define PRINT cprintf
# define PUT(c) cputc((char)(c))
/* conio doesn't echo typed characters.
** So, this function does it.
*/
static int GET(void) {
PUT(c = (int)cgetc());
return c;
}
PUT(c = (int)cgetc());
return c;
}
#else
# define PRINT printf
# define GET getchar
# define PRINT printf
# define GET getchar
#endif
int main(void) {
# ifndef USE_STDIO
/* conio doesn't scroll! Avoid trouble by starting at the top
** of the screen, and never going "below" the bottom of the screen.
*/
clrscr();
r = 7; /* allow for prompt */
# endif
# ifndef USE_STDIO
/* conio doesn't scroll! Avoid trouble by starting at the top
** of the screen, and never going "below" the bottom of the screen.
*/
clrscr();
r = 7; /* allow for prompt */
# endif
/* This prompt fits on the VIC-20's narrow screen.
*/
PRINT("Type characters to see\r\ntheir hexadecimal code\r\nnumbers:\r\n\n");
screensize(&width, &height); /* get the screen's dimensions */
width /= 6; /* get number of codes on a line */
cursor(true);
t = 0;
while ((c = GET()) != EOF) {
/* This prompt fits on the VIC-20's narrow screen.
*/
PRINT("Type characters to see\r\ntheir hexadecimal code\r\nnumbers:\r\n\n");
screensize(&width, &height); /* get the screen's dimensions */
width /= 6; /* get number of codes on a line */
cursor(true);
t = 0;
while ((c = GET()) != EOF) {
# ifndef USE_STDIO
if (r == height) {
clrscr();
t = 0;
PUT(c); /* echo char. again because screen was erased */
r = 1;
}
if (c == '\n')
++r;
# endif
# ifndef USE_STDIO
if (r == height) {
clrscr();
t = 0;
PUT(c); /* echo char. again because screen was erased */
r = 1;
}
if (c == '\n')
++r;
# endif
PRINT("=$%02x ", c);
if (c == QUIT)
break;
if (++t == width) {
PRINT("\r\n");
++r;
t = 0;
}
}
PRINT("\r\n");
return EXIT_SUCCESS;
}
PRINT("=$%02x ", c);
if (c == QUIT)
break;
if (++t == width) {
PRINT("\r\n");
++r;
t = 0;
}
}
PRINT("\r\n");
return EXIT_SUCCESS;
}
+4 -4
View File
@@ -3,7 +3,7 @@
* *
* (w)2002 by groepaz/hitmen *
* *
* Cleanup and porting by Ullrich von Bassewitz. *
* Cleanup and porting by Ullrich von Bassewitz. *
* 2004-06-08, Greg King *
* *
*****************************************************************************/
@@ -26,7 +26,7 @@
# 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
@@ -34,7 +34,7 @@
# 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
@@ -201,7 +201,7 @@ int main (void)
/* 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 ();
outb (&VIC.addr, PAGE1);
+2 -2
View File
@@ -17,8 +17,8 @@ void main (void)
// Let's show what we've got...
DlgBoxOk(CBOLDON "Hello, world" CPLAINTEXT,
"This is written in C!");
"This is written in C!");
// Normal apps exit from main into system's mainloop, and app finish
// when user selects it from icons or menu, but here we want to exit
// immediately.
+1 -1
View File
@@ -36,7 +36,7 @@ void main (void)
// Note that this is multitasking sleep, and if there are any icons/menus onscreen,
// they would be usable, in this case you have only pointer usable
Sleep(5*50);
// Normal apps exit from main into system's mainloop, and app finish
// when user selects it from icons or menu, but here we want to exit
// immediately.
+121 -121
View File
@@ -21,22 +21,22 @@
*/
unsigned inflatemem(char* dest, const char* source)
{
z_stream stream;
z_stream stream;
stream.next_in = (Bytef*) source;
stream.avail_in = 65535;
stream.next_in = (Bytef*) source;
stream.avail_in = 65535;
stream.next_out = dest;
stream.avail_out = 65535;
stream.next_out = dest;
stream.avail_out = 65535;
stream.zalloc = (alloc_func) 0;
stream.zfree = (free_func) 0;
stream.zalloc = (alloc_func) 0;
stream.zfree = (free_func) 0;
inflateInit2(&stream, -MAX_WBITS);
inflate(&stream, Z_FINISH);
inflateEnd(&stream);
inflateInit2(&stream, -MAX_WBITS);
inflate(&stream, Z_FINISH);
inflateEnd(&stream);
return stream.total_out;
return stream.total_out;
}
#endif /* __CC65__ */
@@ -63,11 +63,11 @@ unsigned inflatemem(char* dest, const char* source)
*/
/* Flags in the GZIP header. */
#define FTEXT 1 /* Extra text */
#define FHCRC 2 /* Header CRC */
#define FEXTRA 4 /* Extra field */
#define FNAME 8 /* File name */
#define FCOMMENT 16 /* File comment */
#define FTEXT 1 /* Extra text */
#define FHCRC 2 /* Header CRC */
#define FEXTRA 4 /* Extra field */
#define FNAME 8 /* File name */
#define FCOMMENT 16 /* File comment */
/*
* We read whole GZIP file into this buffer.
@@ -94,82 +94,82 @@ static unsigned char buffer[26000];
*/
unsigned uncompress_buffer(unsigned complen)
{
unsigned char* ptr;
unsigned long crc;
unsigned long unclen;
void* ptr2;
unsigned unclen2;
unsigned char* ptr;
unsigned long crc;
unsigned long unclen;
void* ptr2;
unsigned unclen2;
/* check GZIP signature */
if (buffer[0] != 0x1f || buffer[1] != 0x8b) {
puts("Not GZIP format");
return 0;
}
/* check GZIP signature */
if (buffer[0] != 0x1f || buffer[1] != 0x8b) {
puts("Not GZIP format");
return 0;
}
/* check compression method (it is always (?) "deflate") */
if (buffer[2] != 8) {
puts("Unsupported compression method");
return 0;
}
/* check compression method (it is always (?) "deflate") */
if (buffer[2] != 8) {
puts("Unsupported compression method");
return 0;
}
/* get CRC from GZIP trailer */
crc = GET_LONG(buffer + complen - 8);
/* get CRC from GZIP trailer */
crc = GET_LONG(buffer + complen - 8);
/* get uncompressed length from GZIP trailer */
unclen = GET_LONG(buffer + complen - 4);
if (unclen > sizeof(buffer)) {
puts("Uncompressed size too big");
return 0;
}
/* get uncompressed length from GZIP trailer */
unclen = GET_LONG(buffer + complen - 4);
if (unclen > sizeof(buffer)) {
puts("Uncompressed size too big");
return 0;
}
/* skip extra field, file name, comment and crc */
ptr = buffer + 10;
if (buffer[3] & FEXTRA)
ptr = buffer + 12 + GET_WORD(buffer + 10);
if (buffer[3] & FNAME)
while (*ptr++ != 0);
if (buffer[3] & FCOMMENT)
while (*ptr++ != 0);
if (buffer[3] & FHCRC)
ptr += 2;
/* skip extra field, file name, comment and crc */
ptr = buffer + 10;
if (buffer[3] & FEXTRA)
ptr = buffer + 12 + GET_WORD(buffer + 10);
if (buffer[3] & FNAME)
while (*ptr++ != 0);
if (buffer[3] & FCOMMENT)
while (*ptr++ != 0);
if (buffer[3] & FHCRC)
ptr += 2;
/*
* calculate length of raw "deflate" data
* (without the GZIP header and 8-byte trailer)
*/
complen -= (ptr - buffer) + 8;
/*
* calculate length of raw "deflate" data
* (without the GZIP header and 8-byte trailer)
*/
complen -= (ptr - buffer) + 8;
/*
* We will move the compressed data to the end of buffer[].
* Thus the compressed data and the decompressed data (written from
* the beginning of buffer[]) may overlap, as long as the decompressed
* data doesn't go further than unread compressed data.
* ptr2 points to the beginning of compressed data at the end
* of buffer[].
*/
ptr2 = buffer + sizeof(buffer) - complen;
/* move the compressed data to end of buffer[] */
memmove(ptr2, ptr, complen);
/*
* We will move the compressed data to the end of buffer[].
* Thus the compressed data and the decompressed data (written from
* the beginning of buffer[]) may overlap, as long as the decompressed
* data doesn't go further than unread compressed data.
* ptr2 points to the beginning of compressed data at the end
* of buffer[].
*/
ptr2 = buffer + sizeof(buffer) - complen;
/* move the compressed data to end of buffer[] */
memmove(ptr2, ptr, complen);
/* uncompress */
puts("Inflating...");
unclen2 = inflatemem(buffer, ptr2);
/* uncompress */
puts("Inflating...");
unclen2 = inflatemem(buffer, ptr2);
/* verify uncompressed length */
if (unclen2 != (unsigned) unclen) {
puts("Uncompressed size does not match");
return 0;
}
/* verify uncompressed length */
if (unclen2 != (unsigned) unclen) {
puts("Uncompressed size does not match");
return 0;
}
/* verify CRC */
puts("Calculating CRC...");
if (crc32(crc32(0L, Z_NULL, 0), buffer, unclen2) != crc) {
puts("CRC mismatch");
return 0;
}
/* verify CRC */
puts("Calculating CRC...");
if (crc32(crc32(0L, Z_NULL, 0), buffer, unclen2) != crc) {
puts("CRC mismatch");
return 0;
}
/* return number of uncompressed bytes */
return unclen2;
/* return number of uncompressed bytes */
return unclen2;
}
/*
@@ -177,52 +177,52 @@ unsigned uncompress_buffer(unsigned complen)
*/
char* get_fname(void)
{
static char filename[100];
unsigned len;
fgets(filename, sizeof(filename), stdin);
len = strlen(filename);
if (len >= 1 && filename[len - 1] == '\n')
filename[len - 1] = '\0';
return filename;
static char filename[100];
unsigned len;
fgets(filename, sizeof(filename), stdin);
len = strlen(filename);
if (len >= 1 && filename[len - 1] == '\n')
filename[len - 1] = '\0';
return filename;
}
int main(void)
{
FILE* fp;
unsigned length;
FILE* fp;
unsigned length;
/* read GZIP file */
puts("GZIP file name:");
fp = fopen(get_fname(), "rb");
if (!fp) {
puts("Can't open GZIP file");
return 1;
}
length = fread(buffer, 1, sizeof(buffer), fp);
fclose(fp);
if (length == sizeof(buffer)) {
puts("File is too long");
return 1;
}
/* read GZIP file */
puts("GZIP file name:");
fp = fopen(get_fname(), "rb");
if (!fp) {
puts("Can't open GZIP file");
return 1;
}
length = fread(buffer, 1, sizeof(buffer), fp);
fclose(fp);
if (length == sizeof(buffer)) {
puts("File is too long");
return 1;
}
/* decompress */
length = uncompress_buffer(length);
if (length == 0)
return 1;
/* decompress */
length = uncompress_buffer(length);
if (length == 0)
return 1;
/* write uncompressed file */
puts("Uncompressed file name:");
fp = fopen(get_fname(), "wb");
if (!fp) {
puts("Can't create output file");
return 1;
}
if (fwrite(buffer, 1, length, fp) != length) {
puts("Error while writing output file");
return 1;
}
fclose(fp);
/* write uncompressed file */
puts("Uncompressed file name:");
fp = fopen(get_fname(), "wb");
if (!fp) {
puts("Can't create output file");
return 1;
}
if (fwrite(buffer, 1, length, fp) != length) {
puts("Error while writing output file");
return 1;
}
fclose(fp);
puts("Ok.");
return 0;
puts("Ok.");
return 0;
}
+2 -2
View File
@@ -15,7 +15,7 @@
/*****************************************************************************/
/* Data */
/* Data */
/*****************************************************************************/
@@ -25,7 +25,7 @@ static const char Text [] = "Hello world!";
/*****************************************************************************/
/* Code */
/* Code */
/*****************************************************************************/
+13 -13
View File
@@ -14,28 +14,28 @@
/* Graphics definitions */
#define SCREEN_X (tgi_getxres())
#define SCREEN_Y (tgi_getyres())
#define MAXCOL (tgi_getcolorcount())
#define SCREEN_X (tgi_getxres())
#define SCREEN_Y (tgi_getyres())
#define MAXCOL (tgi_getcolorcount())
#define maxiterations 32
#define fpshift (10)
#define tofp(_x) ((_x)<<fpshift)
#define fromfp(_x) ((_x)>>fpshift)
#define fpabs(_x) (abs(_x))
#define maxiterations 32
#define fpshift (10)
#define tofp(_x) ((_x)<<fpshift)
#define fromfp(_x) ((_x)>>fpshift)
#define fpabs(_x) (abs(_x))
#define mulfp(_a,_b) ((((signed long)_a)*(_b))>>fpshift)
#define divfp(_a,_b) ((((signed long)_a)<<fpshift)/(_b))
#define mulfp(_a,_b) ((((signed long)_a)*(_b))>>fpshift)
#define divfp(_a,_b) ((((signed long)_a)<<fpshift)/(_b))
/* Workaround missing clock stuff */
#if defined(__APPLE2__) || defined(__APPLE2ENH__)
# define clock() 0
# define CLK_TCK 1
# define clock() 0
# define CLK_TCK 1
#endif
/* Use dynamically loaded driver by default */
#ifndef DYN_DRV
# define DYN_DRV 1
# define DYN_DRV 1
#endif
/* Use static local variables for speed */
+5 -5
View File
@@ -20,11 +20,11 @@
/* Address of data for sprite 0 */
#if defined(__C64__)
# define SPRITE0_DATA 0x0340
# define SPRITE0_PTR 0x07F8
# define SPRITE0_DATA 0x0340
# define SPRITE0_PTR 0x07F8
#elif defined(__C128__)
# define SPRITE0_DATA 0x0E00
# define SPRITE0_PTR 0x07F8
# define SPRITE0_DATA 0x0E00
# define SPRITE0_PTR 0x07F8
#endif
/* The mouse sprite (an arrow) */
@@ -58,7 +58,7 @@ static const unsigned char MouseSprite[64] = {
/* Dynamically loaded driver by default */
#ifndef DYN_DRV
# define DYN_DRV 1
# define DYN_DRV 1
#endif
+95 -95
View File
@@ -22,16 +22,16 @@
/*****************************************************************************/
/* Data */
/* Data */
/*****************************************************************************/
/* Tables with voice data.
*
* Bit Description
* Bit Description
* -------------------------------------------
* 15 Pause bit.
* 15 Pause bit.
* 12-14 Octave
* 8-11 Tone (index into frequency table)
* 7 Unused. Was thought as a control bit in the original version to
@@ -885,12 +885,12 @@ static unsigned long FreqTab [12] = {
typedef struct {
unsigned char DoneMask; /* Set this if we're done */
unsigned char Trigger; /* Trigger value */
unsigned char Ticks; /* Ticks for this tone */
unsigned Freq; /* Actual frequency value */
unsigned* Data; /* Pointer to data */
struct __sid_voice* Voice; /* Pointer to sid registers */
unsigned char DoneMask; /* Set this if we're done */
unsigned char Trigger; /* Trigger value */
unsigned char Ticks; /* Ticks for this tone */
unsigned Freq; /* Actual frequency value */
unsigned* Data; /* Pointer to data */
struct __sid_voice* Voice; /* Pointer to sid registers */
} VoiceCtrl;
/* Control structs for all three voices */
@@ -919,7 +919,7 @@ static unsigned char NextClock;
static clock_t StartTime;
/* Number of ticks for each tone */
#define TICKS_PER_TONE 4
#define TICKS_PER_TONE 4
/* Done flag. Contains one bit for each voice. Will contain 0x07 if all
* voices have finished playing.
@@ -929,7 +929,7 @@ static unsigned char Done;
/*****************************************************************************/
/* Code */
/* Code */
/*****************************************************************************/
@@ -948,22 +948,22 @@ static void MakeNiceScreen (void)
/* Make a nice screen */
{
typedef struct {
unsigned char Y;
char* Msg;
unsigned char Y;
char* Msg;
} TextDesc;
static TextDesc Text [] = {
{ 2, "Wolfgang Amadeus Mozart" },
{ 4, "\"Eine kleine Nachtmusik\"" },
{ 5, "(KV 525)" },
{ 2, "Wolfgang Amadeus Mozart" },
{ 4, "\"Eine kleine Nachtmusik\"" },
{ 5, "(KV 525)" },
{ 9, "Ported to the SID in 1987 by" },
{ 11, "Joachim von Bassewitz" },
{ 12, "(joachim@von-bassewitz.de)" },
{ 13, "and" },
{ 14, "Ullrich von Bassewitz" },
{ 15, "(ullrich@von-bassewitz.de)" },
{ 18, "C Implementation by" },
{ 19, "Ullrich von Bassewitz" },
{ 23, "Press any key to quit..." },
{ 11, "Joachim von Bassewitz" },
{ 12, "(joachim@von-bassewitz.de)" },
{ 13, "and" },
{ 14, "Ullrich von Bassewitz" },
{ 15, "(ullrich@von-bassewitz.de)" },
{ 18, "C Implementation by" },
{ 19, "Ullrich von Bassewitz" },
{ 23, "Press any key to quit..." },
};
register const TextDesc* T;
@@ -1004,8 +1004,8 @@ static void MakeNiceScreen (void)
/* Write something into the frame */
for (I = 0, T = Text; I < sizeof (Text) / sizeof (Text [0]); ++I) {
X = (XSize - strlen (T->Msg)) / 2;
cputsxy (X, T->Y, T->Msg);
++T;
cputsxy (X, T->Y, T->Msg);
++T;
}
}
@@ -1017,7 +1017,7 @@ static void TimeSync (void)
static unsigned char Clock;
do {
Clock = clock ();
Clock = clock ();
} while (Clock != NextClock);
NextClock = Clock + TICKS_PER_TONE;
}
@@ -1041,11 +1041,11 @@ static void DisplayTime (void)
* just write to the memory space.
*/
#if defined(__CBM510__) || defined(__CBM610__)
# define outb(addr,val) pokebsys ((unsigned)(addr), val)
# define outw(addr,val) pokewsys ((unsigned)(addr), val)
# define outb(addr,val) pokebsys ((unsigned)(addr), val)
# define outw(addr,val) pokewsys ((unsigned)(addr), val)
#else
# define outb(addr,val) (*(addr)) = (val)
# define outw(addr,val) (*(addr)) = (val)
# define outb(addr,val) (*(addr)) = (val)
# define outw(addr,val) (*(addr)) = (val)
#endif
@@ -1055,9 +1055,9 @@ int main (void)
unsigned char I;
unsigned char Tone;
unsigned char Octave;
unsigned Val;
struct __sid_voice* Voice;
register VoiceCtrl* VC;
unsigned Val;
struct __sid_voice* Voice;
register VoiceCtrl* VC;
/* Initialize the debugger */
DbgInit (0);
@@ -1089,74 +1089,74 @@ int main (void)
/* Play each voice until all three are done */
while (Done != 0x07) {
/* Display the time in the lower left corner */
DisplayTime ();
/* Display the time in the lower left corner */
DisplayTime ();
/* Wait for the next run */
TimeSync ();
/* Wait for the next run */
TimeSync ();
/* Check for a key */
if (kbhit ()) {
if (cgetc () == 'd') {
/* Start the debugger */
BREAK ();
} else {
/* Stop playing music */
break;
}
}
/* Check for a key */
if (kbhit ()) {
if (cgetc () == 'd') {
/* Start the debugger */
BREAK ();
} else {
/* Stop playing music */
break;
}
}
/* Play all three voices */
for (I = 0; I < 3; ++I) {
/* Play all three voices */
for (I = 0; I < 3; ++I) {
/* Get a pointer to this voice */
VC = V [I];
Voice = VC->Voice;
/* Get a pointer to this voice */
VC = V [I];
Voice = VC->Voice;
/* Is this voice done? */
if (Done & VC->DoneMask) {
/* Voice already done */
continue;
}
/* Is this voice done? */
if (Done & VC->DoneMask) {
/* Voice already done */
continue;
}
/* Do we have any more ticks to play? */
if (VC->Ticks == 0) {
/* We need new data */
if ((Val = *VC->Data) == 0) {
/* End of data. Mark the voice as done */
Done |= VC->DoneMask;
continue;
}
++VC->Data;
/* Do we have any more ticks to play? */
if (VC->Ticks == 0) {
/* We need new data */
if ((Val = *VC->Data) == 0) {
/* End of data. Mark the voice as done */
Done |= VC->DoneMask;
continue;
}
++VC->Data;
/* Get the ticks from the data */
VC->Ticks = (Val & 0x7F) - 1;
/* Get the ticks from the data */
VC->Ticks = (Val & 0x7F) - 1;
/* Check if this is a tone or a pause */
if (Val & 0x8000) {
/* This is a pause. Remember it and shut off the SID */
outb (&Voice->ctrl, VC->Trigger & 0xFE);
} else {
/* This is a tone. Extract the attributes. */
Tone = (Val >> 8) & 0x0F;
Octave = ((Val >> 12) & 0x07) ^ 0x07;
/* Calculate the frequency */
VC->Freq = FreqTab [Tone] >> Octave;
/* Set the frequency */
outw (&Voice->freq, VC->Freq);
/* Start the tone */
outb (&Voice->ctrl, VC->Trigger);
}
} else {
/* Decrement the ticks. If this is the last tick of a tone,
* reset bit 0 of the trigger value and write it back to the
* SID to start the release phase.
*/
if (--(VC->Ticks) == 0) {
outb (&Voice->ctrl, VC->Trigger & 0xFE);
}
}
}
/* Check if this is a tone or a pause */
if (Val & 0x8000) {
/* This is a pause. Remember it and shut off the SID */
outb (&Voice->ctrl, VC->Trigger & 0xFE);
} else {
/* This is a tone. Extract the attributes. */
Tone = (Val >> 8) & 0x0F;
Octave = ((Val >> 12) & 0x07) ^ 0x07;
/* Calculate the frequency */
VC->Freq = FreqTab [Tone] >> Octave;
/* Set the frequency */
outw (&Voice->freq, VC->Freq);
/* Start the tone */
outb (&Voice->ctrl, VC->Trigger);
}
} else {
/* Decrement the ticks. If this is the last tick of a tone,
* reset bit 0 of the trigger value and write it back to the
* SID to start the release phase.
*/
if (--(VC->Ticks) == 0) {
outb (&Voice->ctrl, VC->Trigger & 0xFE);
}
}
}
}
/* Reset the SID */
@@ -1169,7 +1169,7 @@ int main (void)
/* If we have a character, remove it from the buffer */
if (kbhit ()) {
cgetc ();
cgetc ();
}
/* Done */
+27 -27
View File
@@ -3,7 +3,7 @@
* *
* (w)2001 by groepaz/hitmen *
* *
* Cleanup and porting by Ullrich von Bassewitz. *
* Cleanup and porting by Ullrich von Bassewitz. *
* *
*****************************************************************************/
@@ -19,19 +19,19 @@
# define SCREEN1 0xE000
# define SCREEN2 0xE400
# define CHARSET 0xE800
# define outb(addr,val) (*(addr)) = (val)
# define outb(addr,val) (*(addr)) = (val)
# define inb(addr) (*(addr))
#elif defined(__CBM510__)
# define SCREEN1 0xF000
# define SCREEN2 0xF400
# define CHARSET 0xE000
# define outb(addr,val) pokebsys ((unsigned)(addr), val)
# define outb(addr,val) pokebsys ((unsigned)(addr), val)
# define inb(addr) peekbsys ((unsigned)(addr))
#elif defined(__PLUS4__)
# define SCREEN1 0x6400
# define SCREEN2 0x6C00
# define CHARSET 0x7000
# define outb(addr,val) (*(addr)) = (val)
# define outb(addr,val) (*(addr)) = (val)
# define inb(addr) (*(addr))
#endif
@@ -41,7 +41,7 @@
#if defined(__PLUS4__)
#define PAGE1 ((SCREEN1 >> 8) & 0xF8)
#define PAGE2 ((SCREEN2 >> 8) & 0xF8)
#define CHARADR ((CHARSET >> 8) & 0xFC)
#define CHARADR ((CHARSET >> 8) & 0xFC)
#else
#define PAGE1 ((SCREEN1 >> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E)
#define PAGE2 ((SCREEN2 >> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E)
@@ -106,7 +106,7 @@ static void doplasma (register unsigned char* scrn)
for (ii = 0; ii < 25; ++ii) {
ybuf[ii] = (sinustable[c1a] + sinustable[c1b]);
c1a += 4;
c1b += 9;
c1b += 9;
}
c1A += 3;
c1B -= 5;
@@ -115,15 +115,15 @@ static void doplasma (register unsigned char* scrn)
for (i = 0; i < 40; ++i) {
xbuf[i] = (sinustable[c2a] + sinustable[c2b]);
c2a += 3;
c2b += 7;
c2b += 7;
}
c2A += 2;
c2B -= 3;
for (ii = 0; ii < 25; ++ii) {
/* Unrolling the following loop will give a speed increase of
* nearly 100% (~24fps), but it will also increase the code
* size a lot.
*/
/* Unrolling the following loop will give a speed increase of
* nearly 100% (~24fps), but it will also increase the code
* size a lot.
*/
for (i = 0; i < 40; ++i, ++scrn) {
*scrn = (xbuf[i] + ybuf[ii]);
}
@@ -135,26 +135,26 @@ static void doplasma (register unsigned char* scrn)
static void makechar (void)
{
static const unsigned char bittab[8] = {
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
};
unsigned char i, ii, b, s;
unsigned c;
gotoxy (0, 1);
for (c = 0; c < 0x100; ++c) {
s = sinustable[c];
s = sinustable[c];
for (i = 0; i < 8; ++i){
b = 0;
for (ii = 0; ii < 8; ++ii) {
if ((rand() & 0xFF) > s) {
b |= bittab[ii];
}
b |= bittab[ii];
}
}
((unsigned char*)CHARSET) [(c*8) + i] = b;
}
if ((c & 0x07) == 0) {
cputc ('.');
}
if ((c & 0x07) == 0) {
cputc ('.');
}
}
}
@@ -222,8 +222,8 @@ int main (void)
#if defined(__PLUS4__)
for (i=0;i<1000;i++) {
((unsigned char *) (SCREEN1-0x0400))[i] = 0;
((unsigned char *) (SCREEN2-0x0400))[i] = 0;
((unsigned char *) (SCREEN1-0x0400))[i] = 0;
((unsigned char *) (SCREEN2-0x0400))[i] = 0;
}
outb (&TED.char_addr, CHARADR);
#endif
@@ -231,23 +231,23 @@ int main (void)
/* 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 */
doplasma ((unsigned char*)SCREEN1);
#if defined(__PLUS4__)
outb (&TED.video_addr, PAGE1);
outb (&TED.video_addr, PAGE1);
#else
outb (&VIC.addr, PAGE1);
outb (&VIC.addr, PAGE1);
#endif
/* Build page 2, then make it visible */
/* Build page 2, then make it visible */
doplasma ((unsigned char*)SCREEN2);
#if defined(__PLUS4__)
outb (&TED.video_addr, PAGE2);
outb (&TED.video_addr, PAGE2);
#else
outb (&VIC.addr, PAGE2);
outb (&VIC.addr, PAGE2);
#endif
/* Count frames */
/* Count frames */
f += 2;
}
t = clock() - t;
+27 -27
View File
@@ -13,27 +13,27 @@
/* Workaround missing clock stuff */
#if defined(__APPLE2__) || defined(__APPLE2ENH__)
# define clock() 0
# define CLOCKS_PER_SEC 1
# define clock() 0
# define CLOCKS_PER_SEC 1
#endif
/*****************************************************************************/
/* Data */
/* Data */
/*****************************************************************************/
#define COUNT 16384 /* Up to what number? */
#define SQRT_COUNT 128 /* Sqrt of COUNT */
#define COUNT 16384 /* Up to what number? */
#define SQRT_COUNT 128 /* Sqrt of COUNT */
static unsigned char Sieve[COUNT];
/*****************************************************************************/
/* Code */
/* Code */
/*****************************************************************************/
@@ -59,8 +59,8 @@ int main (void)
/* This is an example where register variables make sense */
register unsigned char* S;
register unsigned I;
register unsigned J;
register unsigned I;
register unsigned J;
/* Output a header */
printf ("Sieve benchmark - calculating primes\n");
@@ -73,17 +73,17 @@ int main (void)
/* Execute the sieve */
I = 2;
while (I < SQRT_COUNT) {
if (Sieve[I] == 0) {
/* Prime number - mark multiples */
if (Sieve[I] == 0) {
/* Prime number - mark multiples */
J = I*2;
S = &Sieve[J];
while (J < COUNT) {
*S = 1;
S += I;
J += I;
}
}
++I;
S = &Sieve[J];
while (J < COUNT) {
*S = 1;
S += I;
J += I;
}
}
++I;
}
/* Calculate the time used */
@@ -97,11 +97,11 @@ int main (void)
/* Wait for a key and print the list if not 'Q' */
if (ReadUpperKey () != 'Q') {
/* Print the result */
/* Print the result */
J = 0;
for (I = 2; I < COUNT; ++I) {
if (Sieve[I] == 0) {
printf ("%4d\n", I);
for (I = 2; I < COUNT; ++I) {
if (Sieve[I] == 0) {
printf ("%4d\n", I);
if (++J == 23) {
printf ("Q to quit, any other key continues\n");
if (ReadUpperKey () == 'Q') {
@@ -109,11 +109,11 @@ int main (void)
}
J = 0;
}
}
if (kbhit() && ReadUpperKey == 'Q') {
break;
}
}
}
if (kbhit() && ReadUpperKey == 'Q') {
break;
}
}
}
return EXIT_SUCCESS;
+5 -5
View File
@@ -10,15 +10,15 @@
#ifndef DYN_DRV
# define DYN_DRV 1
# define DYN_DRV 1
#endif
#define COLOR_BACK TGI_COLOR_BLACK
#define COLOR_FORE TGI_COLOR_WHITE
#define COLOR_BACK TGI_COLOR_BLACK
#define COLOR_FORE TGI_COLOR_WHITE
/*****************************************************************************/
/* Data */
/* Data */
/*****************************************************************************/
@@ -31,7 +31,7 @@ static unsigned AspectRatio;
/*****************************************************************************/
/* Code */
/* Code */
/*****************************************************************************/
+1 -1
View File
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
extern const char text[]; /* In text.s */
extern const char text[]; /* In text.s */
int main (void)
{
+2 -2
View File
@@ -1,4 +1,4 @@
.export _text
_text: .asciiz "Hello world!"
.export _text
_text: .asciiz "Hello world!"