Computing Pi on the NES

182,388
0
Published 2023-03-03
An NES game that computes the digits of pi.

Become a Patron - patreon.com/NesHacker
Buy my t-shirt (Amazon Affiliate Link) - amzn.to/3ksOPmR
Get the ROM - github.com/NesHacker/NesPi/raw/main/nes-pi.nes
See the Code - github.com/NesHacker/NesPi

Pi-Spigot Algorithm Paper (Rabinowitz & Wagon, 1995):
www.maa.org/sites/default/files/pdf/pubs/amm_suppl…

Music:

“Raintown (My Love For You) - Instrumental Version” by Alchemorph
“Maldito” by Family Kush
“Boiling Point - Instrumental Version” by Evgeny Bardyuzha
“Night Chase” by Raz Burg

Chapters:

0:00 Introduction
2:20 Choosing a Mapper
3:16 Math Routines
5:22 The Spigot Algorithm
7:18 Coding the Game

All Comments (21)
  • I remember when I realized that game console were just special-built computers and not just "magic game machines" - so cool
  • @nict2
    This video is going to blow up on Pi Day. 🥧
  • @vdubs4189
    I would love to learn more about NMIs and graphics programming.
  • @BlocPanda
    I love the fact that the NES is asking "What is 'Flop'?". Just a nice touch. Also, 1:00
  • @LukeAvedon
    Super cool! Loved, "do you even flop bro"
  • @JoshJones720
    Great video. The use of visuals on this channel to explain assembly and binary operations are very helpful.
  • @Josh2102
    NES translations 1:03 「あのー、フロップは何ですか?」= umm, what’s a flop? 5:00 「そうです」= that’s right
  • I'm Brazilian and I study computer engineering, your videos inspired me a lot and I'm more and more interested in programming with the 6502. I would love to learn more about NMIs and I'm already following your playlist on basic assembly!
  • @Jennn
    This video deserves 1000x the views it currently has. Thank you sir. This was Great!
  • @Zygorg
    Man, never thought ill watch a 9min vid about PI in the NES, but how you explain it and how you put it graphically makes it very engaging. Thanks for this video even though i dont have any idea of it!
  • @Mentalbox52
    It's not entirely true that the nes lacks multiplication and division, but that it's limited. There are 4 bitwise opcodes, ROL, ROR, ASL, and LSR which you can use to shift the bits left and right which can be used to multiply and divide bytes by 2.
  • I sold my stack of Megaman NES carts around 8 years ago... You just hit me so hard in the feels with your stack.
  • @v1x4z
    A complex, daunting process explained in a very understandable and concise manner. The visuals are very smooth and helpful and your speech has a nice, relaxing cadence. Exceptional video, can't wait for more.
  • @SmoggyLambGG
    「あのー フロップは何ですか?」 "EVERYBODY DO THE FLOP!"
  • @jaysonl
    This is great stuff! Finally! A concrete, complete, and not too complex example of how to get an NES to do some actual work! <3
  • @matte.309
    This is really cool. I'm loving your recent videos.
  • Wow, I was once assigned to do this using the 8086 assembly and didn't even try, was too hard back then but definitely knowing that algorithm would have changed a lot
  • Great vid, awesome production quality and a super interesting subject all explained very well!
  • @Bofner
    I've been living in Japan and learning assembly for the past 8 months now, but I was very surprised to see your NES speak in Japanese xD