mesen 0.9.8 and headers (again)

Mugi

Member
okay so i've had an exchange about this with Sour on github and it turned out that it was a mistake by him due to the extremely stupid way the nesdev wiki article is worded about how the mapper's
mirroring bits work, and i fell on the same trap as he did due to the fact that joes comment on the header code (on the wrong line at that) notes that horizontal mirroring is intended, while in reality,
nesmaker's engine does not even work with it.

the header was indeed configured for vertical, and the comment for it is simply wrong.

Sour issued an update to mesen (version 0.9.8.4, availabble from appveyor) fixes this.

here's a cleaned up header with mirror bits marked appropriately.

Code:
	.db "NES",$1a	; iNES identifier

	.db $20         ; number of PRG-ROM blocks
			; 32 prg rom blocks
	.db $00         ; number of CHR-ROM blocks
			; 0 chr rom blocks, using chr ram
	.db %11100011 		
	;        |  |
	;        These 2 bits control mirroring mode, set to 0/0 for Horizontal and 0/1 for Vertical mirroring.
	
	.db %00010000   
	.db $00,$00,$00,$00,$00,$00,$00,$00
 

Mugi

Member
Sour has re-updated the 0.9.8 build of mesen now, so redownloading 0.9.8 should now also work as intended (no need to grab 0.9.8.4 from the development builds.)
 

dale_coop

Moderator
Staff member
Mugi said:
Sour has re-updated the 0.9.8 build of mesen now, so redownloading 0.9.8 should now also work as intended (no need to grab 0.9.8.4 from the development builds.)

So... if I understand well, the original NESmaker header was correct after all?!
Thanks Mugi!
 

Mugi

Member
dale_coop said:
Mugi said:
Sour has re-updated the 0.9.8 build of mesen now, so redownloading 0.9.8 should now also work as intended (no need to grab 0.9.8.4 from the development builds.)

So... if I understand well, the original NESmaker header was correct after all?!
Thanks Mugi!

yeah, the header was correct, just the comment on it was not (the nesmaker header code had a confusing comment saying it sets Horizontal mirroring) even though it actually sets vertical.
Im fairly sure that this is again because of the exact same reason why Sour broke this in mesen, and why i had such a hard time understanding why the mirror bits are upside down...

here's what Sour said about it,

That's the thing - the wiki says 0 = vertical arrangement, but vertical arrangement is actually the same thing as horizontal mirroring.
This is how I ended up inadvertently reversing both settings when I updated the code for 0.9.8.

the nesdev article regarding this mapper and it's mirroring behavior talks about Screen arrangements, as opposed to screen mirroring, and we all just silently autocorrected that in our heads,
but in the article, a vertical arrangement means that your 2 screens are arranged vertically (on top of eachother) and then mirrored to the side, resulting in horizontal mirroring

it should just say mirroring and drop this confusing, unnecessary arrangement speech alltogether.


well anyway, my OCD got the best of me so i poked at the nesdev wiki for the full header specification and just made a commented out version.

iNES header for nesmaker games (vertical mirroring)
(header.asm in gameenginedata/routines/basic/system/header.asm)
Code:
	.db "NES",$1a				; iNES identifier.
	.db $20					; number of PRG-ROM blocks -- 32 prg rom blocks.
	.db $00					; number of CHR-ROM blocks -- 0 chr rom blocks, using chr ram.

	.db %11100011 		
	;    |||||||+---- This bit controls mirroring mode, set to 0 for Horizontal and 1 for Vertical mirroring. Must be used in conjunction with bit 3
	;    ||||||+----- Is battery backed PRG-RAM or other persistent memory present ? (we have flashROM, so yes.)  
	;    |||||+------ Is trainer present ?
	;    ||||+------- Second mirroring control bit, use in conjunction with bit 0 to set four-screen VRAM / single screen modes (not supported by nesmaker games)
	;    ++++-------- lower bits of mapper number
	
	.db %00010000   
	;    |||||||+---- VS unisystem
	;    ||||||+----- Playchoice-10
	;    ||||++------ if set to 2, following header data is specified in NES 2.0 format
	;    ++++-------- upper bits of mapper number

	.db $00,$00,$00,$00,$00,$00,$00,$00	; padding/unused bits

						; the mapper number (mapper 30) is defined by writing a binary number using the 2 sets of 4bits provided,
						; we have a set of 00011110 in this case which is 30 in decimal or 0x1E in hexadecimal.
						; the upper and lower bits of the number are then separated into 2 sets of 4 bits and written
						; in their respective places in the header specification.
 

dale_coop

Moderator
Staff member
Oh, that makes perfectly sense... I completly see how the "vertical arrangement" became "vertical mirroring" in our heads.
Ah ah. That's quite funny.

Thanks, Mugi for this enlightenment < 3
 
Top Bottom