How to Code a 6502 Emulator in Python Part 6

TokyoEdtech Guide 8 months ago

Description

Welcome to Part 6!

In this video, I will show you how to implement the CMP command. The CMP command compares an 8-bit value to the value in the accumulator. Depending on whether or not the value is equal, greater than, or less than the value in the accumulator, various CPU flags are set. In the video I add the negative and equal flags. If the value in the accumulator is negative (8-bit signed), then the negative flag is set.

I originally wanted to also do branching, but decided to save that for the next video.

To follow along, download the Starter Code Here: https://github.com/wynand1004/6502_Emulator_2025/tree/a2ff57273cc7fe1c20608dfaf9d2b22cdd82d3d1

📖 DOWNLOAD my FREE Intro to Python eBook here: https://drive.google.com/file/d/1ajYJZLGUaVmNbuG98LnRfHMTzvnZx9el/view?usp=sharing
📖 DOWNLOAD my FREE Intro to Java eBook here: https://drive.google.com/file/d/1c4NlIyL0S9mfYSQ9f5KVEoiQD88nI3nu/view?usp=sharing

NEED HELP?
🆘 If you need help, please copy and paste your code into a comment along with any error messages. I'll take a look when I'm able and get back to you.

LINKS
🗄️ GITHUB: https://github.com/wynand1004
💬 Follow me on Twitter: https://x.com/tokyoedtech
📝 Check out my Blog: https://christianthompson.com
⬇️ Download Geany Editor: https://www.geany.org

LEARN MORE PYTHON
➡️Space Invaders: https://www.youtube.com/watch?v=QvtlEj_T55o&list=PLlEgNdBJEO-lqvqL5nNNZC6KoRdSrhQwK
➡️Snake Game: https://www.youtube.com/watch?v=BP7KMlbvtOo&list=PLlEgNdBJEO-n8k9SR49AshB9j7b5Iw7hZ
➡️Pong: https://www.youtube.com/watch?v=LH8WgrUWG_I&list=PLlEgNdBJEO-kXk2PyBxhSmo84hsO3HAz2
➡️Space War: https://www.youtube.com/watch?v=Ak1IDnP5IrI&list=PLlEgNdBJEO-muprNCDYiKLZ-Kc3-p8thS
➡️Intro to Python (for Java Coders): https://www.youtube.com/watch?v=hIulVFh4S-k&list=PLlEgNdBJEO-n4c4QMmUVknHxfjDlvbY1l
➡️Space Arena - The Ultimate Python Turtle Graphics Game Tutorial: https://www.youtube.com/watch?v=nUoJjHOlY24&list=PLlEgNdBJEO-kK78GXDVzytiZlJtCyiFyW

LEARN MORE JAVA
➡️Basic Java for Beginners: https://www.youtube.com/watch?v=FxmQeC-3uuE&list=PLlEgNdBJEO-lCMWT4wd3VbZbv_swTd_eT
➡️Intro to AP Computer Science A: https://www.youtube.com/watch?v=1g99HckBk8c&list=PLlEgNdBJEO-kaJjwvtMrBBrm6-i4w1TQG

#Python #6502 #retrocomputing