Jump to content

Photo

Text mode plots and drawto - how to use drawing characters?

atari programming graphics text

12 replies to this topic

#1 fujidude OFFLINE  

fujidude

    Quadrunner

  • 5,177 posts
  • Location:United States of America

Posted Thu Aug 6, 2015 10:50 AM

Like the topic says.... is there a way to use PLOT and DRAWTO to quickly drawn lines with the line drawing characters?  Here's what I understand so far after some research:

  • You can use PLOT and DRAWTO in a text mode.
  • The COLOR statement is used to determine what character is output.
  • The COLOR statement is ranged 0-255 (8 bits), but the 1st two bits are said to control color of character, and the last 6 to identify which character.
  • Six bits only allows for 64 possible characters (out of 128 + another 128 inverse).

When I wanted to plot an ATASCII 17 (upper left corner drawing character), I instead neded up with a Q, ATASCII 81 (in the next set of 64 chars).  So, how do I plot box corner characters and "draw" box side characters between them?  Also I'm pondering... normally the COLOR statement determined which color register will be used for subsequent plots.  There are 5 color registers (0 - 4).  When doing graphics, the least sigificant bits given to the COLOR statement determine which register,  Why is it that the same COLOR statement, when using for text mode, has the two most significant bits deal with color?  Also, since it is just two bits, it could only refer to teh 1st four color registers and not the 5th one.  That's okay I suppose, but do they even refer to color registers at all?

 

Any of you gurus able to help clear this up?


Edited by fujidude, Thu Aug 6, 2015 10:50 AM.


#2 billkendrick OFFLINE  

billkendrick

    Chopper Commander

  • 120 posts
  • Location:Davis, CA

Posted Thu Aug 6, 2015 11:02 AM

It sounds like you're trying to use GRAPHICS 1 or 2 mode (20x24 & 20x12 text).  They give you 4 colors to use for the characters, plus the background.  As you noticed, you only get 64 characters to work with.  So normally, uppercase only, no control characters.  If you print a CHR$(17), or COLOR 17 and then PLOT/DRAWTO, you should be getting a green (default color palette) "1" character.

 

So Q, q, inverse Q and inverse q give you four colors of capital "Q".

1, ctrl-Q, inverse 1, and inverse ctrl-Q give you four colors of numeral "1".

 

If you want the lowercase & control characters _instead_ of the uppercase and numeric stuff, you'll want to POKE 756 with the 4K page of your character set (e.g., the internal OS ROM's charset at page 224), but plus 2 pages.  e.g. POKE 756,226

 

Of course, since 32-32 = 0, and character 0 is the heart, this means your screen will be filled with hearts.  See attached screenshot.

 

Coffee is wearing off. I hope I made sense, and helped in some way. ;)

 

Attached Thumbnails

  • gr2_plot.png


#3 billkendrick OFFLINE  

billkendrick

    Chopper Commander

  • 120 posts
  • Location:Davis, CA

Posted Thu Aug 6, 2015 11:09 AM

BTW, I've probably mentioned it before, but I've been meaning to write a game that lets me use 64 different 20x12 _multicolor_ characters (each being 8x16 pixels in resolution, so 160x192 total).

 

Simply use GRAPHICS 12 (40x24 multicolor), where you get 128 total characters to use.  Every other row in the display list would repeat the previous line (so you get 40x12).  Each of your 64 symbols is made of 2 characters (so if you stick to a grid, you get 20x12).

 

Then, on each row that repeats the previous row's characters, use a DLI to switch to an alternate font/character set.

 

So for 480 bytes (40x12) of screen data, and 2KB of character set data, plus a custom display list and a very simple little DLI, you can make a game that has the same constrants as GRAPHICS 2 mode (20x12, 64 unique symbols allowed), but with 2x the resolution per character (like GRAPHICS 1), AND multiple colors _within_ the symbols.

 

Of course, your ability to reuse a symbol/tile, but recolor it, is limited to GRAPHICS 12 (& 13)'s "4th color becomes 5th color" ability... versus GRAPHICS 2's ability to have the same monochrome character/symbol/tile in one of 4 colors.  Seems a reasonable trade-off to me, though. :)

 

Semi off-topic rambling, sorry.



#4 fujidude OFFLINE  

fujidude

    Quadrunner

  • Topic Starter
  • 5,177 posts
  • Location:United States of America

Posted Thu Aug 6, 2015 12:40 PM

Thanks for the info but no, I am wishing to do this in a graphics 0 environment.  So how does it all fit within that construct?  Basically what I want to do is have a completely text application, that uses mode 0.  Then I want to use box drawing characters to frame certain areas, then have text within them.  I can accomplish it with a number of POSTION, PRINT, or PUT statements.  I was hoping to save effort in writing code by taking advantage of plotting and drawing "lines" of box drawing characters in the text mode.


Edited by fujidude, Thu Aug 6, 2015 12:44 PM.


#5 drac030 OFFLINE  

drac030

    Stargunner

  • 1,836 posts
  • Location:Warszawa, Poland

Posted Thu Aug 6, 2015 12:53 PM

Like the topic says.... is there a way to use PLOT and DRAWTO to quickly drawn lines with the line drawing characters?  Here's what I understand so far after some research:

  • You can use PLOT and DRAWTO in a text mode.
  • The COLOR statement is used to determine what character is output.
  • The COLOR statement is ranged 0-255 (8 bits), but the 1st two bits are said to control color of character, and the last 6 to identify which character.
  • Six bits only allows for 64 possible characters (out of 128 + another 128 inverse).

When I wanted to plot an ATASCII 17 (upper left corner drawing character), I instead neded up with a Q, ATASCII 81 (in the next set of 64 chars).  So, how do I plot box corner characters and "draw" box side characters between them?  Also I'm pondering... normally the COLOR statement determined which color register will be used for subsequent plots.  There are 5 color registers (0 - 4).  When doing graphics, the least sigificant bits given to the COLOR statement determine which register,  Why is it that the same COLOR statement, when using for text mode, has the two most significant bits deal with color?  Also, since it is just two bits, it could only refer to teh 1st four color registers and not the 5th one.  That's okay I suppose, but do they even refer to color registers at all?

 

Any of you gurus able to help clear this up?

 

10 GRAPHICS 0:COLOR 17:PLOT 10,10 works here (i.e. ASCII 17 is plotted at pos. 10,10). You would just need to disable the cursor.



#6 fujidude OFFLINE  

fujidude

    Quadrunner

  • Topic Starter
  • 5,177 posts
  • Location:United States of America

Posted Thu Aug 6, 2015 1:37 PM

My bad, I should have stated I did something like this:

 

COLOR 0+64+17

 

I was thinking that I needed to set the 1st two most significant bits to 01 (for register #1).

 

Thanks a bunch for pointing out that it is as simple as using all 8 bits for the character! (at least in GR.0).


Edited by fujidude, Thu Aug 6, 2015 1:37 PM.


#7 Rybags OFFLINE  

Rybags

    Quadrunner

  • 15,891 posts
  • Location:Australia

Posted Thu Aug 6, 2015 7:48 PM

Using draws in text mode offers no assistance re selecting of graphical characters to simulate a line, it's up to you for that choice and the one character makes up the entire line.

 

For GR. 0 you should disable the cursor otherwise you'll get unwanted blocks appearing.

 

Also, control characters will be acted upon, you can have them always printed instead of executed by POKE 766,1.

Additional to that, you might run into trouble if trying to use COLOR 155.  That's the RETURN/EOL character and won't get processed as expected.

 

On top of all that, you can experience problems if trying this stuff out in immediate mode under Basic.

The draw command works in Basic programs because when you execute the GRAPHICS command it opens an S: device for it using IOCB #6.

That includes GR. 0 which allows the draw commands to work inside the program.

The problem you can encounter is when a Basic program runs through you have an "implied END" which will close the other IOCBs.

When this occurs you can't use the DRAWTO command.


Edited by Rybags, Thu Aug 6, 2015 7:56 PM.


#8 fujidude OFFLINE  

fujidude

    Quadrunner

  • Topic Starter
  • 5,177 posts
  • Location:United States of America

Posted Thu Aug 6, 2015 9:02 PM

Thanks for the additional info.  I did notice that already about turning off the cursor and the graphics modes.  Good to know about location 766 too.



#9 Grevle OFFLINE  

Grevle

    Moonsweeper

  • 381 posts
  • Location:Norway

Posted Wed Aug 12, 2015 8:36 AM

I call this the color plot metode, I used it a lot when i learned Basic Programming and even in some of my newer games. What i usualy do to find the right Color varaiable for the character i want to plot or drawto is to make a small program that prints the value and then plot the character next to the number and by moving the joystick up and down i cycle throug the numbers and then take note of the value that fits the character i want to use..so the same characters may be show up to 3 or 4 times but in different colors, or i guess in gr.0 inverse, It depends what graphics mode your using.



#10 Rybags OFFLINE  

Rybags

    Quadrunner

  • 15,891 posts
  • Location:Australia

Posted Wed Aug 12, 2015 10:41 PM

Most of the graphics characters are easy to work out - the character/colour coding equates to which letter of the alphabet you use to type it onscreen, ie Ctrl A = 1, Ctrl Z = 26.



#11 fujidude OFFLINE  

fujidude

    Quadrunner

  • Topic Starter
  • 5,177 posts
  • Location:United States of America

Posted Wed Aug 12, 2015 11:05 PM

I use this:

 

Attached Files



#12 Grevle OFFLINE  

Grevle

    Moonsweeper

  • 381 posts
  • Location:Norway

Posted Thu Aug 13, 2015 2:06 PM

Well i used my little program with modified character sets, So my characters would be designet for drawing backround graphics etc. so for me that way i always was sure i got the right character i wanted to use, It was also nice to see the Modified character , To see if it look right in the same mode its going to be used and cycle trough the Characters make that prosses easier.

 

Just my way of doing that.

 

 

 

 

Nice Table by the way, Wish i knew it sooner :woozy:


Edited by BioFreeze, Thu Aug 13, 2015 2:13 PM.


#13 fujidude OFFLINE  

fujidude

    Quadrunner

  • Topic Starter
  • 5,177 posts
  • Location:United States of America

Posted Thu Aug 13, 2015 6:57 PM

I didn't make it, but it came in very handy for my AAC (ASCII ATASCII Converter) program I made recently.  I ended up finding that chart after doing some Googling.  I also found this:

 

Attached File  8-Bit ATASCII.pdf   106.29KB   289 downloads







Also tagged with one or more of these keywords: atari, programming, graphics, text

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users