commit a7f58b3128f2cab36f403374544736b04fe4fb6e Author: aprzn Date: Wed Aug 30 20:26:35 2023 -0400 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..a4b2e16 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "zing" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..4db0a55 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "zing" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..8cd17b0 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,49 @@ +#![allow(dead_code)] + +// see §11 (page 61) of the spec +#[repr(usize)] +enum HeaderFields { + Version = 0x0, + Flags1, + HighMemoryStartAddr = 0x4, + PCInitValAddr = 0x6, + DictionaryAddr = 0x8, + ObjectTableAddr = 0xA, + GlobalsTableAddr = 0xC, + StaticMemoryStartAddr = 0xE, + Flags2 = 0x10, + AbbreviationsTableaddr = 0x18, + FileLength = 0x1A, // divided by a constant; see §11.1.6 + FileChecksum = 0x1C, + InterpreterNumber = 0x1E, + InterpreterVersion = 0x1F, + ScreenHeightChars = 0x20, + ScreenWidthChars = 0x21, + ScreenHeightUnits = 0x22, + ScreenWidthUnits = 0x24, + FontWidthUnits = 0x26, + FontHeightUnits = 0x27, + BackgroundColor = 0x2C, + ForegroundColor = 0x2D, + TerminatingCharsTableAddr = 0x2E, + RevisionNumber = 0x32, + AlphabetTableAddr = 0x34, + HeaderExtensionTableAddr = 0x36, +} + +// note: this is a table of words, unlike the regular header which is all bytes +#[repr(usize)] +enum ExtensionTableFields { + TableLength = 0, + MouseXAfterClick = 1, + MouseYAfterClick = 2, + UnicodeTranslationTableAddr = 3, +} + +struct ZMachine5 { + memory: Box<[u8]>, +} + +fn main() { + println!("Hello, world!"); +} diff --git a/z-spec10.pdf b/z-spec10.pdf new file mode 100644 index 0000000..67e4945 Binary files /dev/null and b/z-spec10.pdf differ