#olympia #derive #macro-derive #instructions #emulation #cycle #accurate

macro olympia_derive

Olympia is a gameboy emulator and toolkit, intended to run as a native or web assembly application targeting a cycle count accurate emulation. olympia_derive provides a couple of proc macros used for olympia implementation.

1 unstable release

0.3.0 May 10, 2020

#27 in #accurate


Used in 3 crates (via olympia_engine)

GPL-3.0-or-later

86KB
2K SLoC

olympia_derive

olympia_derive currently provides one derive macro, OlympiaInstruction.

A usage example for a two argument instruction is below:

#[derive(OlympiaInstruction)]
#[olympia(
    opcode=0x00AA_A111,
    label="LD", 
    excluded(0b1010_1100)
)]
struct LoadRegisterConstant8 {
    #[olympia(dest, mask=0xA)]
    dest: ByteRegisterLookup,
    #[olympia(src)]
    src: u8,
}

A usage example for one argument instruction is below:

#[derive(OlympiaInstruction)]
#[olympia(
    opcode=0x110A_A000, 
    label="RET", 
)]
struct ReturnIf {
    #[olympia(single, mask=0xA)]
    dest: ByteRegisterLookup,
}

A usage example for no argument instruction is below:

#[derive(OlympiaInstruction)]
#[olympia(
    opcode=0x1100_1001, 
    label="RET", 
)]
struct ReturnIf;

Dependencies

~335–790KB
~18K SLoC