DAvideo
alle Bilder sehen ;)
Designed by: Hinx3
OSWD 2004

Valid HTML 4.01!

Atari Basic programming example

· 28.05.2009 · 12:25:36 ··· ··· Thursday ·· 4 (4) Mark Miller
A couple Atari Basic programming examples.

The second design is created by having a constant offset, and repeatedly adding it to the X and Y axes. I explain how it's done below.

Lines 25 and 27 create a right border for the design.

On the Atari the X axis runs across the top of the screen from left to right. The Y axis goes from the top to the bottom of the screen.

Line 30 sets up a loop for a variable "I" that increments it (adds to it) by 5 rather than by 1.

A loop in Basic is a construct (a way of working) where a variable starts with an initial value (in this case 0). Then a set of "bracketed" instructions is executed (another way of explaining it is it's a set of instructions that are designated to be run repeatedly). These instructions may or may not use the loop variable. Then an additive offset is applied to the loop variable (in this case what happens to I is "Take the value of I, whatever it is, and add 5 to it"). Then the same set of designated instructions is executed again. This repeats until the end value for the loop variable is reached. In this case the end value is 135.

Lines 40 and 50 create the left side of the design, beginning each line on the left side (the X-coordinate=0 (and stays constant), the Y-coordinate uses the loop variable, which increases by 5 as it goes) and drawing a straight line to the bottom of it (where the X-coordinate uses the loop variable, which increases by 5 as it goes, and the Y-coordinate=135 (and stays constant)).

So on the left side it goes:

plot 0,0:drawto 0,135
plot 0,5:drawto 5,135
plot 0,10:drawto 10,135
etc.

Line 60 changes the tone of the sound you hear as the loop progresses.

Lines 70 and 80 do the same design along the right side by beginning each line on the top (where the X-coordinate uses the loop variable, which increases by 5 as it goes, and the Y-coordinate=0 (stays constant)) and drawing a straight line to the right side of it (where the X-coordinate=135 (stays constant), and the Y-coordinate uses the loop variable, which increases by 5 as it goes).

So on the right side it goes:

plot 0,0:drawto 135,0
plot 0,5:drawto 135,5
plot 0,10:drawto 135,10
etc.

Line 90 "brackets" the instructions in the for-loop.

Line 100 turns the sound off.

The cool thing is what gets created in the middle! Kind of looks like an "eye", doesn't it?

From what I understand there's some cool math concepts going on here which probably have something to do with calculus (tangents on a curve), but I'm embarrassed to say that I wouldn't really know how to explain it at this point. This is just a computer form of something we used to do by hand on graph paper for extra credit when I was in 5th grade. In fact we did it often enough that our teacher eventually said, "Alright! No more extra credit!" It was getting too easy.


· 01.01.1970 · 01:00:00 ···
0**##
🧠 📺

· 01.01.1970 · 01:00:00 ···
# · 01.01.1970 · 01:00:00 ···
* · 01.01.1970 · 01:00:00 ···
* · 01.01.1970 · 01:00:00 ···

********