zeerust/examples/
mod.rs

1/// Calculates fizzbuzz (assembly)
2pub const FIZZBUZZ_ASM: &str = include_str!("fizzbuzz.asm");
3/// Calculates fizzbuzz (machine code)
4pub const FIZZBUZZ_BIN: &[u8] = include_bytes!("fizzbuzz.bin");
5
6/// Print ZEERUST using a hand-unrolled loop (assembly)
7pub const HELLO_ZEERUST_ASM: &str = include_str!("zeerust.asm");
8/// Print ZEERUST using a hand-unrolled loop (machine code)
9pub const HELLO_ZEERUST_BIN: &[u8] = include_bytes!("zeerust.bin");
10
11/// Print Hello World using a loop (assembly)
12pub const HELLO_WORLD_ASM: &str = include_str!("hello_world.asm");
13/// Print Hello World using a loop (machine code)
14pub const HELLO_WORLD_BIN: &[u8] = include_bytes!("hello_world.bin");
15
16/// Count down from 9 to 1 (assembly)
17pub const COUNTDOWN_ASM: &str = include_str!("countdown.asm");
18/// Count down from 9 to 1 (machine code)
19pub const COUNTDOWN_BIN: &[u8] = include_bytes!("countdown.bin");
20
21/// Example is a named z80 program, along with its associated assembly.
22pub struct Example {
23    pub name: &'static str,
24    pub assembly: &'static str,
25    pub binary: &'static [u8],
26}
27
28pub const EXAMPLES: &[Example] = &[
29    Example {
30        name: "fizzbuzz",
31        assembly: FIZZBUZZ_ASM,
32        binary: FIZZBUZZ_BIN,
33    },
34    Example {
35        name: "hello zeerust",
36        assembly: HELLO_ZEERUST_ASM,
37        binary: HELLO_ZEERUST_BIN,
38    },
39    Example {
40        name: "hello world",
41        assembly: HELLO_WORLD_ASM,
42        binary: HELLO_WORLD_BIN,
43    },
44    Example {
45        name: "countdown",
46        assembly: COUNTDOWN_ASM,
47        binary: COUNTDOWN_BIN,
48    },
49];