Jump to content
IGNORED

5 Hz 6502


John_L

Recommended Posts

Yeah, that's not a typo... I didn't mean 5 MHz, I meant 5 Hz....

 

I watched a video recently on YouTube that showed how people alot smarter than me exposed and photographed all the layers of a 6502 with a microscope. Then, they feed these high resolution photos into a computer and wrote computer programs to generate polygons over the traces, and then they wrote software to recognize transistors and built a 3D model of the 6502 in the memory of the computer. They then wrote software that then operated the virtual 6502. This isn't an emulator, emulators simply mimic the functions of the processor through code. This is a true simulator, and one could even take the same simulation code and apply it to any 3D model, so they could dissect any chip and then simulate it.

 

These simulators are more accurate than most emulators as they're mimicking the actual operation of the hardware, but running a simulator in a computer is pretty slow, but it lends itself to educational uses as well as reverse engineering the chip. The 6502 was done on paper back in the day, and the original circuit diagrams are oddly not available anymore.

 

The folks who did this have a website, Visual6502.org where they have a java implementation of the simulator. In the advanced mode, you can type in your own opcodes and then either run the code at a blazing 3 to 5 hertz, or manually step, which is the cool part.

 

I'm not huge on hand assembly... but I wrote a simple routine that I then punched in so I could step through it and watch the magic happen. There is a visualization of what lines are firing as you step through each instruction.

 

My Code in 6502 Assembly:

 

CLD Clears the decimal math function flag, state unknown at startup, so prudent to clear before adding...

LDA #5 Load the A accumulator with the value of 5

STA $20 Store the 5 we loaded into a into memory location $20

LDA #3 Load the A accumulator with the value of 3

ADC $20 Add with carry the value in A (3) to the value stored in $20 (5)

STA $30 Result is stored back into A, so store final result into memory location $30

JMP $00 Unconditional jump back to memory location 0.

 

I started typing in my code at $0000 as that's where the simulator starts showing memory, and it lets me work in the Zero Page addressing mode for storing values, and the jump at t the end.

 

I did the lookup for each opcode, and hand assembled the values that need to go into memory....

 

Here's the code:

 

D8 CLD

A9 05 LDA #5

85 20 STA $20

A9 03 LDA #3

65 20 ADC $20

85 30 STA $30

4C 00 JMP $00

 

As you step through the code, you can see the lines fire for the CLD, then for the LDA instruction, then you see it read the 5, and then it appears in A in the area above the code, and then you see the lines fire for the STA $20, and the highlighted area jumps to $20 and a 5 appears in that location, and so on... if I hit play and let it cycle, the simulator hits a whopping 5 Hz. If you're interested in assembly language, it's a really cool way to visual what goes on while code executes.

 

 

  • Like 1
Link to comment
Share on other sites

Yep amazing stuff.. thanks for the neat trick about passing code through a URL! I figured since many of the systems discussed here in the forum use variations of the 6502, Apple, Atari 2600, NES, etc that it would be of interest to the folks here. Didn't realize anyone here was involved in the project, but major kudos to you and the rest of the folks involved on the project. The first thing that popped into my head when I saw this was the GIME chip found in the Tandy Color Computer 3. That chip combined the functions of the Motorola 6847 VDG and 6853 SAM chip along with new graphics mode and an MMU similar to the 6829. This awesome chip has a partial implementation of a 256 color mode in the chip, but Tandy stopped them from implementing it in the Color Computer 3 because they were worried it would harm sales of the Tandy 1000 PC line, which had just had EGA graphics in the latest models.

 

So the CoCo 3 community is left with a 16 color 64 palette machine that has another mode buried deep within it. Certain people involved with designing the chip were contacted, but no one remembered all the details, but it is possible to coax the chip into the 256 color mode despite the fact that it was never fully implemented, and when I saw the video, I thought man, that would be great if we could have that done to the GIME chip. I'm pretty sure the CoCo community would collectively give their left arm to have that mode revealed.

 

I noticed the 6800 model too but forgot to mention it. Do you know if the team has any plans to move forward on any other chips?

 

Thanks, John.

Link to comment
Share on other sites

  • 2 years later...
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...