271 lines
		
	
	
		
			9.7 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			271 lines
		
	
	
		
			9.7 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| WheelOfFortune:
 | |
|   db 10, "WHEEL OF  "
 | |
|   db 10, "FORTUNE   "
 | |
|   db 10, "          "
 | |
|   db 10, "chance    "
 | |
|   db 10, "cycles    "
 | |
|   db 10, "destiny   "
 | |
|   
 | |
|   db 10, "WHEEL OF  "
 | |
|   db 10, "FORTUNE   "
 | |
|   db 10, "(reversed)"
 | |
|   db 10, "bad luck  "
 | |
|   db 10, "reluctant "
 | |
|   db 10, "resist    "
 | |
|   
 | |
|   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 numbers
 | |
|   ld [hl+], a 
 | |
|   ; drawing 12 characters total
 | |
|   ; top sprites
 | |
|   ld [hl+], a ; CVS+2 first character tile id 
 | |
|   ld [hl+], a ; CVS+3 second character
 | |
|   ; second row
 | |
|   ld [hl+], a ; CVS+4 third char
 | |
|   ld [hl+], a ; CVS+5 4th char
 | |
|   ld [hl+], a ; CVS+6
 | |
|   ld [hl+], a ; CVS+7
 | |
|   ; third row
 | |
|   ld [hl+], a ; CVS+8
 | |
|   ld [hl+], a ; CVS+9
 | |
|   ld [hl+], a ; CVS+10
 | |
|   ld [hl+], a ; CVS+11
 | |
|   ; final row 
 | |
|   ld [hl+], a ; CVS+12
 | |
|   ld [hl+], a ; CVS+13
 | |
|    
 | |
|   ; setting up the positioins of all the sprites now that w'ere drawing with
 | |
|   ; sprites and not background tiles
 | |
|   ld hl, .numbersBlockSprite
 | |
|   ld de, MY_OAM
 | |
|   ld b, 24 + 6*8
 | |
|   ld c, 16 + 2*8
 | |
|   ld a, $44
 | |
|   call BuildMetaSprite
 | |
|   ; location of source tile map: hl
 | |
|   ; location in memory to write to: de
 | |
|   ; y and x in b and c 
 | |
|   ; height and width in a & %11110000 and a & %00001111 ??? that's deranged
 | |
|   ret
 | |
| .numbersBlockSprite
 | |
|   db $90, $00, $00, $90
 | |
|   db $00, $00, $00, $00
 | |
|   db $00, $00, $00, $00
 | |
|   db $90, $00, $00, $90
 | |
|   
 | |
| .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, :+ ; if the timer is less than $0400, skip 
 | |
|     ; if the timer is greater or equal to $0400, reset it and update numbers
 | |
|     ld a, 0 
 | |
|     ld [CVS], a 
 | |
|     ld [CVS+1], a 
 | |
|     call .updateNumbers
 | |
|   :
 | |
|   ret
 | |
|   
 | |
| .updateNumbers:
 | |
|   call OneRandomByte
 | |
|   ld hl, rLFSR
 | |
|   ld de, CVS+2
 | |
|   call DrawByte
 | |
|   
 | |
|   call OneRandomByte
 | |
|   ld hl, rLFSR
 | |
|   ld de, CVS+4
 | |
|   call DrawByte
 | |
|   call OneRandomByte
 | |
|   ld hl, rLFSR
 | |
|   ld de, CVS+6
 | |
|   call DrawByte
 | |
|   
 | |
|   call OneRandomByte
 | |
|   ld hl, rLFSR
 | |
|   ld de, CVS+8
 | |
|   call DrawByte
 | |
|   call OneRandomByte
 | |
|   ld hl, rLFSR
 | |
|   ld de, CVS+10
 | |
|   call DrawByte
 | |
|   
 | |
|   call OneRandomByte
 | |
|   ld hl, rLFSR
 | |
|   ld de, CVS+12
 | |
|   call DrawByte
 | |
|   
 | |
|   ; draw those into sprites
 | |
|   ld a, [CVS+2]
 | |
|   ld hl, MY_OAM + 2 + 1*4
 | |
|   ld [hl], a 
 | |
|   ld a, [CVS+3]
 | |
|   ld hl, MY_OAM + 2 + 2*4
 | |
|   ld [hl], a 
 | |
|   
 | |
|   ld a, [CVS+4]
 | |
|   ld hl, MY_OAM + 2 + 4*4
 | |
|   ld [hl], a 
 | |
|   ld a, [CVS+5]
 | |
|   ld hl, MY_OAM + 2 + 5*4
 | |
|   ld [hl], a 
 | |
|   ld a, [CVS+6]
 | |
|   ld hl, MY_OAM + 2 + 6*4
 | |
|   ld [hl], a 
 | |
|   ld a, [CVS+7]
 | |
|   ld hl, MY_OAM + 2 + 7*4
 | |
|   ld [hl], a 
 | |
|   
 | |
|   ld a, [CVS+8]
 | |
|   ld hl, MY_OAM + 2 + 8*4
 | |
|   ld [hl], a 
 | |
|   ld a, [CVS+9]
 | |
|   ld hl, MY_OAM + 2 + 9*4
 | |
|   ld [hl], a 
 | |
|   ld a, [CVS+10]
 | |
|   ld hl, MY_OAM + 2 + 10*4
 | |
|   ld [hl], a 
 | |
|   ld a, [CVS+11]
 | |
|   ld hl, MY_OAM + 2 + 11*4
 | |
|   ld [hl], a 
 | |
|   
 | |
|   ld a, [CVS+12]
 | |
|   ld hl, MY_OAM + 2 + 13*4
 | |
|   ld [hl], a 
 | |
|   ld a, [CVS+13]
 | |
|   ld hl, MY_OAM + 2 + 14*4
 | |
|   ld [hl], a 
 | |
|   
 | |
|   ret
 | |
| .fDraw: ret 
 | |
| .fPrintPrep: ret
 | |
| 
 | |
| .SpriteTiles:
 | |
| 	db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$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 $aa,$00,$44,$00,$aa,$00,$11,$00,$aa,$00,$45,$00,$ab,$01,$13,$03
 | |
| 	db $aa,$00,$44,$00,$ab,$01,$0f,$0f,$bf,$3f,$fb,$fb,$c3,$c3,$83,$83
 | |
| 	db $80,$54,$18,$df,$ff,$ff,$e1,$e1,$01,$81,$00,$81,$00,$bf,$00,$f0
 | |
| 	db $aa,$01,$00,$ff,$f8,$fe,$80,$cc,$80,$f9,$00,$c7,$00,$1c,$01,$11
 | |
| 	db $0a,$20,$04,$20,$0a,$60,$30,$70,$3e,$fc,$df,$ff,$c3,$e3,$c1,$e1
 | |
| 	db $aa,$00,$44,$00,$aa,$00,$11,$00,$aa,$00,$45,$00,$aa,$80,$d1,$c0
 | |
| 	db $ae,$0e,$5c,$1c,$b8,$38,$78,$7c,$fc,$fe,$ce,$cf,$87,$87,$03,$03
 | |
| 	db $01,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$80,$80,$c0
 | |
| 	db $00,$c3,$01,$ff,$c1,$e1,$c1,$e1,$c1,$e1,$c0,$e0,$00,$00,$00,$00
 | |
| 	db $01,$e1,$81,$c1,$83,$c3,$83,$c3,$83,$c3,$03,$03,$00,$00,$00,$00
 | |
| 	db $80,$c0,$80,$c0,$80,$c0,$00,$80,$00,$80,$00,$80,$00,$00,$01,$01
 | |
| 	db $7a,$70,$3c,$38,$1e,$1c,$1f,$1e,$3f,$3f,$73,$7b,$e1,$f1,$c0,$e0
 | |
| 	db $af,$07,$56,$06,$ac,$0c,$5c,$0c,$bc,$1c,$58,$1f,$bf,$1f,$7f,$3f
 | |
| 	db $01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$e0,$e0,$fc
 | |
| 	db $c0,$e0,$e0,$f0,$70,$78,$30,$30,$00,$00,$00,$00,$00,$00,$00,$00
 | |
| 	db $03,$03,$07,$07,$0e,$0f,$0c,$0e,$00,$04,$00,$00,$00,$00,$00,$00
 | |
| 	db $80,$c0,$00,$80,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$07,$07
 | |
| 	db $ea,$e0,$75,$60,$3a,$30,$31,$30,$3a,$38,$1d,$18,$fa,$f8,$fd,$fc
 | |
| 	db $f1,$31,$70,$30,$b0,$30,$60,$60,$e0,$60,$60,$60,$e0,$7f,$7f,$7f
 | |
| 	db $fc,$fc,$3c,$3c,$00,$00,$00,$00,$00,$00,$00,$00,$00,$f8,$f8,$f8
 | |
| 	db $3f,$3f,$3c,$3f,$00,$3c,$00,$00,$00,$00,$00,$00,$00,$00,$1f,$1f
 | |
| 	db $8e,$fc,$0d,$8c,$0e,$0c,$07,$06,$06,$06,$07,$06,$06,$06,$ff,$fe
 | |
| 	db $ff,$7f,$60,$60,$e0,$60,$60,$60,$e0,$60,$70,$30,$b0,$31,$71,$3f
 | |
| 	db $f8,$f8,$00,$00,$00,$00,$00,$00,$00,$00,$00,$3c,$3c,$fc,$fc,$fc
 | |
| 	db $1f,$1f,$00,$1f,$00,$00,$00,$00,$00,$00,$00,$00,$3c,$3c,$3f,$3f
 | |
| 	db $fe,$fe,$07,$fe,$06,$06,$07,$06,$06,$06,$0d,$0c,$0f,$0c,$8d,$8c
 | |
| 	db $ff,$3f,$5f,$1f,$b8,$18,$5c,$1c,$fc,$0c,$5c,$0c,$be,$06,$57,$07
 | |
| 	db $e0,$e0,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01,$01,$03
 | |
| 	db $00,$00,$00,$00,$00,$00,$00,$20,$30,$70,$70,$f0,$e0,$e0,$c0,$c0
 | |
| 	db $00,$00,$00,$00,$00,$00,$00,$00,$0c,$0c,$0e,$1e,$07,$0f,$03,$07
 | |
| 	db $07,$3f,$00,$07,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$80,$80
 | |
| 	db $fe,$fc,$fd,$f8,$1b,$f8,$3d,$38,$3f,$30,$35,$30,$7b,$60,$f5,$e0
 | |
| 	db $ff,$03,$dd,$01,$ff,$00,$75,$00,$ff,$00,$dd,$00,$ff,$00,$37,$c0
 | |
| 	db $03,$07,$87,$8f,$ce,$de,$fc,$fc,$f8,$78,$78,$38,$fc,$1c,$5e,$0e
 | |
| 	db $80,$80,$00,$00,$00,$01,$00,$01,$00,$01,$01,$03,$01,$03,$01,$03
 | |
| 	db $00,$00,$00,$00,$c0,$c0,$c0,$c0,$c1,$c3,$c1,$c3,$81,$83,$81,$83
 | |
| 	db $00,$00,$00,$00,$03,$07,$03,$07,$83,$87,$83,$87,$81,$83,$81,$83
 | |
| 	db $01,$03,$00,$01,$00,$00,$00,$00,$00,$00,$80,$80,$80,$80,$80,$80
 | |
| 	db $c0,$c0,$e1,$e1,$73,$f3,$3f,$7f,$1f,$3e,$1d,$1c,$3f,$38,$75,$70
 | |
| 	db $ff,$c0,$dd,$80,$ff,$00,$75,$00,$ff,$00,$dd,$00,$fe,$01,$70,$07
 | |
| 	db $83,$87,$c3,$c7,$fb,$ff,$7f,$3f,$ff,$0f,$dd,$01,$ff,$00,$77,$00
 | |
| 	db $81,$83,$01,$03,$01,$03,$01,$03,$e1,$e3,$ff,$ff,$ff,$1f,$77,$00
 | |
| 	db $81,$83,$80,$81,$80,$81,$80,$81,$87,$87,$ff,$ff,$ff,$f8,$77,$00
 | |
| 	db $c1,$c1,$c3,$c3,$df,$df,$fd,$fc,$ff,$f0,$dd,$80,$ff,$00,$77,$00
 | |
| 	db $aa,$00,$44,$00,$aa,$00,$00,$00,$aa,$00,$44,$00,$ab,$01,$03,$03
 | |
| 	db $aa,$00,$44,$00,$aa,$00,$00,$00,$aa,$00,$44,$00,$aa,$80,$c1,$c0
 | |
| 	db $ff,$03,$55,$01,$ff,$00,$55,$00,$ff,$00,$5d,$00,$ff,$00,$55,$00
 | |
| 	db $ff,$c0,$d5,$80,$ff,$00,$55,$00,$ff,$00,$5d,$00,$ff,$00,$55,$00
 | |
| 	db $ff,$00,$dd,$00,$ff,$00,$75,$00,$ff,$00,$dd,$00,$80,$7f,$00,$ff
 | |
| 	db $ff,$00,$dd,$00,$ff,$00,$75,$00,$c0,$3f,$00,$ff,$00,$ff,$00,$ff
 | |
| 	db $00,$00,$00,$00,$00,$00,$00,$00,$08,$00,$00,$00,$00,$00,$00,$00
 | |
| 	db $88,$00,$00,$00,$20,$00,$00,$00,$88,$00,$00,$00,$22,$00,$00,$00
 | |
| 	db $a8,$00,$00,$00,$22,$00,$00,$00,$8a,$00,$00,$00,$22,$00,$00,$00
 | |
| 	db $aa,$00,$00,$00,$aa,$00,$00,$00,$aa,$00,$00,$00,$aa,$00,$00,$00
 | |
| 	db $aa,$00,$44,$00,$aa,$00,$00,$00,$aa,$00,$44,$00,$aa,$00,$01,$00
 | |
| 	db $ff,$00,$fd,$00,$ff,$00,$77,$00,$ff,$00,$df,$00,$ff,$00,$77,$00
 | |
| 	db $ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$ff
 | |
| 	db $a8,$01,$00,$00,$22,$01,$00,$01,$88,$02,$00,$02,$20,$02,$00,$01
 | |
| 	db $00,$24,$00,$a5,$00,$a5,$00,$67,$00,$67,$00,$67,$00,$0e,$40,$cc
 | |
| 	db $30,$b8,$10,$9f,$3c,$bd,$74,$f7,$e0,$73,$00,$51,$80,$51,$00,$57
 | |
| 	db $00,$00,$00,$00,$00,$00,$00,$00,$08,$00,$00,$00,$00,$00,$00,$ff
 | |
| 	db $88,$01,$00,$03,$20,$02,$00,$02,$88,$02,$00,$02,$20,$03,$00,$01
 | |
| 	db $00,$81,$00,$3c,$00,$42,$00,$a5,$00,$81,$00,$db,$00,$42,$00,$7e
 | |
| 	db $08,$80,$00,$80,$20,$c0,$00,$40,$08,$40,$01,$41,$23,$c3,$06,$86
 | |
| 	db $5c,$8c,$18,$18,$32,$f0,$60,$e0,$ca,$d0,$00,$c8,$02,$18,$00,$3c
 | |
| 	db $20,$c6,$00,$63,$00,$f1,$00,$01,$00,$00,$00,$00,$00,$e0,$00,$ff
 | |
| 	db $aa,$00,$00,$00,$aa,$00,$00,$00,$2a,$80,$00,$c0,$2a,$40,$00,$60
 | |
| 	db $1f,$e0,$1d,$e0,$01,$fe,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff
 | |
| 	db $ff,$00,$fd,$00,$ff,$00,$77,$00,$7f,$80,$5f,$80,$7f,$80,$77,$80
 | |
| 	db $1f,$e0,$03,$fc,$01,$fe,$01,$fe,$00,$ff,$00,$ff,$00,$ff,$ff,$ff
 | |
| 	db $ff,$00,$fd,$00,$ff,$00,$77,$00,$fe,$01,$dc,$03,$fc,$03,$74,$03
 | |
| 	db $f0,$0f,$f0,$0f,$f0,$0f,$50,$2f,$00,$ff,$00,$ff,$00,$ff,$00,$ff
 | |
| 	db $fc,$03,$e0,$1f,$80,$7f,$80,$7f,$00,$ff,$00,$ff,$00,$ff,$ff,$ff
 | |
| 	db $00,$ff,$00,$7f,$00,$7f,$00,$7f,$00,$7f,$00,$3f,$00,$1f,$00,$0f
 | |
| 	db $00,$ff,$00,$ff,$00,$7f,$00,$7f,$80,$3f,$00,$1f,$20,$0f,$00,$03
 | |
| 	db $00,$ff,$00,$ff,$00,$7f,$00,$1f,$8a,$00,$00,$00,$22,$00,$00,$00
 | |
| 	db $00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$fe,$00,$f8,$00,$f0
 | |
| 	db $00,$ff,$00,$ff,$00,$ff,$00,$fe,$00,$fe,$00,$fc,$02,$f8,$00,$e0
 | |
| 	db $00,$ff,$00,$ff,$00,$ff,$00,$fe,$00,$fe,$00,$fe,$02,$fc,$00,$f8
 | |
| 	db $00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff
 | |
| 	db $00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$ff,$ff
 | |
| 	db $00,$00,$0f,$0f,$04,$06,$06,$06,$02,$03,$03,$03,$01,$01,$00,$01
 | |
| 	db $00,$00,$f8,$f8,$10,$30,$30,$30,$20,$60,$60,$60,$40,$c0,$c0,$c0
 | |
| 	db $01,$01,$01,$01,$03,$03,$02,$03,$06,$06,$04,$06,$0f,$0f,$00,$00
 | |
| 	db $80,$c0,$40,$c0,$60,$60,$20,$60,$30,$30,$10,$30,$f8,$f8,$00,$00
 | |
| .KeyArtTilesEnd:
 | |
| 
 | |
| .BackgroundCopy: ; tiles start at 26
 | |
| 	db $6a, $6a, $67, $57, $4d, $64, $6a, $6a
 | |
| 	db $6a, $68, $58, $59, $5a, $4e, $65, $6a
 | |
| 	db $69, $4f, $54, $55, $5b, $4f, $4f, $66
 | |
| 	db $50, $50, $50, $56, $5c, $5d, $50, $50
 | |
| 	db $51, $47, $1c, $1d, $1e, $1f, $48, $51
 | |
| 	db $1b, $21, $22, $23, $24, $25, $26, $20
 | |
| 	db $27, $28, $29, $1a, $1a, $2a, $2b, $2c
 | |
| 	db $2d, $2e, $1a, $1a, $1a, $1a, $2f, $30
 | |
| 	db $31, $32, $1a, $1a, $1a, $1a, $33, $34
 | |
| 	db $35, $36, $37, $1a, $1a, $38, $39, $3a
 | |
| 	db $49, $3c, $3d, $3e, $3f, $40, $41, $4a
 | |
| 	db $4b, $3b, $43, $44, $45, $46, $42, $4c
 | |
| 	db $6a, $5e, $5f, $52, $52, $61, $62, $6a
 | |
| 	db $6b, $6b, $60, $53, $53, $63, $6b, $6b
 | |
| 	db $1a, $1a, $1a, $6c, $6d, $1a, $1a, $1a
 | |
| 	db $1a, $1a, $1a, $6e, $6f, $1a, $1a, $1a
 | |
| .BackgroundCopyEnd:
 |