Fabrizio Caruso Posted June 25, 2017 Share Posted June 25, 2017 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 1 Quote Link to comment Share on other sites More sharing options...
JamesD Posted June 26, 2017 Share Posted June 26, 2017 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. Quote Link to comment Share on other sites More sharing options...
tschak909 Posted June 26, 2017 Share Posted June 26, 2017 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 Quote Link to comment Share on other sites More sharing options...
Fabrizio Caruso Posted June 26, 2017 Author Share Posted June 26, 2017 (edited) 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 June 26, 2017 by Fabrizio Caruso Quote Link to comment Share on other sites More sharing options...
sanny Posted June 26, 2017 Share Posted June 26, 2017 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) 1 Quote Link to comment Share on other sites More sharing options...
baktra Posted June 26, 2017 Share Posted June 26, 2017 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/ANTIC, http://www.atariarchives.org/dere/chapt02.php Quote Link to comment Share on other sites More sharing options...
kenjennings Posted June 27, 2017 Share Posted June 27, 2017 (edited) ... 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 June 27, 2017 by kenjennings Quote Link to comment Share on other sites More sharing options...
Fabrizio Caruso Posted June 27, 2017 Author Share Posted June 27, 2017 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. Quote Link to comment Share on other sites More sharing options...
tschak909 Posted June 27, 2017 Share Posted June 27, 2017 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 Quote Link to comment Share on other sites More sharing options...
MaPa Posted June 27, 2017 Share Posted June 27, 2017 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). Quote Link to comment Share on other sites More sharing options...
sanny Posted June 27, 2017 Share Posted June 27, 2017 The Atari cc65 runtime lib also provides a _setcolor() function with the same arguments as BASIC. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.