Jump to content

Data Structure for Sprite scripts and tiles


bruddog

Recommended Posts

This is for sprites only and not backgrounds and the overall screen scripts. 

 

0X00-0X7F = FRAMES TO WAIT/ OR CONTINUE SCROLLING TIMES 2. 

 

0X80-0X9F = SET DATA ADDR FOR SPR TILES +0x20 to high byte Example 0x8444 = 0x84+0x20= A4 = sets sprite TILE DATA address = 0xA444

 

0XA0-0XBF = JUMP TO NEW SPRITE  SCRIPT ADDRESS                 Example 0xA444 = sets sprite SCRIPT DATA address = 0xA444

 

0XC0-0XDF = DO SPRITE  SCRIPT AT ADDRESS AND RETURN  -0X20 to high byte      Example 0xD444 = sets sprite SCRIPT DATA address = 0xB444

 

0XE0-0XEF = WAIT # FRAMES ( 0 TO 15)   Example 0xE4= wait 4 frames

 

0XF0 SET SPR PAL AND SET TO FULLY FADED IN(SPR PAL INDEX)

Example F0 05 = Load sprite pallete set #5 to sprite pallete

0XF1 SET SPRITE OFFSCREEN THRESHOLDS(0=TOP 1=BOT, THRESHOLD)

Example F1 00 80= Sets top of screen threshold to the middle of the screen (useful for vertically scrolling sprites to make them "appear" from behind something)

 Example F1 01 80= Sets bottom of screen threshold to the middle of the screen  

0XF2 START SCROLLING

0XF3 SET SPRITE PRIORITY =  BEHIND BACKGROUND

0XF4 SET SPRITE SIZE = 8X8

0XF5 SET SPRITE SIZE = 8X16

Sets the tile size to two tiles. 

0XF6 SET SPRITE CHR BANKS (1000 BNK, 1400 BNK, 1800 BNK, 1C00 BNK)

Example F6 00 01 02 03. This would set the sprite character banks to be used to the first 4 chr banks in the CHR section of the rom. 

0XF7 WAIT OR CONTINUE SCROLLING 1 FRAME

Same function as 00-7f but its only 1 frame

0XF8 SET SPR START LOCATION(Y/2,X/2)

Example F8 40,40. The arguments or the y and x location divided by 2. This would start our sprite in the middle of the screen. Values 80 or greater will set the sprite

offscreen used for scrolling things in. 

0XF9 SWITCH CURRENT PLAYER CUTSCENE SIDE

0XFA SAVE CURRENT CUTSCENE SIDE IN RAM

0XFB SET SCROLL SPEEDS( DATA = Y SPEED/16, X SPEED/16, Y INC, X INC)

Example FB 01,08,00,00 This would set the sprite scroll speeds to 1/16 pixel per frame down in the Y direction and, 1 pixels per frame in the x direction 

0XFC SET SPRITE PAL INDEX (DATA =PAL INDEX) 

USELESS COMMAND The large helmets use this command but it does nothing. the 0xF0 command does what this was supposed to do. And for the large helmets

the sprite palletes end up getting set elsewhere

0XFD SET SCROLLING = TRUE AND FLIP SCROLL DIRECTION

0XFE RETURN FROM ROUTINE

0xFF END OF SPRITE DRAW

 

SCRIPT EXAMPLE TAKEN FROM ROM: 

L_9_A565:                                                 ; 0x2B KICKING CHEERLEADER STARTING FAR LEFT

      .DB $F6,$64,$65,$52,$00                   ; SET SPRITE CHR BANKS (CHR 1000, CHR 1400, CHR 1800, CHR 1C00)

      .DB $FC,$33                                       ; SET SPRITE PALLETE INDEX  TO: 51

      .DB $F8,$22,$1E                                ; SET SPRITE STARTING LOCATION= Y: 68, X: 60                                              

      .DB $FB,$00,$02,$00,$00                  ; SET SCROLL SPEED Y PIXELS/FRM: 0, X PIXELS/FRM: 0.125, Y SPEED INC/FRM: 0 , XSPEED INC/FRM: 0

      .DB $F5                                              ; SET SPRITE SIZE = 8X16

L_9_A575:                                               ; CHEERLEADER LEG KICK SCROLL LOOP      

  .DB $98,$A0                                           ; SET SPRITE DATA ADDR = b8a0

      .DB $02                                              ; SCROLL OR WAIT FOR: 4 FRAMES

      .DB $98,$92                                       ; SET SPRITE DATA ADDR = b892

      .DB $02                                              ; SCROLL OR WAIT FOR: 4 FRAMES

      .DB $98,$8A                                      ; SET SPRITE DATA ADDR = b88a

      .DB $0A                                             ; SCROLL OR WAIT FOR: 20 FRAMES

      .DB $98,$92                                      ; SET SPRITE DATA ADDR = b892

      .DB $02                                             ; SCROLL OR WAIT FOR: 4 FRAMES

      .DB $98,$A0                                      ; SET SPRITE DATA ADDR = b8a0

      .DB $02                                             ; SCROLL OR WAIT FOR: 4 FRAMES

      .DB $98,$BF                                     ; SET SPRITE DATA ADDR = b8bf

      .DB $02                                            ; SCROLL OR WAIT FOR: 4 FRAMES

      .DB $98,$D7                                     ; SET SPRITE DATA ADDR = b8d7

      .DB $02                                            ; SCROLL OR WAIT FOR: 4 FRAMES

      .DB $98,$82                                     ; SET SPRITE DATA ADDR = b882

      .DB $0A                                            ; SCROLL OR WAIT FOR: 20 FRAMES

      .DB $98,$D7                                    ; SET SPRITE DATA ADDR = b8d7

      .DB $02                                            ; SCROLL OR WAIT FOR: 4 FRAMES

      .DB $98,$BF                                    ; SET SPRITE DATA ADDR = b8bf

      .DB $02                                           ; SCROLL OR WAIT FOR: 4 FRAMES

      .DB $A5,$75                                    ;  JUMP TO NEW ADDR: a575 = CHEERLEADER LEG KICK SCROOL LOOP 

 

 

 

 

Link to comment
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
Reply to this topic...

×   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.

×
×
  • Create New...