Writing NES Games! With Assembly!!

I’d like to take you on a stroll down memory lane and dig into the internals of the Nintendo Entertainment System (NES) to figure out how it works. While we’re there, we’ll see how to build a game for the NES using 6502 assembly with the help of a few modern tools. We’ll gain a new respect for ’80s developers and an appreciation for the high-level languages we have today!

EVENT:

!!Con 2017

SPEAKER:

Christian Joudrey

PERMISSIONS:

The original video was published with the Creative Commons Attribution license (reuse allowed).

CREDITS:

Original video source: https://www.youtube.com/watch?v=IbS7uEsHV_A

Comments

notthesameman says:

Wow i want to see more of this its fun

sl4y3r 0wn3r says:

great work dude!

First Last says:

What is mayereeio? Is that like a mexican mayor simulator?

Patrick Mosier says:

Brings me back to my atari 800 days

Backstage Bum says:

Even the NES ran at 60 fps. Eat shit, Xbox One and PS4

thearchiveable says:

He talks about 6502, but forgot to mention the C64..

YellowOnline says:

I’m like “work on your public speaking”. But I really did find it interesting.

Pedro Custodio says:

Explaining this stuff in plain English sounds difficult

Jonathan Morales says:

This is like a TED talk, but not as pretentious.

0xBADCOFFEE says:

this video should be titled “ruby developer discovers how software actually work” 😛 but good for him, it’s great to see more high level programmers getting their hands dirty once in a while, be it programming on the nes or just doing some c++, helps a lot with optimizations at any level. kudos

Hugo Santos says:

The static noise is so annoying gosh

Krasen Makes Content says:

nes
maker

ÅßÐðU mL says:

Is the sound glitchy or is it just my headphones …

Md Adil Shahrukh says:

thumbs for “this is not a blank screen, thoda is a black screen”

Fhshslfskxh Ajakaksbo says:

Thanks god nesmaker exists

Hugo Santos says:

Best quality slides I have seen in a very very very long time!

Shaun Carlin says:

In this video, a Mac user learns how computers work.

Christopher Drum says:

Maybe I didn’t follow something but this seemed to be, “I studied assembly for the 6502 until I found an emulator that lets me write Lua code.”

mediumstyle says:

still have an original NES copy of zelda. battery back up still works.

Saminations says:

9:35 *breaks head through phone screen so he is magically at the presentation* did you say… lua..? I eat drink and breathe lua!!!

Só uma Teoria says:

YOU’RE A GENIUS!!!

Master Robotnik says:

=HMMMMMM IT’S TOO HARD FOR ME AND ABSOLUTELY POINTLESS TO HANDLE

=……………

Elite Stomper says:

LOL this guys is so funny to watch how excited he got while sharing his experiance

RLomoterenge says:

“Merry-Oh”

KazzArie says:

What’s mind blowing to me is how information can be stored in those chips (back then)

Benjamin Ramsey says:

I love the enthusiasm and almost childlike wonder of “discovering” the tech of the NES, good stuff.

vulcan logic says:

“Mary-O”

Leiki Dragon says:

neat 8 bit controller

unguidedone says:

why is he using mac….. so not cool

CliffBiq says:

One read at $4016 doesn’t give you the 8 button presses in a single byte, only bit 0 indicates a button state, and you have to read 8 times.
You’d have to do something like this before the code shown at 8:25 :

controller1State=$50 //Let’s say you choose some address to keep your button states on a single byte
ldx #1
stx $4016 //Initiate strobe, part 1
dex
stx $4016 //Initiate strobe, part 2
stx controller1State //Button state byte initialised to 0
lda #%10000000 //Injection bit starts out left (since A buttons state was bit 7 in your example)
readButtons:
lda $4016 //Read controller 1
and #1 //Flush out superfluous status bits
beq readButtons10 //Don’t inject bit in your precious controller state byte if button isn’t pressed
ora controller1State //Inject the bit in you state byte if button is pressed
sta controlle1State
readButtons10:
lsr a //Move the injection bit right
bcc readButtons //if the bit isn’t flushed out to the carry, read the next button state

Then, your code would work, assuming you use “controller1state” the same way you used “controller1”.

The NES doesn’t neatly give you all the button states in one byte because the joypad produces a serial signal, with each read shifting which button state you get. The other bits are used by the other devices, like the zapper, and the strobe sequence can be different if you actually want to use the NES expansion port. The upper bits are open bus, which means that the last state of the bus will show up there (thus garbage data).
Since you ran your code in FCEUX, which simulates persistent bus states, you would’ve encountered this problem in some form…

Martin Fracker says:

Awesome. Though you don’t need to program directly in 6502 assembly, as there exists a C compiler for 6502 based systems (which includes NES).

Silver Spoon says:

6502 assembly is certainly the most easy to familiarize, along with z80’s asm to code with, and the NES by design was really developer friendly when you think about it. All 8bit consoles were, to allow devs not to be bottlenecked by complexity. and you, somehow can barely manage to make pong, or make it print “Hello World”?

I’m considering writing an IRC cartridge and a few other unix-shell based for the Atari 800XL right now.

Spider Mcgavenport says:

Love NES in assembly the games code, makes sense. If your looking for codes in assembly I have so many I needed to start a channel based on codes.

Donny Clark says:

“That’s not a blank screen, it’s a black screen!” That’s a quote for the ages

Matthew Watson says:

That low hertz buzz… was this recorded on an old vhs haha

Pak3nuh says:

Dude keep it up. Some people find writing low-level code awfull… Well, they’re right but with the right toolchain it gets easier. Although I like low level code, it isn’t magic like exception handling or memory management in managed languages.
Every dev should know a bit how this things work.

Niamm Paramadvaiti says:

Tabernak

Benjamin Short says:

I love programming with assembly! Its not hard but it takes some time. Leave a like if you feel the same!

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours