Code: Select all
Well, I was talking with gil_ on IRC and we were discussing how a potential NSF 2.0 would be approached. The goals are: * IRQ supprt * "no return" init addresses * information block For IRQ support, I figured allowing the use of frame IRQs and DPCM IRQs just like on the NES, and then a 16 bit IRQ timer which would be connected to the CPU in the usual way (via its IRQ input). This would allow a real NES to play 2.0 NSFs using say a powerpak or similar. So my proposal for IRQ hardware: * a 16 bit IRQ timer that sits at 0x4018-0x401a * 4018 = lower 8 bits of the 16 bit timer reload value * 4019 = upper 8 bits of the 16 bit timer reload value * 401a = control register. * bit 0 - 0 = timer off, reset. 1 = timer is running * all registers are readable and writable. on a real NES, these addresses are fully readable/writable to the cartridge. * allowing the use of DPCM and frame IRQs. * these will work like on a real NES. you MUST write to 0x4017 to enable the external (timer) IRQ, and to reset the frame IRQ, just like a regular NES. * IRQ vector. * write the vector to FFFE and FFFF. These two locations hold the IRQ vector like usual, but are writable. When read by the CPU, these two locations must return the two bytes written there. * when written, you DO NOT write to the underlying NSF data bank. * in effect, FFFE/FFFF become two bytes of RAM which are separate from the rest of NSF space. And the proposal for no return on the init address: * Allow for the init address to never return. this basically means: * init becomes the reset vector * play becomes the NMI vector * and IRQ has its vector at FFFE/FFFF Proposed header changes: 0005 1 BYTE Version number (currently 01h) this will be bumped to 02h for version 2.0 007c 4 ---- 4 extra bytes for expansion (must be 00h) these will be used as follows: 007c 1 BYTE NSF 2.0 feature enables bit: 0 - when set, enables the IRQ features. when clear, disables them 1 - when set, allows for a non-returning init address. 2 - when set, allows play calling to be disabled 3-6 - maintain 0 7 - an extended info block follows nsf data. (see below) 007d 3 WORD length of NSF data block, in bytes. LSB first (little endian) Extended data block: * an extended block of data that is optional to include. * it has the following features: * stores a unicode? title up to N characters long * stores the same for copyright, author, and ripper * allow for separate author/copyright/title on each track? * lengths of tracks * any other possible ancillary data? * the reason for placing it at the end, is so that 1.0 players can still use these NSFs. they will append the extra data into NSF space, and it should not affect the playback if it doesn't use any of the other features (IRQs, non-return init addresses) * You MUST still populate the original author/copyright/title strings in the original header for backwards compatibility. So that's basically it. I think it adds all the features that can be added and still function properly on an NES with a powerpak or similar player cartridge. I'm open to suggestions or feedback on it. If people like it, I will formalize it and update the existing NSF document, and modify my FPGA synth to conform to the document for testing.