Power C

From C64-Wiki
Jump to: navigation, search
Power C
Box
Developer Unknown
Company ProLine Software, Ltd
Publisher Spinnaker Software
Hering Direkt
Centsible Software
Release 1986
Licence Proprietary
Platform Commodore 64
Genre Compiler, Assembler
Operation C64-icon.png
Media Icon disk525.png
Language(s) Language:english
Information Power C for the Commodore 64

General[edit]

Power C is a development system for the high-level language C on the C64 or C128. The generated program code is also executable without Power C and the compiler supports embedded assembly, allowing for manually tuned and optimized code where needed. Power C is based on ProLine's C Power. Inside the program test, which is part of the Power C package, the address of Spinnaker Software is visible, remained in the manual with the accompanying description the following text:

If all has gone well, ProLine Software, Ltd.'s corporate name and address will appear on the screen.

Power C first appeared in 1986 under the label Better Working Software at Spinnaker Software Corporation, of Cambridge Massachusetts in the United States. In Germany, Power C was offered by Hering Direkt in Dresden for 39.50 DM. Sadly, the names of the developers are not known. Even the manual is silent and not even the foreword is signed. The last commercial software vendor for Power C was Centsible Software which stopped selling the product in 2005.

Description[edit]

The development system is stored on two floppy disks in 1541 format (recorded on both sides), one each for C64 and C128. The cardboard box also contains an English language manual of 60 pages. This explains the deviations from (then standard) K&R C and explains the operation of the subroutines Shell, Editor, Compiler and Linker. The supplied function libraries are described and explained with examples. Knowledge in C is mandatory, the compiler's manual is not an introductory textbook on the language itself.

Hardware requirements[edit]

PowerCCode1.jpg

Minimum[edit]

  • Commodore 64 (or C128)
  • 1541 floppy disk drive

Better[edit]

Best[edit]

Operation[edit]

The floppy disks are not copy protected, so you first create working copies. If you have a larger capacity drive, simply copy all front and back files with a regular file copy utility. Target directory can also be a partition on a CMD drive. It was reported in 1993 by Matthias Matting that there was a CMD patch for Power C, which is not included in the retail version. It is not known what this patch contains.

After startup, the shell appears and displays the familiar dollar sign ($) as a prompt in Unix-like fashion. This is the command interface from which the individual programs of the development environment can be executed. It provides the most important disk and file functions (delete, rename, directory display, etc.) Changing the partition on a CMD drive is also possible thanks to JiffyDOS. Furthermore, you can run self-written C programs here, if they have been compiled for processing under the shell.

The source (text) editor can be started with or without a syntax checker, depending on the available space. The source text can be scrolled up, down or sideways on C64. On the C128 version, Power C runs on in full 80-column mode.

The text editing options, including searches, are useful. You can work with multiple source documents in parallel. The source code is written as usual in C. In the command mode of the editor, the source texts are saved, before it can be checked for syntax errors.

The compiler generates object files from the source texts. The text scrolls over the screen, and if the compiler still finds errors it breaks at compile time and displays detailed error messages. From here you can switch back to the text editor and correct the source file as needed.

The compiler is somewhat space inefficient and an included compactor trim can reduce the final size of the executable — but not usually by much. A less than ten percent decrease in file size is typical, but on a system as memory constrained as the C64 this can be significant. However, the compactor has been known to introduce bugs in the final program not present in the non-trimmed binary.

The linker links the object files and the required libraries to a program which can be run independently of the Power C system and whose base address can be defined beforehand. Alternatively, linking can also be done so that the program can only be started under the shell.

Compiler Specific Libraries[edit]

Included are the function libraries stdio.h (input and output), math.h (mathematical functions), dir.h (directory), strings.h (string processing) and the system and standard libraries.

Third Party Libraries[edit]

GRAFPAK[edit]

Mark Rinfret (programming) and Rich Helms (documentation) also released a graphics library in 1985 for Power C. Their graphics pack offers various graphics capabilities, even for the multicolor mode.

Power C Graphics Library[edit]

David Kesner and David Brown created a Hires graphics library for Power C, adapted from GRAFPAK, with advanced programming features. In addition to the standards such as graphic initialization, setting points and drawing geometric figures, support for sprite handling and text are also included.

Cmaster[edit]

Cmaster was written by W Mat Waites using serial routines originally published in February 1989, Volume 9, Issue 3 of Transactor Magazine. This library allows for serial communications at rates of 300, 450, and 1200 baud.

Windows C v1.00[edit]

Rubens Abbound released a windowing utility in 1987 as public domain shareware. This library provides a basis for window-based programming on the C64.

Examples[edit]

Julia-Menge

PowerCFractalgrafik1.jpg
/*   JULIA-MENGEN
 *  BERECHNUNG UND DARSTELLUNG
 *   FOR C-64 AND C-POWER. 
 *   BY: DOC PHURA
 * BASED ON A TEXT IN INPUT64 
 */

#INCLUDE <STDIO.H>
#INCLUDE <GRAPHIC.H>

#DEFINE VOID INT;
#DEFINE KEYBOARD (*((CHAR *) 197))
#DEFINE CLR 147
#DEFINE UCASE 142
#DEFINE LCASE 14

MAIN(){

/* VARIABLES DEFINITIONS */
FLOAT LRAND, RRAND;
FLOAT URAND, ORAND;
UNSIGNED ZEILEN, SPALTEN;
UNSIGNED LBILDRAND,OBILDRAND;

SCREENINIT();
GRAPHINIT();

LBILDRAND =   0;
SPALTEN   = 320;
OBILDRAND =   0;
ZEILEN    = 200;

LRAND = 0.7;
RRAND = 2.1;
URAND =-1.2;
ORAND = 1.2;

JULIABERECHNUNG(LRAND,RRAND,URAND,ORAND,ZEILEN,SPALTEN,LBILDRAND,OBILDRAND);

WHILE(KEYBOARD!=60);
TEXT();
EXIT();
}/*END OF MAIN*/

JULIABERECHNUNG(LRAND,RRAND,URAND,ORAND,ZEILEN,SPALTEN,LBILDRAND,OBILDRAND)
FLOAT LRAND, RRAND,URAND, ORAND;
UNSIGNED ZEILEN,SPALTEN,LBILDRAND,OBILDRAND;
{
UNSIGNED MAXTIEFE;
UNSIGNED AKTZEILE;
UNSIGNED AKTSPALTE;
UNSIGNED AKTTIEFE;
FLOAT HORPOS;
FLOAT VERTPOS;
FLOAT HORSCHRITT, VERTSCHRITT;
FLOAT X, Y, XQ, YQ;
MAXTIEFE=15;

HORSCHRITT = (RRAND - LRAND) / SPALTEN;
VERTSCHRITT = (ORAND - URAND) / ZEILEN;

HORPOS = LRAND;
VERTPOS = ORAND;

FOR(AKTZEILE=OBILDRAND;AKTZEILE<=(OBILDRAND+ZEILEN);AKTZEILE++){
  FOR(AKTSPALTE=LBILDRAND;AKTSPALTE<=(LBILDRAND+SPALTEN);AKTSPALTE++){
    X=0;
    Y=0;
    XQ=0;
    YQ=0;
    AKTTIEFE=0;

    DO{
      Y=2*X*Y-VERTPOS;
      X=XQ-YQ-HORPOS;
      XQ=X*X;
      YQ=Y*Y;
      AKTTIEFE++;
      } 
    WHILE((XQ+YQ<4)&&(AKTTIEFE<MAXTIEFE));
     
    IF((AKTTIEFE<MAXTIEFE)&&(AKTTIEFE&1)) PLOT(AKTSPALTE,AKTZEILE,1);     
    HORPOS=HORPOS+HORSCHRITT;
  }
HORPOS=LRAND;
VERTPOS=VERTPOS-VERTSCHRITT;
 }
}

VOID SCREENINIT(){
HIGHMEM(0X8000);
GINIT();
TXCOLOR (DKGRAY, WHITE, BLACK);
TEXT();
PUTCHAR(LCASE);
}

VOID GRAPHINIT(){
HIRES();
HRCOLOR(BLACK,WHITE,DKGRAY);
DRAW(0);
DISPLAY(0);
HRCLR();
}

Reviews and literature[edit]

Power C was discussed by Matthias Matting in the December 1993 issue of the 64'er pp. 69–70.

Alternatives[edit]

Manual[edit]

Links[edit]