uaflag: turn your screen blue and yellow

A place where you can keep others updated about your NES-related projects through screenshots, videos or information in general.

Moderator: Moderators

Post Reply
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

uaflag: turn your screen blue and yellow

Post by tepples »

Some people repeat the claim the NES has no yellow. This program displays $11 on the top half of the screen and $28 on the bottom half. This resembles the flags of Ukraine, Lower Austria, and Chemnitz. On a suitably bright TV, $28 indeed displays as yellow.
Attachments
uaflag.zip
ROM and source
(2.05 KiB) Downloaded 68 times
Screenshot
Screenshot
Blue_and_yellow.png (2.1 KiB) Viewed 1845 times
JRoatch
Formerly 43110
Posts: 422
Joined: Wed Feb 05, 2014 7:01 am
Contact:

Re: uaflag: turn your screen blue and yellow

Post by JRoatch »

Recently I've been enjoying various 256 byte demoscene productions, especially from such events like the recent Lovebyte demoparty.

It's kind of annoying that the smallest NES ROM image accepted by emulators is 16KiB. While in reality one could wire up a 256 byte EEPROM to mirror across the CPU address space and connecting VA10 to PPU.A13 à la Mapper 218/Single Chip Cartridge. If only a header-less power of 2 sized ROM file (<32 KiB) would be interpreted in that way.

Regardless, and as useless as it is for me to say this: My thoughts and prayers goes out to those now suffering.
Fiskbit
Posts: 891
Joined: Sat Nov 18, 2017 9:15 pm

Re: uaflag: turn your screen blue and yellow

Post by Fiskbit »

With NES 2.0 headers, you can specify smaller ROM sizes, including 256 bytes. See exponent-multiplier notation under NES 2.0 PRG-ROM Area.
JRoatch
Formerly 43110
Posts: 422
Joined: Wed Feb 05, 2014 7:01 am
Contact:

Re: uaflag: turn your screen blue and yellow

Post by JRoatch »

I did not know that, so I tried it out and got mixed results.
Works in Mesen 0.9.9 (Windows 10), but not in FCEUX 2.6.1 (SDL, Manjaro for Raspberry Pi).

In the FCEUX case it seems to map it's own executable memory to NES CPU space giving me NSF files exploit vibes.
Attachments
uaflag-256.nes
Relocated to $ff00, NES 2.0 mapper 7 with 256 bytes ROM and 1KiB CHR RAM.
(272 Bytes) Downloaded 53 times
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: uaflag: turn your screen blue and yellow

Post by Quietust »

JRoatch wrote: Mon Feb 28, 2022 4:32 pm I did not know that, so I tried it out and got mixed results.
Works in Mesen 0.9.9 (Windows 10), but not in FCEUX 2.6.1 (SDL, Manjaro for Raspberry Pi).
Just last week I finally got around to updating my own emulator to handle small ROM sizes, but I didn't have anything to properly test it against.
I just tried the file attached above and it worked perfectly.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: uaflag: turn your screen blue and yellow

Post by Dwedit »

JRoatch wrote: Mon Feb 28, 2022 3:17 pm It's kind of annoying that the smallest NES ROM image accepted by emulators is 16KiB. While in reality one could wire up a 256 byte EEPROM to mirror across the CPU address space and connecting VA10 to PPU.A13 à la Mapper 218/Single Chip Cartridge. If only a header-less power of 2 sized ROM file (<32 KiB) would be interpreted in that way.
Can't quite get the "Single chip cartridge" because you also need the CIC.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
JRoatch
Formerly 43110
Posts: 422
Joined: Wed Feb 05, 2014 7:01 am
Contact:

Re: uaflag: turn your screen blue and yellow

Post by JRoatch »

So I've been told there was a bit of discussion in the Discord Server about how normal PPU rendering isn't even required for something like this. Along with the ability to use a data URI as the ROM source for the web browser WebAssembly build of RusticNES a actively worked on emulator by zeta0134.

The result was this 64 byte (12 of which are a NOP slide) size-coded ROM by norill
https://rusticnes.reploid.cafe/wasm/?ca ... n%2Fyf8%3D

Reportedly ROMS less then 256 bytes fails in Mesen (and basically ever emulator other then RusticNES).
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: uaflag: turn your screen blue and yellow

Post by Quietust »

JRoatch wrote: Sun Mar 06, 2022 7:47 pm So I've been told there was a bit of discussion in the Discord Server about how normal PPU rendering isn't even required for something like this. Along with the ability to use a data URI as the ROM source for the web browser WebAssembly build of RusticNES a actively worked on emulator by zeta0134.

The result was this 64 byte (12 of which are a NOP slide) size-coded ROM by norill
https://rusticnes.reploid.cafe/wasm/?ca ... n%2Fyf8%3D

Reportedly ROMS less then 256 bytes fails in Mesen (and basically ever emulator other then RusticNES).
Once I extracted the ROM image from the URL, it ran in my latest Nintendulator build, but the top half of the screen flickers because the BIT $2002 loop can sometimes clear the VBLANK flag without detecting that it was set.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
JRoatch
Formerly 43110
Posts: 422
Joined: Wed Feb 05, 2014 7:01 am
Contact:

Re: uaflag: turn your screen blue and yellow

Post by JRoatch »

The troublesome BIT loop was noticed in the Discord Server, and Kieran F managed to fit all this into 32 bytes(!) while also using NMI as the sync to vblank.

https://rusticnes.reploid.cafe/wasm/?ca ... pMH6kdqSii

Here's my commented disassembly of that:

Code: Select all

; 32 byte uaflag (48 bytes with header) by Kieran F
; commented disassembly by JRoatch

nes2_head:
  .byte $4e,$45,$53,$1a,$14,$00,$00,$08
  .byte $00,$0f,$00,$00,$00,$00,$00,$00
; NES 2.0
; mapper 0 / NROM
; 32 bytes ROM via exponent-multiplier notation
; CHR RAM (unused)

; located at $a900 so that a LDA opcode can mix into the 6502 vectors, saving space.
.org $a900       ; Mirrored at $a920 as well
    .byte $84    ; Part 2 of LDX #$84
    stx $2000    ; $84 -> PPUCTRL; turn on vblank NMI, and VRAM increment *down*.
    ldy #$3f     ; Set PPUADDR to $3F3F, and because of the VRAM inc mode
    sty $2006    ; The beam color index will always point to the
    sty $2006    ; color written to $2007 in either $3F3F or $3F5F.
    eor #$39     ; Toggle between the 2 active colors $11 and $28.
    sta $2007    ; Set beam color to current color.
    ldy #$0d     ; Wait 16000+ cycles for timed mid-screen split
delay_loop:
    dex
    bne delay_loop
    dey
    bne delay_loop
    jmp NMI      ; NMI = $A91F = main loop
; because the time between the mid point to vblank is shorter then the delay loop
; NMI will execute the main loop at exactly the right time.
; as a side effect you get a pretty show in the stack page.
    .byte $1d    ; The high byte of the RST vector ($A91D) is the LDA opcode below
RST:
    lda #$28
NMI:             ; NMI is the main loop that executes twice per frame
    .byte $a2    ; Part 1 of LDX #$84
; The unused IRQ vector points to $A228

; 00000000: 4e 45 53 1a 14 00 00 08 00 0f 00 00 00 00 00 00  NES.............
; 00000010: 84 8e 00 20 a0 3f 8c 06 20 8c 06 20 49 39 8d 07  ... .?.. .. I9..
; 00000020: 20 a0 0d ca d0 fd 88 d0 fa 4c 1f a9 1d a9 28 a2   ........L....(.
Fiskbit
Posts: 891
Joined: Sat Nov 18, 2017 9:15 pm

Re: uaflag: turn your screen blue and yellow

Post by Fiskbit »

I'd like to note that this 32 byte version with no CHR is an excellent emulator test, as both sizes are highly unusual and it has been demonstrated to break at least a couple emulators that support NES 2.0. For that reason, I'm attaching the ROM directly so it's easy for people to download and test with. It wasn't posted with a filename, so hopefully uaflag-32.nes is acceptable.

Thanks for this neat program!
Attachments
uaflag-32.nes
(48 Bytes) Downloaded 44 times
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: uaflag: turn your screen blue and yellow

Post by Quietust »

Fiskbit wrote: Wed Mar 09, 2022 2:26 am I'd like to note that this 32 byte version with no CHR is an excellent emulator test, as both sizes are highly unusual and it has been demonstrated to break at least a couple emulators that support NES 2.0.
Specifically, one of the broken emulators was my own, since its NES 2.0 loader code rejected any files that claimed to have zero CHR ROM and zero CHR RAM (which would have also caused it to reject mapper 218 if flagged as NES 2.0).

Apparently, some other emulators get unhappy with PRG ROM sizes that are less than 256 bytes.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: uaflag: turn your screen blue and yellow

Post by Pokun »

Dwedit wrote: Thu Mar 03, 2022 9:26 am
JRoatch wrote: Mon Feb 28, 2022 3:17 pm It's kind of annoying that the smallest NES ROM image accepted by emulators is 16KiB. While in reality one could wire up a 256 byte EEPROM to mirror across the CPU address space and connecting VA10 to PPU.A13 à la Mapper 218/Single Chip Cartridge. If only a header-less power of 2 sized ROM file (<32 KiB) would be interpreted in that way.
Can't quite get the "Single chip cartridge" because you also need the CIC.
Not really, that would only be on a NES.
Post Reply