A (very) basic 6502 disassembler for Abacuc
Photo by?Vipul Jha?on?Unsplash

A (very) basic 6502 disassembler for Abacuc

As I wrote in my last post, I am currently spending some time putting together a 6502 breadboard computer. I got the system up and running in a very basic configuration.

I have some debugging output from my Python code. Every time there is a transition of the clock from high to low, I output a debug line that contains the following information:

- Status of the RESB, SYNC, RWB, BE, SOB, IRQB, RDY, VPB, and NMIB microprocessor pins.

- A binary and hex dump of the addressbus address

- A binary and hex dump of the databus

- An indication if the microprocessor is trying to read or write based on the status of the RWB pin. (Redundant with what I do but I wanted a clear visual indication)

This gives a good idea of what is happening while executing code. Since I can lower the operating frequency to whatever value I want and single-step, I can look closely at what the microprocessor is doing. (Thank you again for the full static design of the W65C02)

If you read the W65C02 datasheet, you will learn that:

(SYNC) The OpCode fetch cycle of the microprocessor instruction is indicated with SYNC high. The SYNC output is provided to identify those cycles during which the microprocessor is fetching an OpCode. The SYNC line goes high during the clock cycle of an OpCode fetch and stays high for the entire cycle. If the RDY line is pulled low during the clock cycle in which SYNC went high, the processor will stop in its current state and will remain in the state until the RDY line goes high. In this manner, the SYNC signal can be used to control RDY to cause single instruction execution.

This is cool. I can check if the microprocessor fetches an OpCode and disassemble it on the fly, writing the disassembler output to my console.

A few days ago, I stumbled upon a GitHub repository from Bill Zissimopoulos, basically doing the same thing I was trying to do. The only difference was that he used an Arduino Mega instead of a Raspberry Pi. Looking at the Arduino code he wrote, I noticed he had the same idea about using the SYNC pin. The disassembler code was written in C, and I ported it to Python, spending an hour or so in the process.

It worked like a charm! Thank you, Bill, for your code.

What I wrote is quick and dirty, but it does the job.


要查看或添加评论,请登录

Alessandro Galetto的更多文章

  • Retouching photographs

    Retouching photographs

    Since I bought a second-hand Leica X2, a twelve-year-old camera, I have started playing with photography again after a…

  • Books

    Books

    I am an avid reader. The Kindle app on my iPhone tells me that in the first three months of the year, I have already…

  • Freedom?

    Freedom?

    I was not surprised to read that Apple killed the Epic developer account because it had proven to be "verifiably…

  • I need to pay more attention

    I need to pay more attention

    I must admit, I have a deep-seated affection for vi. It harks back to the eighties, a time when I first ventured into…

  • Poor man signal generator

    Poor man signal generator

    In the world of electronics and microcontrollers, Abacuc is slowly but surely making its way. With meticulous…

  • Abacuc is going remote

    Abacuc is going remote

    I have entered a rabbit hole with Abacuc. I have spent much of my free time on time in the past few days.

  • Abacuc - Episode 1

    Abacuc - Episode 1

    Why? After I finished with Geremia, I had to pick up another personal project to spend some time soldering and coding…

    1 条评论
  • I bought a camera

    I bought a camera

    For as long as I can remember, photography has been a deep-rooted passion of mine. The notion of capturing moments in…

    1 条评论
  • The Geremia project is finished.

    The Geremia project is finished.

    Let’s start from the beginning. There will be some repetitions in this post.

  • Apple Vision Pro

    Apple Vision Pro

    Yesterday I was looking at the Apple WWDC event, where they unveiled the Vision Pro. During the event, I was thinking:…

社区洞察

其他会员也浏览了