Here - 1000 BiT
Here - 1000 BiT Here - 1000 BiT
206 FOR J=0TO 2:S$=MID$(R$,J*8+2,8)210N=0:P=128215 FOR K=1 TO 8:D$=MID$(S$,K,1]220 IF D$="*" THEN N=N+P225 P=P/2:NEXT K230 POKE B*64+L,N:L=L+1280 NEXT J.I:PRINT"clr"299 RETURNqpjn RFM301 DATA ! *302 DATA ! *303 DATA ! *304 DATA ! *305 DATA ! *306 DATA ! *307 DATA ! *308 DATA ! *309 DATA ! *310 DATA !* *311 DATA !***312 DATA j*313 DATA !314 DATA !315 DATA !316 DATA !317 DATA !318. DATA |319 DATA !320 DATA |321 DATA |322 REMSAVE before running!*************!!!!!!!!!*!*** |*i!* !* !* !* !* !!!IHOW TO USE THE SPRITE PROGRAMDraw your own picture in the DATA statements and enter the DATA lines into theprogram, like this:List the program and see the DATA statements on the screen.Move the cursor into the rectangle drawn in the DATA statements. Erase thestars which are already there. Draw whatever picture you like (a smiley face?)using the "*" key.178
Then use the CRSR keys to move the cursor to line 301 at the top of thedrawing. Then press the RETURN key 21 times to enter all the new DATAstatements into the program.Then run the program to see your sprite move.HOW IT WORKSThe VIC chip has 47 memory boxes which tell the sprites what to do. Besides that, eachsprite needs a picture stored in a block of 64 boxes in memory, and a "sprite pointer" boxto tell which 64 boxes to use.Line 22 The addresses of VIC's boxes start at 53248.Line 26 The box at 2040 is the "sprite pointer" for sprite 0. It tells in which block of 64boxes sprite 0 will find its picture. Block 200 has boxes 12800 to 12863.(12800 = 64*200).CAREFUL! Use only blocks 200 to 255!Line 32 Box V+21 is the sprite on-off box. Put number 0 into the box to turn off all thesprites. The number 1 turns on sprite 0.Line 34 Box V+39 holds a color number (0 to 15) for sprite 0.Line 44 Box V holds the X position of sprite 0. The number is between 0 and 255.Numbers near 0 put the sprite off the screen at the left.Line 45 Box V+1 holds the Y position of sprite 0. Numbers near 0 put it off the screen atthe top. Numbers near 255 put it off the screen at the bottom.Line 200 The subroutine reads each DATA line, breaks it up into three "bytes" of eightcharacters each, and then looks to see which characters are stars. The stars tellwhich bits are "ones" in binary notation. Study pages 72 and 73 in theCommodore 64 User's Guide to learn more about making binary numbers intodecimal numbers for sprites.TWO STEPS TO SPRITESYou use sprites in two steps: First you draw and store a picture. Then you make VICcolor it, turn it on and move it around.Load the SPRITE program, then change it.179
- Page 127 and 128: Try this: Change the number 83 to a
- Page 129 and 130: We can number the streets and house
- Page 131 and 132: n INSTRUCTOR NOTES 23 SECRET WRITIN
- Page 133 and 134: THE COMPUTER ISIMPATIENTThe compute
- Page 135 and 136: ^ INSTRUCTOR NOTES 24 PRETTY PROGRA
- Page 137 and 138: Assignment 24A:1. The delay loop is
- Page 139 and 140: Assignment 24B:1. Write a short pro
- Page 141 and 142: LESSON 25 LOGIC: AND, OR, NOTANOTHE
- Page 143 and 144: THE IF COMMAND TELLS LITTLE WHITE L
- Page 145 and 146: THE LOGIC SIGNSYou can use these si
- Page 147 and 148: LESSON 26 SNIPPING STRINGS: LEFTS,
- Page 149 and 150: CUTTING A PIECE OUT OF THE MIDDLETh
- Page 151 and 152: nnO INSTRUCTOR NOTES 27 SWITCHING N
- Page 153 and 154: MAKING NUMBERS INTO STRINGSRun10 RE
- Page 155 and 156: Assignment 27:1. Write a program wh
- Page 157 and 158: LESSON 28ACTION GAMES AND THE FUNCT
- Page 159 and 160: LOOKING IN THE KEYBOARD'S BOXHere i
- Page 161 and 162: Run it. It puts a white diamond on
- Page 163 and 164: cTHETARGETS ARE HEARTSAdd these lin
- Page 165 and 166: LESSON 29MUSICGo back and review th
- Page 167 and 168: REGISTER ADDRESSES Base address is
- Page 169 and 170: D^ INSTRUCTOR NOTES 30 ARRAYS AND T
- Page 171 and 172: The DIM... command tells the comput
- Page 173 and 174: 1 REM *** EIGHT QUEENS ***2 GOTO 10
- Page 175 and 176: Assignment 30:1. Write a program wh
- Page 177: LESSON 31SPRITES FOR ACTION GRAPHIC
- Page 181 and 182: MANY SPRITES AT ONCEHere are the bo
- Page 183 and 184: WATCH OUT, TWO SPRITES ARE GOING TO
- Page 185 and 186: LESSON 32USER FRIENDLY PROGRAMSTher
- Page 187 and 188: TIE A STRING AROUND THE USER'S FING
- Page 189 and 190: SET TRAPS FOR ERRORSExample: Add th
- Page 191 and 192: LESSON 33DEBUGGING, STOP, CONTTHE S
- Page 193 and 194: Use the PRINT command to look at va
- Page 195 and 196: RESERVED WORDSABSAND ASC ATNCHR$CLR
- Page 197 and 198: ells and whistlesA phrase going bac
- Page 199 and 200: error trapPart of a program which c
- Page 201 and 202: listingA list of all the lines in a
- Page 203 and 204: emarkA comment you make in the prog
- Page 205 and 206: variableA name given to a box in me
- Page 207 and 208: FORMULA TOO COMPLEXYou wrote a stri
- Page 209 and 210: SYNTAXYou "spelled" the line wrong.
- Page 211 and 212: 1 REM A4-310 REM*** SMILE***13 POKE
- Page 213 and 214: 1 REM A6-210 REM*** FAVORITE***15 P
- Page 215 and 216: ~ 40 INPUT C$1 REM A9B-210 REM ***
- Page 217 and 218: ^ 1 REM A11A-210 REM !"#$% INSULTS
- Page 219 and 220: 1 REM A12B-410 REM *** PICK A CARD
- Page 221 and 222: ^ 1 REM A15-210 REM!!! VACATION!!!r
- Page 223 and 224: ■1 REMA17B-510 REM*** OPERA SOPRA
- Page 225 and 226: 1 REM A22-110 REM *** COLORED BOX *
- Page 227 and 228: 1 REM A24B-1r> 10 REM*** SUBROUTINE
Then use the CRSR keys to move the cursor to line 301 at the top of thedrawing. Then press the RETURN key 21 times to enter all the new DATAstatements into the program.Then run the program to see your sprite move.HOW IT WORKSThe VIC chip has 47 memory boxes which tell the sprites what to do. Besides that, eachsprite needs a picture stored in a block of 64 boxes in memory, and a "sprite pointer" boxto tell which 64 boxes to use.Line 22 The addresses of VIC's boxes start at 53248.Line 26 The box at 2040 is the "sprite pointer" for sprite 0. It tells in which block of 64boxes sprite 0 will find its picture. Block 200 has boxes 12800 to 12863.(12800 = 64*200).CAREFUL! Use only blocks 200 to 255!Line 32 Box V+21 is the sprite on-off box. Put number 0 into the box to turn off all thesprites. The number 1 turns on sprite 0.Line 34 Box V+39 holds a color number (0 to 15) for sprite 0.Line 44 Box V holds the X position of sprite 0. The number is between 0 and 255.Numbers near 0 put the sprite off the screen at the left.Line 45 Box V+1 holds the Y position of sprite 0. Numbers near 0 put it off the screen atthe top. Numbers near 255 put it off the screen at the bottom.Line 200 The subroutine reads each DATA line, breaks it up into three "bytes" of eightcharacters each, and then looks to see which characters are stars. The stars tellwhich bits are "ones" in binary notation. Study pages 72 and 73 in theCommodore 64 User's Guide to learn more about making binary numbers intodecimal numbers for sprites.TWO STEPS TO SPRITESYou use sprites in two steps: First you draw and store a picture. Then you make VICcolor it, turn it on and move it around.Load the SPRITE program, then change it.179