Here - 1000 BiT

Here - 1000 BiT Here - 1000 BiT

11.07.2015 Views

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

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

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!