Close

Memory Sanity Check Complete

A project log for TG6502

A 6502 based single board computer project

tom-gwozdzTom Gwozdz 07/01/2018 at 00:340 Comments

Until now, I haven't yet had a chance to test any of the RAM, so I had no idea if reading or writing to RAM would work.  This meant that any code I wrote had to live completely within the registers.  This is hard on the 6502, as I only have 3 8 bit registers to work with.  So getting the RAM online was a priority.

Now that I am able to get some output from the serial port, I added a quick Power On Self Test (POST) routine that runs on boot up.  It goes through the zero page and the stack page, writes some data to each byte, and verifies that I can read it back correctly.  I can now confirm that I can successfully read and write to RAM!

Since I was limited only to registers, I wasn't even able to call any subroutines, since that requires writing to the stack.  My POST routine is therefore just a single block of code that doesn't perform any subroutine calls.  It means that there are some duplicated serial routines in the POST code, but that's a small price to pay to get a reliable POST.

Now that RAM works, I was able to write and test some real serial routines.  Next step will be to come up with a simple monitor program that takes over on boot.  From there I will be able to test the rest of the hardware, and have a way of uploading code over the serial port.  Having to re-flash my EEPROM on every code change is slowing me down quite a bit.

My initial serial port testing was causing me issues.  It simply wouldn't write to the serial port.  It took me a while to figure out what was going on, but it was simply a mis-wiring of one of the chip select lines on the 6551 chip.  It was permanently unselected, and hence wasn't responding to anything on the bus.  Here's a picture of the epic debugging session:

Discussions