Port plasma to the C128
git-svn-id: svn://svn.cc65.org/cc65/trunk@1437 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
fc774b3006
commit
13f81d0377
2 changed files with 37 additions and 14 deletions
|
@ -30,7 +30,7 @@ Name: mousedemo
|
||||||
Description: Shows how to use the mouse.
|
Description: Shows how to use the mouse.
|
||||||
Platforms: All systems with mouse and conio support:
|
Platforms: All systems with mouse and conio support:
|
||||||
Atari (untested), C64, C128 and CBM510
|
Atari (untested), C64, C128 and CBM510
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
Name: nachtm
|
Name: nachtm
|
||||||
Description: Plays "Eine kleine Nachtmusik" by Wolfgang Amadeus Mozart
|
Description: Plays "Eine kleine Nachtmusik" by Wolfgang Amadeus Mozart
|
||||||
|
@ -41,8 +41,8 @@ Platforms: All systems that have the Commodore SID (Sound Interface
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
Name: plasma
|
Name: plasma
|
||||||
Description: A fancy graphics demo written by groepaz/hitmen.
|
Description: A fancy graphics demo written by groepaz/hitmen.
|
||||||
Platforms: The program needs a VIC but has not been ported to / tested
|
Platforms: The program needs a VIC, so it runs on the following systems:
|
||||||
on the C128, so it does currently run on the CBM510 and C64.
|
C64, C128, CBM510
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
Name: sieve
|
Name: sieve
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__C64__)
|
#if defined(__C64__) || defined(__C128__)
|
||||||
# define SCREEN1 0xE000
|
# define SCREEN1 0xE000
|
||||||
# define SCREEN2 0xE400
|
# define SCREEN2 0xE400
|
||||||
# define CHARSET 0xE800
|
# define CHARSET 0xE800
|
||||||
|
@ -113,7 +113,7 @@ static void doplasma (void)
|
||||||
c2B -= 3;
|
c2B -= 3;
|
||||||
for (ii = 0; ii < 25; ++ii) {
|
for (ii = 0; ii < 25; ++ii) {
|
||||||
/* Unrolling the following loop will give a speed increase of
|
/* Unrolling the following loop will give a speed increase of
|
||||||
* nearly 100% (~24fps), but it will also increase the code
|
* nearly 100% (~24fps), but it will also increase the code
|
||||||
* size a lot.
|
* size a lot.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < 40; ++i, ++scrn) {
|
for (i = 0; i < 40; ++i, ++scrn) {
|
||||||
|
@ -165,6 +165,14 @@ int main (void)
|
||||||
unsigned long fps;
|
unsigned long fps;
|
||||||
unsigned fps10;
|
unsigned fps10;
|
||||||
|
|
||||||
|
#if defined(__C64__)
|
||||||
|
unsigned char block;
|
||||||
|
#endif
|
||||||
|
#if defined(__C128__)
|
||||||
|
unsigned char block;
|
||||||
|
unsigned char initflag;
|
||||||
|
unsigned char graphflag;
|
||||||
|
#endif
|
||||||
|
|
||||||
clrscr ();
|
clrscr ();
|
||||||
cprintf ("Making charset, mompls");
|
cprintf ("Making charset, mompls");
|
||||||
|
@ -176,9 +184,19 @@ int main (void)
|
||||||
text = textcolor (COLOR_BLACK);
|
text = textcolor (COLOR_BLACK);
|
||||||
clrscr ();
|
clrscr ();
|
||||||
|
|
||||||
#if defined(__C64__)
|
#if defined(__C64__) || defined(__C128__)
|
||||||
/* Move the VIC 16K block */
|
/* Move the VIC 16K block */
|
||||||
outb (&CIA2.pra, 0x00);
|
block = inb (&CIA2.pra);
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
initflag = *(unsigned char*) 0xA04;
|
||||||
|
*(unsigned char*) 0xA04 &= 0xFE;
|
||||||
|
graphflag = *(unsigned char*) 0xD8;
|
||||||
|
*(unsigned char*) 0xD8 = 0xFF;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Remember the VIC address register */
|
/* Remember the VIC address register */
|
||||||
|
@ -187,17 +205,17 @@ int main (void)
|
||||||
/* Run the demo until a key was hit */
|
/* Run the demo until a key was hit */
|
||||||
t = clock ();
|
t = clock ();
|
||||||
while (!kbhit()) {
|
while (!kbhit()) {
|
||||||
/* Build page 1, then make it visible */
|
/* Build page 1, then make it visible */
|
||||||
scrn = (unsigned char*)SCREEN1;
|
scrn = (unsigned char*)SCREEN1;
|
||||||
doplasma();
|
doplasma();
|
||||||
outb (&VIC.addr, PAGE1);
|
outb (&VIC.addr, PAGE1);
|
||||||
|
|
||||||
/* Build page 2, then make it visible */
|
/* Build page 2, then make it visible */
|
||||||
scrn = (unsigned char*)SCREEN2;
|
scrn = (unsigned char*)SCREEN2;
|
||||||
doplasma();
|
doplasma();
|
||||||
outb (&VIC.addr, PAGE2);
|
outb (&VIC.addr, PAGE2);
|
||||||
|
|
||||||
/* Count frames */
|
/* Count frames */
|
||||||
f += 2;
|
f += 2;
|
||||||
};
|
};
|
||||||
t = clock() - t;
|
t = clock() - t;
|
||||||
|
@ -205,9 +223,14 @@ int main (void)
|
||||||
/* Switch back the VIC screen */
|
/* Switch back the VIC screen */
|
||||||
outb (&VIC.addr, v);
|
outb (&VIC.addr, v);
|
||||||
|
|
||||||
#if defined(__C64__)
|
#if defined(__C64__) || defined(__C128__)
|
||||||
/* Move back the VIC 16K block */
|
/* Move back the VIC 16K block */
|
||||||
outb (&CIA2.pra, 0x03);
|
outb (&CIA2.pra, block);
|
||||||
|
#endif
|
||||||
|
#if defined(__C128__)
|
||||||
|
/* Restore the flags */
|
||||||
|
*(unsigned char*) 0xA04 = initflag;
|
||||||
|
*(unsigned char*) 0xD8 = graphflag;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Fetch the character from the keyboard buffer and discard it */
|
/* Fetch the character from the keyboard buffer and discard it */
|
||||||
|
|
Loading…
Add table
Reference in a new issue