Furby 1998 source code

Let's talk about anything related to the 6502 microprocessor.
Post Reply
User avatar
nanochess
Posts: 16
Joined: 09 Jan 2017
Location: Mexico, Mexico
Contact:

Furby 1998 source code

Post by nanochess »

Hi.

I've read in Twitter the existance of the source code for the Furby toy of 1998.

And guess what? it's written in 6502 ;)

http://www.seanriddle.com/furbysource.pdf
Author, IOCCC+JS1K winner, Princess Quest in Evercade Intellivision, MSX/Atari/CV/Intellivision/SMS game dev, Knight of boot sector games, IntyBASIC/CVBasic creator.
User avatar
MichaelM
Posts: 761
Joined: 23 Apr 2012
Location: Huntsville, AL

Re: Furby 1998 source code

Post by MichaelM »

Cool. Thanks for sharing.
Michael A.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Furby 1998 source code

Post by BigEd »

An excellent find!
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Furby 1998 source code

Post by BigEd »

First thing to note is that it's not quite a 6502 - there's no Y register and some addressing modes and many opcodes are missing. But the source certainly looks like 6502 and would probably run on a 6502.

I noticed a couple of oddities:

- they always CLC before SBC, so maybe SEC is missing? It makes the result out-by-one, unless maybe SBC has the opposite sense of carry on this chip. Or, witness the comment on the front page, the programmers hadn't quite got the idea of borrow and SEC.

- they PHA and PHP in their interrupt routine. Is that PHP a mistake, or does RTI work differently on this chip? If it does, then PLA needs not to affect the flags.

Also available at the Internet Archive in their book viewer.

See also the discussion on Hacker News - with links to more readings.

See also this previous post.

(Text above mostly recycled from the recent gplus post by mos6502.)
User avatar
ttlworks
Posts: 1464
Joined: 09 Nov 2012
Contact:

Re: Furby 1998 source code

Post by ttlworks »

The Sunplus SPC81A microcontroller was mentioned here in the forum in 2017.
The datasheet doesn't explicitly tell you that there is an Y register, so we could assume that this register is missing.
The data sheet doesn't tell you anything about the instruction set, either.
kakemoms wrote:
Sunplus SPC81A¤¤ (2000) - 4&6MHz - 69 opcodes(?), 80KB ROM + 128Byte RAM, 2 D/A converters (8-bit), 20-IO ports
Sunplus has a full range of controllers that contain 65B02 or 65N02 (Full instruction set), 65R02 (Reduced instruction set) or 65S02 (Reduced instruction set+bit+TAX+TXA).
A manual for 6502 related Sunplus instruction sets seems to be here.
//'Google Analytics' again, you better go with AdBlocker, NoScript etc.
Starting at page 52, there seems to be a list of the instructions for the different instruction sets...
...but I just fail to spot an instruction set where the Y register is missing.

Hmm... that Chinese Sunplus MCU page wants you to log in with a password when klicking "English".
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Furby 1998 source code

Post by BigEd »

ttlworks wrote:
kakemoms wrote:
Sunplus has a full range of controllers that contain 65B02 or 65N02 (Full instruction set), 65R02 (Reduced instruction set) or 65S02 (Reduced instruction set+bit+TAX+TXA).
A manual for 6502 related Sunplus instruction sets seems to be here.
Thanks for the link!
Quote:
...
...but I just fail to spot an instruction set where the Y register is missing.
Yes, see for example TAY, the instruction has cycle counts for two flavours of core but an X for the reduced flavours.
65r02-TAY.png
User avatar
ttlworks
Posts: 1464
Joined: 09 Nov 2012
Contact:

Re: Furby 1998 source code

Post by ttlworks »

BigEd wrote:
Yes, see for example TAY, the instruction has cycle counts for two flavours of core but an X for the reduced flavours.
When taking a closer look at the addressing modes for LDA...
sunplus_opcodes.png
Aha: _all_ variations of LDY are missing for 65r02, 65s02 and CPU12... plus quite a few other instructions.
Post Reply