Skip to content
forked from arwn/corewar

Virtual machine and assembler for Corewar game

Notifications You must be signed in to change notification settings

acarlson99/corewar

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Corewar

image

Corewar is a game that consists of making small assembly programs fight in a virtual machine. Each program has a small (and confusing!) instruction set. Every number of cycles each thread must call live or it will be culled. The last player to call live wins.

Resources

  • Subject pdfs in resources
  • Sample assembler, VM, champions in resources/vm_champs
  • 42 Corewar cookbook

Building

Build glfw and glew by running make deps. Then run make to compile and link both corewar and the assembler.

Assembler

Usage

./asm file.s        # assembles asm file and writes to file.cor
./asm -d file.cor   # disassembles binary and writes to file.s

Virtual Machine

Usage

./corewar -abcd:hlnpv: [files.cor, ...]
  -a    enable the `aff' instruction
  -b	run GUI in background
  -c    enable color
  -d[n] dump the vm's core memory after `n' cycles
  -h    show help
  -l    pause at the end of execution to allow for leak checking
  -n    disable gui mode
  -p    dump the processes
  -v[n] enable verbose output

Debug

  • Step: Steps forward one cycle.
  • Walk: Steps until a process executes an instruction.
  • Run: Runs the program until there is a winner.
  • Slider: Change execution speed.
  • Reset: Reset the state of the vm and unload every program.

Open

  • Open File: Opens .cor files at the specified location and opens any other file in the Edit window.
  • Save: Writes the contents of the Edit buffer to the specified file.
  • Compile: Compiles the contents of the Edit buffer and writes the result to the specified file.
  • Decompile: Decompiles the specified .cor file and loads the result into the Edit buffer.

Edit

An editable text buffer used for writing corewar assembly files

Graph

Shows instruction execution frequency.

About

Virtual machine and assembler for Corewar game

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • C 91.6%
  • HTML 3.0%
  • Assembly 2.1%
  • Objective-C 1.7%
  • CMake 0.5%
  • Perl 0.4%
  • Other 0.7%