BoatofCar Posted February 6, 2014 Share Posted February 6, 2014 I'm working my way through the Compute First Book of Atari Graphics. I think I understand what's going on, but when I try to put in this line: 10 GRAPHICS 6 + 16:COLOR 1:PLOT 5,5:DRAWTO 10,5:DRAWTO 10,10:DRAWTO 5,10:DRAWTO 5,5 It draws a small square with no left side and then immediately brings me back to the READY prompt. I'm using Altirra. What am I doing wrong? Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted February 6, 2014 Share Posted February 6, 2014 Are you sure it didn't draw the left side? Since you don't have a text window for the READY prompt, it's kicking you out of the gfx mode when it finishes (and that is the last line it's drawing). Add 20 GOTO 20 so the program keeps running to check. Quote Link to comment Share on other sites More sharing options...
+Allan Posted February 6, 2014 Share Posted February 6, 2014 When you add +16 to graphics mode it tells the computer to not put a graphics zero window at the bottom of the screen. Since your program is done after line 10 it has to print a 'ready' message somewhere so it make a new graphics 0 screen and prints 'ready' after erasing your graphics 6 screen. Do what Nukey Shay said above and see what happens. I added that to your program and it drew a complete square. Allan Quote Link to comment Share on other sites More sharing options...
BoatofCar Posted February 6, 2014 Author Share Posted February 6, 2014 I see what I was doing wrong. I originally tried 20 GOTO 10 and it was redrawing so fast I didn't see the left side being drawn. Cool, it's all good. Thanks guys! Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted February 6, 2014 Share Posted February 6, 2014 Or you could just remove the +16 from the gfx mode so a 4-line text window stays present. Or use 20 GR.6+32 so the screen adds the text window when done without erasing the screen. IIRC POKE 87,0 could be used to fool the interpreter that you are in GR.0 so text is dumped onscreen as bitpatterns (lol). Quote Link to comment Share on other sites More sharing options...
BoatofCar Posted February 6, 2014 Author Share Posted February 6, 2014 Is there an easy way understand what POKE commands do? I've looked through a few books, but I'm still not able to grok it...it seems like you use them to do all kinds of stuff... Quote Link to comment Share on other sites More sharing options...
+Stephen Posted February 6, 2014 Share Posted February 6, 2014 Mapping the Atari would probably be your best bet. It's available online. The POKE command simply sets a value in a particular memory location. So, knowing what the particular memory location is used for will tell you what the poke does. A simple example, would be : POKE 710,96 That will turn the screen purple, because memory location 710 holds the background colour in Graphics mode 0. Quote Link to comment Share on other sites More sharing options...
BoatofCar Posted February 6, 2014 Author Share Posted February 6, 2014 So POKE commands are like shortcuts? That makes sense, but what about the 96 in your example? Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted February 6, 2014 Share Posted February 6, 2014 (edited) The POKE X,Y instruction is really only doing one thing: altering a memory location you specify (X) to hold the value you specify (Y). Just as your Basic program can use variables (like FOR I = 1 to 10), the Basic language itself is also a program running in the background which uses it's own variables. Basic instructions can be replaced by a single POKE...like using POKE 710,C instead of SETCOLOR 2,X,Y (X*16+Y=C)...but most use multiple variables (a DRAWTO equivalent needs two for the origin, two for the destination, two for the step values in order to connect the dots). Most of them can only be altered via POKE within the Basic language, since they have no keyword built-in to do it (like POKE 756,X to specify what memory page the character set bitmaps exist at). Try Atari Magazines or Atari Archives for starters. Edited February 6, 2014 by Nukey Shay Quote Link to comment Share on other sites More sharing options...
+Stephen Posted February 6, 2014 Share Posted February 6, 2014 So POKE commands are like shortcuts? That makes sense, but what about the 96 in your example? The 96 is the value that will go into memory location 710. It is interpreted as Colour #6, darkest of the 8 (16 in other Graphics modes) available brightnesses. Keep in mind, that 96 has no intrinsic meaning. Each memory location can and usually will interpret the value it holds differently, according to the bit of hardware that the location controls. Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted February 6, 2014 Share Posted February 6, 2014 In that example, it is a shortcut. Basic SETCOLOR just lets you handle the color (6) and intensity (0) as separate values...so it appears to be longer. SETCOLOR 2,6,0 is the same as POKE 710,6*16+0. Quote Link to comment Share on other sites More sharing options...
BoatofCar Posted February 7, 2014 Author Share Posted February 7, 2014 After looking at the other posts in this forum, it's clear I'm an ant among giants when it comes to A8 programming, so I'll just keep posting questions here in order not to clutter the forum. In Graphics 3, I'm trying to use the Atari Color Numbers found in Compute's Book of Atari Graphics to draw colored lines. Here's my code: 10 COLOR 0:PLOT 1,1:DRAWTO 5,1 Color 0 is supposed to be grey, but it's not showing up. Color 1 is gold, just as the book says, but color 2 shows up green (in the book it says it's supposed to be orange.) What am I doing wrong? Quote Link to comment Share on other sites More sharing options...
+Stephen Posted February 7, 2014 Share Posted February 7, 2014 Each colour has 8 or 16 shades. Color 0 is black, then 2 through 15 gets lighter. You will want to multiply the colour in that chart by 16. Quote Link to comment Share on other sites More sharing options...
BoatofCar Posted February 7, 2014 Author Share Posted February 7, 2014 I don't understand. How can I multiply 0 by 16? It seems like there's a pattern: 0-black (or blank) 1-orange 2-light green 3-dark blue 4-(black) 5-orange 6-light green 7-dark blue and so on. Quote Link to comment Share on other sites More sharing options...
kenjennings Posted February 7, 2014 Share Posted February 7, 2014 I don't understand. How can I multiply 0 by 16? It seems like there's a pattern: 0-black (or blank) 0 x 16 == 0. Add the luminance value 0 to 15... and the numbers you get are 0...15. The next color ( 1 ) x 16 == 16. Add the luminance value 0 to 15 and the numbers you get are 16 to 31. and so forth. (Technically, outside of GTIA mode 9, only the even luminance values 0, 2, 4, 6, 8, 10, 12, 14 are valid. the lowest bit is ignored, so 15 is the same luminance value as 14..) Quote Link to comment Share on other sites More sharing options...
Bryan Posted February 7, 2014 Share Posted February 7, 2014 Best way to think about POKE is that it circumvents the BASIC environment and allows you direct access to "behind the scenes" memory. It's useful in BASIC because there are limitations on what BASIC keywords can do but you can easily crash the system with a wrong poke too. Once you learn assembly programming, you get a much better grasp on what's actually going on in the background. Quote Link to comment Share on other sites More sharing options...
BoatofCar Posted February 7, 2014 Author Share Posted February 7, 2014 (edited) Ok, I think I've got it. Please let me know if this is right. I want to plot a gray point. I need to tell the computer that a COLOR 1 is gray. I type SETCOLOR 0(this number is telling the computer I want to set the color for the point, not the background, text window, etc),0(this is the color from the color table--in this case, gray),5(this is how bright I want the gray to be) and then COLOR 1:PLOT 1,1 I know that works, but I want to make sure I understand why it works. Edited February 7, 2014 by BoatofCar Quote Link to comment Share on other sites More sharing options...
BoatofCar Posted February 7, 2014 Author Share Posted February 7, 2014 Ok, so that wasn't right. I tried to add another color line underneath it and it messed everything up. Quote Link to comment Share on other sites More sharing options...
kenjennings Posted February 7, 2014 Share Posted February 7, 2014 EVERYTHING on the screen for Atari playfield graphics is colored by indirection. COLOR 1 simply says draw pixels with a specific bit pattern in memory that is then output to the screen. This has nothing to do with the actual color that is seen on the screen. The pixels corresponding to playfield COLOR 1 are assigned a color by a color register. SETCOLOR (OR POKE) define the color in the color register. So, by using SETCOLOR/POKE you can make COLOR 1 pixels red, green, blue, etc, pick one of 128 possible color values. Quote Link to comment Share on other sites More sharing options...
Bryan Posted February 7, 2014 Share Posted February 7, 2014 http://www.atarimania.com/documents/Your-Atari-Computer.pdf Start at p.271. It explains the whole thing. Quote Link to comment Share on other sites More sharing options...
BoatofCar Posted February 7, 2014 Author Share Posted February 7, 2014 (edited) Edit: Reading the above link before I post any more questions. Edited February 7, 2014 by BoatofCar Quote Link to comment Share on other sites More sharing options...
BoatofCar Posted February 7, 2014 Author Share Posted February 7, 2014 I'm sorry guys, I still don't get it. I want to draw a white dot next to a red dot. 10 GRAPHICS 3 20 POKE 708,15 (I understand this now!) 30 COLOR 1:PLOT 1,1 40 POKE 710, 53 (Here's the red dot in COLOR 2 if I did the math right) 50 COLOR 2:PLOT 2,1 This gives me white dot and the normal COLOR 2 light green dot. How can I use POKE or SETCOLOR to change the value of COLOR 2? I apologize if it spells it out in the books, I just don't see it Quote Link to comment Share on other sites More sharing options...
kenjennings Posted February 7, 2014 Share Posted February 7, 2014 708 == COLPF1 (COLOR 1) 709 == COLPF2 (COLOR 2) 710 == COLPF3 (COLOR 3). Quote Link to comment Share on other sites More sharing options...
Bryan Posted February 7, 2014 Share Posted February 7, 2014 For now, always use SETCOLOR to keep things is BASIC. SETCOLOR will essentially do the POKE for you. In GR. 3, you have 4 colors- 3 different drawing colors and a background color. Use SETCOLOR 1-3(,x,x) to set the 3 drawing colors. Use SETCOLOR 4,x,x to set the background. Use COLOR 1-3 to set the current drawing color to one of the colors you set with SETCOLOR. If you do not set the colors, they are orange (1), green (2), and blue (3). The selected drawing color remains until you use the COLOR command again. If you use a SETCOLOR command after drawing, all pixels on the screen of that color value will change to the new color. In other words, if you draw in COLOR 1 and then change COLOR 1, all pixels of color 1 will change. So, SETCOLOR is similar to filling paint buckets with color to use (except for the fact that changing what's in the buckets also changes the paint you've already applied). COLOR is like picking up one of the brushes from a bucket. Getting more than 3 foreground colors requires more programming work. Quote Link to comment Share on other sites More sharing options...
+MrFish Posted February 7, 2014 Share Posted February 7, 2014 Getting more than 3 foreground colors requires more programming work. Unless you want to use one of the GTIA modes. 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.