# Cogwork: Watch a program run, one instruction at a time

> Two-pass assembler (labels → indices) + a ~20-opcode stack machine where execution is a pure step(program, state) - so the debugger just renders state. 8 tests run real programs (factorial loop, max via jumps).

Cogwork is a visual virtual machine that lets you watch a program execute one instruction at a time. A two-pass assembler resolves labels to indices, and a roughly 20-opcode stack machine runs the result, with execution modelled as a pure step(program, state) function so the debugger simply renders the resulting state. It is a from-scratch, dependency-light build - 8 tests run real programs like a factorial loop and a max-via-jumps routine - that you can download and run locally.

## About the app

Virtual machines

## What to take away

- Two-pass assembler (labels → indices) + a ~20-opcode stack machine where execution is a pure step(program, state) - so the debugger just renders state. 8 tests run real programs (factorial loop, max via jumps).
- Download: Cogwork (ZIP)

## Tags

Free software, Cogwork

## Read the full write-up

/downloads/cogwork.zip

## We build this for clients

https://dfieldsolutions.com/en/services/full-stack

## More from the lab

- https://dfieldsolutions.com/en/lab/sylex.md — Sylex: Make sense of the slashes
- https://dfieldsolutions.com/en/lab/kindra.md — Kindra: Miss a beat, not the rhythm
- https://dfieldsolutions.com/en/lab/voxara.md — Voxara: Argue better. Lose gracefully
- https://dfieldsolutions.com/en/lab/wraithward.md — Wraithward: Spot the bait before you bite

---

Source: https://dfieldsolutions.com/en/lab/cogwork
DField Solutions — Torony köz 5-1.a, 2120 Dunakeszi, Hungary — +36 20 722 0002 — dezso@dfieldsolutions.com
Booking: see https://dfieldsolutions.com/en/contact
