Do computers still use the Z80 CPU? - z80

I have seen that some people are asking questions about assembly programming using the Z80 CPU. I used it years ago. It it still being used in new pieces of hardware or is it totally obsolete?

Yes, the TI-84+/TI-83+ line of graphing calculators (besides the CE, which uses the faster eZ80 processor) use it: https://en.wikipedia.org/wiki/TI-84_Plus_series
Zilog still appears to sell the Z-80 though it does look like they're mostly selling the eZ80 in that line which is compatible but much improved.
Hobbyists still use it and there is even a kickstarter for building a ZX Spectrum clone: https://www.kickstarter.com/projects/1835143999/zx-spectrum-next However, they don't technically use the Z-80 but a 100% programming compatible clone using an FPGA. Certainly that's still a Z-80 as far as the programmer is concerned.

I was curious about this myself so I looked around a bit. The most extensive list I could find was from Wikipedia: https://en.wikipedia.org/wiki/Zilog_Z80#Embedded_systems_and_consumer_electronics
Here are the more modern pieces of equipment from the list:
Gasoline dispenser flow-rate controllers. US Patents 4930665 (1988), 4962462 (1983), 5602745 (1995). I would bet many of these are still in use today.
Breathalyzers (2008)
Looking through Google Patents I found these (after 2000):
Set-top box (2001)
Energy-saving cooking stove (2010)
Currency counting system (2013)
"Digital language learning machine" (2003)
Pinball Game Machine (2011)
Pachinko machine (2014)
Slot machine (2014)
Game machine processor (2019)
Many of these are low-cost Chinese embedded devices or Japanese arcade machines.

There is hobbyists project of ZX Spectrum clone that uses Z80 exactly http://nedopc.com/zxevo/zxevo_eng.php
This computer is still in production as well as several extension devices for it.

Related

is there a verilog tutorial where you build a very simple microprocessor? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
The community reviewed whether to reopen this question 10 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I'm a programmer wishing to learn verilog.
What would be amazingly neat would be a tutorial where one constructs a tiny microprocessor with a very clean design, something like an Intel 4004, and then goes on to actually make it using an fpga and gets it to flash LEDs to order.
Is there such a tutorial?
If not, I might have a go at writing one as I try to do it. Has anyone got any recommendations as to resources I might draw on? e.g. nice open source verilog compiler, debugging tools, simulators, verilog tutorials, cheap fpgas and programming tools, breadboards for LEDs, etc.
I found some glorious slides about an elementary microprocessor here:
http://www.slideshare.net/n380/elementary-processor-tutorial
The open source tools are good for development/testing but won't be able to synthesise your hdl to produce a bitstream, you'll need to use one of the manufacturers tools from altera or xilinx (or others).
The manufacturers tools come as suites , are large (5GB install and need 7 to 12 GB drive space) available for windows and linux. altera.com xilinx.com
There are plenty of soft cores out there.
opencores.org would be a good place to have a look at
There is the zpuino which is arduino compatible.
Best idea is start simple and build up
Get a fpga board, implement a simple design (led flasher) and work up from there.
Quite a learning curve especially if you haven't done much digital electronics.
Remember its hardware and your designing circuits not writing code
so timing is everything.
Have a look at the fpga4fun.com projects and work through them
as a starting point.
xilinx based
digilentinc has some low cost boards , as does gadget factory.
avnet has a usb dongle based board for $80.
altera based .
terasic has some nice boards.
Gadget factory has a kickstarter project up at the moment for the paillio + a few addon boards http://www.kickstarter.com/projects/13588168/retrocade-synth-one-chiptune-board-to-rule-them-al
You can play with Verilog without an actual board using the GNU Icarus Verilog. You can get a Windows build from here.
There is a also a tutorial by Niklaus Wirth on how to design and build a simple CPU, with code in Verilog for a Xilinx board:
https://www.inf.ethz.ch/personal/wirth/FPGA-relatedWork/RISC.pdf
https://www.inf.ethz.ch/personal/wirth/FPGA-relatedWork/ComputerSystemDesign.pdf
~Yes, it is the same Wirth that invented Pascal -- he is playing with FPGAs in his retirement.
Not sure about an explicit verilog tutorial, but you might find this class interesting from MIT open courseware:
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-004-computation-structures-spring-2009/
All the class notes are online, and the syllabus sounds like it might be what you're interested in (emphasis mine):
6.004 offers an introduction to the engineering of digital systems. Starting with MOS transistors, the course develops a series of
building blocks — logic gates, combinational and sequential circuits,
finite-state machines, computers and finally complete systems. Both
hardware and software mechanisms are explored through a series of
design examples.
6.004 is required material for any EECS undergraduate who wants to understand (and ultimately design) digital systems. A good grasp of
the material is essential for later courses in digital design,
computer architecture and systems. Before taking 6.004, students
should feel comfortable using computers; a rudimentary knowledge of
programming language concepts (6.001) and electrical fundamentals
(6.002) is assumed.
The problem sets and lab exercises are intended to give students
"hands-on" experience in designing digital systems; each student
completes a gate-level design for a reduced instruction set computer
(RISC) processor during the semester. Access to workstations as well
as help from the course staff is provided in the lab but it is
possible to complete the assignments using Athena machines or one's
home computer.
Altera has great resources on this kind of stuff.
You can try out this link:
http://www.altera.com/education/univ/materials/digital_logic/labs/unv-labs.html
There's a series of lab tutorials that goes through making an embedded processor using Verilog/VHDL.
All of the FPGA vendors have inexpensive ($200~250 range) development kits. For example, the SP601 from Xilinx or the Cyclone III Starter from Altera. I personally own an SP605 (~$500) from Xilinx. You may be able to find cheaper options from other options (e.g. Sparkfun).
Strictly speaking, while you can find open source VHDL/Verilog tools, I am not aware of any such tools for synthesis (making something the FPGA will use). Both Xilinx and Altera provide free (as in beer) tooling, but they are not open or free (as in libre) software. The Xilinx tools include a simulator (limited in the free version) and can run on Windows or Linux. I assume the Altera tools are similar, but I am not familiar with them.
Building a simple microprocessor in Verilog/VHDL is a pretty common feature in college computer architecture classes. You can undoubtedly find class notes and the like from pretty much any major school.
There is an excellent open source verilog compiler, Icarus. From the Icarus web page
Icarus Verilog is a Verilog simulation and synthesis tool. It operates as a compiler, compiling source code written in Verilog (IEEE-1364) into some target format.
I am not aware of a microprocessor-in-verilog tutorial, but there is the OpenCores web site. In the Processors tag under Projects, I see many processors implemented in Verilog or VHDL: 8080, 6502, 8051, Z80, 6805, to name a few. I assume one of these would serve you as an example to get you started.

What type of programs are C/C++ used for now? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
in which area is c++ mostly used?
I started off with C in school, went to Java and now I primarily use the P's(Php, Perl, Python) so my exposure to the lower level languages have all but disappeared. I would like to get back into it but I can never justify using C over Perl or Python. What real-world apps are being built with these languages? Any suggestions if I want to dive back in, what can I do with C/C++ that I can't easily do with Perl/Python?
To borrow some text from the answer I had for another related question:
Device drivers in native code.
High performance floating point number crunching (i.e. SIMD).
Easy ability to interface with assembly language routines.
Manage memory manually for extended execution runs.
Most of my work has been C and C++. I studied computer engineering in school and worked with embedded devices. My Master's degree had an emphasis in graphics and visualization. One of our visualization apps was written in Python, but for the most part, graphics demands C/C++ for the speed. I now work with embedded devices running Windows Mobile and Windows CE - all C++, though you can do a lot with C#. I previously worked in simulations, which was all C++ code on the backend. C++ is still king for time-sensitive IO, embedded applications, graphics and simulations.
Basically, if you need tight control of timing, you go lower level. Or if you need light-weight (ie, small program size, small memory footprint)
Somewhat unscientifically I took a look on Sourceforge and the top twenty projects/language break-down is currently thus:
Java(43,199)
C++(34,313)
PHP(28,333)
C(26,711)
C#(12,298)
Python(12,222)
JavaScript(10,307)
Perl(8,931)
Unix Shell(3,618)
Delphi/Kylix(3,353)
Visual Basic(3,044)
Visual Basic .NET(2,513)
Assembly(2,283)
JSP(1,891)
Ruby(1,731)
PL/SQL(1,669)
Objective C(1,424)
ASP.NET(1,344)
Tcl(1,241)
ActionScript(1,164)
Perl + Python together still total less than C alone. I have no idea why Java is so high, I know of no single Java developer and have not seen a single Java project, but I am sure someone is using it! For probably the same reason, you are not seeing much C/C++, you are just not working in a domain where it figures highly. I work in embedded systems where C and C++ are ubiquitous and Python comes nowhere. Different languages are encountered to different extents in different worlds.
You ask what you can do with C/C++ that you cannot do easily with Perl/Python; well the answer is plenty, real-time embedded systems for one; but if that is not what you want/need to do, then there is no reason to. On the other hand I might ask the reverse; I'd use C++ for things you might use Python for, simply because for me it would be easier and quicker (than learning a new language and getting the tools working)
C/C++ can be, and is, used for nearly all "types" of programs.
There are some major advantages to C and C++:
Potentially better performance
Easier to build interoperable libraries, especially if working with libraries usable from multiple languages.
well the interpreters for your "P's" languages are most certainly written in c/c++. Most OS code is written in C/C++. On the application side, if you are into games, they are generally written in c/c++. Anything that needs high performance and or low memory is a good candidate.
I've used Gsoap, a c++ soap client implementation for a web service that got HUGE traffic.
Most desktop/console applications with a bias toward graphics rely heavily on C++. This includes CAD software and AAA video games, among other things.

Need some ignition for learning Embedded Systems [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm very much interested in building applications for Embedded Devices. I'm in my 3rd year Electrical Engineering and I'm passionate about coding, algorithms, Linux OS, etc. And also by Googling I found out that Linux OS is one of the best OSes for Embedded devices(may be/may not be). I want to work for companies which work on mobile applications. I'm a newbie/naive to this domain & my skills include C/C++ & MySQL. I need help to get started in the domain of Embedded Systems; like how/where to start off, Hardware prerequisites, necessary programming skills, also what kind of Embedded Applications etc. I've heard of ARM, firmware, PIC Micorcontrollers; but I don't know anything & just need proper introduction about them.
P.S: I'm currently reading Bjarne Struotsup's lecture in C++ at Texas A&M University, and one chapter in it describes about Embedded Systems Programming.
I would avoid operating systems all together, Embedded Linux is an oxymoron, what are you really learning? You could learn the same thing with your home computer.
Yes, ARM is the king of embedded and may remain so for a while, eventually you will need to take a look.
Sparkfun.com is a great site, they offer a number of the olimex boards plus others like arduino derivatives. I prefer the msp430 to the avr, but the avr is more popular.
Outside sparkfun look at the ez430 from TI (msp430) direct or from digikey or mouser. Stellaris has a number of nice boards, the 811 is easy to brick, my first one lasted only a few hours, oops, I should have read the 17 warning labels stuck to everything in the box, dont touch the enables or direction on those jtag lines. stellaris packed a ton of stuff on the boards, very good platform for learning embedded programming, reading schematics, reading data sheets and programmers reference manuals, learning that all schematics and reference manuals are a little buggy and you have to hack your way through. If you want something to build your own projects on though you have to cut away (not literally) goodies on the boards, so I would go with an olimex header board for adding your own electronics to.
Back to sparkfun. The olimex header boards are good, sub $50, the various arm vendors are represented (except for ti/stellaris). Arduino pro mini for under $20. The armmite pro is good. Avoid the mbed2 and lpcxpresso, perhaps avoid lpc all together (other than the armmite pro).
qemu is also a good simulator, not as easy as the armulator or my thumbulator to dig into to see what your code is doing. But there are many rtoses and linuxes that run on it (arm and other processors are simulated), the arm integrator eval board is a popular target and is simulated by qemu. Just within arm there are many eval boards emulated by qemu.
The beagleboard is popular but I was quite disappointed with my beagleboard and always innovating netbook. It cost another $100 - $150 to make the beagleboard useful. Embest has a much better beagleboard clone, that is useful out of the box. I like the hawkboard.org much better than the beagleboard, slower by a bit, half the price, but a better board. You can work on linux or true embedded (no operating system) or whatever you like. Being TI omap based there is a dsp on chip as well in case you have some interests there.
I am not a fan of pic, and have been and will get flamed for it, doesnt bother me. I recommend learning assembler for the msp430, avr, arm, thumb (and pic), real embedded always involves a little assembler to manage the boot process, interrupt handling and the like at a minimum. The msp430 and arm are well suited instruction sets for C compilers, pic is horrible as is the 8051, that doesnt mean there arent C compilers, it is just horribly inefficient and adding a high level language makes the result that much worse. The pics are quite resource limited. The pic32 is a mips derivative and not what I am talking/complaining about. That is a whole other family and category of device. I would go with the msp430 over pic given the choice both for assembler and C, size, power, features, etc.
Mips is probaby arms biggest competitor, sadly it is the one platform I have not had the opportunity to learn.
8051, 6501, and the lsi11 used by the pdp11 are a nice trip down history lane. the lsi11 is what the C language was invented on and you can see parallels between the assembler and C. The msp430 instruction set has the same feel, both the msp430 and lsi11 are excellent instruction sets for beginning assembler. The 8051 is probably the oldest surviving workhorse, it had its day as the dominant embedded processor, and can still be found in new chip products. like the pic the instruction set is a tower of hanoi puzzle, in and out of the accumulator, in and out, in and out several instructions to do anything useful. sdcc is a free 8051 C compiler and just the right size if you want to dig into the guts of a compiler and have a chance at understanding it (without having to buy books or take classes).
I am a big fan of the gameboy advance and nintendo ds, the gba is easier, emulators are out there for both, although are geared toward playing rom games and not necessarily perfect at emulation you might do for homebrew development. the gba's other than the mini have serial ports making debug that much easier (mini has one but getting at it is harder). start with the gba if you can, much cheaper, much easier, once you get the hang of the the ds is a couple of gbas tied together with some extra complications.
Based on your post, not knowing if the cost is too much, my guess is the hawkboard (hawkboard.org) is a good choice for linux, embedded, algorithms and other items you listed. Go ahead and get the power supply and the otg usb cable if it doesnt come with it. If you are like I was as an EE student that may be too rich, look at the arduino pro or actually the lillypad because it comes with the pins already, no soldering or extra parts required, yes get the $14 usb to serial thing. For the price of the lillypad and usb to serial/power board you could get a armmite pro and not need anything else other than a usb cable (I know it is a lpc, its okay). I have web pages on how to remove the arduino like firmware from both platforms and get at the processor, not brain surgery, pretty easy, but first timers might hesitate. The ez430 falls into this same price category, you dont need anything else but the $20 kit, three more boards cost you $10 for the set. If that is too rich or even if not the emulators are free some are much easier to debug than running on real hardware as you have the source code and can compile in print statements or whatever. You can get your feet wet without expending anything but time, and see if this is something you are really interested in.
Remember even the best emulator is not like being on the real hardware (same as running your code under a debugger). You may have to start your project over on hardware, but that is the fun of embedded. board bring up...
by Googling I found out that Linux OS
is one of the best OSes for Embedded
devices(may be/may not be)
It gives you a lot of functionality at on the face of it, low cost. However you have to factor in the cost of the hardware needed to run it, when you might otherwise have been able to use lower cost devices, and the huge amount of third-party code over which you have little control. Also it is not suited to hard real-time applications. By using Linux, you will have implicitly imposed a requirement for a 32 bit processor with an MMU (unless you use uClinux and loose memory protection), and several Mb of RAM and non-volatile storage.
Also you'd learn a lot more about embedded systems by not initially targeting Linux, but using an RTOS or real-time kernel such as FreeRTOS, QNX, VxWorks, eCOS, uC/OS-II or III for example, or just programming 'bare metal' without an OS or executive at all.
A good resource for embedded systems articles is http://embedded.com/
Regarding hardware, ARM is the most ubiquitous architecture in embedded systems used everywhere including phones, PDAs, STBs, DAB radios, digital cameras, hand-held games, netbooks, iPad, robotics etc. It is available from many chip-makers, in a wide range of cost/performance and peripherals and on-chip memory. A Cortex-M3 based part would be a good introduction, and is a cleaner design that the older ARM7TDMI core that it essentially replaces. (so long as you don't want to run Linux in which case you'll need at least an ARM9 with external memory).
If board/tool cost is critical, you might rather use an 8bit device, and I suggest something based on Atmel's AVR. These devices are simple, come in an extensive range, and are suited to programming in C (and C++ if you wish). PIC may seem attractive, but it covers a range of largely incompatible architectures (each requiring different tool-chains) and unless you use a high end-device (PIC24/dsPIC for example), they do not present the best platform for programming in C or C++.
Take a look at the Arduino project. It was designed, among other things, as a cheap and easy to program embedded system for students.
I happen to be a fan of the more recent PIC devices, such as PIC24F and dsPIC33F. They are optimized for C, and Microchip has a free compiler available. One thing nice about the PICs is that many of them come in DIP packages, so you can put them on a plastic breadboard and get started with them right away. Inexpensive also. For example, Digikey sells the PIC24FJ16GA002 (16K Flash, 4K RAM, I2C, SPI, UART and parallel port) in a 28-pin DIP package for $3.64.

What did they program this toy with?

A rather strange question: I'm often asking myself with what programming languages things were created. I recently found this toy mini computer I played with when I was 13 or so at home. (Note: It is not one of those toy "notebooks", it's really small and came as an extra with a magazine)
"Features":
Hadware:
LCD with a small field of pixels where the games were going on, besides that some stats such as score, highscore etc.
Sounds and horrible music when started
A really small "keyboard" with a wire
Software:
At least 14 or so games, from Snake over Tetris and Breakdown to some abomination of a car racing game
A calculator
Game selecting menu
An alarm clock
Inside there is a really small circuit board, I don't want to open the thing up now, though.
Can you imagine if the games and "Operating System" of this thing where actually programmed using a language?
If yes, what language could it be?
If not with a programming language, how else was it created?
If I were to hazard a guess I'd say they used C, it's often used with Microcontrollers in devices like that.
The question is really architectural. Is there a microprocessor in there at all? If so it's likely to have been programmed in quite a low-level language - assembler or C are quite common. However, there might conceivably not be a processor; it might be implemented as custom silicon, either an FPGA or (unlikely) an ASIC, either of which you'd program in VHDL or Verilog.
Anybody's guess. A frequently used tactic when trying to cram a lot of software into a mass-market device (where saving 10c on storage can matter) is to use some kind of bytecode interpreter, where the bytecodes are designed to save space, even if they execute fairly slowly. FORTH used to be popular for this purpose, but there are an awful lot of one-off bytecodes in the world. One that has survived for adventure gaming is the Infocom Z-Machine.
It's clearly an embedded microcontroller.
While in principle it could have been programmed in almost any language, I would be surprised if it were written in anything other than assembly language or C.
My understanding is that all operating systems before 1972 and practically all embedded systems before 1980 or so were written entirely in assembly language, perhaps (as Norman Ramsey pointed out) with a one-off domain specific language (DSL) on top.
Assembly decreased in popularity and the C programming language became the most popular microcontroller programming language.
Even up to around 2000, practically all embedded systems used at least a little assembly language to handle the things that no available higher-level language could handle.
Even today, of the thousands of embedded system microcontrollers available, the vast majority of them have no more than 4 programming languages for them available off-the-shelf:
assembly language, C, BASIC, and Forth.
(I'm hoping that Python will become available for more microcontrollers -- the Pyastra and PyMite dialects already cover a couple of the most popular microcontrollers).
http://www.faqs.org/faqs/microcontroller-faq/primer/

What programming languages were used to go to the moon?

I have always wondered: what programming languages were used to go to the moon?
I realize there may not be a single answer/language, but it interests me.
How many people worked on the code for these systems? How was it tested?
Not a full answer, but a bit more info:
"The on-board Apollo Guidance Computer (AGC) was about 1 cubic foot with 2K of 16-bit RAM and 36K of hard-wired core-rope memory with copper wires threaded or not threaded through tiny magnetic cores. The 16-bit words were generally 14 bits of data (or two op-codes), 1 sign bit, and 1 parity bit. The cycle time was 11.7 micro-seconds. Programming was done in assembly language and in an interpretive language, in reverse Polish."
http://www.hq.nasa.gov/alsj/a11/a11.1201-fm.html
Added: the BBC has recently published a wonderful article about the AGC including interviews with the designers, and with the "little old ladies" who wove the "rope core." It doesn't cover how the software was designed, coded or tested, but you'll probably find it interesting all the same!
Additionally, the source code for the main and landing modules can be found here
The Apollo Guidance Computer was programmed in assembly language.
From "Digitial Apollo Human and Machine in Spaceflight" by David A. Mindell, MIT Press (C) 2008
pg. 149
Apollo's software derived from the basic design of the Mars mission.
Designer Hugh-Blair Smith created a language called "Basic", a
low-level assmelby language of about forty instructions (distince from
the hgigh-level BASIC programming language developed at Dartmouth at
about the same time). On top of BASIC was "Interpreter," brainchild of
Hal Laning, a language that was really a collection of routines to do
the higher-level mathematical functions associated with gudance and
control, in the high precision data format.
Not exactly the Moon, but Lisping at JPL.
I remember reading that the exact same software was written by (at least) two different disjoint teams. The computers would then compare their answers together and check for any discrepancies... not sure what it would do if it found any, but at least they would know there was a problem. I think they used four different computers actually, and took the majority vote, so if one computer was wrong, it was ignored.

Resources