Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' ------------------------------------------------------------------------------
- ' - Sprite Test ----------------------------------------------------------------
- ' ------------------------------------------------------------------------------
- '
- '!sna "h:\test.snx" -a
- #incluDe <nextlib.bas>
- CONST sprX2=%01000
- CONST sprX4=%10000
- CONST sprX8=%11000
- CONST sprY2=%00100
- CONST sprY4=%00010
- CONST sprY8=%00110
- ' The following MACRO can be used to SCALE / ROT MIRROR by a CONST no good for vars
- ' #DEFINE SpriteScale(spr_spriteid,spr_scalefactor) \
- ' NextReg($34,spr_spriteid) \
- ' NextReg($39,spr_scalefactor)
- '
- ' #DEFINE SpriteRotate(spr_spriteid,rot_factor) \
- ' NextReg($34,spr_spriteid) \
- ' NextReg($37,rot_factor)
- SpriteTest()
- dim r as ubyte = 0
- DO
- ' zoom up
- FOR x = 0 to 3
- SpriteAtrrib(0,x<<1 BOR x<<3,r<<1 )
- Pause 5
- next x
- r=r+1
- ' unzoom
- FOR x = 0 to 3
- SpriteAtrrib(0,3-x<<1 BOR 3-x<<3,r<<1 )
- Pause 5
- next x
- r=r+1
- Loop
- Sub fastcall SpriteAtrrib(sprID as ubyte, sprScale as ubyte,rotFactor as ubyte)
- ' This routine sets scale, mirror and rotate, can also do palette oofset
- asm
- PROC
- LOCAL sprID, sprScale, rotFact
- exx
- ld (sprID),a ; store at sprID
- pop de
- pop af ; get second param in af
- ld (sprScale),a ; store at sprScale
- pop af ; get second param in af
- ld (rotFact),a ; store at sprScale
- DW $91ED ; Nextreg nn
- DB $34 ; select sprite
- sprID: DB 0 ;
- DW $91ED ; Nextreg nn
- DB $39 ; sprite attribute 4
- sprScale: DB 0
- DW $91ED ; Nextreg nn
- DB $37 ; sprite attribute 2
- rotFact: DB 0
- push de ; fix stack before leaving
- exx
- ENDP
- end asm
- end sub
- sub SpriteTest()
- border 6: paper 7: ink 0: cls
- print at 0,0;"Scale Test"
- ' Registers
- NextReg($7,$3) ' 0=3.5Mhz, 1=7Mhz, 2=14Mhz, 3=28 Mhz
- NextReg($15,%00111001) ' Sprite and Layer Setup: ClipSprites, S(U+L-5), Sprites not border
- ' Layer2
- ShowLayer2(1)
- ' Init Sprites
- InitSprites(1,@Sprites)
- ' Show Sprites Mirror and rotation
- ' X Y S P R XXYY
- UpdateSprite(40,56,0,0,0,sprX2)
- end sub
- Sprites:
- asm
- Sprite1:
- db $E3, $E3, $E3, $E3, $E3, $E3, $00, $FC, $FC, $00, $E3, $E3, $E3, $E3, $E3, $E3;
- db $E3, $E3, $E3, $E3, $E3, $00, $FC, $FC, $FC, $FC, $00, $E3, $E3, $E3, $E3, $E3;
- db $E3, $E3, $E3, $E3, $00, $FC, $FC, $FC, $FC, $FC, $FC, $00, $E3, $E3, $E3, $E3;
- db $E3, $E3, $E3, $00, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $00, $E3, $E3, $E3;
- db $E3, $E3, $00, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $00, $E3, $E3;
- db $E3, $00, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $00, $E3;
- db $00, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $FC, $00;
- db $6C, $6C, $6C, $6C, $6C, $6C, $6C, $6C, $6C, $6C, $6C, $6C, $6C, $6C, $6C, $6C;
- db $E3, $E3, $E3, $E3, $E3, $E3, $6C, $FC, $FC, $6C, $E3, $E3, $E3, $E3, $E3, $E3;
- db $E3, $E3, $E3, $E3, $E3, $E3, $6C, $FC, $FC, $6C, $E3, $E3, $E3, $E3, $E3, $E3;
- db $E3, $E3, $E3, $E3, $E3, $E3, $6C, $FC, $FC, $6C, $E3, $E3, $E3, $E3, $E3, $E3;
- db $E3, $E3, $E3, $E3, $E3, $E3, $6C, $FC, $FC, $6C, $E3, $E3, $E3, $E3, $E3, $E3;
- db $E3, $E3, $E3, $E3, $E3, $E3, $6C, $FC, $FC, $6C, $E3, $E3, $E3, $E3, $E3, $E3;
- db $E3, $E3, $E3, $E3, $E3, $E3, $6C, $FC, $FC, $6C, $E3, $E3, $E3, $E3, $E3, $E3;
- db $E3, $E3, $E3, $E3, $E3, $E3, $6C, $FC, $FC, $6C, $E3, $E3, $E3, $E3, $E3, $E3;
- db $E3, $E3, $E3, $E3, $E3, $E3, $6C, $6C, $6C, $6C, $E3, $E3, $E3, $E3, $E3, $E3;
- END asm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement