Questions about NES programming and architecture
Moderator: Moderators
Re: Questions about NES programming and architecture
That means there are eight internal counters in the PPU? This would explain why there are 8 sprites per scanline at most.
Re: Questions about NES programming and architecture
Yes, each additional sprite increases the cost of the hardware, since the chip gets more complex. Apparently there is enough time in the rendering pipeline to render more sprites, but doing that probably would've meant increasing the cost of the PPU.
Re: Questions about NES programming and architecture
I'm glad to know exactly why the NES has such limitations.
Which reminds me of the lack of a decimal mode on the console's processor. From what I've read, this feature was removed to avoid getting sued by MOS or something. I've always seen NES homebrew games use the instruction CLD at the beginning of their code. Is it mandatory to disable a mode that doesn't even exist on the Ricoh 2A03? Is their actually a Decimal nibble in the 2A03's processor status register?
Which reminds me of the lack of a decimal mode on the console's processor. From what I've read, this feature was removed to avoid getting sued by MOS or something. I've always seen NES homebrew games use the instruction CLD at the beginning of their code. Is it mandatory to disable a mode that doesn't even exist on the Ricoh 2A03? Is their actually a Decimal nibble in the 2A03's processor status register?
Re: Questions about NES programming and architecture
At the time of the NES, silicon received no protection. If you had copies of the masks used to make a device, you could make the device: legally the resulting silicon wasn't protected.
So MOS got a patent on how they implemented decimal mode. By disabling decimal mode, no licensing needed to be paid.
There are famiclones that left the decimal mode functional. While this was almost never used, the superstition did make these games upwardly compatible with later 3rd-party NES copies.I've always seen NES homebrew games use the instruction CLD at the beginning of their code. Is it mandatory to disable a mode that doesn't even exist on the Ricoh 2A03?
Yes, it exists. see:Is there actually a Decimal bit in the 2A03's processor status register?
http://visual6502.org/wiki/index.php?ti ... 27_RP2A03G
Re: Questions about NES programming and architecture
Presumably devs used debugging tools designed for an authentic MOS 6502, which could be confused by sed or by the unspecified state of the decimal bit of P at power on.
Re: Questions about NES programming and architecture
So the decimal flag exists and can be set or cleared, but it has no effect on the decimal mode circuit which is always disabled due to the 5 removed transistors. There not much reason to skip a CLD at the start of your homebrew though.
In interviews with Nintendo it sounded like Ricoh convinced Nintendo to use a 6502, partly because they had a license for it. I wonder if they by "license" they meant that they had the masks to produce it with?
Nintendo's ultimate decision to use a 6502 instead of something like a Z80 was supposedly because the 6502 was a mostly unknown processor in Japan, which would decrease the chance for third-party software (something Nintendo initially tried to avoid). The programmers at Nintendo wasn't very happy with this decision. It wasn't that unknown though, since the Commodore PET was very popular in Japan at the time (and programmers like the late Iwata learned it that way).
In interviews with Nintendo it sounded like Ricoh convinced Nintendo to use a 6502, partly because they had a license for it. I wonder if they by "license" they meant that they had the masks to produce it with?
Nintendo's ultimate decision to use a 6502 instead of something like a Z80 was supposedly because the 6502 was a mostly unknown processor in Japan, which would decrease the chance for third-party software (something Nintendo initially tried to avoid). The programmers at Nintendo wasn't very happy with this decision. It wasn't that unknown though, since the Commodore PET was very popular in Japan at the time (and programmers like the late Iwata learned it that way).
Re: Questions about NES programming and architecture
That and 6502 (well, 6507) was the processor associated with the crash of 1983-1984.
Re: Questions about NES programming and architecture
Do first party games explicitly clear decimal mode? Afaik Nintendo directly tested their code on the Famicom since the computers they used to make their games didn't run on a 6502.
Re: Questions about NES programming and architecture
Yes.
IMO there's no point in overthinking why most games uses CLD when starting up. They just do.
Interestingly enough, the (very incarucate) emulator REW actually simulates the decimal mode if enabled ! This is funny.
Useless, lumbering half-wits don't scare us.
Re: Questions about NES programming and architecture
As you can see in most of my replies, I tend to overthink everything regarding this machine! That being, I still find it amusing in a good way that programmers disable a mode that isn't featured on the CPU, as if they were paranoid or something.
Re: Questions about NES programming and architecture
Not only do games clear decimal mode at bootup, they often disable interrupts too. Turns out that the initial power-on state is to have interrupts disabled, so disabling interrupts doesn't do much. May be useful though if the game wants to jump back to the power-on code to reset the game.
More information regarding removed decimal mode (with images of the cut transitors!): http://visual6502.org/wiki/index.php?ti ... ecimalMode (look near the bottom of the page for images)
More information regarding removed decimal mode (with images of the cut transitors!): http://visual6502.org/wiki/index.php?ti ... ecimalMode (look near the bottom of the page for images)
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Re: Questions about NES programming and architecture
While being quite acustomed to 6502 programming, I've never actually used the decimal, do you know what it was used for on other machines?
Same goes for the BRK instruction, from what I understand it's mainly used for debugging. This instruction seems rather obscure to me since it's actually a 1 byte instruction treated as a 2 byte instruction.
Same goes for the BRK instruction, from what I understand it's mainly used for debugging. This instruction seems rather obscure to me since it's actually a 1 byte instruction treated as a 2 byte instruction.
-
- Posts: 1565
- Joined: Tue Feb 07, 2017 2:03 am
Re: Questions about NES programming and architecture
6502s are "dodgy", its more "mostly" clears at boot up. There have been some fun bugs where D flag isn't always cleared at boot see https://c65gs.blogspot.com/2016/08/reve ... -flag.html I would always set it to be sure sure.Dwedit wrote: ↑Sat Sep 05, 2020 10:41 am Not only do games clear decimal mode at bootup, they often disable interrupts too. Turns out that the initial power-on state is to have interrupts disabled, so disabling interrupts doesn't do much. May be useful though if the game wants to jump back to the power-on code to reset the game.
More information regarding removed decimal mode (with images of the cut transitors!): http://visual6502.org/wiki/index.php?ti ... ecimalMode (look near the bottom of the page for images)
-
- Posts: 1565
- Joined: Tue Feb 07, 2017 2:03 am
Re: Questions about NES programming and architecture
Its quite handy for counting scores saves all the cmp 10 and fix up. The CIA TODs also store things in BCD format, so it can be handy for working with them. If I was making VisiCalc, BCD mode would be my go to for the money mode. Saves memory and clocks. It was a big deal to business software.Secamline wrote: ↑Sun Sep 06, 2020 1:00 am While being quite acustomed to 6502 programming, I've never actually used the decimal, do you know what it was used for on other machines?
Same goes for the BRK instruction, from what I understand it's mainly used for debugging. This instruction seems rather obscure to me since it's actually a 1 byte instruction treated as a 2 byte instruction.
Re: Questions about NES programming and architecture
Atari 2600 games had Decimal Mode available, so they used it. If you look at the disassembly of Dragster, it uses Decimal Mode for all the game's math.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!