Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Sonic 2 example
- ; object load time ~62 cycles
- Obj_WeirdPlatform:
- moveq #0,d0 ; 4 cycles
- move.b $24(a0),d0 ; routine counter ; 12 cycles
- move.w Obj_WP_Index(pc,d0.w),d1; get offset ; 14 cycles
- jmp Obj_WP_Index(pc,d1.w) ; jump to routine ; 14 cycles
- Obj_WP_Index:
- dc.w Obj_WP_Init-Obj_WP_Index ; 0
- dc.w Obj_WP_Type0-Obj_WP_Index ; 2
- dc.w Obj_WP_Type1-Obj_WP_Index ; 4
- Obj_WP_Init:
- ori.b #4,1(a0) ; render on playfield ; 24 cycles
- move.w #$1234,2(a0) ; set art_tile ; 16 cycles
- move.l #Obj_WP_Map,4(a0) ; set mappings ; 24 cycles
- move.b #1,$18(a0) ; set priority ; 16 cycles
- move.b #$20,$19(a0) ; set width ; 16 cycles
- move.b $28(a0),d0 ; get subtype to d0 ; 12 cycles
- lsl.b #1,d0 ; double it ; 8 cycles
- addq.w #2,d0 ; skip over index ; 4 cycles
- move.b d0,$24(a0) ; save routine counter ; 12 cycles
- rts ; 16 cycles
- ; time to reach this routine on second frame: 62 + 44 = 106 cycles
- ; path to get to here: obj loading routine -> Obj_WeirdPlatform -> Obj_WP_Type0
- Obj_WP_Type0:
- ...
- Obj_WP_Type1:
- ...
- ; Sonic & Knuckles example
- ; object load time ~40 cycles
- Obj_WeirdPlatform:
- ;Obj_WP_Init
- ori.b #4,4(a0) ; render on playfield ; 24 cycles
- move.w #$1234,$A(a0) ; set art_tile ; 16 cycles
- move.l #Obj_WP_Map,$C(a0) ; set mappings ; 24 cycles
- move.w #$80,$08(a0) ; set priority ; 16 cycles
- move.b #$20,$1F(a0) ; set width ; 16 cycles
- move.b $28(a0),d0 ; get subtype to d0 ; 12 cycles
- lsl.b #2,d0 ; quadruple it ; 10 cycles
- move.l Obj_WP_Index(pc,d0.w),(a0); set new obj address ; 26 cycles
- rts ; 16 cycles
- Obj_WP_Index:
- dc.l Obj_WP_Type0
- dc.l Obj_WP_Type1
- ; time to reach this routine on second frame: 40 cycles
- ; path to get to here: obj loading routine -> Obj_WP_Type0
- Obj_WP_Type0:
- ...
- Obj_WP_Type1:
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement