Jump to content
  • 0
Sign in to follow this  
Alfa

Address in basic-sprite demo

Question

I have been working on learning how the sprites work, and I started with the BASIC example in the x16-demo-master.  I am trying to understand the addresses being used verses the VERA documentation.  For example the first two lines where the sprite information is being loaded :

10 REM ADDRESS 12:5
20 VPOKE $F, $5000, 0

It seems odd to use bank $F and address $5000 when the VERA documentation states these entries start at $1FC00. This would seem to indicate bank $1 and address $FC00.  I am obviously missing something here.  Any pointers in the right direction would be appreciated.

 

 

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0
Posted (edited)

Fortunately, it wasn't too bad to figure out how to update it. Try this code, instead:

Quote

10 REM 'ADDRESS 12:5
20 VPOKE $1,$FC00,0
30 REM 'ADDRESS 16:13 (STARTING AT $10000) AND 8 BPP MODE
40 VPOKE $1,$FC01,$88
50 REM 'X COORDINATE 7:0
60 VPOKE $1,$FC02,220
70 REM 'X COORDINATE 9:8
80 VPOKE $1,$FC03,0
90 REM 'Y COORDINATE 7:0
100 VPOKE $1,$FC04,55
110 REM 'Y COORDINATE 9:8
120 VPOKE $1,$FC05,0
130 REM 'Z-DEPTH: IN FRONT OF LAYER 2
140 VPOKE $1,$FC06,$0C
150 REM '16 PIXELS FOR WIDTH AND HEIGHT
160 VPOKE $1,$FC07,$50
170 REM 'COPY SMILEY SPRITE DATA TO VIDEO RAM
180 GOTO 500
180 FOR I=0 TO 255
190 READ A
200 VPOKE 1,I,A
210 NEXT I
220 REM 'ENABLE SPRITES
230 POKE $9F29,PEEK($9F29)OR$40
240 END

500 DATA 00,00,00,00,00,16,16,16,16,16,16,00,00,00,00,00
510 DATA 00,00,00,16,16,07,07,07,07,07,07,16,16,00,00,00
520 DATA 00,00,16,07,07,07,07,07,07,07,07,07,07,16,00,00
530 DATA 00,16,07,07,07,07,07,07,07,07,07,07,07,07,16,00
540 DATA 00,16,07,07,07,16,07,07,07,07,16,07,07,07,16,00
550 DATA 16,07,07,07,07,16,07,07,07,07,16,07,07,07,07,16
560 DATA 16,07,07,07,07,16,07,07,07,07,16,07,07,07,07,16
570 DATA 16,07,07,07,07,07,07,07,07,07,07,07,07,07,07,16
580 DATA 16,07,07,07,07,07,07,07,07,07,07,07,07,07,07,16
590 DATA 16,07,07,07,07,07,07,07,07,07,07,07,07,07,07,16
600 DATA 16,07,07,16,07,07,07,07,07,07,07,07,16,07,07,16
610 DATA 00,16,07,07,16,07,07,07,07,07,07,16,07,07,16,00
620 DATA 00,16,07,07,07,16,16,16,16,16,16,07,07,07,16,00
630 DATA 00,00,16,07,07,07,07,07,07,07,07,07,07,16,00,00
640 DATA 00,00,00,16,16,07,07,07,07,07,07,16,16,00,00,00
650 DATA 00,00,00,00,00,16,16,16,16,16,16,00,00,00,00,00
670 GOTO 190

Edit: As an experiment, I'm going to try a copy-paste and see if something works...

Quote

10 REM 'ADDRESS 12:5

20 VPOKE $1,$FC00,0

30 REM 'ADDRESS 16:13 (STARTING AT $10000) AND 8 BPP MODE

40 VPOKE $1,$FC01,$88

50 REM 'X COORDINATE 7:0

60 VPOKE $1,$FC02,220

70 REM 'X COORDINATE 9:8

80 VPOKE $1,$FC03,0

90 REM 'Y COORDINATE 7:0

100 VPOKE $1,$FC04,55

110 REM 'Y COORDINATE 9:8

120 VPOKE $1,$FC05,0

130 REM 'Z-DEPTH: IN FRONT OF LAYER 2

140 VPOKE $1,$FC06,$0C

150 REM '16 PIXELS FOR WIDTH AND HEIGHT

160 VPOKE $1,$FC07,$50

170 REM 'COPY SMILEY SPRITE DATA TO VIDEO RAM

180 GOTO 500

180 FOR I=0 TO 255

190 READ A

200 VPOKE 1,I,A

210 NEXT I

220 REM 'ENABLE SPRITES

230 POKE $9F29,PEEK($9F29)OR$40

240 END

 

500 DATA 00,00,00,00,00,16,16,16,16,16,16,00,00,00,00,00

510 DATA 00,00,00,16,16,07,07,07,07,07,07,16,16,00,00,00

520 DATA 00,00,16,07,07,07,07,07,07,07,07,07,07,16,00,00

530 DATA 00,16,07,07,07,07,07,07,07,07,07,07,07,07,16,00

540 DATA 00,16,07,07,07,16,07,07,07,07,16,07,07,07,16,00

550 DATA 16,07,07,07,07,16,07,07,07,07,16,07,07,07,07,16

560 DATA 16,07,07,07,07,16,07,07,07,07,16,07,07,07,07,16

570 DATA 16,07,07,07,07,07,07,07,07,07,07,07,07,07,07,16

580 DATA 16,07,07,07,07,07,07,07,07,07,07,07,07,07,07,16

590 DATA 16,07,07,07,07,07,07,07,07,07,07,07,07,07,07,16

600 DATA 16,07,07,16,07,07,07,07,07,07,07,07,16,07,07,16

610 DATA 00,16,07,07,16,07,07,07,07,07,07,16,07,07,16,00

620 DATA 00,16,07,07,07,16,16,16,16,16,16,07,07,07,16,00

630 DATA 00,00,16,07,07,07,07,07,07,07,07,07,07,16,00,00

640 DATA 00,00,00,16,16,07,07,07,07,07,07,16,16,00,00,00

650 DATA 00,00,00,00,00,16,16,16,16,16,16,00,00,00,00,00

670 GOTO 190

Edit: It did! Huzzah, I think I know how I'm going to sneak preformatted, colorized code into comments in the future. 😛

Edited by StephenHorn
  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites
  • 0

Thank you both for your answers, and the updated example.  

Share this post


Link to post
Share on other sites
  • 0

Nice! I had given up on those tutorials. During that experiment, I also discovered the files resulting from a SAVE aren't just plain text BASIC and it took me way too long to figure out why the emulator would just freeze when I LOADed them. Why aren't they just plain text?

Share this post


Link to post
Share on other sites
  • 0
36 minutes ago, jtk said:

Nice! I had given up on those tutorials. During that experiment, I also discovered the files resulting from a SAVE aren't just plain text BASIC and it took me way too long to figure out why the emulator would just freeze when I LOADed them. Why aren't they just plain text?

It's because you're saving the program data, not the raw text on the display. The program data is bytecode. The raw text on the display isn't really meaningful to anything under the hood, especially with long programs that take up more than one screen's worth of lines.

Someone could potentially write a plaintext exporter, but the LOAD and SAVE commands in BASIC don't actually export the data, instead they're literally just saving a snapshot of a portion of memory. And, for that matter, the kernal's own load and save routines are all about snapshots, as well. And they're not even implemented yet (as far as I know, and certainly not in r37), the emulator itself is just looking for the attempt to call into the kernal routine, then performing the byte copy itself into a file on the host OS.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

Please review our Terms of Use