Jump to content

Photo

Understanding and using graphics mode with CC65

Atari 800 Atari 800XL CC65 conio.h

10 replies to this topic

#1 Fabrizio Caruso OFFLINE  

Fabrizio Caruso

    Chopper Commander

  • 103 posts

Posted Sun Jun 25, 2017 4:39 PM

Hi eveyone,

 

I am using CC65 to code a game that use conio.h to display characters on the screen.
It works fine in graphics mode 0 but I get weird results with other text modes.
(I am compiling with cl65.exe  -O -t atarixl --start-addr 0x4000 ... to get enough memory).

 

I would like to use any other text mode that adds support for colors like graphics mode 12.

(I would use re-defined characters but this is not my issue).

My goal is to have a text mode with at least 4 colors and to know how to draw characters and set their

colors with CC65.

 

(1) If I set graphics mode 12 I get the lower four lines in monochromatic mode. Is it normal?

I thought it was a BASIC thing. How can I get read of them?

 

(2) The conio library seems not to behave correctly when used with any graphics mode other than 0. How to I set colors?

 

Where can I find any simple example?

 

   Fabrizio
 

 

 

 

 

 



#2 JamesD OFFLINE  

JamesD

    Quadrunner

  • 8,437 posts
  • Location:Flyover State

Posted Sun Jun 25, 2017 10:54 PM

Well, from my first and only experience with Atari assembly, I'd be inclined to blame the display list.
But I've never used cc65.



#3 tschak909 ONLINE  

tschak909

    River Patroller

  • 3,150 posts
  • Location:USA

Posted Sun Jun 25, 2017 11:50 PM

Myself, I wouldn't bother with the tgi graphics modes unless you were porting something, just set up a display list, and literally do everything yourself. You'll have more memory, that way.

 

-Thom



#4 Fabrizio Caruso OFFLINE  

Fabrizio Caruso

    Chopper Commander

  • Topic Starter
  • 103 posts

Posted Mon Jun 26, 2017 12:55 AM

CC65 is a C cross compiler. Is graphics mode 13 supposed to always have the 4 lowest lines of monochromatic text? I am not using Assembly. Where can I get help on how to use a text mode with colors and still use CC65?

TGI is not for text modes.

I have zero experience with display lists. Where can I start reading about them?


Edited by Fabrizio Caruso, Mon Jun 26, 2017 12:56 AM.


#5 sanny OFFLINE  

sanny

    Moonsweeper

  • 364 posts
  • Location:Bavaria

Posted Mon Jun 26, 2017 12:56 AM

Are you using the graphics() function? Its parameters are just like BASIC. So use 12+16 in order not to have the four lines graphics 0 window.

And, are you sure you need the "atarixl" Target? It's normally only needed for very large programs, it makes the RAM below the ROM available. Try "atari" target (and use __RESERVED_MEMORY__ to reserve memory for the screen buffer)

#6 baktra OFFLINE  

baktra

    Dragonstomper

  • 615 posts
  • Location:Czech republic

Posted Mon Jun 26, 2017 2:37 AM

The GRAPHICS mode 12+16 will do the trick as sanny suggested.

 

A good source of information on how to get text/graphics working with cc65 are cc65 games with source code available. See this thread.

When it comes to display list - https://en.wikipedia.org/wiki/ANTIChttp://www.atariarch...ere/chapt02.php



#7 kenjennings OFFLINE  

kenjennings

    Dragonstomper

  • 789 posts
  • Me + sio2pc-usb + 70 old floppies
  • Location:Florida, USA

Posted Mon Jun 26, 2017 6:47 PM

... Is graphics mode 13 supposed to always have the 4 lowest lines of monochromatic text?

 

I don't have cc65.  From what you describe it sounds like cc65 uses the Atari OS CIO to open graphics modes.  Any BASIC language documentation referring to the graphics mode numbers should be good to use, since it is the OS, not BASIC that is creating the graphics modes.

 

Simply, you get graphics modes numbered 0 through 11 on Atari 800/400, 0 to 15 on XL and XE.

 

Mode 0 is the usual 40x24 text mode.  What you described as monochromatic text.

 

Mode 1 and 2 are colored text modes.   Modes 3 to 7 are regular graphics modes (black background by default). 

 

Mode 8 is the highest resolution mode which uses the same color scheme as the monochromatic text mode (blue background, white pixels).

 

The modes from 1 through 8 automatically include four lines of "monochromatic text" at the bottom of the screen.  Add 16 to the graphics mode number to remove the text window at the bottom of the screen. 

 

On computers with GTIA (which by now is almost every 8-bit Atari available) modes 9, 10, 11 are graphics modes with special color options.  None of these include the text window at the bottom of the screen.

 

On the XL/XE there are also modes 12, 13, 14, 15.   Two are text modes that really require custom character set to be effective, and two are graphics modes.


Edited by kenjennings, Mon Jun 26, 2017 6:49 PM.


#8 Fabrizio Caruso OFFLINE  

Fabrizio Caruso

    Chopper Commander

  • Topic Starter
  • 103 posts

Posted Tue Jun 27, 2017 12:43 AM

I have managed to set up video mode 12 + 16. Now I need to understand

(1) how the 5 color palette is created
(2) how the 5 available colors are encoded in each character

My characters seem to only have 3 colors.

How are 5 colors possible? A 2 bit combination would only produce 4 possible colors per pixel on each character.

#9 tschak909 ONLINE  

tschak909

    River Patroller

  • 3,150 posts
  • Location:USA

Posted Tue Jun 27, 2017 12:50 AM

You really need to read the hardware manual regarding ANTIC modes 4 and 5. Seriously, go to atarimania.com, into the atari 800 books section. We'll be right here.

 

But in case that's TL:DR:

 

Basically, in ANTIC modes 4 and 5, bit 7 of a character determines whether or not the fifth color is used.

 

-Thom



#10 MaPa OFFLINE  

MaPa

    Dragonstomper

  • 961 posts
  • Location:Czech Republic

Posted Tue Jun 27, 2017 12:54 AM

The color shadow registers are at addresses 708-712 ($2C4-$2C8) which are copied by the OS VBI to the HW registers $D016-$D01A. First colour registers are COLOR0-3 and the last one is background colour.

 

The 5th color in character mode 12 is produced by using inverse character codes in which the bitpair 11 is using COLOR3 register instead COLOR2 (00 - backround, 01 - COLOR0, 10 - COLOR1, 11 - COLOR2).



#11 sanny OFFLINE  

sanny

    Moonsweeper

  • 364 posts
  • Location:Bavaria

Posted Tue Jun 27, 2017 1:32 AM

The Atari cc65 runtime lib also provides a _setcolor() function with the same arguments as BASIC.







Also tagged with one or more of these keywords: Atari 800, Atari 800XL, CC65, conio.h

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users