Skip to content

Commit

Permalink
NES: add Hanover bars test
Browse files Browse the repository at this point in the history
  • Loading branch information
pinobatch committed Mar 10, 2024
1 parent 6e25d86 commit 0f9834d
Show file tree
Hide file tree
Showing 9 changed files with 272 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ __pycache__/
/fc-mdf/obj/fc-mdf/*.s
/fc-mdf/*.n??.deb
/fc-mdf/*.dbg
/fc-mdf/*.fdb
/fc-mdf/*map.txt
/fc-mdf/mdfourier-*.nes
/fc-mdf/mdfourier.prg
Expand All @@ -45,6 +46,7 @@ __pycache__/
/nes/obj/nes/*.sav
/nes/obj/nes/last-commit*
/nes/*.dbg
/nes/*.fdb
/nes/*map.txt
/nes/240pee-*rom.nes
/nes/240pee.nes
Expand Down
1 change: 0 additions & 1 deletion gba/tilesets/linearity.grit

This file was deleted.

Binary file removed gba/tilesets/linearity.png
Binary file not shown.
2 changes: 1 addition & 1 deletion nes/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ version:=0.23
objlist:=vwf7 zappertest overclock paldetect vwf_draw init \
main help helppages.hlp stills stopwatch backlight \
scrolltest kiki audiosync soundtest crowd mdfourierfe mdfourier \
overscan megaton shadowsprite padstest \
overscan megaton shadowsprite padstest hanover \
pads ppuclear unpb53 uniu undte bcd rand rectfill muldiv \
pb53files rectfiles ntscPeriods
objlistnsf := mdfouriernsf mdfourier ntscPeriods
Expand Down
3 changes: 3 additions & 0 deletions nes/src/global.inc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ GATEDATA_BANK = 1
SIZEOF_TEST_STATE = 24
.globalzp test_state

; hanover.s
.global do_hanover_bars

; linearity.s
.global do_new_linearity

Expand Down
162 changes: 162 additions & 0 deletions nes/src/hanover.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
.include "nes.inc"
.include "global.inc"
.include "rectfill.inc"
.importzp RF_hanover, helpsect_hanover_bars

hanover_bgcolor = test_state+0

.code
.proc do_hanover_bars
lda #0
sta hanover_bgcolor
restart:
lda #$80
sta help_reload
sta PPUCTRL
asl a
sta PPUMASK
lda #RF_hanover
jsr rf_load_layout
lda #$3F
sta PPUADDR
ldx #$01
stx PPUADDR
palloop:
lda hanover_palette-1,x
sta PPUDATA
inx
cpx #hanover_palette_end-hanover_palette+1
bcc palloop
ldx #0
jsr ppu_clear_oam

; fill tiles
ldx #0
stx PPUADDR
stx PPUADDR
jsr hanover_gentiles
ldx #0
stx PPUDATA
inx
jsr hanover_gentiles

; generate sprite
ldx #0
objloop:
txa
and #%01110000 ; keep row
lsr a
cmp #24 ; move bottom sprites down 1 line
adc #79
sta OAM,x
inx
lda #1
sta OAM,x
inx
lsr a
sta OAM,x
inx
txa
and #%00001100 ; keep column
asl a
adc #48
sta OAM,x
inx
cpx #$60
bcc objloop

loop:
lda #helpsect_hanover_bars
jsr read_pads_helpcheck
bcs restart

ldy hanover_bgcolor
lda new_keys
lsr a
bcc not_right
iny
not_right:
lsr a
bcc not_left
dey
not_left:
cpy #13
bcc have_new_bgcolor
bmi wrap_below_0
ldy #0
beq have_new_bgcolor
wrap_below_0:
ldy #13-1
have_new_bgcolor:
sty hanover_bgcolor

jsr ppu_wait_vblank

; update palette
lda #$3F
sta PPUADDR
lda #$00
sta PPUADDR
lda hanover_bgcolor
beq :+
ora #$10
:
sta PPUDATA
; update nametable
lda #$20
sta PPUADDR
lda #$CD
sta PPUADDR
lda hanover_bgcolor
beq :+
lda #2
:
ora #$20
sta PPUDATA
lda hanover_bgcolor
cmp #1
adc #$21
sta PPUDATA
lda #VBLANK_NMI|BG_0000|OBJ_0000
jsr ppu_oam_dma_screen_on_xy0
bit new_keys+0
bvc loop
rts
.endproc

.proc hanover_gentiles
xorvalue = $01
txa
and #$01
jsr genplane
txa
and #$02
jsr genplane
inx
cpx #4
bcc hanover_gentiles
rts
genplane:
beq :+
lda #$FF
:
sta xorvalue
ldy #8
byteloop:
sta PPUDATA
eor xorvalue
dey
bne byteloop
rts
.endproc

.rodata
; palette 1: 144,80-240,128
; palette 2: 48,144-144,192
; palette 3: 144,144-240-192

hanover_palette:
.byte $20,$12,$13, $00,$14,$15,$16, $00,$17,$18,$19, $00,$1a,$1b,$1c
.byte $00,$11
hanover_palette_end:
21 changes: 21 additions & 0 deletions nes/src/helppages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Gradient color bars
SMPTE color bars
Color bars on gray
Color bleed
Hanover bars
Monoscope
Convergence
Gray ramp
Expand Down Expand Up @@ -191,6 +192,26 @@ Select: Show or hide

Concept by Konsolkongen

== Hanover bars ==

Test mixing of colors
on consecutive lines.
Many TVs' composite video
decoders use "comb filtering"
or "delay line decoding" to
consider two lines at once,
which improves luma detail
and hue in some sources.

The pattern alternates lines
of dark gray (or a medium
color) and each medium color.
If rectangles are solid or
dots, the TV is applying
chroma averaging.

←→: Change background color

== Monoscope ==

This pattern contains
Expand Down
1 change: 1 addition & 0 deletions nes/src/main.s
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ routines:
.addr do_smpte-1
.addr do_601bars-1
.addr do_color_bleed-1
.addr do_hanover_bars-1
.addr do_monoscope-1
.addr do_convergence-1
.addr do_gray_ramp-1
Expand Down
82 changes: 82 additions & 0 deletions nes/src/rectfiles.s
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ rectfill_layouts:

rectfile RF_input_mouse, input_mouse_rects, $20, $18
rectfile RF_safearea_lite, safearea_lite_rects, $20
rectfile RF_hanover, hanover_rects, $20, $20

ire_rects:
rf_rect 0, 0,256,240,$00, 0 ; Clear screen to black
Expand Down Expand Up @@ -695,3 +696,84 @@ input_mouse_rects:
rf_label 32,128, 1, 0
.byte "Select: Acceleration", 0
.byte 0

hanover_rects:
rf_rect 0, 0,256,240,$00, 0 ; Clear screen
rf_rect 80, 80,112,104,$02, 0 ; 12-16 top
rf_rect 112, 80,144,104,$03, 0
rf_rect 144, 80,176,104,$01, 0
rf_rect 176, 80,208,104,$02, 0
rf_rect 208, 80,240,104,$03, 0
rf_rect 80,104,112,128,$05, 0 ; 12-16 bottom
rf_rect 112,104,144,128,$06, 0
rf_rect 144,104,176,128,$04, 0
rf_rect 176,104,208,128,$05, 0
rf_rect 208,104,240,128,$06, 0
rf_rect 48,144, 80,168,$01, 0 ; 17-1C top
rf_rect 80,144,112,168,$02, 0
rf_rect 112,144,144,168,$03, 0
rf_rect 144,144,176,168,$01, 0
rf_rect 176,144,208,168,$02, 0
rf_rect 208,144,240,168,$03, 0
rf_rect 48,168, 80,192,$04, 0 ; 17-1C bottom
rf_rect 80,168,112,192,$05, 0
rf_rect 112,168,144,192,$06, 0
rf_rect 144,168,176,192,$04, 0
rf_rect 176,168,208,192,$05, 0
rf_rect 208,168,240,192,$06, 0

; reuse tiles
rf_rect 88, 72, 96, 80,$22, 0 ; digit 1
rf_rect 120, 72,128, 80,$22, 0 ; digit 1
rf_rect 152, 72,160, 80,$22, 0 ; digit 1
rf_rect 184, 72,192, 80,$22, 0 ; digit 1
rf_rect 216, 72,224, 80,$22, 0 ; digit 1
rf_rect 56,136, 64,144,$22, 0 ; digit 1
rf_rect 88,136, 96,144,$22, 0 ; digit 1
rf_rect 120,136,128,144,$22, 0 ; digit 1
rf_rect 152,136,160,144,$22, 0 ; digit 1
rf_rect 184,136,192,144,$22, 0 ; digit 1
rf_rect 216,136,224,144,$22, 0 ; digit 1
rf_rect 16,152, 40,160,$2F, RF_INCR ; Even 17-1C
rf_rect 24,176, 40,184,$32, RF_INCR ; Odd 17-1C
.byte 0
rf_attr 0, 0,256,240, 0 ; clear attributes
rf_attr 144, 80,240,128, 1 ; 14-16
rf_attr 48,144,144,192, 2 ; 14-16
rf_attr 144,144,240,192, 3 ; 1a-1c
.byte 0
rf_label 107, 48, 1, 0
.byte "00", 0
rf_label 59, 72, 1, 0
.byte "11", 0
rf_label 96, 72, 1, 0
.byte "2", 0
rf_label 128, 72, 1, 0
.byte "3", 0
rf_label 160, 72, 1, 0
.byte "4", 0
rf_label 192, 72, 1, 0
.byte "5", 0
rf_label 224, 72, 1, 0
.byte "6", 0

rf_label 64,136, 1, 0
.byte "7", 0
rf_label 96,136, 1, 0
.byte "8", 0
rf_label 128,136, 1, 0
.byte "9", 0
rf_label 160,136, 1, 0
.byte "a", 0
rf_label 192,136, 1, 0
.byte "b", 0
rf_label 224,136, 1, 0
.byte "c", 0

rf_label 19, 88, 1, 0
.byte "Even", 0
rf_label 24,112, 1, 0
.byte "Odd", 0
rf_label 48, 48, 1, 0
.byte "Background:", 0
.byte 0

0 comments on commit 0f9834d

Please sign in to comment.