UDG in Assembly
How do you create User Definable Graphic and move it around the screen? In C64 its as easy as:
Sincerely,
ZXogger
SPRITEENABLE = $d015 SPRITEPOINTER = $07f8 =* 2000 Sprite !byte $00, $0f, $ff ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 !byte $00, $00, $00 ; 000000000000000000000000 *= 3000 ; enabling it (1= sprite 0, 3 = sprite 0, 1, 7 = sprite 0, 1, 2 etc) lda #$07 sta SPRITEENABLE ; turn on sprites 0 and 1 ; then pointing to it lda #(Sprite/$40) sta SPRITEPOINTER ; set sprite pointer for sprite 0 ; setting it's color SPRITE0COLOR = $d027 ; and then setting it's position using the registers SPRITE0X = $d000 SPRITE0Y = $d001Is it as easy as this or harder? Any assistance would be greatly appreciated.
Sincerely,
ZXogger
Post edited by Zxogger on
Comments
So, while creating a sprite from bit patterns isn't particularly difficult (quite similar to how you do it above actually), moving the sprites around is a bit more complicated because of the way the speccy's display is arranged.
You could look around in the development section of this forum to see various threads on the very same topic. Or you could have a look at some of the tutorials in the Chuntey blog (see my sig) regarding sprite handling. There are also *tons* of books in the archive that you can download and refer to at your leisure on the subject.
This forums is of course always at your disposal in case you need any specific tips and help in this regard. :)
Bytes:Chuntey - Spectrum tech blog.
Some simplest "sprite"
It will copy from the ROM graphics making the "P" letter but you can point to any other graphics.
All sprite drawing in Spectrum is copying data to screen memory. There is not any other way.
This example is sprite drawing at "equal" position - fitting it precisely into a grid 32x24, a bit similar to text mode. Drawing just anywhere is much harder and you'll have to learn the Spectrum screen organisation. It's not easy for beginner but don't give up and you'll eventually get it :)
Star Tip 7 (Sprite Moving), Raffaelle Cecco, Your Sinclair, Dec'87
Sprite Designer, Toni Baker, Your Spectrum, Dec'84
Sprite Designer, Chris Wood, Your Spectrum, Oct'85
Sprite Creator, Roger Allen, Sinclair Programs, Dec'84
Sprite Editor, Robert Newman, Your Computer, Jun'85
Sprite Designer, Dom Early, Your Sinclair, Apr'88
Sprite Editor, Simon Owen, Your Sinclair, Aug'88
Sprite Grabber, Steve Anderson, Your Sinclair, Nov'92
Well knowing Simon Owen's work that one might suit the OP, but really unless you want to write your own routine from scratch there's no good reason not to use Alvin's splib.