One for Neil (6502)

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mr Barnes,

Apologies if you've already posted about this but I just stumbled upon it and thought it was truly astonishing.
.
https://youtu.be/HDMkw6lnzmI
.
DIY 6502 with 3000+ transistors (and 100+ LEDs)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Morning Cliff,

 

I was aware of that wonderful device, but I don't think I've posted about it.

 

My sort of project though: huge fun but utterly pointless in and except for itself!

 

Fun fact is that it's probably smaller to do it all with discrete transistors than to use low-level 74xx parts... my 'half an 8080' is eight by ten inches, though possibly not the most efficient implementation and certainly not following the original design as this does. One issue on any project like this is that the 70s processors did what might technically be called 'weird stuff' around registers with dynamic use of the mosfets; tricky to re-engineer except at chip level.

 

Neil

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


barnacle wrote:
huge fun but utterly pointless
Especially the speed it runs at.

 

Of course the thing I like about it are the twinkly lights!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A project can never have too many LEDs!

 

I am glad to hear that they are adding 100 more to their Ver 2!

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The most intriguing LEDs in the video for me weren't so much those showing data in registers etc but the ones showing the internal state of opcode fetch and so on. Stuff you could never normally see "inside" a CPU.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are intriguing differences when emulating a microprocessor between 'cycle accurate' emulation, following your best guess at the internal state, and 'just get the bloody result right' - which is usually faster overall but does tend to make things speed up and slow down depending on the instruction being emulated. When using a longer word-length processor as the emulator, keeping track of status bits gets interesting; one trick I have seen done with assembly language emulation is to use the upper bits of the word (say bits 31-24) to hold the emulated bits 7-0, so that things like carry and overflow and sign happen automatically. Tricky to do that in C, though, since the designers chose not to implement a visible carry out...

 

How to do an eight bit addition in decimal mode, assuming a valid BCD input. It doesn't generate the same result for invalid BCD inputs as the 6502, but then, neither do later versions of the 6502...

uint16_t bcdadd (uint8_t a, uint8_t b, bool C)
{
	uint16_t t1, t2, t3, t4, t5, t6;

	// this approach taken from Douglas Jones http://homepage.cs.uiowa.edu/~jones/bcd/bcd.html

 	t1 = a + 0x6666;
	t2 = t1 + b + (uint16_t)C;			// and if there's a carry, add one
	t3 = t1 ^ (b + C);
	t4 = t2 ^ t3;
	t5 = ~t4 & 0x1110;
	t6 = (t5 >> 2) | (t5 >> 3);
	return (t2 - t6);
}

Neil