Cinderella - Intel 4004 Emulator for VIC 20 (and C-64)

Basic and Machine Language

Moderator: Moderators

Post Reply
aeb
Vic 20 Amateur
Posts: 67
Joined: Sat Jun 19, 2004 2:06 pm

Cinderella - Intel 4004 Emulator for VIC 20 (and C-64)

Post by aeb »

Name: Cinderella - Intel 4004 Emulator for VIC 20 (and C-64)
Author: Aleksi Eeben
Genre: Emulator/Tool
Requirements: VIC-20 with 3+24K or 3+32K expansion
Download & Manual: https://www.dropbox.com/sh/c1nd44z8fqq9 ... I4U2a?dl=0

See the Cinderella Manual at the Dropbox link for instructions. Work in progress, updates at the same Dropbox link. Version 0.9 attached here:
cinderella-vic20-v0_9.zip
(40.72 KiB) Downloaded 55 times
"Introduced in November 1971, the Intel® 4004 microprocessor was an early and significant commercial product to embody computer architecture within a silicon device. And it started an electronics revolution that changed our world.

There were no customer-programmable microprocessors on the market before the 4004. It was the first and it was the enabling technology that propelled software into the limelight as a key player in the world of digital electronics design."

Cinderella is an Intel 4004 emulator that runs on VIC 20 (and C64) and uses the Commodore screen editor as a terminal. Cinderella emulates all 4004 instructions, full 4KB of 4001 ROM's (for program code) and full pack of 4002 RAM chips. Joystick is connected to ROM I/O port and processor test pin. The era appropriate, cosy, green monochrome CGA font (in VIC 20 version the much less common "thin" CGA font) video terminal is limited to Early ASCII with uppercase letters only, and a bunch of C0 terminal control codes are supported, including a fabulous easter egg as the bell sound.

Quick start: Load and run Cinderella. Load helloworld.prg or stingray.prg and type SYS4004. (You may also want to type NEW.) C= key to stop program. SYS4000 to display help. Example source code included. You can use https://bit.ly/theas4004 online 4004 assembler to write code and import hex dump directly to Cinderella by typing it in (or using paste in VICE xvic) after starting the import mode by typing SYS1234.

cinderella-vic20-screenshot-1.png
cinderella-vic20-screenshot-1.png (9.44 KiB) Viewed 727 times
cinderella-vic20-screenshot-2.png
cinderella-vic20-screenshot-2.png (8.65 KiB) Viewed 727 times
Hello World and Schwinn Sting-Ray '70 graphics demo / programmer recruitment ad included! (Intel 4004 creators mentioned in an interview that it was, at first, difficult to recruit programmers to write code for Intel 4004, because it was so small... and programmers thought only mainframes are real computers :D :D )
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Cinderella - Intel 4004 Emulator for VIC 20 (and C-64)

Post by Mike »

I loaded "cinderella20.prg" as emulation engine/monitor, in succession loaded "helloworld.prg" and "stingray.prg" and could reproduce the two screenshots in your introductory post.

To make things clear for the interested people, we're talking about this thing here:

Image

(taken from Wikipedia)

As you have stated, this is the first single chip microprocessor, introduced in 1971. Together with its "chip set" (RAM, ROM, I/O in the other 400x packages) it served in a desk calculator sold by Busicom. It was designed as alternative to a custom chip set which initially had been suggested by a Busicom engineer when he approached Intel, where Intel engineers thought they could do better than that - and they did!

Fast forward to today.

A 4004 emulator for the VIC-20 actually was one of the ideas I entertained once and again. After all, compared to more contemporary micros like the 8080/Z80, that emulation should come at a more palatable speed margin - the 4004 is clocked at around 700 kHz, and takes dozens of cycles for a single intruction and after all, has only a 4 bit wide Arithmetic/Logic Unit, so one has to synthesize calculations on bigger values from multiple instructions. There also exists a 8080 emulator in the wild, written by Dann McCreary, with at least one implementation on the KIM, and a software only implementation of CP/M for the C64 was also based on this: https://www.pagetable.com/?p=824.

I think the topic principally focusses on alternate methods to express program code, which ideally should provide a size advantage or alternatively, an advantage in expressiveness of the machine code. These two aspects can be confirmed mostly positively with the aforementioned 8080 emulator: you get more registers and the 8080, even if it requires a somewhat different mind set, offers slightly more code density for compute intensive applications. The Sweet16 VM would fare in a similar fashion.

Unfortunately, the 4004 can be expected to be not so appealing in that regard. It is already difficult enough to write machine code, doing that for a CPU much below the abilities of either 65xx or 8080 is perhaps good for an evening's worth of entertainment, just to see one gets something running on it. It might make more fun though to do this on a real machine.

Perhaps if you follow up with a more detailed description of how the emulation functions I could imagine this to gain momentum. Maybe an interesting tool like Sweet16 could result from this, perhaps more geared to today's demands on expressiveness, yet still running on a VIC-20.

Greetings,

Michael
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: Cinderella - Intel 4004 Emulator for VIC 20 (and C-64)

Post by chysn »

Is some form of the 4004 still in production today, like the 65C02 is?
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5

WIP: MIDIcast BASIC extension

he/him/his
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Cinderella - Intel 4004 Emulator for VIC 20 (and C-64)

Post by Mike »

chysn wrote:Is some form of the 4004 still in production today, [...]?
According to Wikipedia, the 4004 was discontinued in 1981.

About its immediate successor, the Intel 8008, Wikipedia tells this interesting fact:
Wikipedia wrote:The subsequent 40-pin NMOS Intel 8080 expanded upon the 8008 registers and instruction set [...] the 8080 was not made binary compatible with the 8008, so an 8008 program would not run on an 8080. However, as two different assembly syntaxes were used by Intel at the time, the 8080 could be used in an 8008 assembly-language backward-compatible fashion.

[...]

Almost every [...] 8008 instruction has an equivalent not only in the instruction set of the 8080, 8085, and Z80, but also in the instruction set of modern x86 processors (although the instruction encodings are different).
... which means a current Intel CPU in 32-bit mode could be made to execute programs originally written for the 8008 by re-assembling a binary from source.

So - tongue-in-cheek - some form of the 4004 indeed still is in production today. :wink:

Intel had released all relevant info about the 4004 some years ago (see here), so in principle it is possible to reproduce the 4004 in some way for non-commercial purposes.
User avatar
TRIANGULAR OS
Vic 20 Dabbler
Posts: 87
Joined: Wed Mar 09, 2022 4:53 am
Website: https://www.youtube.com/@triangular_uos
Location: Cracow, Poland

Re: Cinderella - Intel 4004 Emulator for VIC 20 (and C-64)

Post by TRIANGULAR OS »

aeb I will check it right away. I remember me trying to write some code in 4004 web emulator/assembly years ago.
TRIANGULAR μOS for VIC-20:
http://www.sleepingelephant.com/ipw-web ... =2&t=10352

TRIANGULAR μOS YouTube channel:
https://www.youtube.com/@triangular_uos
User avatar
JonBrawn
Vic 20 Devotee
Posts: 225
Joined: Sat Sep 11, 2021 10:47 pm
Website: http://youtube.com/@vicenary
Location: Austin TX USA
Occupation: CPU design engineer

Re: Cinderella - Intel 4004 Emulator for VIC 20 (and C-64)

Post by JonBrawn »

Mike wrote: Tue Sep 27, 2022 5:56 amit served in a desk calculator sold by Busicom.
I don't have the Busicom electronic calculator that used the 4004, but I do have its immediate predecessor, the HL-21:
Busicom HL-21.png
This is the machine that my father used for his company accounts. Unfortunately, it's broken now as one of the nylon gears is stripped. The Y2K sticker is from where I had it at work while we were undergoing Y2K certification - the auditor spent a considerable amount of time playing with it and then declared it compliant and gave it a sticker.
Working on FPGA replacement for 6560/6561
https://youtube.com/@vicenary
Post Reply