[comp.sys.cbm] C-Power

schaefer@ogcvax.UUCP (02/13/87)

Expires:
References:
Sender:
Followup-To:
Keywords:

[ This is a partial reposting of an earlier article.  I'm not sure the first
  one ever made it out of OGC.  Apologies if you've seen this before. ]

Does anyone out there have a COMPLETE source for grafpak1.c (originally posted
some months ago)?  If so, I would greatly appreciate it if you could mail me
a copy.  I have appended a context diff of the corrections I attempted, but
they are wrong somewhere because gdriver locks up with a blank screen right
after the textmode test.

Actually, a summary of what else I need to fix would suffice.  Thanks in
advance ....

*** grafpak1.c	Tue Nov 11 13:17:10 1986
--- g1.c	Tue Jan 27 10:19:16 1987
***************
*** 179,185
  }
    
  /* Set graphics screen base address */
! 
  unsigned vb,bb;
  {
    register unsigned bank;

--- 179,185 -----
  }
    
  /* Set graphics screen base address */
! setmap(vb,bb)
  unsigned vb,bb;
  {
    register unsigned bank;
***************
*** 212,217
  }
  
  /* Set Text Graphics mode */
    setmap(0,1024);
    setscreen(0,1024);
    poke(VICCTL,peek(VICCTL) & 223);   

--- 212,219 -----
  }
  
  /* Set Text Graphics mode */
+ textmode()
+ {
    setmap(0,1024);
    setscreen(0,1024);
    poke(VICCTL,peek(VICCTL) & 223);   
***************
*** 239,244
    poke(VICMC,peek(VICMC) & 239); /* disable multi-color mode */
    poke(53281,pencolor[0]); /* background color reg */
    aspect = 320.0 / 200.0;  /* compute aspect ratio */
  
  /* Convert pixel coordinate to byte offset.
  ** The BASIC formula from the PRG is:

--- 241,247 -----
    poke(VICMC,peek(VICMC) & 239); /* disable multi-color mode */
    poke(53281,pencolor[0]); /* background color reg */
    aspect = 320.0 / 200.0;  /* compute aspect ratio */
+ }
  
  /* Convert pixel coordinate to byte offset.
  ** The BASIC formula from the PRG is:
***************
*** 263,269
    
    loc = y_offset[y >> 3] + /* row offset */
      (x & 0xfff8) +         /* character offset */
! 
    return loc;
  }
   

--- 266,272 -----
    
    loc = y_offset[y >> 3] + /* row offset */
      (x & 0xfff8) +         /* character offset */
!     (y & 7);		   /* line offset */
    return loc;
  }
   
***************
*** 329,335
        poke(loc,(pencolor[1]<<4) | pencolor[2]);
      }
    }
!       
  }
  /* Bresenham's line drawing algorithm.
  ** Draw a line between two coordinate pairs.

--- 332,338 -----
        poke(loc,(pencolor[1]<<4) | pencolor[2]);
      }
    }
!   /* something must be missing here */
  }
  /* Bresenham's line drawing algorithm.
  ** Draw a line between two coordinate pairs.
-- 
Bart Schaefer						Dept. of CS&E
CSNET:	schaefer@Oregon-Grad				Oregon Graduate Center
UUCP:	{ihnp4,seismo,sun}!verdix \			19600 NW Von Neumann Dr
 {hplabs,ucbvax,decvax}!tektronix  !ogcvax!schaefer	Beaverton, OR  97006

czei@osu-cgrg.UUCP (Mike Czei...) (05/14/87)

I've never heard of C-Power before.  How about some information like:

1.  How does it work.  (speed, efficiency, etc)

2.  How much does it cost?

3.  where is it sold?

4.  Anything else one should know about C-Power.


Thanks much.  I always wanted to port some of my Unix programs over the
my lowly C64.


-- 
Michael S. Czeiszperger                        "I'm the Doctor, wether
The Ohio State University			you like it or not."
Advanced Computing Center for Art and Design
Sound Synthesis Studios
121 Lord Hall
124 W. 17 Ave
Columbus, OH 43210
{decvax,ucbvax}!{cbatt,cbosgd}!osu-eddie!{osupyr!artsvax,osu-cgrg}!czei(uucp)

dwl10@amdahl.amdahl.com (Dave Lowrey) (09/29/87)

There was enough response to my initial posting to justify posting these
procedures to the net.

This procedures describe modifications to C-Power to create a better
development environment when using the CBM-1581 3.5 inch disk drive.

Please note that these mods are for the C-64 only. If someone wishes to
port it to the C-128 version of C-Power, feel free. I will provide
all the help I can.


===============================================================================
C-Power from Proline (and Power-C from Spinnaker) for the Commodore
64 will support two disk drives. They are divided up into a SYStem
drive, and a WORK drive. When you enter a command to the shell, it
is first checked to see if it is a "builtin" command. If not, then
the WORK disk is searched. If not on the WORK disk, then the SYStem
dusk is searched. cc.sh expects to find it's files (COMPILER &
TRANSLATOR) on the SYStem disk, and the input, object, & work files
on the WORK disk. link.sh expects to find all ".o" files on the
work disk, and all system libraries (via the 'up arrow' command)
on the SYStem disk.

This was all well and good for 1541/1571 drives. But, the new 1581
3.5 inch drive offers 800K of storage. This storage can be broken
up into individual partitions (logical disks). I wanted a configuration
where I could retain my 1541 drive, in order to utilize my fastload
cartridge, for loading often used executables. I also wanted all other
files, including the system object libraries, to be on the 1581
disk drive.

The following modifications to various C-Power programs accomplishes
these goals.

DISCLAIMER: Part of the procedure is to make a new disk, that cointains
only the executable modules needed for your work. One of these is the
C compiler. The compiler is copy protected, to prevent unauthorized
distribution of the product. I do not condone pirating of software.
I do, however, feel that I have the right to make copies for my own
personal use. The compiler CAN be copied, but I aint'a'gonna tell
you how. If you are against copying, or you don't know how, you can still
use these procedures. You will have to modify your distribution
C-Power disk. If you do that, PLEASE BACK IT UP FIRST!!!!!!!!!!!!!

STEP 1: Format a new 1541 disk.
        Copy the following files from the C-Power disk, to the new disk:
             shell
             cc.sh
             compiler (NOTE: Copy protect must be copied also)
             translator
             link.sh
             ed.sh
             ced.sh
             (Any other executables you may need)

STEP 2: Format a new 1581 disk.
        Create a 5 track partition called 'syslib'
        Copy all of the system object and library files, from both sides of
          the C-Power disk to the 'syslib' partition.
        Create a 3 track partition called 'headers'
        Copy all of the header files from the C-Power disk to the 'header'
          partition.

STEP 3: Modify the files. This can be done either with a ML Monitor, or
          (if you are brave) with a sector editor.

File: shell        Load adderss: $0801     Ending address: $1678
Addr: $126B Old data: E003   New data: E004   /*Allow 4 char file size */

File: cc.sh        Load adderss: $1800     Ending address: $1c20
Addr: $1810 Old data: A901   New data: A900   /* Set 2 drive switch     */
Addr: $1A37 Old data: A901   New data: A902   /*Change disk cmd. len.   */
Addr: $1A51 Old data: A901   New data: A902   /*Change disk cmd. len.   */
Addr: $1A7b Old data: A903   New data: A902   /*Change disk cmd. len.   */
Addr: $1BCC Old data: 4930   New data: 5530   /*Change disk command     */

File: compiler     Load adderss: $2000     Ending address: $7d20
Addr: $2029 Old data: A94920 New data: 4C3820 /* Skip disk init code    */

File: link.sh      Load adderss: $1800     Ending address: $27a3 (new)
Addr: $183b Old data: 8727   New data: 9B17   /* New save area          */
Addr: $1846 Old data: 8727   New data: 9B17   /* New save area          */
Addr: $1872 Old data: FA17   New data: FC17   /* Libs on work disk      */
Addr: $1C45 Old data: C958   New data: C95F   /* Change exit char       */
Addr: $1C47 Old data: D007   New data: D002   /* BNE $1C4b              */
Addr: $1C49 Old data: ADA$   New data: 1860   /* CLC ; RTS              */
Addr: $1C4B Old data: 27D0   New data: C940   /* CMP #'@  ;disk cmd?    */
Addr: $1C4D Old data: 0218   New data: D004   /* BNE $1C53              */
Addr: $1C4F Old data: 60ADA3 New data: 4C8727 /* JMP $2787 ;go to patch */
 The following code is to be added to link.sh, starting at $2787:
ADDR  DATA    CODE            COMMENT
2787 a9a4   lda #$a4  ;Addr of disk command
2789 852a   sta $2a   ;Save for disk command routine
278b a927   lda #$27  ;        . .
278d 852b   sta $2b   ;        . .
278f a960   lda #$60  ;Modify shell routine to RTS to us
2791 8d7013 sta $1370 ;        . .
2794 20f21a jsr $1af2 ;Turn on ROM
2797 204313 jsr $1343 ;Send command to disk
279a a94c   lda #$4c  ;Restore shell routine's JMP return
279c 8d7013 sta $1370 ;        . .
279f 38     sec       ;Set return code
27a0 4cfc1a jmp $1afc ;Turn off ROM, continue



------------PROCEDURES---------------------------------
Now that you have the disks created, and the files modified, you
can do complete C-Power development without having to swap a disk.

The following example assumes the the 1541 is device 8 and the 1581 is
device 11 (my configuration).

Put the appropriate disks into the appropriate drives. Create partitions
on the 1581 to hold your various development projects. I do one
partition per project.

Boot the shell on the 1541

Set the work drive: work 11 0

Change to your development partition: disk /partition_name

Edit your files: ed (or ced) file.c

Header files that are used by your program must reside in the partition
that comtains the source file. Use the editor to copy the header files
from the header partition to the development partition.

Compile your program: cc myprog.c (Note: The two drive switch (-p) has been
permantly turned on, so it is not necessary)

Link your program: As you have probably noted, link.sh was highly modified.
The modification added a new command '@'. This command sends any chars
following it to the WORK disk drive. The main purpose of this is to
send 'partition change' commands to the 1581. In order to accomplish
the patch, the link exit command has been changed from 'X' to the
'left-arrow' key.
 Sample link session:
    $ link
    > myprog.o
    > @/                    /* change to ROOT partition /*
    > @/syslib              /* Change to system object partition */
    > (up-arrow)            /* Include necessary system objects */
    > @/                    /* change to ROOT partition */
    > @/dev_part            /* change to development partition
    > (return)
    > Enter file name......


===============================================================================
If you have any questions on this procedure, feel free to contact me.

Dave
-- 
-------------------------------------------------------------------

                  "Familiarity breeds attempt"

                          Dave Lowrey
                          Amdahl Corp.
                          Houston, Texas
                          (713)-850-8828
                         ...!{ihnp4,cbosgd,hplabs,oliveb}!amdahl!dwl10

[ The opinions expressed <may> be those of the author and not necessarily
  those of his most eminent employer. ]