I built dynamically programmable arduino based computer to run a chess program

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

I built dynamically programmable arduino based computer to run a chess program

Post by maksimKorzh »

Image

Hi guys, I'd like to share my recent project - an arduino nano based "computer"
with a flashed CPU emulator and hex editor as the runtime environment.
It implements an imaginary CPU and the ultimate goal is to write a chess program
in assembly language of my own design and implementation (in python) that would
be running on this computer.

The challenges are:
- only 1k of ram
- only 512 bytes for instructions
- 8-bit CPU with only 40 instructions (heavily inspired by MOS 6502 processor)
- LCD display

The demo of project can be found here:


The "docs" for my computer and ROM source code (in C) are here:
https://github.com/maksimKorzh/cmk-computer

The most sophisticated program I've written so far is a Chrome Dino game of 496 bytes:
https://github.com/maksimKorzh/cmk-comp ... s/dino.asm

I know chess is much more complicated but I believe my HGM/Oscar Toledo mixture code can be ported to this tiny little assembly.
Really wondering what do you think about this idea and the project in general!

P.S. sorry for being a bit off topic, but this is a really technical thing and initially it was/is intended exactly to write chess for it,
so please be kind to observe the current state as just a proof of concept bundle of electronics circuit/CPU emulator flashed to arduino/assembler
software serving as the bases for writing chess for it.
User avatar
mclane
Posts: 18748
Joined: Thu Mar 09, 2006 6:40 pm
Location: US of Europe, germany
Full name: Thorsten Czub

Re: I built dynamically programmable arduino based computer to run a chess program

Post by mclane »

If a chess engine would be ready, one could let it compete versus the old dedicated chess engines.
But they had 6502 3,4,5 mhz and usually 8 kb ram and 32 kb rom.
What seems like a fairy tale today may be reality tomorrow.
Here we have a fairy tale of the day after tomorrow....
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: I built dynamically programmable arduino based computer to run a chess program

Post by maksimKorzh »

mclane wrote: Sun Oct 31, 2021 10:23 am If a chess engine would be ready, one could let it compete versus the old dedicated chess engines.
But they had 6502 3,4,5 mhz and usually 8 kb ram and 32 kb rom.
I think that the hardware is too different for a fair competition, for instance ATMega328p micro-controller supports up to 16MIPS throughput at 16MHz
(https://ww1.microchip.com/downloads/en/ ... asheet.pdf)
which is incomparable with 6502 based computers but on the other hand the amount of emulated RAM is only 1k (while arduino nano/uno SRAM amount is 2k). The only more less comparable parameter is a ROM size.

Probably a more fair competition could've been playing two arduino computers (so that chess engine is written in C and runs directly on ATMega328p and NOT on imaginary CPU emulator like in my case) versus each other say via serial port which I believe could be really fun to watch) But that goes beyond
the scope of this project which is more refers to things like ZX Spectrum 1k chess where the idea is to make the smallest engine possible no matter how weak it would be.
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: I built dynamically programmable arduino based computer to run a chess program

Post by diep »

Thorsten - would be kind of Villegas type competition then - the engine doing most agressive moves will win every game of course :)
User avatar
mclane
Posts: 18748
Joined: Thu Mar 09, 2006 6:40 pm
Location: US of Europe, germany
Full name: Thorsten Czub

Re: I built dynamically programmable arduino based computer to run a chess program

Post by mclane »

I would find it interesting to see if anybody could beat Ed, the Spracklen, Kittinger, frans morsch, Rathsmann, … on 8 bit.
The interesting thing is the limited resources of the hardware.
What seems like a fairy tale today may be reality tomorrow.
Here we have a fairy tale of the day after tomorrow....