Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Commodore » Commodore 8-bit » Power C newbie help needed
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Power C newbie help needed [message #266776] Sun, 07 September 2014 07:36 Go to next message
Harry Potter is currently offline  Harry Potter
Messages: 1304
Registered: March 2012
Karma: 0
Senior Member
Hi! I want to get started programming with Power C 64 and 128 and need a little help:

* How do I set text and screen colors?
* How do I clear the screen other than putchar (147)?
* How do I set the screen coordinates?
* What about the extra memory of a C64/128? I created access to this for cc65, but I might want to do this for Power C as well. the C128 version seems to use Bank 1.
* How do I handle system and work disks? I'm using WinVice 2.2.
* I'll need to look back on the Power C site for more info about using assembler with C, but where do I find a suitable assembler?

BTW, I want some advice: I looked hard on the internet for a suitable Commodore-based C compiler, and Power C was the only decent one out there. I want to know: in your opinion, how efficient a C compiler Power C is.
Re: Power C newbie help needed [message #266846 is a reply to message #266776] Mon, 08 September 2014 02:01 Go to previous messageGo to next message
rusure is currently offline  rusure
Messages: 1030
Registered: March 2012
Karma: 0
Senior Member
the screen operations have basic 7 (c128) commands. you
need an instruction set to determine if there are any
equivalent commands in the selected computer language.
> * How do I set the screen coordinates?

;program for repositioning the location of
;character memory operations in vdc chips
;
*=$1300
ldx #$00 ; bank 15
stx $ff00
;
;the rgb character display ordinarily
;occupies the first +2000 memory locations
;of the vdc chip. for the upper
;left hand corner of the screen, vdc
;registers $12 and $13 are set to zero.
;this program places a character with
;the screen code of +1 (the letter
;'a') at the lower left hand corner.
;this is the +1999 or $7cf vdc memory
;location. vdc registers $12 and $13
;are set to $07 & $cf respectively.
;
ldy #$12;reset vdc character operations
sty $d600;to the lower right
ldx #$07;hand corner of the screen
stx $d601
iny
sty $d600
ldx #$cf
stx $d601
ldy #$1f;store a screen code in the vdc
sty $d600
vdc bit $d600
bpl vdc
ldx #$01
stx $d601
rts


> * How do I clear the screen other than putchar (147)?
;between you & me, printing a
;clearscreen character is easier,
;but this may be slightly faster.
;the following code fills the rgb screen
;with 'o's (screen code $0f). to clear
;a screen replace the #$0f with a #$20
;(screen code for a blank character).
*=1300
ldx #$00;bank 15
stx $ff00
ldy #$12;reset display operations
sty $d600;to the upper left corner
stx $d601
iny
sty $d600
stx $d601
ldx #$1f
lda #$0f;fill the vdc screen with code
ldy #$08;of #$0f ('o'). to clear
loop stx $d600;the screen, replace
wait bit $d600;the #$0f with a #$20
bpl wait
sta $d601
lda #$fa;on each subsequent pass, set a
ldx #$1e;vdc block of 250 locations to
dey;the value stored in the first pass
bpl loop
rts

the program is sloppy because it modifies 2001 vdc
memory locations, one more than in the display locations.


> * How do I set text and screen colors?
each vdc character location is linked to another attribute vdc
location. one or 2 bits in an attribute location controls the
color of the character in the corresponding display location.
if you discover the vdc attribute locations, you may have some
fun with what the other bits in an attribute location do.
i don't remember either the locations of the attribute memory,
or the vdc register that controls the background color.
> What about the extra memory of a C64/128? I created
> access to this for cc65, but I might want to do this for
> Power C as well. the C128 version seems to use Bank 1.

i think that bank 1 access on stock c128s in c64 mode is blocked.
c128 emulators may have remedied this. c128 basic uses bank 1 for
program variables. of course, you can use banks 0 and 1 any way that
suites you in ml. there are kernal routines for inter bank operations
in the c128 rom. in c64 mode, the vdc can be used as an REU.

> * How do I handle system and work disks? I'm using WinVice 2.2.
no comment

> * I'll need to look back on the Power C site for more info about
> using assembler with C, but where do I find a suitable assembler?
i only toyed with languages other than ml and basic on
commodores. i am not sure if they were c or pascal.
one of the processors came with its own assembler. it
didn't have bitmap graphics in its hi order language.

> BTW, I want some advice: I looked hard on the internet for a suitable
> Commodore-based C compiler, and Power C was the only decent one out
> there. I want to know: in your opinion, how efficient a C compiler
> Power C is
did abacus publish a c language? could pascal be more appropiate?
Re: Power C newbie help needed [message #266847 is a reply to message #266776] Mon, 08 September 2014 02:39 Go to previous messageGo to next message
rusure is currently offline  rusure
Messages: 1030
Registered: March 2012
Karma: 0
Senior Member
On Sunday, September 7, 2014 5:36:49 AM UTC-6, Harry Potter wrote:

> * I'll need to look back on the Power C site for more info about using assembler with C, but where do I find a suitable assembler?

i posted an comp.sys.cbm message here about a power c 128 package sold with buddy:

https://groups.google.com/forum/#!searchin/comp.sys.cbm/abac us$20c|sort:date/comp.sys.cbm/BUNvS7e4H-g/jwo_oRHuuhkJ
Re: Power C newbie help needed [message #266882 is a reply to message #266776] Mon, 08 September 2014 12:17 Go to previous messageGo to next message
rusure is currently offline  rusure
Messages: 1030
Registered: March 2012
Karma: 0
Senior Member
On Sunday, September 7, 2014 5:36:49 AM UTC-6, Harry Potter wrote:
>
> * How do I set text and screen colors?

i can only partially confirm these color statements' validity
since i am using the rgb monochrome video of my c128d.

the background color is controlled by the value
in the lo order nybble of the vdc $1a register .

rgb display memory is in vdc locations from $0000 to $07ff. attribute
memory is in a vdc range from $0800 to $0fff. whether each display's
red, green or blue rgb gun is on is determined by the value in the
corresponding attribute's bits 3, 2, or 1. bit 0 controls a firing gun's intensity. attributes are stored by using vdc registers $12, $13. $1e,
& $1f in much the same way characters are stored in vdc display memory.
Re: Power C newbie help needed [message #266928 is a reply to message #266882] Mon, 08 September 2014 19:12 Go to previous message
Harry Potter is currently offline  Harry Potter
Messages: 1304
Registered: March 2012
Karma: 0
Senior Member
I thank all of you for your input--it should be helpful in the future--but I'm looking for appropriate function calls to do the operations. I looked in Power C's documentation and couldn't find the proper functions. :(
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Videos from CommVEx v10 2014
Next Topic: First photos from CommVEx v10 2014
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Mar 28 12:56:10 EDT 2024

Total time taken to generate the page: 0.48052 seconds