The Moncky project

Creating a complete working retro 16-bit computer from scratch in the style of the C64, CPC 464 and alike using an FPGA

Similar projects worth following
Welcome to the Moncky project! (yes, with 'c' and without the 'e' :-) )
The goal is to create a complete working retro 16-bit computer but with modern technology (FPGA board). It is a work in progress. A lot of ideas are still floating around :-)
At the heart is a 16-bit single cycle self-made RISC processor (not pipelined): the Moncky-3. In this project you can also find its predecessors. The Moncky-1 was first conceived to teach students about digital logic and processors.
The Moncky-3 computer runs at 20MHz and is implemented on an Arty S7: Spartan-7 FPGA Development Board. The Moncky-3 processor interfaces with 2x128KB dual-port RAM, a VGA output, a PS/2 keyboard input, and an SPI interface. The computer can read files from an SD card connected to the SPI port.
All code and documentation can be found at:
After a successful implementation of pacman, working on floating point math and a 3D demo!

The software is read from an SD card at startup.  So it is easy to change it.  Here you see a few video's.

Adobe Portable Document Format - 169.44 kB - 08/17/2022 at 14:15


Adobe Portable Document Format - 120.33 kB - 08/17/2022 at 14:14


Adobe Portable Document Format - 460.34 kB - 08/17/2022 at 14:14


Adobe Portable Document Format - 141.45 kB - 08/17/2022 at 14:14


Adobe Portable Document Format - 432.48 kB - 08/17/2022 at 14:14


View all 6 files

  • 1 × Digilent ArtyS7 50 FPGA board
  • 1 × Digilent pmod VGA adapter
  • 1 × Digilent pmod PS/2 adapter
  • 1 × Velleman SD card adapter
  • 1 × Arduino proto shield + mini bread board

View all 7 components

  • CORDIC on the Moncky

    bigbat10/26/2023 at 14:12 0 comments

    Currently looking at CORDIC algorithms for calculating sin, cos, tan, exp, log, ...  Very interesting!  This algorithm was invented in 1957!!!  It is still used in a lot of hardware.  I hope to implement it soon so I can show it of with some 3D graphics or so :-)

  • Documentation updated

    bigbat08/17/2022 at 14:16 0 comments

    I updated the documentation.  It is now split into different parts.  You can find all files on:

  • Pacman

    bigbat07/27/2022 at 11:22 0 comments

    Yes, finally.  You can play pacman on the Moncky computer!

    This game was written in the Moncky programming language and compiled to Moncky-3 machine code.  It is about 20KiB. So plenty of memory left!

    You can see a video on: 

  • Code for the first game

    bigbat07/04/2022 at 18:12 0 comments

    This is the Moncky code for the game I created as a proof of concept:

    const CANON_WIDTH = 10
    const CANON_HEIGHT = 10
    const ALIEN_WIDTH = 4
    const ALIEN_HEIGHT = 8
    const BULLET_HEIGHT = 5
    const LEFT_KEY = 0x16B
    const RIGHT_KEY = 0x174
    const SPACE = 0x29
    var score : uint8 = 0
    var canonX : uint16 = 160
    var alienX : int16 = 4
    var bulletX : int16 = 160
    var bulletY : int16 = -1
    fun drawScore() {
        call graphics_setCol(0xFF)
        call text_setCursor(0 0)
        call text_printString("score: ")
        call text_printHex(score)
    fun drawCanon() {
        if ((canonX >= CANON_WIDTH) & (canonX <= (319 - CANON_WIDTH))) {
            call graphics_setCol(0xFF)
            call graphics_line((canonX - CANON_WIDTH) 199 canonX (199 - CANON_HEIGHT))
            call graphics_line(canonX (199 - CANON_HEIGHT) (canonX + CANON_WIDTH) 199)    }
    fun drawAlien() {
        if ((alienX >= ALIEN_WIDTH) & (alienX <=(319 - ALIEN_WIDTH))) {
            call graphics_setCol(0x0F)
            call text_drawChar((alienX - ALIEN_WIDTH) 8 'O')
    fun drawBullet() {
        if ((bulletY >= BULLET_HEIGHT) & (bulletY < (199- BULLET_HEIGHT))) {
            call graphics_setCol(0xF0)
            call graphics_line(bulletX (bulletY - BULLET_HEIGHT) bulletX (bulletY + BULLET_HEIGHT))
    fun checkKeyCode(keycode: uint16): uint16 {
        if (keycode == LEFT_KEY) {
            let canonX = (canonX - 5)
            if (canonX < CANON_WIDTH) {
                let canonX = CANON_WIDTH
        if (keycode == RIGHT_KEY) {
            let canonX = (canonX + 5)
            if (canonX > (319 - CANON_WIDTH)) {
                let canonX = (319 - CANON_WIDTH)
        if (keycode == SPACE) {
            let bulletX = canonX
            let bulletY = ((199 - CANON_HEIGHT) - BULLET_HEIGHT)
    fun animateBullet() {
        if (bulletY > ((BULLET_HEIGHT + ALIEN_HEIGHT) + 8)) {
            let bulletY = (bulletY - 1)
        } else {
            if (bulletY > 0) {
                if ((bulletX >= (alienX - ALIEN_WIDTH)) & (bulletX <= (alienX + ALIEN_WIDTH))) {
                    let score = (score + 1)
                let bulletY = -1
    fun animateAlien() {
        if (alienX >= ALIEN_WIDTH) {
            let alienX = (alienX + 1)
            if (alienX > (319 - ALIEN_WIDTH)) {
                let alienX = ALIEN_WIDTH
    keycode : uint16
    drawBuffer : uint8
        let drawBuffer = 0
        call graphics_setBgCol(0)
        while true {
            call graphics_setScreenBuffer((1 - drawBuffer))
            call graphics_setDrawBuffer(drawBuffer)
            call graphics_clrscr()
            call drawScore()
            call drawCanon()
            call drawAlien()
            call drawBullet()
            let keycode = call keyboard_readKeyCode()
            call checkKeyCode(keycode)
            call animateBullet()
            call animateAlien()
            let drawBuffer = (1 - drawBuffer)
            call util_enableInterrupts()
            call graphics_waitVertRetrace()
            call util_disableInterrupts()

  • Moncky programming language ready

    bigbat07/04/2022 at 18:03 0 comments

    The moncky programming language is ready.  It still needs to be documented :-)

    I programmed a simple game in it and it works!!!

  • Moncky compiler

    bigbat06/22/2022 at 17:51 0 comments

    I abbandoned the C-compiler project since it has been too long since I worked on it and it got too complicated.

    But all the experience has made me want to create my own programming language.

    So I started that.  You can follow the progress on Gitlab.  The EBNF specification is rather stable and is made to be easily parsed.  I hope to be able to finish it somewhere in the summer.  Because then I can start coding on a nice game for the Moncky-computer.  My partner has been asking for a packman so I'll see what I can do :-)

  • C compiler enhanced

    bigbat09/15/2021 at 12:48 0 comments

    The C compiler now also knows external functions (from firmware), while, if, and return statements.  See the file "testje.c" on gitlab. It will compile and execute on the Moncky computer.

  • Initial C compiler ready

    bigbat09/10/2021 at 11:58 0 comments

    A first implementation of the C compiler is available on gitlab. 

    The code can use some refactoring, and comments.

    The compiler can already parse a lot of C-files but code generation is not implemented for a lot of constructions.  However, the basic structure is there and just needs extra code.

    Still a lot of work :-) 

View all 8 project logs

  • 1
    How to make your own Moncky-3 computer

    Make sure the arduino shield does not have any components that could generate a 5V signal on one of the pins.  The FPGA cannot handle this!  I also took away the LED that was connected to pin 13.

    Use the arduino shield to connect the SD card reader to the board.  Power (3.3 V) can be drawn from the standard pins.  The SPI pins are also standard for an arduino UNO (pins 10, 11, 12, and 13 are used for SS, MOSI, MISO, CLK respectively).

    You can find the file "top.bit" in the "Moncky3_verilog" folder in the project files (  This file can be used to program the FPGA.  Uploading the file to the FPGA can be done with Vivado software (freely available at the Xilinx site).  The chipset of the flash-chip is "s25fl128sxxxxxxx0" and not the one in the documentation of the board.

  • 2
    Running a program on the Moncky-3 computer

    The assembler will output many different files.  One of them is a ".img" file.  Rename this file to "MONCKYOS".

    Now create a partition on an SD card <32 MB (currently only small partitions are supported).  Format the partition with a FAT16 file system.  Now copy the "MONCKYOS" file to the SD card.

    Put the SD card into the computer and boot it up.  It should load your project and execute it.

View all instructions

Enjoy this project?



f4hdk wrote 07/03/2022 at 10:09 point

@bigbat Great project. I like it. Quite similar to my old project AZ2 Computer :

  Are you sure? yes | no

bigbat wrote 07/04/2022 at 17:54 point

Thanks!  Our projects are similar indeed.  Nice to meet another great/weird mind! :-)

  Are you sure? yes | no

f4hdk wrote 07/06/2022 at 06:07 point

@bigbat  Do you plan to add more RAM? Via the DRAM of the FPGA Dev-board? Having a lot of RAM is one of the key for implementing more complex applications. But of course, it depends what you want to acheive, what kind of application.

  Are you sure? yes | no

bigbat wrote 07/06/2022 at 11:49 point

Good suggestion!  I don't have any plans to add DRAM at the moment.  The most important reason is that I didn't have enough time to figure out how to drive it.  This is my first HDL project, so I had to learn a lot in a short time.  On the other hand I have 128 KiB available at this moment and the commodore 64 only had half of that :-)  The compiler I just wrote, creates quite dense code, so I'm still hopeful it will be enough.  If I would make this project again, DRAM could be an interesting choice because the use of BRAM is very slow I find (but maybe I could improve the design :-) )

The goal now is to play pack-man and that should be feasible :-)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates