Skip to content

Commit

Permalink
fix #1: add PLUGE
Browse files Browse the repository at this point in the history
I finished the GBC-exclusive tests with 129 bytes left.  One thing
that helped is I was able to reuse the SMPTE bars engine for some of
the other GBC-exclusive tests.
  • Loading branch information
pinobatch committed Jun 3, 2018
1 parent 0e9f881 commit b38c4ae
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 13 deletions.
3 changes: 2 additions & 1 deletion gameboy/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ obj/gb/gfxincbins.o: \
obj/gb/megatontiles.chrgb16.pb16 \
obj/gb/stopwatchface.iu \
obj/gb/stopwatchhand.chrgb.pb16 obj/gb/stopwatchdigits.chrgb.pb16 \
obj/gb/smptetiles.chrgb.pb16 obj/gb/gradientcolorbartiles.chrgb.pb16 \
obj/gb/smptetiles.chrgb.pb16 obj/gb/plugetiles.chrgb.pb16 \
obj/gb/gradientcolorbartiles.chrgb.pb16

# Graphics conversion

Expand Down
90 changes: 81 additions & 9 deletions gameboy/src/gbctests.z80
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,78 @@ color_handlers:
; PLUGE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

section "pluge", ROM0
pluge_palette_ntsc:
drgb $101010
drgb $181818
drgb $080808
drgb $080808
drgb $686868
drgb $989898
drgb $c8c8c8
drgb $f8f8f8

pluge_palette_ntscj:
drgb $000000
drgb $080808
drgb $080008
drgb $000800

activity_pluge:
ld a,PADF_A|PADF_B|PADF_START|PADF_LEFT|PADF_RIGHT
xor a
ldh [curpalette],a
.restart:
call clear_gbc_attr

ld b,b
; Load tiles and map
ld hl,CHRRAM0
ld de,plugetiles_chr
ld b,5
call pb16_unpack_block
ld hl,_SCRN0
ld de,pluge_rowmap
call smpte_load_map
ld hl,pluge_palette_ntsc
ld bc,16*256+low(rBCPS)
ld a,$80
call set_gbc_palette

ld a,$FF
ldh [rLYC],a
ld a,LCDCF_ON|BG_NT0|BG_CHR01
ld [vblank_lcdc_value],a
ldh [rLCDC],a

.loop:
ld b,helpsect_pluge
jp helpscreen
call read_pad_help_check
jr nz,.restart

ld a,[new_keys]
ld b,a
bit PADB_B,b
ret nz
bit PADB_A,b
jr z,.notogglepalette
ldh a,[curpalette]
cpl
ldh [curpalette],a
.notogglepalette:

call wait_vblank_irq

; Load palette and tiles
ld hl,pluge_palette_ntsc
ldh a,[curpalette]
or a
jr z,.notloadlight
ld hl,pluge_palette_ntscj
.notloadlight:
ld a,$80
ld bc,(1*8)*256+low(rBCPS)
call set_gbc_palette

jr .loop

; Gradient color bars ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Expand Down Expand Up @@ -184,7 +252,6 @@ activity_gradient_bars:
.not_toggle_grid:

call wait_vblank_irq
ld a,[nmis]
ld a,8
ld de,%000000000000001
call gradient_push_palette
Expand All @@ -202,14 +269,14 @@ activity_gradient_bars:
gradient_load_oam:
ld hl,SOAM
ld de,$18FF
call .threepair
call .threepair
call .threepair
call .threepair
call .threepairpair
call .threepairpair
ld a,l
ld [oam_used],a
call lcd_clear_oam
jp run_dma
.threepairpair:
call .threepair
.threepair:
ld a,d
add 8
Expand Down Expand Up @@ -335,15 +402,20 @@ smpte_rowdata:
db $30,$30,$34,$31,$31,$35,$32,$32,$36,$33, $a3,$a6,$a2,$a2,$a5,$a1,$a1,$a4,$a0,$a0 ; SMPTE2
db $43,$43,$43,$47,$42,$42,$42,$41,$41,$41, $48,$40,$40,$40,$51,$50,$52,$50,$50,$50 ; SMPTE3
db $10,$10,$14,$11,$11,$15,$12,$12,$16,$13, $83,$86,$82,$82,$85,$81,$81,$84,$80,$80 ; SMPTE1 flipped

db $00,$00,$00,$00,$02,$02,$11,$12,$21,$22, $31,$32,$41,$42,$51,$52,$61,$62,$71,$72 ; gradient

db $00,$00,$01,$01,$00,$00,$04,$04,$00,$00, $13,$13,$13,$13,$13,$13,$13,$13,$00,$00 ; pluge 1
db $00,$00,$01,$01,$00,$00,$04,$04,$00,$00, $12,$12,$12,$12,$12,$12,$12,$12,$00,$00 ; pluge 2
db $00,$00,$01,$01,$00,$00,$04,$04,$00,$00, $11,$11,$11,$11,$11,$11,$11,$11,$00,$00 ; pluge 3
db $00,$00,$01,$01,$00,$00,$04,$04,$00,$00, $10,$10,$10,$10,$10,$10,$10,$10,$00,$00 ; pluge 4
smpte_rowmap:
db $B1,$22,$53,$00
ongray_rowmap:
db $30,$41,$40,$44,$30,$00
gradient_rowmap:
db $20,$35,$10,$35,$10,$35,$10,$35,$10,$00
pluge_rowmap:
db $10,$46,$47,$48,$49,$10,$00

;;
; @param DE
smpte_load_map:
Expand Down
8 changes: 6 additions & 2 deletions gameboy/src/gfxincbins.z80
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,14 @@ spritegfx_chr::

; GBC exclusive tests ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

section "gradientbars_gfx1",ROM0
section "pluge_gfx0",ROM0
plugetiles_chr::
incbin "obj/gb/plugetiles.chrgb.pb16"

section "gradientbars_gfx0",ROM0
gradientcolorbartiles_chr::
incbin "obj/gb/gradientcolorbartiles.chrgb.pb16"

section "smptebars_gfx1",ROM0
section "smptebars_gfx0",ROM0
smptetiles_chr::
incbin "obj/gb/smptetiles.chrgb.pb16"
2 changes: 1 addition & 1 deletion gameboy/src/helppages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ S: 00 for handheld or

== Color tests: Menu ==

NYA:PLUGE
PLUGE
Gradient color bars
SMPTE color bars
Color bars on gray
Expand Down
Binary file added gameboy/tilesets/plugetiles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b38c4ae

Please sign in to comment.