347 lines
		
	
	
		
			9.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			347 lines
		
	
	
		
			9.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| TheStar:
 | |
|   db 10, "THE STAR  "
 | |
|   db 10, "          "
 | |
|   db 10, "          "
 | |
|   db 10, "hope      "
 | |
|   db 10, "healing   "
 | |
|   db 10, "purpose   "
 | |
|   
 | |
|   db 10, "THE STAR  "
 | |
|   db 10, "(reversed)"
 | |
|   db 10, "          "
 | |
|   db 10, "hopeless  "
 | |
|   db 10, "monotony  "
 | |
|   db 10, "despair   "
 | |
|   
 | |
|   dw .BackgroundCopyEnd - .BackgroundCopy
 | |
|   dw .BackgroundCopy
 | |
|   dw .KeyArtTilesEnd - .KeyArtTiles
 | |
|   dw .KeyArtTiles
 | |
|   dw .SpriteTilesEnd - .SpriteTiles
 | |
|   dw .SpriteTiles
 | |
|   dw .fInit
 | |
|   dw .fUpdate
 | |
|   dw .fDraw
 | |
|   dw .fPrintPrep
 | |
|   
 | |
| .fInit: 
 | |
|   ld hl, CVS
 | |
|   ld a, 0 
 | |
|   ld [hl+], a ; CVS timer for star flicker
 | |
|   ld [hl+], a 
 | |
|   ld [hl+], a ; CVS+2 frame of star flicker
 | |
|   ld [hl+], a ; CVS+3 timer for lil stars
 | |
|   ld [hl+], a 
 | |
|   ld [hl+], a ; CVS+5 frame of lill stars
 | |
|   
 | |
|   ; star flare is first 20 OAM sprites
 | |
|   ld hl, MY_OAM+20*4
 | |
|   ld b, 21
 | |
| .paletteLoop
 | |
|   inc hl ; now poining at x
 | |
|   inc hl ; now pointing at tile id
 | |
|   inc hl ; now pointing at attributes
 | |
|   set OAMB_PAL1, [hl]
 | |
|   set 0, [hl]
 | |
|   inc hl ; now pointing at y for next sprite
 | |
|   dec b
 | |
|   jp nz, .paletteLoop
 | |
|   
 | |
|   ld a, %00_01_10_00
 | |
|   ld [rOBP0], a 
 | |
|   call AdjustOBP0
 | |
|   ld a, %10_01_00_00
 | |
|   ld [rOBP1], a
 | |
|   call AdjustOBP1
 | |
|   
 | |
|   ld hl, .starflare
 | |
|   ld de, MY_OAM
 | |
|   ld b, (2+1)*8
 | |
|   ld c, (1+1+2)*8
 | |
|   ld a, $54
 | |
|   call BuildMetaSprite
 | |
|   
 | |
|   ld hl, MY_OAM + 20*4
 | |
|   ld [hl], (2+1)*8 + 34
 | |
|   inc hl 
 | |
|   ld [hl], (1+1)*8 + 20
 | |
|   inc hl 
 | |
|   ld [hl], 1
 | |
|   
 | |
|   ld hl, MY_OAM + 20*4 + 1*4
 | |
|   ld [hl], (2+1)*8 + 48
 | |
|   inc hl 
 | |
|   ld [hl], (1+1)*8 + 14
 | |
|   inc hl 
 | |
|   ld [hl], 1
 | |
|   
 | |
|   ld hl, MY_OAM + 20*4 + 2*4
 | |
|   ld [hl], (2+1)*8 + 60
 | |
|   inc hl 
 | |
|   ld [hl], (1+1)*8 + 22
 | |
|   inc hl 
 | |
|   ld [hl], 1
 | |
|   
 | |
|   ld hl, MY_OAM + 20*4 + 3*4
 | |
|   ld [hl], (2+1)*8 + 78
 | |
|   inc hl 
 | |
|   ld [hl], (1+1)*8 + 45
 | |
|   inc hl 
 | |
|   ld [hl], 1
 | |
|   
 | |
|   ld hl, MY_OAM + 20*4 + 4*4
 | |
|   ld [hl], (2+1)*8 + 86
 | |
|   inc hl 
 | |
|   ld [hl], (1+1)*8 + 34
 | |
|   inc hl 
 | |
|   ld [hl], 1
 | |
|   
 | |
|   ld hl, MY_OAM + 20*4 + 5*4
 | |
|   ld [hl], (2+1)*8 + 77
 | |
|   inc hl 
 | |
|   ld [hl], (1+1)*8 + 18
 | |
|   inc hl 
 | |
|   ld [hl], 1
 | |
|   
 | |
|   ld hl, MY_OAM + 20*4 + 6*4
 | |
|   ld [hl], (2+1)*8 + 45
 | |
|   inc hl 
 | |
|   ld [hl], (1+1)*8 + 37
 | |
|   inc hl 
 | |
|   ld [hl], 2
 | |
| 
 | |
|   ld hl, MY_OAM + 20*4 + 7*4
 | |
|   ld [hl], (2+1)*8 + 20
 | |
|   inc hl 
 | |
|   ld [hl], (1+1)*8 + 51
 | |
|   inc hl 
 | |
|   ld [hl], 2
 | |
|   
 | |
|   ld hl, MY_OAM + 20*4 + 8*4
 | |
|   ld [hl], (2+1)*8 + 3
 | |
|   inc hl 
 | |
|   ld [hl], (1+1)*8 + 4
 | |
|   inc hl 
 | |
|   ld [hl], 2
 | |
|   
 | |
|   ld hl, MY_OAM + 20*4 + 9*4
 | |
|   ld [hl], (2+1)*8 + 34
 | |
|   inc hl 
 | |
|   ld [hl], (1+1)*8 + 7
 | |
|   inc hl 
 | |
|   ld [hl], 2
 | |
|   
 | |
|   ld hl, MY_OAM + 20*4 + 10*4
 | |
|   ld [hl], (2+1)*8 + 66
 | |
|   inc hl 
 | |
|   ld [hl], (1+1)*8 + 50
 | |
|   inc hl 
 | |
|   ld [hl], 2
 | |
|   
 | |
|   ld hl, MY_OAM + 20*4 + 11*4
 | |
|   ld [hl], (2+1)*8 + 70
 | |
|   inc hl 
 | |
|   ld [hl], (1+1)*8 + 5
 | |
|   inc hl 
 | |
|   ld [hl], 2
 | |
|   
 | |
|   ret
 | |
| .fUpdate: 
 | |
|   ld hl, CVS
 | |
|   call IncrementTimer
 | |
|   
 | |
|   ld a, [CVS+1] ; checking the high byte of the timer
 | |
|   cp a, $04 ; $10 = 1 second, $02 = 1/8 of a second
 | |
|   jp c, :+ 
 | |
|   
 | |
|   ld a, 0 
 | |
|   ld [CVS], a 
 | |
|   ld [CVS+1], a 
 | |
|   
 | |
|   ld b, 4
 | |
|   ld a, [CVS+2]
 | |
|   inc a 
 | |
|   call ArrayClampLoopingB
 | |
|   ld [CVS+2], a 
 | |
| :
 | |
| 
 | |
|   ld hl, CVS+3
 | |
|   call IncrementTimer
 | |
|   
 | |
|   ld a, [CVS+3+1] ; checking the high byte of the timer
 | |
|   cp a, $05 ; $10 = 1 second, $02 = 1/8 of a second
 | |
|   jp c, :+ 
 | |
|   
 | |
|   ld a, 0 
 | |
|   ld [CVS+3], a 
 | |
|   ld [CVS+3+1], a 
 | |
|   
 | |
|   ld hl, MY_OAM + 20*4
 | |
|   call .flicker
 | |
|   ld hl, MY_OAM + 20*4 + 1*4
 | |
|   call .flicker
 | |
|   ld hl, MY_OAM + 20*4 + 2*4
 | |
|   call .flicker
 | |
|   ld hl, MY_OAM + 20*4 + 3*4
 | |
|   call .flicker
 | |
|   ld hl, MY_OAM + 20*4 + 4*4
 | |
|   call .flicker
 | |
|   ld hl, MY_OAM + 20*4 + 5*4
 | |
|   call .flicker
 | |
| 
 | |
|   
 | |
|   ld b, 12
 | |
|   ld a, [CVS+5]
 | |
|   inc a 
 | |
|   call ArrayClampLoopingB
 | |
|   ld [CVS+5], a 
 | |
| :
 | |
|   ret
 | |
|   
 | |
| .flicker:
 | |
|   inc hl
 | |
|   inc hl 
 | |
|   bit 1, [hl]
 | |
|   jp z, :+
 | |
|   dec [hl]
 | |
|   ret
 | |
| :
 | |
|   inc [hl]
 | |
|   ret
 | |
| .fDraw: 
 | |
|   ld a, [CVS+2]
 | |
|   cp a, 0
 | |
|   jp z, .frame0
 | |
|   cp a, 1 
 | |
|   jp z, .frame1
 | |
|   cp a, 2
 | |
|   jp z, .frame2
 | |
|   cp a, 3
 | |
|   jp z, .frame3
 | |
| 
 | |
| .frame0
 | |
|   ld a, %00_00_00_00
 | |
|   ld [rOBP0], a
 | |
|   call AdjustOBP0
 | |
|   ret
 | |
| .frame1
 | |
|   ld a, %00_00_01_00
 | |
|   ld [rOBP0], a
 | |
|   call AdjustOBP0
 | |
|   ret
 | |
| .frame2
 | |
|   ld a, %00_01_10_00
 | |
|   ld [rOBP0], a
 | |
|   call AdjustOBP0
 | |
|   ret
 | |
| .frame3
 | |
|   ld a, %00_00_01_00
 | |
|   ld [rOBP0], a 
 | |
|   call AdjustOBP0
 | |
|   ret
 | |
| 
 | |
| .fPrintPrep: ret
 | |
| 
 | |
| .starflare
 | |
|   db $09, $0a, $0b, $0c
 | |
| 	db $07, $08, $0d, $04
 | |
| 	db $05, $06, $0e, $0f
 | |
| 	db $00, $13, $10, $00
 | |
| 	db $00, $12, $11, $00
 | |
| 	
 | |
| .SpriteTiles:
 | |
|   db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 | |
| 	db $00,$20,$00,$50,$20,$88,$00,$50,$00,$20,$00,$00,$00,$00,$00,$00
 | |
| 	db $00,$00,$00,$20,$20,$50,$00,$20,$00,$00,$00,$00,$00,$00,$00,$00
 | |
| 	db $00,$00,$00,$00,$20,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 | |
| 	db $00,$00,$00,$00,$00,$00,$f0,$00,$0c,$f0,$f0,$00,$00,$00,$00,$00
 | |
| 	db $00,$00,$00,$00,$01,$00,$01,$00,$03,$00,$03,$00,$07,$00,$00,$00
 | |
| 	db $80,$7e,$80,$7f,$80,$7f,$3a,$c1,$62,$81,$c2,$01,$82,$01,$02,$01
 | |
| 	db $00,$00,$00,$00,$01,$00,$0f,$00,$38,$07,$0f,$00,$01,$00,$00,$00
 | |
| 	db $80,$7f,$00,$fe,$00,$f8,$00,$f0,$00,$f0,$00,$f0,$80,$70,$00,$78
 | |
| 	db $00,$00,$00,$00,$00,$00,$06,$00,$03,$00,$03,$00,$01,$00,$01,$00
 | |
| 	db $01,$00,$01,$00,$01,$00,$03,$00,$c2,$01,$62,$81,$32,$c1,$98,$67
 | |
| 	db $80,$00,$80,$00,$80,$00,$80,$00,$c3,$00,$4f,$80,$59,$86,$23,$dc
 | |
| 	db $00,$00,$00,$00,$00,$00,$c0,$00,$80,$00,$80,$00,$00,$00,$00,$00
 | |
| 	db $02,$fc,$00,$7e,$01,$1e,$01,$0e,$00,$0f,$01,$0e,$03,$0c,$00,$1c
 | |
| 	db $04,$78,$06,$f8,$02,$fc,$03,$fc,$59,$86,$4d,$82,$47,$80,$41,$80
 | |
| 	db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$80,$00,$80,$00,$c0,$00
 | |
| 	db $40,$80,$40,$80,$40,$80,$40,$80,$40,$80,$c0,$00,$80,$00,$80,$00
 | |
| 	db $80,$00,$80,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 | |
| 	db $01,$00,$01,$00,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 | |
| 	db $02,$01,$02,$01,$02,$01,$02,$01,$03,$00,$01,$00,$01,$00,$01,$00
 | |
| .SpriteTilesEnd:
 | |
| ; original export script by gabriel reis, modified by shoofle
 | |
|  
 | |
|  
 | |
| .KeyArtTiles:
 | |
| 	db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 | |
| 	db $00,$ff,$22,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$3f,$ff,$07,$ff,$00,$ff
 | |
| 	db $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff
 | |
| 	db $7f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$77,$ff,$ff,$ff,$fd,$ff,$ff,$ff
 | |
| 	db $77,$ff,$ff,$ff,$dd,$ff,$ff,$ff,$77,$ff,$ff,$ff,$dd,$ff,$ff,$ff
 | |
| 	db $55,$ff,$ff,$ff,$5d,$ff,$ff,$ff,$55,$ff,$ff,$ff,$d5,$ff,$ff,$ff
 | |
| 	db $55,$ff,$bf,$ff,$55,$ff,$ff,$ff,$55,$ff,$fb,$ff,$55,$ff,$ff,$ff
 | |
| 	db $55,$ff,$bb,$ff,$55,$ff,$ee,$ff,$55,$ff,$bb,$ff,$55,$ff,$ee,$ff
 | |
| 	db $55,$ff,$ab,$ff,$55,$ff,$ee,$ff,$55,$ff,$aa,$ff,$55,$ff,$ea,$ff
 | |
| 	db $55,$ff,$aa,$ff,$55,$ff,$aa,$ff,$55,$ff,$aa,$ff,$55,$ff,$aa,$ff
 | |
| 	db $11,$ff,$aa,$ff,$55,$ff,$aa,$ff,$11,$ff,$aa,$ff,$54,$ff,$aa,$ff
 | |
| 	db $11,$ff,$aa,$ff,$44,$ff,$aa,$ff,$10,$ff,$aa,$ff,$44,$ff,$aa,$ff
 | |
| 	db $00,$ff,$aa,$ff,$04,$ff,$aa,$ff,$00,$ff,$aa,$ff,$00,$ff,$aa,$ff
 | |
| 	db $00,$ff,$2a,$ff,$00,$ff,$aa,$ff,$00,$ff,$22,$ff,$00,$ff,$aa,$ff
 | |
| 	db $00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff
 | |
| 	db $7f,$7f,$7f,$7f,$7f,$7f,$7f,$7f,$3c,$3c,$30,$30,$20,$20,$00,$00
 | |
| 	db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$80,$80
 | |
| 	db $01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$03,$03
 | |
| 	db $77,$ff,$ff,$ff,$dc,$fe,$fe,$fe,$74,$fc,$fc,$fc,$d8,$f8,$ff,$ff
 | |
| 	db $00,$00,$00,$00,$00,$00,$04,$04,$14,$1c,$3c,$3c,$5c,$7c,$fc,$fc
 | |
| 	db $ff,$ff,$ff,$ff,$ff,$ff,$f9,$f9,$fc,$fc,$fc,$fc,$fe,$fe,$fe,$fe
 | |
| 	db $fe,$fe,$fe,$fe,$fe,$fe,$fc,$fc,$3c,$3c,$1c,$1c,$0c,$0c,$00,$00
 | |
| 	db $03,$03,$01,$01,$01,$01,$00,$00,$20,$20,$30,$30,$18,$38,$3e,$3e
 | |
| 	db $77,$ff,$ff,$ff,$dd,$ff,$ff,$ff,$77,$ff,$7f,$7f,$5d,$7f,$3f,$3f
 | |
| 	db $7f,$ff,$ff,$ff,$fe,$fe,$f0,$f0,$40,$c0,$f0,$f0,$fe,$fe,$ff,$ff
 | |
| 	db $7f,$ff,$ff,$ff,$ff,$ff,$0f,$0f,$03,$03,$0f,$0f,$fd,$ff,$ff,$ff
 | |
| 	db $54,$fc,$fc,$fc,$5c,$fc,$fc,$fc,$54,$fc,$fe,$fe,$d4,$fe,$fe,$fe
 | |
| 	db $15,$3f,$3f,$3f,$1d,$3f,$3f,$3f,$15,$3f,$3f,$3f,$55,$7f,$7f,$7f
 | |
| 	db $55,$7f,$3f,$7f,$55,$ff,$ff,$ff,$55,$ff,$fb,$ff,$55,$ff,$ff,$ff
 | |
| 	db $00,$ff,$23,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$fe,$ff,$e0,$ff,$00,$ff
 | |
| 	db $3f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff
 | |
| 	db $fc,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff
 | |
| 	db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01,$01,$03,$03,$00,$03
 | |
| 	db $00,$03,$00,$03,$00,$03,$00,$03,$00,$03,$00,$03,$00,$03,$00,$03
 | |
| 	db $00,$03,$00,$03,$00,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 | |
| 	db $00,$ff,$00,$f0,$02,$f9,$00,$f9,$04,$f9,$00,$fc,$02,$fc,$00,$fe
 | |
| 	db $00,$ff,$00,$0f,$40,$9f,$40,$9f,$40,$9f,$40,$9f,$40,$9f,$40,$9f
 | |
| 	db $01,$fe,$02,$fc,$00,$fc,$04,$f9,$00,$f9,$02,$f9,$00,$f0,$00,$ff
 | |
| 	db $54,$fe,$be,$fe,$54,$fe,$ff,$ff,$55,$ff,$fb,$ff,$55,$ff,$ff,$ff
 | |
| 	db $ff,$ff,$ff,$ff,$ff,$ff,$3f,$3f,$7f,$7f,$7f,$7f,$ff,$ff,$ff,$ff
 | |
| 	db $00,$ff,$00,$00,$12,$e4,$02,$e4,$0a,$e4,$0a,$e4,$02,$cc,$12,$cc
 | |
| 	db $12,$cc,$02,$dc,$02,$1c,$22,$1c,$02,$3c,$02,$3c,$00,$00,$00,$ff
 | |
| 	db $40,$9f,$40,$9f,$40,$9f,$40,$9f,$40,$9f,$40,$9f,$00,$0f,$00,$ff
 | |
| 	db $00,$00,$00,$00,$00,$00,$00,$00,$80,$80,$80,$80,$e0,$e0,$00,$00
 | |
| 	db $00,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$00,$ff,$00,$ff,$00,$ff
 | |
| 	db $00,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$80,$ff,$00,$ff,$00,$ff,$00,$ff
 | |
| 	db $00,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$07,$ff,$00,$ff,$00,$ff,$00,$ff
 | |
| 	db $00,$ff,$00,$00,$22,$c9,$00,$c9,$14,$c9,$04,$99,$20,$9c,$42,$3c
 | |
| 	db $02,$3c,$a0,$1e,$00,$9e,$11,$ce,$00,$cf,$20,$cf,$00,$00,$00,$ff
 | |
| .KeyArtTilesEnd:
 | |
| 
 | |
| .BackgroundCopy: ; tiles start at 26
 | |
| 	db $1c, $1c, $2e, $2f, $29, $41, $1c, $1c
 | |
| 	db $1d, $1d, $32, $2a, $2b, $33, $1d, $1d
 | |
| 	db $1e, $1e, $2c, $2d, $30, $31, $1e, $1e
 | |
| 	db $1f, $1f, $1f, $34, $35, $1f, $1f, $1f
 | |
| 	db $20, $20, $20, $40, $36, $20, $20, $20
 | |
| 	db $21, $21, $21, $21, $21, $21, $21, $21
 | |
| 	db $22, $22, $22, $22, $22, $22, $22, $22
 | |
| 	db $23, $23, $23, $23, $23, $23, $23, $23
 | |
| 	db $24, $24, $24, $24, $24, $24, $24, $24
 | |
| 	db $25, $25, $25, $25, $25, $25, $25, $25
 | |
| 	db $26, $26, $26, $26, $26, $26, $26, $26
 | |
| 	db $27, $27, $27, $27, $27, $27, $27, $27
 | |
| 	db $37, $46, $47, $38, $39, $48, $46, $1b
 | |
| 	db $28, $28, $28, $28, $28, $28, $28, $28
 | |
| 	db $28, $28, $3d, $49, $42, $3e, $28, $28
 | |
| 	db $28, $28, $3f, $4a, $43, $44, $28, $28
 | |
| .BackgroundCopyEnd:
 |