From: uz Date: Wed, 11 Feb 2009 17:37:18 +0000 (+0000) Subject: Support for the Plus/4 by john "graham" selck. X-Git-Tag: V2.13.0rc1~325 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5d5615942119e3c9092d43d1b8cca049905c4772;p=cc65 Support for the Plus/4 by john "graham" selck. git-svn-id: svn://svn.cc65.org/cc65/trunk@3930 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/samples/README b/samples/README index bd00bbbf2..c5136517d 100644 --- a/samples/README +++ b/samples/README @@ -78,8 +78,9 @@ Platforms: All systems that have the Commodore SID (Sound Interface ----------------------------------------------------------------------------- Name: plasma Description: A fancy graphics demo written by groepaz/hitmen. -Platforms: The program needs a VIC, so it runs on the following systems: - C64, C128, CBM510 +Platforms: The program needs a VIC, or a TED, so it runs on the following + systems: + C64, C128, CBM510, Plus/4 ----------------------------------------------------------------------------- Name: sieve @@ -88,6 +89,7 @@ Description: Implements the "Sieve of Eratosthenes" as a way to find all a benchmark program. Platforms: All systems with conio and clock support: Atari, C16, C64, C128, CBM510, CBM610, PET, Plus/4 + ----------------------------------------------------------------------------- Name: tgidemo Description: Shows some of the graphics capabilities of the "tiny graphics diff --git a/samples/plasma.c b/samples/plasma.c index 9bc100d50..37514ecd4 100644 --- a/samples/plasma.c +++ b/samples/plasma.c @@ -27,13 +27,25 @@ # define CHARSET 0xE000 # 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 inb(addr) (*(addr)) #endif /* Values for the VIC address register to switch between the two pages */ +#if defined(__PLUS4__) +#define PAGE1 ((SCREEN1 >> 8) & 0xF8) +#define PAGE2 ((SCREEN2 >> 8) & 0xF8) +#define CHARADR ((CHARSET >> 8) & 0xFC) +#else #define PAGE1 ((SCREEN1 >> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E) #define PAGE2 ((SCREEN2 >> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E) +#endif @@ -170,6 +182,10 @@ int main (void) unsigned char initflag; unsigned char graphflag; #endif +#if defined(__PLUS4__) + unsigned int i; + unsigned char v2; +#endif clrscr (); cprintf ("Making charset, mompls"); @@ -197,18 +213,39 @@ int main (void) #endif /* Remember the VIC address register */ +#if defined(__PLUS4__) + v = inb (&TED.char_addr); + v2 = inb (&TED.video_addr); +#else v = inb (&VIC.addr); +#endif + +#if defined(__PLUS4__) + for (i=0;i<1000;i++) { + ((unsigned char *) (SCREEN1-0x0400))[i] = 0; + ((unsigned char *) (SCREEN2-0x0400))[i] = 0; + } + outb (&TED.char_addr, CHARADR); +#endif /* Run the demo until a key was hit */ t = clock (); while (!kbhit()) { /* Build page 1, then make it visible */ doplasma ((unsigned char*)SCREEN1); +#if defined(__PLUS4__) + outb (&TED.video_addr, PAGE1); +#else outb (&VIC.addr, PAGE1); +#endif /* Build page 2, then make it visible */ doplasma ((unsigned char*)SCREEN2); +#if defined(__PLUS4__) + outb (&TED.video_addr, PAGE2); +#else outb (&VIC.addr, PAGE2); +#endif /* Count frames */ f += 2; @@ -216,7 +253,12 @@ int main (void) t = clock() - t; /* Switch back the VIC screen */ +#if defined(__PLUS4__) + outb (&TED.video_addr, v2); + outb (&TED.char_addr, v); +#else outb (&VIC.addr, v); +#endif #if defined(__C64__) || defined(__C128__) /* Move back the VIC 16K block */