Skip to content

5iri/conway-in-asm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conway's Game of Life in RISC-V Assembly

This project implements Conway's Game of Life on an 8x8 grid, written in RISC-V assembly. The simulation runs in a terminal emulator that supports VT100 escape codes, animating the evolution of the grid in real time.

Features

  • 8x8 grid with a glider pattern as the initial state
  • True Conway's Game of Life rules (birth, survival, death)
  • Uses VT100 escape codes to animate the grid in-place
  • Adjustable delay for animation speed
  • No dependencies beyond a RISC-V simulator (e.g., spike, QEMU)

Files

  • conway.S — Main source file with the Game of Life logic and animation loop
  • Makefile — Build and run targets for your RISC-V toolchain

How It Works

  • The program prints an intro and saves the cursor position.
  • It repeatedly restores the cursor, prints the current grid, waits, computes the next generation, and repeats.
  • The grid is updated in-place using a temporary buffer for the next generation.
  • The animation continues indefinitely.

Usage

The Makefile expects you to tell it which assembly file to build via FILE=<source.s>.

  1. Build (example uses the main program):
    make FILE=conway.S
  2. Run with spike:
    make run FILE=conway.S
  3. View a disassembly in less:
    make dump FILE=conway.S
  4. Clean generated artifacts for that file:
    make clean FILE=conway.S

Swap conway.S for any other .s/.S file you want to assemble (e.g., grid.s, invert.s). Override the toolchain prefix if needed, e.g. make RISCV_PREFIX=riscv64-linux-gnu FILE=conway.S.

Customization

  • Initial Pattern: Edit the grid in the .data section of conway.S.
  • Animation Speed: Change the DELAY_CYCLES constant in conway.S.

Requirements

  • RISC-V toolchain (assembler, linker, and simulator)
  • Terminal emulator with VT100 support (for cursor movement)

License

MIT License. See LICENSE file if present.


Inspired by classic cellular automata and low-level programming fun!

About

game of life in riscv assembly

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published