Crate retroshield_z80_workbench

Crate retroshield_z80_workbench 

Source
Expand description

RetroShield Z80 Workbench

A framework for building Z80 ROMs for RetroShield projects.

§Example

use retroshield_z80_workbench::prelude::*;

let mut rom = CodeGen::new();

// Setup
rom.label("start");
rom.ld_sp(0x3FFF);
rom.di();

// Include standard I/O
rom.emit_io_routines();
rom.emit_terminal_routines();
rom.emit_math_routines();

// Your code here
rom.label("main");
rom.call("clear_screen");
rom.ld_hl_label("hello_msg");
rom.call("print_string");
rom.jp("main");

// Data
rom.label("hello_msg");
rom.emit_string("Hello, RetroShield!\r\n");

// Finalize and write
rom.resolve_fixups();
rom.write_bin("output.bin").unwrap();

§Module Structure

  • codegen - Core emit/label/fixup machinery
  • instructions - Z80 instruction helpers
  • stdlib::io - MC6850 serial I/O routines
  • stdlib::terminal - VT100/ANSI terminal sequences
  • stdlib::math - Number conversion and math routines

Modules§

prelude
Prelude - import this for convenient access to common types
stdlib
Standard library routines for RetroShield Z80 projects

Structs§

CodeGen
Core code generator
RomConfig
Configuration for ROM generation