Commodore 64 Uživatelský manuál Strana 28

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 83
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 27
The bit of that byte is:
BIT
= 7-(X AND 7)
Now we put these formulas together. The byte in which character
memory dot (X,Y) is located is calculated by:
BYTE = BASE+ ROW*320+ CHAR*8+ LINE
To turn on any bit on the grid with coordinates (X,V), use this line:
POKE BYTE, P.EEK(BYTE) OR 2jBIT
Let's add these calculations to the program. In the following example,
the COMMODORE 64 will plot a sine curve:
5121 FOR:X:=0T0319STEP. 5: REr1 WAVE WILL FILL THE SCREE~I
60 Y=INTC9121+80:f.SINCX/1121»
7(1 CH= I tH C;";/8::-
8121 RO=INTC'T'/8::-
85 UI='r'AND7
90 B'T'=BASE +RO*32121+8*CH+L~1
1121121BI=7-C:X:AND7)
11121 POKEB'r'" PEEK CB'r' ::0OR 0:2 t:E: I ::-
12121 t'IE:":n~
125 POKE1024..16
13121 GOT0130
The calculation in line 60 will change the values for the sine function
from a range of + 1 to -1 to a range of 10 to 170. Lines 70 to 100
calculate the character, row, byte, and bit being affected, using the
formulae as shown above. Line 125 signals the program is finished by
changing the color of the top left corner of the screen. Line 130 freezes
the program by putting it into an infinite loop. When you have finished
looking at the display, just hold down .:m/'~"tI'I:Iand hit .'1:1.'11I1'1:11.
126 PROGRAMMING GRAPHICS
Zobrazit stránku 27
1 2 ... 23 24 25 26 27 28 29 30 31 32 33 ... 82 83

Komentáře k této Příručce

Žádné komentáře