Juraj's Blog

28 Jun 2021
Developing Minesweeper like it's 1999 (or fun with VB6)

Developing Minesweeper like it's 1999 (or fun with VB6)

Minesweeper was one of the first games I played on a computer (after Solitaire ). I wouldn’t say that I’m very good at it, but that doesn’t discourage me from wanting to implement it. For some added nostalgia, let’s make it with tooling …
8 min read - windows games vb6 retro
27 Jun 2021
Barcode Hunter: gaming on a logistics terminal

Barcode Hunter: gaming on a logistics terminal

I like doing small projects and one-off games for my kids, and I’ve recently acquired a handheld industrial PDA with a barcode scanner that suggested an idea of a barcode-scanning game. It was quite successful, as it kept my son busy for a …
3 min read - windows handheld games csharp
20 Jun 2021
A physical minimalistic incremental game on micro:bit

A physical minimalistic incremental game on micro:bit

I often chat with my son about computer games on the way to the school in the morning. One topic that comes up fairly often are the incremental games, which we both like and enjoy in various forms - I usually play browser-based ones and my …
13 Jun 2021
Adventures in hardware, part 11 - digital circuit design in Deeds

Adventures in hardware, part 11 - digital circuit design in Deeds

I like it when software is fun to use, and Deeds is fun! While playing around and doing the exercises from the the nand2Tetris course I’ve ended up discovering an awesome software for digital circuit design - Deeds , created by Giuliano …
3 min read - hardware vhdl
13 Jun 2021
Page faults in emuriscv explained (and bugs fixed)

Page faults in emuriscv explained (and bugs fixed)

I’ve fixed two more bugs in the RISC-V emulator recently, both related to memory paging . The first one was caused by only supporting a one third of the possible page faults, the second one was closely related to page faults as well. Load / …
3 min read - emuriscv riscv
08 Jun 2021
Online 6502 disassembler

Online 6502 disassembler

I’ve already visited the wonderful MOS 6502 architecture in a post titled Fantasy console on a console where I ported my 6502 emulator to the Gameboy Advance. Keeping in the spirit of implementing web applications in C, I’ve extracted and …
3 min read - 6502 assembly interactive
30 May 2021
Breaking and fixing the RISC-V Store-Conditional instructions

Breaking and fixing the RISC-V Store-Conditional instructions

Trying to debug the Linux boot process on the emuriscv RISC-V emulator has led me to discover another fun bug, one that appears when you don’t read the specification as thoroughly as you should. The bug manifested itself by an endless loop …
4 min read - emuriscv riscv linux emulation
29 May 2021
Converting Slovak text to Braille

Converting Slovak text to Braille

My visually-impaired friend asked me for help in developing a conversion tool for the Slovak text into the Braille code. The idea was to convert the text into an equivalent Unicode Braille pattern . These could be further utilized, for …
5 min read - javascript interactive
29 May 2021
Windows 2000 on an ARM Pinebook

Windows 2000 on an ARM Pinebook

I thought it would be fun to run Windows 2000 on a Pinebook - a nice little ARM-powered laptop. As there is no version targetting this architecture, we have to use an emulator. QEMU is a nice free choice to run on Linux, and it supports the …
3 min read - qemu windows arm emulation
27 May 2021
Sudoku development diaries - part 2

Sudoku development diaries - part 2

After developing the basic parts of a Sudoku game in text mode, I was looking for UI toolkit to make it playable with a mouse. After checking various options for a while I ended up using Dear ImGui . See also Sudoku development diaries - …
4 min read - games sudoku c++
22 May 2021

Code golfing tips and tricks

This is a companion article to the 4-in-1 game for taskbar post, which has four playable games for the Windows taskbar in 3727 bytes of code describing the techniques of code size reduction. Table of contents: Shorter identifiers …
5 min read - csharp codegolf
11 May 2021
RISC-V Linux syscall table

RISC-V Linux syscall table

Here’s a list of Linux system calls for the RISC-V architecture. Click the syscall name for the related manpage. See also syscalls(2) . RISC-V System call table Use the fuzzy filter box for search:Filter # Call Prototype var …
3 min read - riscv linux interactive
09 May 2021
Fun with floating-point assembly (in RISC-V and x64)

Fun with floating-point assembly (in RISC-V and x64)

There was a fun little exercise in an old Fortran book that involved approximating a cube root using the Newton method to a specified accuracy. I’ve implemented this in multiple high-level languages and then moved on to two different …
5 min read - riscv assembly
22 Apr 2021
(Mis)understanding RISC-V ecalls and syscalls

(Mis)understanding RISC-V ecalls and syscalls

After spending some time with emuriscv and attempting to boot Linux into a shell I realized that I’m doing something really wrong regarding system calls. RISC-V offers an ecall (Environment Call) instruction to implement system calls. These …
18 Apr 2021
Online RISC-V disassembler

Online RISC-V disassembler

Making a nicer disassembler I’ve had a rudimentary disassembler in the emuriscv emulator, but compared to other disassemblers out there it was not very refined. Debugging and fixing the emulator required me to read a lot of disassembled …
16 min read - riscv assembly interactive
04 Apr 2021
RISC-V supervisor mode

RISC-V supervisor mode

RISC-V features multiple privilege levels (machine, hypervisor, supervisor and user mode). The cores (harts) power up in machine mode, which is mandatory in all RISC-V implementations. Operating system kernel is typically loaded in …
03 Apr 2021
Booting RISC-V on QEMU

Booting RISC-V on QEMU

For reference, I wanted to check how qemu boots RISC-V Linux. Loosely following a guide , I describe how to build and boot a Linux environment targeting the 32-bit RISC-V architecture. There are three things we will need: QEMU the emulator …
8 min read - emuriscv riscv linux qemu
02 Apr 2021

Revisiting RISC-V emulator in 2021

This week I’ve revisited my RISC-V emulator project emuriscv - https://github.com/jborza/emuriscv , as I’m still intrigued by the idea of booting Linux on my own CPU emulator. I’ve worked on and off on this project since 2019, it initially …
7 min read - emuriscv riscv linux
26 Mar 2021
Rolling your own on-screen keyboard

Rolling your own on-screen keyboard

Rolling your own on-screen keyboard I wanted to play the Robotics;Notes visual novel on my Windows touchscreen tablet, but unfortunately the game only supports keyboard controls. While connecting a hardware keyboard is an option, it’s kind …
3 min read - games csharp windows
06 Mar 2021
Sudoku development diaries - part 1

Sudoku development diaries - part 1

I’ve been playing Sudoku on my phone for the past few weeks, learning new techniques and generally having fun. I thought it would be interesting to apply the playing skills in implementing a Sudoku game from scratch. I’ve spent several …
5 min read - games sudoku c++
14 Feb 2021
Fixing Saitek Heavy Equipment Wheel

Fixing Saitek Heavy Equipment Wheel

As a fan of simulator games I’ve also tried a couple of steering wheel setups. I’ve been playing truck , bus and farming simulator games recently and wanted a somewhat different wheel. The complete kit costs 249 € new and as usual, I tried …
13 Feb 2021
Fixing laptop reboot after waking up from sleep

Fixing laptop reboot after waking up from sleep

One of the most frustrating experiences with a computer is putting it to sleep, only to find it waking up as if it had been restarted. My ThinkPad T440p has guilty of doing exactly that every so often. This is not what you typically …
4 min read - thinkpad windows debugging
07 Feb 2021
Notes from Programming in Lua

Notes from Programming in Lua

See the source book Programming in Lua targeted at Lua 5.0. Here are my notes in case I need to come back to it. I’ll mostly note the differences to Python as that’s what I’m used to these days. Chunks Every piece of code is a chunk …
5 min read - lua
06 Feb 2021
Writing a Forth interpreter - part 2

Writing a Forth interpreter - part 2

In the first part I started to describe a simple Forth interpreter. I eventually completed it and made it more usable - so in this part I’d like to get into the details of the interpreter mode, allowing the user to utilize the builtin …
06 Feb 2021
My third FPGA (for 10€)

My third FPGA (for 10€)

Sipeed Tang Nano FPGA development board I like FPGA development boards and I’m excited that there are products that exist outside of the Xilinx / Intel duopoly. This branch of the Chinese semiconductor industry is still developing and I was …
5 min read - fpga hardware
04 Feb 2021
CHIP-8 on Nokia 3410

CHIP-8 on Nokia 3410

Mobile development like it’s 2002 I thought it’d be fun to develop something for a mobile phone. Thus I did a quick port of my previous CHIP-8 emulator from C to Java. Nokia 3410 looked like a fun target, having a screen resolution of 96x65 …
3 min read - chip8 games java
29 Jan 2021
4-in-1 game for the taskbar

4-in-1 game for the taskbar

A collection of minigames under 4 KB As a kid, I had a cheap 8 in 1 Brick Game handheld console, which had LCD display with large dots, 4 directional buttons and a speaker. Along with a couple of Tetris variations it had games like car …
4 min read - csharp games codegolf windows
06 Jan 2021
Wiring car instruments for fun

Wiring car instruments for fun

Car accessories as game controllers? I got inspired by the CAN BUS Gaming Simulator post on hackaday, where Leon Bataille connected a VW Polo dashboard and switches to Euro Truck Simulator 2. I’d like to do something similar, but with with …
7 min read - hardware games controller
04 Jan 2021
CHIP-8 in hardware - part 3 (drawing, VGA)

CHIP-8 in hardware - part 3 (drawing, VGA)

In the last part I ended up with a partially working CPU with most of the single-clock instructions implemented. So far, all of the testing was done in simulator only, and it’s about time to to get a visual output, so I implemented the …
24 Dec 2020
CHIP-8 in hardware - part 2 (CPU)

CHIP-8 in hardware - part 2 (CPU)

Continuing with the implementation of CHIP-8 in Verilog, I wanted to continue with the CPU module and get it to actually execute some instructions, so we’ll build an instruction decoder, CPU states and a register file. As described in the …
23 Dec 2020
CHIP-8 emulators inconsistent behavior

CHIP-8 emulators inconsistent behavior

CHIP-8 arithmetic behavior and VF variable I’ve been fiddling with CHIP-8 and writing a sample program in Octo - a CHIP-8 IDE/assembler with a nicer scripting language than raw opcodes. I wanted to make a demo to try out various opcodes and …
2 min read - chip8
14 Dec 2020
CHIP-8 in hardware - part 1 (ALU)

CHIP-8 in hardware - part 1 (ALU)

I got into FPGAs with the intent of building a retro-computer. A couple of popular hardware implementation targets are Gameboy, NES, RISC-V and CHIP-8. Last year I’ve done my practice round with 6502 and RISC-V emulators, both in C. CHIP-8 …
13 Dec 2020
FPGA VGA serial display

FPGA VGA serial display

VGA on an FPGA In the previous articles I’ve mainly interfaced with LCD displays. I thought it would be nice a produce a VGA output from my FPGA board. I’ve already had a working framebuffer-based display controller that can be written to …
5 min read - verilog serial vga hardware fpga
07 Dec 2020
CHIP-8 emulator in C

CHIP-8 emulator in C

CHIP-8 is one of the most popular target architectures for aspiring emulator writers. I’m planning to implement it in hardware, so I thought that writing a software emulator/interpreter would be enlightening. I was also looking for some …
4 min read - console c emulation chip8
06 Dec 2020
ModelSim and testbenches revisited

ModelSim and testbenches revisited

There seems to be a better way to run ModelSim than I originally described in the LCD controller post , where I was a bit lost with the tooling. (Optional) - setting up ModelSim paths If you didn’t do this when the project was created, set …
3 min read - verilog testing fpga
28 Nov 2020
Adventures in hardware, part 10 - FPGA serial display

Adventures in hardware, part 10 - FPGA serial display

Doom on a screen, again Recently I’ve been playing with displaying DOOM on various devices (a smart watch and a smallish IoT stick), and previously I also played with a 128x64px LCD screen connected to my FPGA board. After an afternoon of …
3 min read - verilog serial doom lcd hardware
22 Nov 2020
Adventures in hardware, part 9 - FPGA calculator

Adventures in hardware, part 9 - FPGA calculator

A pocket calculator on FPGA One potato two potatoes Three potatoes, four! Five potatoes, six potatoes Seven potatoes, more! As a follow up to one of my first FPGA projects Adventures in hardware, part 3 - display and a calculator I wanted …
20 Nov 2020
DOOM on a watch

DOOM on a watch

Does it run DOOM? I was trying to find a good use case for my LILIGO TTGO T-Watch . It’s a programmable smart watch featuring the amazing ESP32 chip and a 240x240 color LCD screen. I keep hearing about Doom running on this and that, …
10 min read - esp32 arduino c games doom
31 Oct 2020
Adventures in hardware, part 8 - PS2 Keyboard Typewriter

Adventures in hardware, part 8 - PS2 Keyboard Typewriter

What will we do with a drunken keyboard? What will we do with a drunken keyboard? What will we do with a drunken keyboard? Early in the morning! A sea shanty from early 19th century After I implemented a display of memory-mapped display in …
7 min read - fpga verilog lcd hardware
25 Oct 2020
Adventures in hardware, part 7 - Stopwatch with a memory-mapped LCD controller

Adventures in hardware, part 7 - Stopwatch with a memory-mapped LCD controller

I wanted to play a bit more with the 128x64 LCD display and the FPGA board, while also exploring the memory-mapping concept of the retro computers. I thought I would like the LCD to display pixels/characters from memory, that would be …
16 Oct 2020
Adventures in hardware, part 6 - 128x64 display

Adventures in hardware, part 6 - 128x64 display

Displaying things on a 128x64 display from an FPGA One of my FPGA boards came with a connector for a parallel-interface 12864 display, so I ordered one online, soldered 20 pins, used sample code provided by the vendor and it lit up. …
7 min read - fpga verilog lcd hardware
04 Oct 2020
My First Altera FPGA

My First Altera FPGA

Over a month ago I bought an Altera Cyclone IV board from a local seller, it seems to be listed on Aliexpress as well. It’s marked as A-C4E6E10, and features: Altera Cyclone IV EP4CE6E22C8 FPGA chip with 6272 logic elements, 270 Kbits of …
6 min read - vhdl fpga hardware
06 Sep 2020
M5Stick digital hourglass

M5Stick digital hourglass

I thought it would be cool to have a digital hourglass. The M5Stick-C with its 80x160 pixel LCD screen, battery, buttons and accelerometer has all the equipment I need. The development process A JavaScript prototype Link: …
6 min read - arduino m5stick esp32
05 Sep 2020
MCPU emulator (and ATTiny85 port)

MCPU emulator (and ATTiny85 port)

MCPU is a neat minimal 8-bit CPU (CPU design by Tim Boescke in 2001, cpldcpu@opencores.org) - see its opencores project file and GitHub repo . It fits into 32 macrocells on a CPLD and can operate on 64 bytes of RAM. Being a minimal CPU it …
7 min read - c arduino emulation
01 Sep 2020
Adventures in hardware, part 4 - LED expander

Adventures in hardware, part 4 - LED expander

Why more LEDs? During the process of developing a 4x4 keypad reader I realized I need more LEDs for diagnostic information. As my Elbert v2 has plenty of digital input/output pins, it should only be a matter of wiring the LEDs to the IOs. …
2 min read - vhdl fpga hardware
07 Aug 2020
Adventures in hardware, part 3 - display and a calculator

Adventures in hardware, part 3 - display and a calculator

Let’s do a calculator Let’s make a very simplistic 3-bit calculator that will: add or subtract number A and B number A is entered by DIP switches 1,2,3 number B is entered by DIP switches 4,5,6 operation (+/-) is defined by DIP switch 8 …
4 min read - hardware vhdl fpga calculator
02 Aug 2020
Adventures in hardware, part 2 - even lower level

Adventures in hardware, part 2 - even lower level

I’ve went through the first part of From Nand to Tetris course where I learnt to build a simple 16-bit computer called Hack from the digital building blocks (NAND gates). The course used its specific HDL (hardware definition language), …
6 min read - hardware vhdl fpga
31 Jul 2020
Detecting directional taps on M5Stick-C

Detecting directional taps on M5Stick-C

As M5Stick only has three buttons, I wanted to prototype a control scheme based on accelerometer either by tilting or tapping the device from the sides. Maybe we can reliably detect “directional” taps on a device in order to move a cursor …
4 min read - c arduino m5stick esp32
18 Jul 2020
Lower level adventures, part 1

Lower level adventures, part 1

Closer to the machine I started my way with programming with Microsoft QBASIC on DOS, I did try (and succeed) to copy code for a game from a BASIC book, and it did run, but I didn’t really “get” development back then. I didn’t really …
5 min read - hardware
12 Jul 2020
Implementing Solitaire in C

Implementing Solitaire in C

Solitaire was the first computer game I have played, ages ago, on an ancient Windows 3.1 laptop. I have never actually implemented it. When I say Solitaire, I actually mean the Klondike variant, which I think is the most commonly known …
20 min read - games c debugging
21 Jun 2020
M5Stick rude watch

M5Stick rude watch

I bought the M5StickC ESP32 mini IoT development kit and wanted to do a fun project. Some of the kits come with a wristband, the board features a real time clock module, so it could also work as a wristwatch. I’ve seen a fun picture once …
5 min read - arduino m5stick esp32
11 May 2020
Programming Fizz-Buzz in Forth

Programming Fizz-Buzz in Forth

After finished implementing my Forth interpreter I was finally ready to do some programming in Forth. Let’s do the famous Fizz-Buzz test . The assignment goes: “Write a program that prints the numbers from 1 to 100. But for multiples of …
3 min read - forth codegolf
03 May 2020
Writing a Forth interpreter - part 1

Writing a Forth interpreter - part 1

Forth the language Forth is a funny language. One of the so-called stack languages, it doesn’t really care about types, isn’t functional or object-oriented. It also has very easy syntax - identifiers (called words) are separated by …
19 Apr 2020
Writing a monitor console for emuriscv

Writing a monitor console for emuriscv

As a follow up to the previous post Debugging things running in your emulator I thought it would be nice to write a monitor console for the emuriscv RISC-V emulator. With a monitor console one can interact with whatever is running inside …
4 min read - riscv emulation debugging
16 Apr 2020
Updating the RISC-V Linux environment

Updating the RISC-V Linux environment

As I planned to work some more on the emuriscv RISC-V emulator, I wanted to upgrade from Linux 4.15 and buildroot from 2018 to something more recent. Buildroot-2020-02 supports compiling the image against Linux 5.x headers, while the 5.x …
5 min read - emulation riscv linux emuriscv
14 Apr 2020
Installing FreeBSD 12.1

Installing FreeBSD 12.1

I wanted to check out FreeBSD as I recently acquired a venerable Thinkpad T61. I have played around ages ago, but wasn’t sure how usable it is today as a Unix desktop. I initially did a test run in a virtual machine, later on the physical …
3 min read - freebsd thinkpad
12 Apr 2020
Test-driven emulator development

Test-driven emulator development

Test-driven development is a software development process where you write a test before writing a code that satisfies that test, then refactor and continuously validate that the requirements are still fulfilled. How can we leverage this …
11 Apr 2020
Debugging things running in your emulator

Debugging things running in your emulator

You’ve written an emulator, how do you debug anything running inside? In this post I’ll try to describe what I did (and thought of doing), starting from the most crude methods. Using the IDE and debug the emulator binary Here you can read …
6 min read - emulation riscv 6502 debugging
09 Apr 2020
Building up a RISC-V Linux with Buildroot

Building up a RISC-V Linux with Buildroot

A friend told me about a cool new open-source instruction set architecture called RISC-V (pronounced risk-five). As I wanted to learn more about the architecture, I decided writing an RISC-V emulator (emuriscv) would make sense. One of my …
5 min read - emulation riscv linux emuriscv
04 Jan 2020
Setting up Pi-hole and PiVPN in Azure for privacy on the go

Setting up Pi-hole and PiVPN in Azure for privacy on the go

I don’t like online ads too much. The easy option on a computer is to use an adblocker, but on some devices you are out of options (smart TV, or mobile games with in-game ads). I have started using Pi-hole about 2 months ago on my home …
4 min read - privacy
20 Oct 2019
Fantasy console on a console

Fantasy console on a console

Back in April 2019 I decided to get into emulation and thought about writing a simple one. I read about the MOS 6502 microprocessor and it looked promising as it was used in famous products such as Apple II, Commodore 64, BBC Micro, …
8 min read - emulation 6502 console