<< Back

 

Cesky: , English:

WCH80

BabyPC

ZX80 computer clone with CH32V002 processor

Version 1.0; Last update: 9/20/2025

WCH80 on GitHub: https://github.com/Panda381/WCH80

WCH80 part of library CH32LibSDK

Library CH32LibSDK on GitHub: github.com/Panda381/CH32LibSDK

Contents

 

Description

The WCH80 BabyPC is an inexpensive mini-computer with two CH32V002 processors, created based on the ZX80 computer. It is not an emulator; the computer does not emulate the ZX80 computer's ROM, nor does it emulate Z80 machine instructions. It was created as a completely independent computer with the BASIC80 programming language and VGA monitor output, only replicating the ZX80's functionality as closely as possible. It uses a CH32V002A4M6 processor, which, thanks to its large 1.27 mm pin pitch, is suitable for easy soldering even for novice designers. Together with other THT components, the WCH80 is particularly suitable as a kit for novice designers. The built-in BASIC80 programming language is used to familiarize users with computer programming and to try out how programmers programmed in the 1980s.

The computer does not contain a storage medium for saving programs. Your own programs can be saved directly to the processor's flash memory. There are 14 memory slots available, i.e. 14 places to store your own programs, numbered 0 to 13. Slot 0 is located in the main CPU1 processor. When stored in slot 0, data variables are also stored along with the program (more precisely, only the first half of the memory with variables). Slot 0 is automatically loaded into the program memory when the computer is turned on. Memory slots 1 to 13 are located in the second processor, CPU2. All slots allow the entire memory with the program to be stored, except for the last slot 13, which is only half the size.

After initial programming, the processors contain 28 sample programs and games written in BASIC80. Once the processors have been programmed, the programmer is no longer needed, but it can be useful if you want to back up the contents of the processors to a PC or if you want to change program versions. Using slot 0, programs can also be transferred between the processors' memory backups by copying between the CPU1 and CPU2 processors.

In addition to the BASIC80 firmware, games and programs written in C can also be uploaded to the computer using a programmer. There are 25 sample games available. The games can be found in the CH32LibSDK library. However, it is important to remember that reprogramming the CPU1 processor will also overwrite the contents of slot 0. The contents of slots 1 to 13 in CPU2 will not change when games are loaded. For games in C code, the following keys are usually used for control: 8, F=right, 7, E=up, 5, S=left, 6, D=down, A, space=action, B, NEW LINE=alternative action, X, P=info, Y, 0=back.

Differences between WCH80 and ZX80:

WCH80 character set:

 

Wiring diagram

The WCH80 contains two CH32V002A4M6 processors. The first processor, CPU1, is the main processor. It contains BASIC80 or programs and games. If it contains BASIC80, the last 1.5 KB of flash memory is reserved for storing the program and data, as memory slot 0. The processor is controlled by a 25 MHz crystal. The crystal (and the corresponding capacitors) may not be necessary to use - in that case, the processor will use an internal HSI oscillator, which, however, may not have sufficient stability - this will manifest itself as a slight shaking of the video lines in the image.

The second processor, CPU2, is used to control the key matrix and to store programs, such as memory slots 1 to 13. The processors communicate with each other via the USART interface. After programming the CPU2 processor, it is necessary to reset the computer by disconnecting the power supply so that the processors can establish a connection with each other. The CPU1 processor is programmed via the SWIO1 connector, and the CPU2 processor via the SWIO2 connector. After the initial programming of the processors, the sample program in slot 0 can be used to check functionality. After turning on the power, press the R (=RUN) and NEW LINE buttons. This can be done even without a monitor connected. The audio output should emit a beep at 1-second intervals.

 

Construction

In the prototype, I used a single-sided printed circuit board manufactured using a photo process with dimensions of 10x7.5 cm (limitation of the free version of Eagle), so it is not certain whether the design is also ready for custom production of printed circuit boards. I used THT components to make assembly easier, including a large USB-B connector. Instead of the top side of the printed circuit board, I used wires. When programming processors, pay attention to the correct pin assignment. I used a socket for the crystal - just so I could test the functionality without the crystal. Micro switches with low actuation force are used as buttons.

I printed the button labels on an inkjet printer on plain paper, covered both sides with transparent adhesive tape, and cut out the holes for the buttons with a 4 mm leather punch. For the final design, you will probably use a printed circuit board with holes and button labels as the top cover.

 

Description of the WCH80 BASIC80 language

WCH80 BASIC80 is almost identical to ZX80 BASIC, except for a few differences. Program editing takes place in RAM memory. The maximum program size is 1 KB. Data variables are stored in a separate buffer in RAM memory, also with a size of 1 KB. The screen buffer has a fixed size of 768 bytes (24 lines of text with 32 characters each).

The program line number can be in the range of 1 to 65534. Calculations are performed with 32-bit integers in the range -2147483648 to +2147483647 (note: the constant -2147483648 cannot be entered numerically, but is used in calculations). Variable names of all types can be between 1 and 63 characters long. The first character must be a letter. Subsequent characters can be letters, digits, and periods. A period can be used as a word separator. Variables can be of the following types:

The result of comparison operators is the number 0 (= condition not met) or -1 (= condition met, in HEX code this is the number 0xFFFFFFFF). The operators AND, OR, and NOT can be used as logical operators or as bitwise operators.

Keys for editing the program:

Operations, sorted by highest priority:

Beware that multiplication has higher priority than division.

Commands - can only be at the beginning of a line or after the THEN command, and are invoked by pressing the letter:

Special commands:

Functions - functions must be written in text form, they do not have keyboard shortcuts:

Table of graphic symbols and their codes, as they can be entered in the CHR$(n) function:

 

Sample programs

Sample programs are stored in flash memory in memory slots 0 to 13 until they are overwritten by a user program. The contents of the programs can be found in the Programs.txt file, along with their detailed descriptions, or click on the title below the image.


1)
WCH80 demo (212 B)
To use: LOAD, RUN

2)
PRINT CHARSET (57 B)
To use: LOAD 1, RUN

3)
PRECISE DIVISION (197 B)
To use: LOAD 1, RUN 100

4)
SQUARE ROOT (188 B)
To use: LOAD 1, RUN 300

5)
DIE THROWING (440 B)
To use: LOAD 1, RUN 500

6)
SNOWFALL (117 B)
To use: LOAD 1, RUN 1100
Break with SPACE

7)
REACTION TIMER (153 B)
To use: LOAD 2, RUN

8)
RND HISTOGRAM (230 B)
To use: LOAD 2, RUN 200

9)
LEAP FROGS (487 B)
To use: LOAD 2, RUN 500
The goal is to swap the frogs between the left
and right sides.

10)
ENCODING MESSAGE (375 B)
To use: LOAD 3, RUN
Encode with number 1.., decode with negative
number. Message can contain only alphabetic
characters or digits or space.

11)
HORSE RACE (602 B)
To use: LOAD 3, RUN 400

12)
LUNAR LANDER (617 B)
To use: LOAD 4, RUN

13)
MAZE GENERATOR (360 B)
To use: LOAD 4, RUN 600

14)
TIC-TAC-TOE (618 B)
To use: LOAD 5, RUN

15)
DRAWING (403 B)
To use: LOAD 5, RUN 700

16)
MASTERMIND (442 B)
To use: LOAD 6, RUN

17)
DAY OF WEEK (457 B)
To use: LOAD 6, RUN 500

18)
SQUARE ROOT (425 B)
To use: LOAD 7, RUN

19)
SIMPLE SIMON (443 B)
To use: LOAD 7, RUN 400

20)
KING HAMMURABI (831 B)
To use: LOAD 8, RUN

21)
PRIME NUMBERS (169 B)
To use: LOAD 8, RUN 700

22)
CASTLE DOORS (1018 B)
To use: LOAD 9, RUN

23)
ACEY DEUCEY (In-Between) (644 B)
Player wins if third card lies between two cards.
To use: LOAD 10, RUN

24)
CHEESE NIBBLER (312 B)
To use: LOAD 10, RUN 600

25)
RPN CALCULATOR (734 B)
To use: LOAD 11, RUN

26)
HEX MANDELBROT (285 B)
To use: LOAD 11, RUN 700

27)
FLAPPY'S SONG (922 B)
To use: LOAD 12, RUN

28)
MATCHES (499 B)
To use: LOAD 13, RUN

 

Downloads

Download resources for WCH80 BabyPC. The resources are also part of the CH32LibSDK library.

In the folders you will find:

Miroslav Nemecek

<< Back