Compare commits

...

5 Commits

39 changed files with 13576 additions and 1793 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
/target /target
log log
george.o george.o
Cargo.lock
.DS_Store .DS_Store
*.bin *.bin
/result /result

882
Cargo.lock generated
View File

@ -1,882 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "anyhow"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
[[package]]
name = "autocfg"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
[[package]]
name = "bumpalo"
version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "cc"
version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2755ff20a1d93490d26ba33a6f092a38a508398a5320df5d4b3014fcccce9410"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "console_error_panic_hook"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
dependencies = [
"cfg-if",
"wasm-bindgen",
]
[[package]]
name = "dlib"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
dependencies = [
"libloading",
]
[[package]]
name = "downcast-rs"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
[[package]]
name = "equivalent"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "fastrand"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
[[package]]
name = "futures"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0"
dependencies = [
"futures-channel",
"futures-core",
"futures-executor",
"futures-io",
"futures-sink",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-channel"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"
dependencies = [
"futures-core",
"futures-sink",
]
[[package]]
name = "futures-core"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
[[package]]
name = "futures-executor"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d"
dependencies = [
"futures-core",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-io"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
[[package]]
name = "futures-macro"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "futures-sink"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5"
[[package]]
name = "futures-task"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
[[package]]
name = "futures-util"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
dependencies = [
"futures-channel",
"futures-core",
"futures-io",
"futures-macro",
"futures-sink",
"futures-task",
"memchr",
"pin-project-lite",
"pin-utils",
"slab",
]
[[package]]
name = "georgeemu"
version = "0.1.0"
dependencies = [
"anyhow",
"console_error_panic_hook",
"minifb",
"serde",
"termion",
"toml",
"web-sys",
]
[[package]]
name = "hashbrown"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
[[package]]
name = "indexmap"
version = "2.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
dependencies = [
"equivalent",
"hashbrown",
]
[[package]]
name = "instant"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222"
dependencies = [
"cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "itoa"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]]
name = "js-sys"
version = "0.3.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "lazy_static"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
version = "0.2.155"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
[[package]]
name = "libloading"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d"
dependencies = [
"cfg-if",
"windows-targets",
]
[[package]]
name = "libredox"
version = "0.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607"
dependencies = [
"bitflags 2.5.0",
"libc",
"redox_syscall",
]
[[package]]
name = "linux-raw-sys"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
[[package]]
name = "log"
version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
[[package]]
name = "memchr"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "memoffset"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
dependencies = [
"autocfg",
]
[[package]]
name = "minifb"
version = "0.27.0"
source = "git+https://github.com/augustkline/rust_minifb#2e2fdcf1d692c8c3d827a221a66569d81c73f99a"
dependencies = [
"cc",
"console_error_panic_hook",
"dlib",
"futures",
"instant",
"js-sys",
"lazy_static",
"libc",
"orbclient",
"raw-window-handle",
"serde",
"serde_derive",
"tempfile",
"wasm-bindgen",
"wasm-bindgen-futures",
"wayland-client",
"wayland-cursor",
"wayland-protocols",
"web-sys",
"winapi",
"x11-dl",
]
[[package]]
name = "nix"
version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069"
dependencies = [
"bitflags 1.3.2",
"cfg-if",
"libc",
"memoffset",
]
[[package]]
name = "numtoa"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
[[package]]
name = "once_cell"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "orbclient"
version = "0.3.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52f0d54bde9774d3a51dcf281a5def240c71996bc6ca05d2c847ec8b2b216166"
dependencies = [
"libc",
"libredox",
"sdl2",
"sdl2-sys",
]
[[package]]
name = "pin-project-lite"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
[[package]]
name = "proc-macro2"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
dependencies = [
"proc-macro2",
]
[[package]]
name = "raw-window-handle"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
[[package]]
name = "redox_syscall"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "redox_termios"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20145670ba436b55d91fc92d25e71160fbfbdd57831631c8d7d36377a476f1cb"
[[package]]
name = "rustix"
version = "0.38.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
dependencies = [
"bitflags 2.5.0",
"errno",
"libc",
"linux-raw-sys",
"windows-sys",
]
[[package]]
name = "ryu"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
[[package]]
name = "scoped-tls"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
[[package]]
name = "sdl2"
version = "0.35.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7959277b623f1fb9e04aea73686c3ca52f01b2145f8ea16f4ff30d8b7623b1a"
dependencies = [
"bitflags 1.3.2",
"lazy_static",
"libc",
"sdl2-sys",
]
[[package]]
name = "sdl2-sys"
version = "0.35.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3586be2cf6c0a8099a79a12b4084357aa9b3e0b0d7980e3b67aaf7a9d55f9f0"
dependencies = [
"cfg-if",
"libc",
"version-compare",
]
[[package]]
name = "serde"
version = "1.0.203"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.203"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_json"
version = "1.0.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad"
dependencies = [
"itoa",
"memchr",
"ryu",
"serde",
]
[[package]]
name = "serde_spanned"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0"
dependencies = [
"serde",
]
[[package]]
name = "slab"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
dependencies = [
"autocfg",
]
[[package]]
name = "smallvec"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "syn"
version = "2.0.67"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff8655ed1d86f3af4ee3fd3263786bc14245ad17c4c7e85ba7187fb3ae028c90"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "tempfile"
version = "3.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
dependencies = [
"cfg-if",
"fastrand",
"rustix",
"windows-sys",
]
[[package]]
name = "termion"
version = "4.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ccce68e518d1173e80876edd54760b60b792750d0cab6444a79101c6ea03848"
dependencies = [
"libc",
"libredox",
"numtoa",
"redox_termios",
]
[[package]]
name = "toml"
version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "toml_datetime"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.22.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
]
[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "version-compare"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
[[package]]
name = "wasm-bindgen"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
dependencies = [
"cfg-if",
"once_cell",
"serde",
"serde_json",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0"
dependencies = [
"cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
[[package]]
name = "wayland-client"
version = "0.29.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715"
dependencies = [
"bitflags 1.3.2",
"downcast-rs",
"libc",
"nix",
"scoped-tls",
"wayland-commons",
"wayland-scanner",
"wayland-sys",
]
[[package]]
name = "wayland-commons"
version = "0.29.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902"
dependencies = [
"nix",
"once_cell",
"smallvec",
"wayland-sys",
]
[[package]]
name = "wayland-cursor"
version = "0.29.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661"
dependencies = [
"nix",
"wayland-client",
"xcursor",
]
[[package]]
name = "wayland-protocols"
version = "0.29.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6"
dependencies = [
"bitflags 1.3.2",
"wayland-client",
"wayland-commons",
"wayland-scanner",
]
[[package]]
name = "wayland-scanner"
version = "0.29.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53"
dependencies = [
"proc-macro2",
"quote",
"xml-rs",
]
[[package]]
name = "wayland-sys"
version = "0.29.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4"
dependencies = [
"dlib",
"lazy_static",
"pkg-config",
]
[[package]]
name = "web-sys"
version = "0.3.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
[[package]]
name = "windows_i686_gnu"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
[[package]]
name = "windows_i686_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
[[package]]
name = "winnow"
version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1"
dependencies = [
"memchr",
]
[[package]]
name = "x11-dl"
version = "2.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f"
dependencies = [
"libc",
"once_cell",
"pkg-config",
]
[[package]]
name = "xcursor"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a0ccd7b4a5345edfcd0c3535718a4e9ff7798ffc536bb5b5a0e26ff84732911"
[[package]]
name = "xml-rs"
version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193"

View File

@ -2,27 +2,28 @@
name = "georgeemu" name = "georgeemu"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
build = "build.rs"
[[bin]] [[target.'cfg(not(target_arch = "wasm32"))'.bin]]
path = "src/bin/main.rs" path = "src/bin/main.rs"
name = "georgeemu" name = "george"
[target.'cfg(target_arch = "wasm32")'.lib] [target.'cfg(target_arch = "wasm32")'.lib]
crate-type = ["cdylib", "rlib"] crate-type = ["cdylib", "rlib"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
bdf-parser = "0.1.0"
[dependencies] [dependencies]
anyhow = "1.0.81" anyhow = "1.0.81"
minifb = { git = "https://github.com/augustkline/rust_minifb" } minifb = { git = "https://github.com/emoon/rust_minifb" }
serde = { version = "1.0.197", features = ["serde_derive", "derive"] } serde = { version = "1.0.197", features = ["serde_derive", "derive"] }
web-sys = "0.3.70"
[target.'cfg(target_arch = "wasm32")'.dependencies] [target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.7" console_error_panic_hook = "0.1.7"
minifb = { git = "https://github.com/augustkline/rust_minifb", features = [ web-sys = "0.3.70"
"web",
] }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
termion = "4.0.2" termion = "4.0.2"

83
build.rs Normal file
View File

@ -0,0 +1,83 @@
use std::{
env,
fs::File,
io::{stdin, stdout, IsTerminal, Read, Write},
ops::Neg,
os::unix::process::CommandExt,
path::Path,
process::{exit, Command},
};
// takes all charaters in bdf and returns a vec of each character row byte in order, normalized to
// width & height of the font (only works with 8 or fewer pixel wide fonts, should work for any height)
fn bdf_to_bitmap(mut bdf: File) -> [u8; 0x8000] {
let mut bdf_font_bytes = Vec::new();
bdf.read_to_end(&mut bdf_font_bytes).unwrap();
let bdf_font = bdf_parser::BdfFont::parse(&bdf_font_bytes).unwrap();
let mut bdf_vec = vec![];
for glyph in bdf_font.glyphs.iter() {
let glyph_offset_x = glyph.bounding_box.offset.x;
let glyph_offset_y = glyph.bounding_box.offset.y;
let glyph_height = glyph.bounding_box.size.y;
let font_height = bdf_font.metadata.bounding_box.size.y;
let font_offset_y = bdf_font.metadata.bounding_box.offset.y;
let top_space = font_height + font_offset_y - glyph_height - glyph_offset_y;
for _ in 0..top_space {
bdf_vec.push(0x00);
}
for bitmap in glyph.bitmap.iter() {
bdf_vec.push(bitmap >> glyph_offset_x);
}
let bottom_space = font_offset_y.neg() + glyph_offset_y;
for _ in 0..bottom_space {
bdf_vec.push(0x00);
}
}
let height = bdf_font.metadata.bounding_box.size.y as usize;
reorder_bitmap(&bdf_vec, height)
}
// takes an vec of ordered characters and translates them for use with the character rom
// TODO: make this work for any arbitrary char rom pin format using some kinda interface
fn reorder_bitmap(bitmap: &[u8], font_height: usize) -> [u8; 0x8000] {
let mut rom = [0; 0x8000]; // create vec the size of character rom
for row in 0..font_height {
for ascii_address in 0..u8::MAX {
// first 8 bits of address pick character
// next 5 bits pick row
// TODO: final 2 pick character set
let byte = bitmap[ascii_address as usize * font_height + row];
let rom_index: u16 = ((row as u16) << 8) + ascii_address as u16;
rom[rom_index as usize] = byte;
}
}
rom
}
fn rom_from_file<P>(path: P) -> [u8; 0x8000]
where
P: AsRef<Path>,
{
let file = File::open(path).unwrap();
bdf_to_bitmap(file)
}
fn main() {
let mut regen_font = Command::new("regen-font.sh");
let mut cleanup = Command::new("cleanup.sh");
regen_font.exec();
let out_dir = env::var_os("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("cozette.rom");
let cozette_rom_bytes = rom_from_file("build/cozette.bdf");
let mut cozette_rom = File::create(dest_path).unwrap();
cozette_rom.write_all(&cozette_rom_bytes).unwrap();
cleanup.exec();
}

File diff suppressed because it is too large Load Diff

3
build/cleanup.sh.old Executable file
View File

@ -0,0 +1,3 @@
#! /bin/sh
rm *.bdf*

3903
build/cozette-13.bdf-e Normal file

File diff suppressed because it is too large Load Diff

3903
build/cozette.bdf Normal file

File diff suppressed because it is too large Load Diff

3903
build/cozette.bdf-e Normal file

File diff suppressed because it is too large Load Diff

523
build/georgeencoding.txt Normal file
View File

@ -0,0 +1,523 @@
# this is georgescii, august's version of extended ascii for george <3
# we're limited to 255 characters
# format: ascii byte, unicode hex, # unicode name
#
# format: three tab-separated columns
# column #1 is the ISO/IEC 8859-1 code (in hex as 0xXX)
# column #2 is the Unicode (in hex as 0xXXXX)
# column #3 the Unicode name (follows a comment sign, '#')
# 0x00 0x00 #
# 0x01 0x2591 # ░
# 0x02 0x2592 # ▒
# 0x03 0x2593 # ▓
# 0x04 0x2661 # ♡
# 0x05 0x2665 # ♥
# 0x06 0x2B50 # ⭐
# 0x07 0x272D # ✭
# 0x08 0xF005 # 
# 0x09 0x2726 # ✦
# 0x0a 0x2728 # ✨
# 0x0b 0x2640 # ♀
# 0x0c 0x2642 # ♂
# 0x0d 0x26A2 # ⚢
# 0x0E 0x26A3 # ⚣
# 0x0F 0x26A5 # ⚥
# 0x10 0x2669 # ♩
# 0x11 0x266A # ♪
# 0x12 0x266B # ♫
# 0x13 0x266C # ♬
# 0x14 0xFC5D # ﱝ
# 0x15 0xF026 # 
# 0x16 0xF027 # 
# 0x17 0xF028 # 
# 0x18 0xFA7E # 奄
# 0x19 0xFA7F # 奔
# 0x1A 0xFA80 # 婢
# 0x1B 0xFC5C # ﱜ
# 0x1C 0xFC5B # ﱛ
# 0x1D 0xF0AC # 
# 0x1E 0xF04B # 
# 0x1F 0xF04D # 
# 0x20 0x0020 #
# 0x21 0x0021 # !
# 0x22 0x0022 # "
# 0x23 0x0023 # #
# 0x24 0x0024 # $
# 0x25 0x0025 # %
# 0x26 0x0026 # &
# 0x27 0x0027 # '
# 0x28 0x0028 # (
# 0x29 0x0029 # )
# 0x2A 0x002A # *
# 0x2B 0x002B # +
# 0x2C 0x002C # ,
# 0x2D 0x002D # -
# 0x2E 0x002E # .
# 0x2F 0x002F # /
# 0x30 0x0030 # 0
# 0x31 0x0031 # 1
# 0x32 0x0032 # 2
# 0x33 0x0033 # 3
# 0x34 0x0034 # 4
# 0x35 0x0035 # 5
# 0x36 0x0036 # 6
# 0x37 0x0037 # 7
# 0x38 0x0038 # 8
# 0x39 0x0039 # 9
# 0x3A 0x003A # :
# 0x3B 0x003B # ;
# 0x3C 0x003C # <
# 0x3D 0x003D # =
# 0x3E 0x003E # >
# 0x3F 0x003F # ?
# 0x40 0x0040 # @
# 0x41 0x0041 # A
# 0x42 0x0042 # B
# 0x43 0x0043 # C
# 0x44 0x0044 # D
# 0x45 0x0045 # E
# 0x46 0x0046 # F
# 0x47 0x0047 # G
# 0x48 0x0048 # H
# 0x49 0x0049 # I
# 0x4A 0x004A # J
# 0x4B 0x004B # K
# 0x4C 0x004C # L
# 0x4D 0x004D # M
# 0x4E 0x004E # N
# 0x4F 0x004F # O
# 0x50 0x0050 # P
# 0x51 0x0051 # Q
# 0x52 0x0052 # R
# 0x53 0x0053 # S
# 0x54 0x0054 # T
# 0x55 0x0055 # U
# 0x56 0x0056 # V
# 0x57 0x0057 # W
# 0x58 0x0058 # X
# 0x59 0x0059 # Y
# 0x5A 0x005A # Z
# 0x5B 0x005B # [
# 0x5C 0x005C # \
# 0x5D 0x005D # ]
# 0x5E 0x005E # ^
# 0x5F 0x005F # _
# 0x60 0x0060 # `
# 0x61 0x0061 # a
# 0x62 0x0062 # b
# 0x63 0x0063 # c
# 0x64 0x0064 # d
# 0x65 0x0065 # e
# 0x66 0x0066 # f
# 0x67 0x0067 # g
# 0x68 0x0068 # h
# 0x69 0x0069 # i
# 0x6A 0x006A # j
# 0x6B 0x006B # k
# 0x6C 0x006C # l
# 0x6D 0x006D # m
# 0x6E 0x006E # n
# 0x6F 0x006F # o
# 0x70 0x0070 # p
# 0x71 0x0071 # q
# 0x72 0x0072 # r
# 0x73 0x0073 # s
# 0x74 0x0074 # t
# 0x75 0x0075 # u
# 0x76 0x0076 # v
# 0x77 0x0077 # w
# 0x78 0x0078 # x
# 0x79 0x0079 # y
# 0x7A 0x007A # z
# 0x7B 0x007B # {
# 0x7C 0x007C # |
# 0x7D 0x007D # }
# 0x7E 0x007E # ~
# 0x7F 0x2500 # ─
# 0x80 0x2502 # │
# 0x81 0x250C # ┌
# 0x82 0x2514 # └
# 0x83 0x251C # ├
# 0x84 0x2524 # ┤
# 0x85 0x252C # ┬
# 0x86 0x2534 # ┴
# 0x87 0x253C # ┼
# 0x88 0x256D # ╭
# 0x89 0x256E # ╮
# 0x8A 0x256F # ╯
# 0x8B 0x2570 # ╰
# 0x8C 0x2571 #
# 0x8D 0x2572 # ╲
# 0x8E 0x2573 #
# 0x8F 0x2550 # ═
# 0x90 0x2551 # ║
# 0x91 0x2554 # ╔
# 0x92 0x2557 # ╗
# 0x93 0x255a # ╚
# 0x94 0x255D # ╝
# 0x95 0x2560 # ╠
# 0x96 0x2563 # ╣
# 0x97 0x2566 # ╦
# 0x98 0x2569 # ╩
# 0x99 0x256C # ╬
# 0x9A 0xF04E # 
# 0x9B 0xF050 # 
# 0x9C 0xF051 # 
# 0x9D 0xF052 # 
# 0x9E 0xF048 # 
# 0x9F 0xE0B0 # 
# 0xA0 0xE0B2 # 
# 0xA1 0xE0B4 # 
# 0xA2 0xE0B6 # 
# 0xA3 0xE0B8 # 
# 0xA4 0xE0BA # 
# 0xA5 0xE0BC # 
# 0xA6 0xE0BE # 
# 0xA7 0x2581 # ▁
# 0xA8 0x2582 # ▂
# 0xA9 0x2583 # ▃
# 0xAA 0x2584 # ▄
# 0xAB 0x2585 # ▅
# 0xAC 0x2586 # ▆
# 0xAD 0x2587 # ▇
# 0xAE 0x2588 # █
# 0xAF 0x2589 # ▉
# 0xB0 0x258A # ▊
# 0xB1 0x258B # ▋
# 0xB2 0x258C # ▌
# 0xB3 0x258D # ▍
# 0xB4 0x258E # ▎
# 0xB5 0x258F # ▏
# 0xB6 0x0295 # ʕ
# 0xB7 0x00B7 # ·
# 0xB8 0x1D25 # ᴥ
# 0xB9 0x0294 # ʔ
# 0xBA 0x2596 # ▖
# 0xBB 0x2597 # ▗
# 0xBC 0x2598 # ▘
# 0xBD 0x2599 # ▙
# 0xBE 0x259A # ▚
# 0xBF 0x259B # ▛
# 0xC0 0x259C # ▜
# 0xC1 0x259D # ▝
# 0xC2 0x259E # ▞
# 0xC3 0x259F # ▟
# 0xC4 0x2190 # ←
# 0xC5 0x2191 # ↑
# 0xC6 0x2192 # →
# 0xC7 0x2193 # ↓
# 0xC8 0x2B60 # ⭠
# 0xC9 0x2B61 # ⭡
# 0xCA 0x2B62 # ⭢
# 0xCB 0x2B63 # ⭣
# 0xCC 0x2B80 # ⮀
# 0xCD 0x2B81 # ⮁
# 0xCE 0x2B82 # ⮂
# 0xCF 0x2B83 # ⮃
# 0xD0 0xF049 # 
# 0xD1 0xF04A # 
# 0xD2 0x23F3 # ⏳
# 0xD3 0xF07B # 
# 0xD4 0xF07C # 
# 0xD5 0xF114 # 
# 0xD6 0xF115 # 
# 0xD7 0xF250 # 
# 0xD8 0xF251 # 
# 0xD9 0xF253 # 
# 0xDA 0xF254 # 
# 0xDB 0xF461 # 
# 0xDC 0xF016 # 
# 0xDD 0xF401 # 
# 0xDE 0x1F52E # 🔮
# 0xDF 0xF2DB # 
# 0xE0 0xF008 # 
# 0xE1 0x25C7 # ◇
# 0xE2 0x25C8 # ◈
# 0xE3 0x1F311 # 🌑
# 0xE4 0x1F312 # 🌒
# 0xE5 0x1F313 # 🌓
# 0xE6 0x1F314 # 🌔
# 0xE7 0x1F315 # 🌕
# 0xE8 0x1F316 # 🌖
# 0xE9 0x1F317 # 🌗
# 0xEA 0x1F318 # 🌘
# 0xEB 0xF04C # 
# 0xEC 0x2714 # ✔
# 0xED 0x2718 # ✘
# 0xEE 0x25C6 # ◆
# 0xEF 0xF15D # 
# 0xF0 0xF15E # 
# 0xF1 0xF071 # 
# 0xF2 0xF449 # 
# 0xF3 0xF529 # 
# 0xF4 0xF658 # 
# 0xF5 0xF659 # 
# 0xF6 0x1f381 # 🎁
# 0xF7 0xf05a # 
# 0xF8 0xf06a # 
# 0xF9 0xf834 # 
# 0xFA 0xf835 # 
# 0xFB 0x2690 # ⚐
# 0xFC 0x2691 # ⚑
# 0xFD 0xf8d7 # 
# 0xFE 0xf0e7 # 
# 0xFF 0xf7d9 # 
0x00 0x00 #
0x01 0x0295 # ʕ
0x02 0x00B7 # ·
0x03 0x1D25 # ᴥ
0x04 0x0294 # ʔ
0x05 0x2661 # ♡
0x06 0x2665 # ♥
0x07 0x2726 # ✦
0x08 0x25C7 # ◇
0x09 0x25C6 # ◆
0x0a 0x272D # ✭
0x0b 0xF005 # 
0x0c 0x2728 # ✨
0x0d 0x000d # CR
0x0e 0x2518 # ┘
0x0f 0x2514 # └
0x10 0x250c # ┌
0x11 0x2510 # ┐
0x12 0x2500 # ─
0x13 0x2502 # │
0x14 0x2524 # ┤
0x15 0x2534 # ┴
0x16 0x251C # ├
0x17 0x252C # ┬
0x18 0x253C # ┼
0x19 0x2571 #
0x1a 0x2572 # ╲
0x1b 0x2573 #
0x1c 0x2591 # ░
0x1d 0x2592 # ▒
0x1e 0x2593 # ▓
0x1f 0x2588 # █
0x20 0x0020 #
0x21 0x0021 # !
0x22 0x0022 # "
0x23 0x0023 # #
0x24 0x0024 # $
0x25 0x0025 # %
0x26 0x0026 # &
0x27 0x0027 # '
0x28 0x0028 # (
0x29 0x0029 # )
0x2a 0x002A # *
0x2b 0x002B # +
0x2c 0x002C # ,
0x2d 0x002D # -
0x2e 0x002E # .
0x2f 0x002F # /
0x30 0x0030 # 0
0x31 0x0031 # 1
0x32 0x0032 # 2
0x33 0x0033 # 3
0x34 0x0034 # 4
0x35 0x0035 # 5
0x36 0x0036 # 6
0x37 0x0037 # 7
0x38 0x0038 # 8
0x39 0x0039 # 9
0x3a 0x003A # :
0x3b 0x003B # ;
0x3c 0x003C # <
0x3d 0x003D # =
0x3e 0x003E # >
0x3f 0x003F # ?
0x40 0x0040 # @
0x41 0x0041 # A
0x42 0x0042 # B
0x43 0x0043 # C
0x44 0x0044 # D
0x45 0x0045 # E
0x46 0x0046 # F
0x47 0x0047 # G
0x48 0x0048 # H
0x49 0x0049 # I
0x4a 0x004A # J
0x4b 0x004B # K
0x4c 0x004C # L
0x4d 0x004D # M
0x4e 0x004E # N
0x4f 0x004F # O
0x50 0x0050 # P
0x51 0x0051 # Q
0x52 0x0052 # R
0x53 0x0053 # S
0x54 0x0054 # T
0x55 0x0055 # U
0x56 0x0056 # V
0x57 0x0057 # W
0x58 0x0058 # X
0x59 0x0059 # Y
0x5a 0x005A # Z
0x5b 0x005B # [
0x5c 0x005C # \
0x5d 0x005D # ]
0x5e 0x005E # ^
0x5f 0x005F # _
0x60 0x0060 # `
0x61 0x0061 # a
0x62 0x0062 # b
0x63 0x0063 # c
0x64 0x0064 # d
0x65 0x0065 # e
0x66 0x0066 # f
0x67 0x0067 # g
0x68 0x0068 # h
0x69 0x0069 # i
0x6a 0x006A # j
0x6b 0x006B # k
0x6c 0x006C # l
0x6d 0x006D # m
0x6e 0x006E # n
0x6f 0x006F # o
0x70 0x0070 # p
0x71 0x0071 # q
0x72 0x0072 # r
0x73 0x0073 # s
0x74 0x0074 # t
0x75 0x0075 # u
0x76 0x0076 # v
0x77 0x0077 # w
0x78 0x0078 # x
0x79 0x0079 # y
0x7a 0x007A # z
0x7b 0x007B # {
0x7c 0x007C # |
0x7d 0x007D # }
0x7e 0x007E # ~
0x7f 0x256F # ╯
0x80 0x2570 # ╰
0x81 0x256D # ╭
0x82 0x256E # ╮
0x83 0x255D # ╝
0x84 0x255a # ╚
0x85 0x2554 # ╔
0x86 0x2557 # ╗
0x87 0x2550 # ═
0x88 0x2551 # ║
0x89 0x2563 # ╣
0x8a 0x2569 # ╩
0x8b 0x2560 # ╠
0x8c 0x2566 # ╦
0x8d 0x256C # ╬
0x8e 0xE0B8 # 
0x8f 0xE0BA # 
0x90 0xE0BC # 
0x91 0xE0BE # 
0x92 0xE0B2 # 
0x93 0xE0B0 # 
0x94 0xE0B6 # 
0x95 0xE0B4 # 
0x96 0x2596 # ▖
0x97 0x2597 # ▗
0x98 0x2598 # ▘
0x99 0x2599 # ▙
0x9a 0x259A # ▚
0x9b 0x259B # ▛
0x9c 0x259C # ▜
0x9d 0x259D # ▝
0x9e 0x259E # ▞
0x9f 0x259F # ▟
0xa0 0x2581 # ▁
0xa1 0x2582 # ▂
0xa2 0x2583 # ▃
0xa3 0x2584 # ▄
0xa4 0x2585 # ▅
0xa5 0x2586 # ▆
0xa6 0x2587 # ▇
0xa7 0x2589 # ▉
0xa8 0x258A # ▊
0xa9 0x258B # ▋
0xaa 0x258C # ▌
0xab 0x258D # ▍
0xac 0x258E # ▎
0xad 0x258F # ▏
0xae 0x1F311 # 🌑
0xaf 0x1F312 # 🌒
0xb0 0x1F313 # 🌓
0xb1 0x1F314 # 🌔
0xb2 0x1F315 # 🌕
0xb3 0x1F316 # 🌖
0xb4 0x1F317 # 🌗
0xb5 0x1F318 # 🌘
0xb6 0xF254 # 
0xb7 0xF251 # 
0xb8 0x23F3 # ⏳
0xb9 0xF253 # 
0xba 0xF250 # 
0xbb 0x2190 # ←
0xbc 0x2191 # ↑
0xbd 0x2192 # →
0xbe 0x2193 # ↓
0xbf 0x2B60 # ⭠
0xc0 0x2B61 # ⭡
0xc1 0x2B62 # ⭢
0xc2 0x2B63 # ⭣
0xc3 0x2B80 # ⮀
0xc4 0x2B81 # ⮁
0xc5 0x2B82 # ⮂
0xc6 0x2B83 # ⮃
0xc7 0xF049 # 
0xc8 0xF04A # 
0xc9 0xF048 # 
0xca 0xF04B # 
0xcb 0xF04C # 
0xcc 0xF04D # 
0xcd 0xF052 # 
0xce 0xF051 # 
0xcf 0xF04E # 
0xd0 0xF050 # 
0xd1 0xFC5D # ﱝ
0xd2 0xF026 # 
0xd3 0xF027 # 
0xd4 0xF028 # 
0xd5 0xFA80 # 婢
0xd6 0xFC5C # ﱜ
0xd7 0xFC5B # ﱛ
0xd8 0x2669 # ♩
0xd9 0x266A # ♪
0xda 0x266B # ♫
0xdb 0x266C # ♬
0xdc 0xF016 # 
0xdd 0xF07B # 
0xde 0xF07C # 
0xdf 0xF114 # 
0xe0 0xF115 # 
0xe1 0xF15D # 
0xe2 0xF15E # 
0xe3 0xF529 # 
0xe4 0xF071 # 
0xe5 0xF449 # 
0xe6 0xf05a # 
0xe7 0xF659 # 
0xe8 0xF658 # 
0xe9 0xf835 # 
0xea 0xf834 # 
0xeb 0x2690 # ⚐
0xec 0x2691 # ⚑
0xed 0xf7d9 # 
0xee 0x2714 # ✔
0xef 0x2718 # ✘
0xf0 0xf0e7 # 
0xf1 0xF2DB # 
0xf2 0xF008 # 
0xf3 0xF461 # 
0xf4 0x2B50 # ⭐
0xf5 0xF401 # 
0xf6 0x1F52E # 🔮
0xf7 0x1f381 # 🎁
0xf8 0xf8d7 # 
0xf9 0xF0AC # 
0xfa 0x25C8 # ◈
0xfb 0x2640 # ♀
0xfc 0x2642 # ♂
0xfd 0x26A2 # ⚢
0xfe 0x26A3 # ⚣
0xff 0x26A5 # ⚥

5
build/regen-font.sh Executable file
View File

@ -0,0 +1,5 @@
#! /bin/sh
fontforge -lang=ff -c 'Open($1); LoadEncodingFile($2, "george"); Reencode("george"); Generate($3)' Cozette.sfd georgeencoding.txt cozette.bdf
sed -i'' -e 's/FONTBOUNDINGBOX 11 13 0 -3/FONTBOUNDINGBOX 8 13 0 -3/' *.bdf
mv cozette-13.bdf cozette.bdf

11
roms/bbr.asm Normal file
View File

@ -0,0 +1,11 @@
.org $00
.byte $80
.org $8000
reset:
bbr7 $00, reset
.org $fffc
.word reset

BIN
roms/bbr.rom Normal file

Binary file not shown.

BIN
roms/cozette.rom.old Normal file

Binary file not shown.

View File

@ -37,7 +37,8 @@ newline: ; sets cursor to start of next line
rts rts
text: text:
.asciiz "george loves u <3" .byte 1,2,3,2,4
.asciiz "- george loves u <3"
random_y: random_y:
.byte 25,12,0,20,4,25,5,13 .byte 25,12,0,20,4,25,5,13

Binary file not shown.

189
roms/george.asm Normal file
View File

@ -0,0 +1,189 @@
; .setcpu "65C02"
.include "./macro.inc"
; okay so rn i wanna set up a very basic system init, and write a few subroutines to draw characters at x,y coordinates
n = $01 ; temporary storage for data stack operations
key_row = $200 ; used for character lookup when key pressed
key_col = $201
cursor = $202
char_buffer = $300 ; 256 byte character buffer
kb_row = $4400 ; keyboard hardware register
kb_row_cache = $203 ; cache
.org $8000
reset:
sei
ldx #0; initialize data stack pointer
initdisplay:
lda #0
ldy #0
cleardisplay:
sta $6000,y
sta $6100,y
sta $6200,y
sta $6300,y
sta $6400,y
sta $6500,y
sta $6600,y
sta $6700,y ; this goes slightly over but it's fine
iny
bne cleardisplay
cli
print_test:
lda #0
sta key_row
lda #5
sta key_col
push_coords #5, #5
main:
; jsr printtext
; key_zero:
; stz keyboard_cache, x
; dex
; bpl key_zero
; fim:
; cli
; bra fim
jsr print
; jsr print
stp
jmp main
; keyboard: ; reads keyboard registers and stores the column and row of the first key found
; ; TODO: make this routine store up to 8 indices (for 8 key rollover)
; ldy #0
; .check_row: ; loop through each row
; lda kb_row, y
; beq .skip_row ; if row has no key pressed, skip checking which key
; ; jmp key_down
; sta kb_row_cache, y ; if key pressed, cache it
; lda kb_row, y
; cmp kb_row_cache, y ; has key changed?
; beq key_down
; .skip_row:
; iny
; cpy #5
; bne .check_row
; rts
; key_down: ; a is loaded with the row byte
; phy
; sty key_row ; store character row
; ldy #0
; .find_col: ; test each row bit, store column if key pressed
; lsr ; test bit 7
; bcs store_col ; if unset, don't go store character columnb
; .skip:
; iny
; cpy #8
; bne .find_col ; loop until we've checked each bit
; rts
; store_col:
; sty key_col
; jsr print
; rts
print: ; x y -- prints the key indexed with key_col and key_row at position x, y
keymap_index:
push
lda key_col
stz 1, x
sta 0, x
push
lda #8
stz 1, x
sta 0, x
push
lda key_row
stz 1, x
sta 0, x
jsr mult
jsr plus
lda 0, x
tay
lda keymap, y
push
sta 0, x
stz 1, x
jsr draw_char
rts
keymap:
.byte "?outrew?"
.byte "?piygsq?"
.byte "a??khvd?"
.byte "42ljbfz?"
.byte "31?mncx?"
.byte "????? m"
draw:
; push_coords #0, #0
; push_char #$00
; jsr draw_char
rts
draw_char: ; draw a character c at (x, y) (n1: x n2: y n3: c -- )
lda 0, x ; load a with character to draw
pop ; and pop it off the stack
jsr get_char_address ; calculate where to put the character in memory
sta (0, x) ; store a at the address pointed to on the stack
rts
get_char_address: ; gets vram address for a character at (x, y),
; (n1: x n2: y -- n: $6000 + x + (64 * y))
;jsr push_lit ; push 64 onto stack, low byte first
;.byte 64
;.byte 0
pha
lda #64
push ; doing this instead until `push_lit` is fixed
sta 0, x
stz 1, x
jsr mult ; multiply 64 with y (n2)
jsr plus ; add result with x (n1)
;jsr push_lit ; push vram address onto the stack
;.byte $00
;.byte $60
lda #$60
push
sta 1, x
stz 0, x
jsr plus ; add vram start address to result
pla
rts
fill: ; fills an area from (x1, y1) to (x2, y2) will character c, (n1: c n2: x1 n3: y1 n4: x2 n5: y2 -- )
jsr get_char_address
isr: ; interrupt service routine
pha
phx
phy
; jsr keyboard
ply
plx
pla
rti
.include "math.inc"
.org $fffc
.word reset
.word isr

BIN
roms/keyboard.rom Normal file

Binary file not shown.

215
roms/keyboard_sys.asm Normal file
View File

@ -0,0 +1,215 @@
; .setcpu "65C02"
.include "./macro.inc"
.org $8000
n = $01 ; temporary storage for data stack operations
temp = $20 ; scratchpad page
str_ptr = $30
cursor = $300
cursor_x = cursor
cursor_y = cursor + 1
char_buf = $302
char_buf_index = char_buf + 8
reset:
sei
ldx #0; initialize data stack pointer
init:
lda #$31
sta str_ptr
lda #$80
sta str_ptr + 1
jsr clear
lda #0
sta cursor_x
lda #0
sta cursor_y
cli
main:
jsr print
jmp main
newline: ; sets cursor to start of next line
stz cursor_x
lda cursor_y
cmp #28
bne .end
stz cursor_y
rts
.end:
inc cursor_y
rts
text:
.asciiz "hello <3"
; increments the cursor line by line, looping to (0, 0) after (63, 28)
inc_cursor:
lda cursor_x
cmp #63
beq .newline
inc cursor_x
rts
.newline:
lda cursor_y
cmp #28
beq .newscreen
stz cursor_x
inc cursor_y
rts
.newscreen:
stz cursor_y
stz cursor_x
rts
; zeroes out the display, resets cursor to 0,0
clear:
lda #0
ldy #0
.loop:
sta $6000,y
sta $6100,y
sta $6200,y
sta $6300,y
sta $6400,y
sta $6500,y
sta $6600,y
sta $6700,y ; this goes slightly over but it's fine
iny
bne .loop
stz cursor
stz cursor + 1
rts
; prints string from cursor position, stopping at end of string or at 256 chars, whichever comes first
; $6000 + (64*Y) + X
; THIS WILL WRITE OUT OF BOUNDS IF THE CURSOR IS OUT OF BOUNDS/STRING IS TOO LONG
; TODO: figure out a simple way of writing arbitrary length strings
; and
print:
jsr cursor_addr
ldy #0
; y_overflow = temp + 5
.loop:
lda (str_ptr), y
beq .end
sta (temp), y
iny
bra .loop
.end:
rts
; calculates real vram address from cursor (x, y)
cursor_addr:
stz temp
stz temp + 1
lda cursor_y
beq .add_x ; if y's zero just add x
.y_mult:
; multiply by 64
clc
asl
rol temp + 1
asl
rol temp + 1
asl
rol temp + 1
asl
rol temp + 1
asl
rol temp + 1
asl
rol temp + 1
sta temp
.add_x:
clc
lda cursor_x
adc temp
sta temp
lda #0
adc temp + 1
sta temp + 1
clc
lda #$60
adc temp + 1
sta temp + 1
rts
; print_text:
; lda text,y
; beq .end
; sta $6000, y
; iny
; bra print_text
; .end:
; ldy #0
; rts
; draw_char: ; draw a character c at (x, y) (n1: x n2: y n3: c -- )
; lda 0, x ; load a with character to draw
; pop ; and pop it off the stack
; jsr get_char_address ; calculate where to put the character in memory
; sta (0, x) ; store a at the address pointed to on the stack
; rts
; get_char_address: ; gets vram address for a character at (x, y),
; ; (n1: x n2: y -- n: $6000 + x + (64 * y))
; ;jsr push_lit ; push 64 onto stack, low byte first
; ;.byte 64
; ;.byte 0
; pha
; lda #64
; push ; doing this instead until `push_lit` is fixed
; sta 0, x
; stz 1, x
; jsr mult ; multiply 64 with y (n2)
; jsr plus ; add result with x (n1)
; ;jsr push_lit ; push vram address onto the stack
; ;.byte $00
; ;.byte $60
; lda #$60
; push
; sta 1, x
; stz 0, x
; jsr plus ; add vram start address to result
; pla
; rts
; fill: ; fills an area from (x1, y1) to (x2, y2) will character c, (n1: c n2: x1 n3: y1 n4: x2 n5: y2 -- )
; jsr get_char_address
isr: ; interrupt service routine
pha
phx
phy
; jsr irq
ply
plx
pla
rti
.include "math.inc"
.org $fffc
.word reset
.word isr

BIN
roms/keyboard_sys.rom Normal file

Binary file not shown.

BIN
roms/template.rom Normal file

Binary file not shown.

173
roms/test.asm Normal file
View File

@ -0,0 +1,173 @@
; .setcpu "65C02"
.include "./macro.inc"
; okay so rn i wanna set up a very basic system init, and write a few subroutines to draw characters at x,y coordinates
n = $01 ; temporary storage for data stack operations
key_row = $200 ; used for character lookup when key pressed
key_col = $201
cursor = $202
char_buffer = $300 ; 256 byte character buffer
kb_row = $4400 ; keyboard hardware register
kb_row_cache = $203 ; cache
.org $8000
reset:
sei
ldx #0; initialize data stack pointer
jmp main
initdisplay:
lda #20
ldy #0
cleardisplay:
sta $6000,y
sta $6100,y
sta $6200,y
sta $6300,y
sta $6400,y
sta $6500,y
sta $6600,y
sta $6700,y ; this goes slightly over but it's fine
iny
bne cleardisplay
cli
main:
; jsr keyboard
; key_zero:
; stz keyboard_cache, x
; dex
; bpl key_zero
; fim:
; cli
; bra fim
; jsr kitty_keys
lda #9
sta $6000
jmp main
not_keyboard:
ldy #0
.check_row: ; loop through each row
lda kb_row, y
beq .skip_row ; if row has no key pressed, skip checking which key
sta kb_row_cache, y ; if key pressed, cache it
lda kb_row, y
cmp kb_row_cache, y ; has key changed?
beq key_down
.skip_row:
iny
cpy #5
bne .check_row
rts
key_down: ; a is loaded with the row byte
phy
sty key_row ; store character row
ldy #0
.find_col: ; test each row bit, store column if key pressed
lsr ; test bit 7
bcs store_col ; if unset, don't go store character columnb
.skip:
iny
cpy #8
bne .find_col ; loop until we've checked each bit
store_col:
sty key_col
keymap_index:
push
lda key_col
stz 1, x
sta 0, x
push
lda #8
stz 1, x
sta 0, x
push
lda key_row
stz 1, x
sta 0, x
jsr mult
jsr plus
lda 0, x
tay
print: ; we've stored the character position, now let's
lda keymap, y
ldy cursor
sta $6000, y
inc cursor
ply
rts
keymap:
.byte "?outrew?"
.byte "?piygsq?"
.byte "a??khvd?"
.byte "42ljbfz?"
.byte "31?mncx?"
.byte "????? m"
; draw:
; ; push_coords #0, #0
; ; push_char #$00
; ; jsr draw_char
; rts
; draw_char: ; draw a character c at (x, y) (n1: x n2: y n3: c -- )
; lda 0, x ; load a with character to draw
; pop ; and pop it off the stack
; jsr get_char_address ; calculate where to put the character in memory
; sta (0, x) ; store a at the address pointed to on the stack
; rts
; get_char_address: ; gets vram address for a character at (x, y),
; ; (n1: x n2: y -- n: $6000 + x + (64 * y))
; ;jsr push_lit ; push 64 onto stack, low byte first
; ;.byte 64
; ;.byte 0
; pha
; lda #64
; push ; doing this instead until `push_lit` is fixed
; sta 0, x
; stz 1, x
; jsr mult ; multiply 64 with y (n2)
; jsr plus ; add result with x (n1)
; ;jsr push_lit ; push vram address onto the stack
; ;.byte $00
; ;.byte $60
; lda #$60
; push
; sta 1, x
; stz 0, x
; jsr plus ; add vram start address to result
; pla
; rts
; fill: ; fills an area from (x1, y1) to (x2, y2) will character c, (n1: c n2: x1 n3: y1 n4: x2 n5: y2 -- )
; jsr get_char_address
isr: ; interrupt service routine
pha
phx
phy
; jsr irq
ply
plx
pla
rti
.include "math.inc"
.org $fffc
.word reset
.word isr

BIN
roms/test.rom Normal file

Binary file not shown.

4
run.sh
View File

@ -7,6 +7,6 @@ fi
set -e set -e
vasm6502_oldstyle ./src/roms/$1.asm -dotdir -wdc02 -ldots -Fbin -o ./src/roms/$1.rom; vasm6502_oldstyle roms/$1.asm -dotdir -wdc02 -ldots -Fbin -o roms/$1.rom;
cargo run -- rom "./src/roms/$1.rom"; cargo run -- rom "roms/$1.rom";
# hexdump -C ./cpu_dump.bin; # hexdump -C ./cpu_dump.bin;

View File

@ -86,7 +86,11 @@ fn help(command: Option<String>) {
println!(" rom, -r, --rom <path>: load a rom/binary from path"); println!(" rom, -r, --rom <path>: load a rom/binary from path");
println!(" screen, -s, --screen <type>: use the \"terminal\" or \"window\" display type"); println!(" screen, -s, --screen <type>: use the \"terminal\" or \"window\" display type");
println!("\nconfiguration:"); println!("\nconfiguration:");
println!(" george-emu searches for a `george.toml` in the current directory.\n in `george.toml` you can specify a path for the character rom using the key `char_rom` and the main rom/binary with the key `rom`"); println!(" george-emu searches for a `george.toml` in the current directory.\n in `george.toml` you can specify a path for the character rom\n using the key `char_rom` and the main rom/binary with the key `rom`");
println!("\ndebugging:");
println!(" you can pipe in a rom for george to evaluate.");
println!(" she'll read it until she reaches a breakpoint (`0x02`) or `stp` instruction,");
println!(" then will dump her memory to stdout <3");
exit(0); exit(0);
} }
} }

View File

@ -1,17 +1,36 @@
use std::io::{self, stdin, IsTerminal};
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
mod cli; mod cli;
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
use cli::get_input; use cli::get_input;
use georgeemu::memory::{Mem, MemHandle};
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
use georgeemu::GeorgeEmu; use georgeemu::GeorgeEmu;
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
use minifb::{Scale, ScaleMode, Window, WindowOptions}; use minifb::{Scale, ScaleMode, Window, WindowOptions};
#[cfg(not(target_arch = "wasm32"))] use std::{fs::File, io::Read};
fn main() {
use std::{fs::File, io::Read};
#[cfg(not(target_arch = "wasm32"))]
fn main() -> io::Result<()> {
use std::io::{stdout, Write};
use georgeemu::cpu::Cpu;
let mut input = stdin();
if !input.is_terminal() {
let mut bytes = [0u8; 0x8000];
input.read_exact(&mut bytes).unwrap();
let memory = make_memory(&bytes);
let mut cpu = Cpu::new(memory);
let final_output = cpu.run_to_end();
let _ = stdout().write_all(&final_output);
Ok(())
} else {
let window = Window::new( let window = Window::new(
"ʕ·ᴥ·ʔ-☆", "ʕ·ᴥ·ʔ-☆",
512, 512,
@ -35,14 +54,22 @@ fn main() {
let mut file = File::open(path).unwrap(); let mut file = File::open(path).unwrap();
let mut bin = vec![0; 0x8000]; let mut bin = vec![0; 0x8000];
file.read_exact(&mut bin).unwrap(); file.read_exact(&mut bin).unwrap();
// println!("reading char rom");
bin.try_into().unwrap() bin.try_into().unwrap()
} }
None => *include_bytes!("../roms/george.rom"), None => *include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/roms/george.rom")),
}; };
let mut emu = GeorgeEmu::builder().rom(rom).window(window).build(); let mut emu = GeorgeEmu::builder().rom(rom).window(window).build();
emu.run(); emu.run();
Ok(())
}
}
#[cfg(not(target_arch = "wasm32"))]
fn make_memory(bytes: &[u8]) -> MemHandle {
let mut memory = Mem::new();
memory.load_bytes(bytes);
MemHandle::new(memory)
} }
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]

View File

@ -97,11 +97,18 @@ impl MemoryWriter for Cpu {
impl Cpu { impl Cpu {
pub fn new(memory: MemHandle) -> Self { pub fn new(memory: MemHandle) -> Self {
// reset the cpu on initialization so we don't
// scream and cry for two days trying to figure
// out why george isn't working <3
let low_byte = memory.read(0xFFFC);
let high_byte = memory.read(0xFFFD);
let pc = (high_byte as u16) << 8 | (low_byte as u16);
Cpu { Cpu {
a: 0x00, a: 0x00,
x: 0x00, x: 0x00,
y: 0x00, y: 0x00,
pc: 0x0000, pc,
s: 0xFF, s: 0xFF,
p: 0b0010_0100, p: 0b0010_0100,
irq: false, irq: false,
@ -111,8 +118,7 @@ impl Cpu {
debug: false, debug: false,
stopped: false, stopped: false,
pending_cycles: 0, pending_cycles: 0,
cycle: false, // cycle_count: 0, cycle: false,
// state_tx,
} }
} }
pub fn with_receiver(mut self, receiver: CpuReceiver) -> Self { pub fn with_receiver(mut self, receiver: CpuReceiver) -> Self {
@ -265,4 +271,26 @@ impl Cpu {
self.stop(); self.stop();
} }
} }
fn quick_cycle(&mut self) {
if !self.get_flag(StatusFlag::IrqDisable) && self.irq {
self.interrupt();
}
let opcode = self.read(self.pc);
let instruction = get_instruction(opcode);
instruction.call(self);
}
pub fn run_to_end(&mut self) -> [u8; 0x10000] {
self.quick_cycle();
while self.pending_cycles != 0 {
let opcode = self.read(self.pc);
let instruction = get_instruction(opcode);
match instruction.name {
"stp" | "breakpoint" => return self.memory.dump(),
_ => self.quick_cycle(),
}
}
unreachable!()
}
} }

View File

@ -1,265 +0,0 @@
# this is august's version of extended ascii for george <3
# we're limited to 255 characters
# format: ascii byte, unicode hex, # unicode name
#
# format: three tab-separated columns
# column #1 is the ISO/IEC 8859-1 code (in hex as 0xXX)
# column #2 is the Unicode (in hex as 0xXXXX)
# column #3 the Unicode name (follows a comment sign, '#')
0x00 0x00 #
0x01 0x2591 # ░
0x02 0x2592 # ▒
0x03 0x2593 # ▓
0x04 0x2661 # ♡
0x05 0x2665 # ♥
0x06 0x2B50 # ⭐
0x07 0x272D # ✭
0x08 0xF005 # 
0x09 0x2726 # ✦
0x0a 0x2728 # ✨
0x0b 0x2640 # ♀
0x0c 0x2642 # ♂
0x0d 0x26A2 # ⚢
0x0E 0x26A3 # ⚣
0x0F 0x26A5 # ⚥
0x10 0x2669 # ♩
0x11 0x266A # ♪
0x12 0x266B # ♫
0x13 0x266C # ♬
0x14 0xFC5D # ﱝ
0x15 0xF026 # 
0x16 0xF027 # 
0x17 0xF028 # 
0x18 0xFA7E # 奄
0x19 0xFA7F # 奔
0x1A 0xFA80 # 婢
0x1B 0xFC5C # ﱜ
0x1C 0xFC5B # ﱛ
0x1D 0xF0AC # 
0x1E 0xF04B # 
0x1F 0xF04D # 
0x20 0x0020 #
0x21 0x0021 # !
0x22 0x0022 # "
0x23 0x0023 # #
0x24 0x0024 # $
0x25 0x0025 # %
0x26 0x0026 # &
0x27 0x0027 # '
0x28 0x0028 # (
0x29 0x0029 # )
0x2A 0x002A # *
0x2B 0x002B # +
0x2C 0x002C # ,
0x2D 0x002D # -
0x2E 0x002E # .
0x2F 0x002F # /
0x30 0x0030 # 0
0x31 0x0031 # 1
0x32 0x0032 # 2
0x33 0x0033 # 3
0x34 0x0034 # 4
0x35 0x0035 # 5
0x36 0x0036 # 6
0x37 0x0037 # 7
0x38 0x0038 # 8
0x39 0x0039 # 9
0x3A 0x003A # :
0x3B 0x003B # ;
0x3C 0x003C # <
0x3D 0x003D # =
0x3E 0x003E # >
0x3F 0x003F # ?
0x40 0x0040 # @
0x41 0x0041 # A
0x42 0x0042 # B
0x43 0x0043 # C
0x44 0x0044 # D
0x45 0x0045 # E
0x46 0x0046 # F
0x47 0x0047 # G
0x48 0x0048 # H
0x49 0x0049 # I
0x4A 0x004A # J
0x4B 0x004B # K
0x4C 0x004C # L
0x4D 0x004D # M
0x4E 0x004E # N
0x4F 0x004F # O
0x50 0x0050 # P
0x51 0x0051 # Q
0x52 0x0052 # R
0x53 0x0053 # S
0x54 0x0054 # T
0x55 0x0055 # U
0x56 0x0056 # V
0x57 0x0057 # W
0x58 0x0058 # X
0x59 0x0059 # Y
0x5A 0x005A # Z
0x5B 0x005B # [
0x5C 0x005C # \
0x5D 0x005D # ]
0x5E 0x005E # ^
0x5F 0x005F # _
0x60 0x0060 # `
0x61 0x0061 # a
0x62 0x0062 # b
0x63 0x0063 # c
0x64 0x0064 # d
0x65 0x0065 # e
0x66 0x0066 # f
0x67 0x0067 # g
0x68 0x0068 # h
0x69 0x0069 # i
0x6A 0x006A # j
0x6B 0x006B # k
0x6C 0x006C # l
0x6D 0x006D # m
0x6E 0x006E # n
0x6F 0x006F # o
0x70 0x0070 # p
0x71 0x0071 # q
0x72 0x0072 # r
0x73 0x0073 # s
0x74 0x0074 # t
0x75 0x0075 # u
0x76 0x0076 # v
0x77 0x0077 # w
0x78 0x0078 # x
0x79 0x0079 # y
0x7A 0x007A # z
0x7B 0x007B # {
0x7C 0x007C # |
0x7D 0x007D # }
0x7E 0x007E # ~
0x7F 0x2500 # ─
0x80 0x2502 # │
0x81 0x250C # ┌
0x82 0x2514 # └
0x83 0x251C # ├
0x84 0x2524 # ┤
0x85 0x252C # ┬
0x86 0x2534 # ┴
0x87 0x253C # ┼
0x88 0x256D # ╭
0x89 0x256E # ╮
0x8A 0x256F # ╯
0x8B 0x2570 # ╰
0x8C 0x2571 #
0x8D 0x2572 # ╲
0x8E 0x2573 #
0x8F 0x2550 # ═
0x90 0x2551 # ║
0x91 0x2554 # ╔
0x92 0x2557 # ╗
0x93 0x255a # ╚
0x94 0x255D # ╝
0x95 0x2560 # ╠
0x96 0x2563 # ╣
0x97 0x2566 # ╦
0x98 0x2569 # ╩
0x99 0x256C # ╬
0x9A 0xF04E # 
0x9B 0xF050 # 
0x9C 0xF051 # 
0x9D 0xF052 # 
0x9E 0xF048 # 
0x9F 0xE0B0 # 
0xA0 0xE0B2 # 
0xA1 0xE0B4 # 
0xA2 0xE0B6 # 
0xA3 0xE0B8 # 
0xA4 0xE0BA # 
0xA5 0xE0BC # 
0xA6 0xE0BE # 
0xA7 0x2581 # ▁
0xA8 0x2582 # ▂
0xA9 0x2583 # ▃
0xAA 0x2584 # ▄
0xAB 0x2585 # ▅
0xAC 0x2586 # ▆
0xAD 0x2587 # ▇
0xAE 0x2588 # █
0xAF 0x2589 # ▉
0xB0 0x258A # ▊
0xB1 0x258B # ▋
0xB2 0x258C # ▌
0xB3 0x258D # ▍
0xB4 0x258E # ▎
0xB5 0x258F # ▏
0xB6 0x0295 # ʕ
0xB7 0x00B7 # ·
0xB8 0x1D25 # ᴥ
0xB9 0x0294 # ʔ
0xBA 0x2596 # ▖
0xBB 0x2597 # ▗
0xBC 0x2598 # ▘
0xBD 0x2599 # ▙
0xBE 0x259A # ▚
0xBF 0x259B # ▛
0xC0 0x259C # ▜
0xC1 0x259D # ▝
0xC2 0x259E # ▞
0xC3 0x259F # ▟
0xC4 0x2190 # ←
0xC5 0x2191 # ↑
0xC6 0x2192 # →
0xC7 0x2193 # ↓
0xC8 0x2B60 # ⭠
0xC9 0x2B61 # ⭡
0xCA 0x2B62 # ⭢
0xCB 0x2B63 # ⭣
0xCC 0x2B80 # ⮀
0xCD 0x2B81 # ⮁
0xCE 0x2B82 # ⮂
0xCF 0x2B83 # ⮃
0xD0 0xF049 # 
0xD1 0xF04A # 
0xD2 0x23F3 # ⏳
0xD3 0xF07B # 
0xD4 0xF07C # 
0xD5 0xF114 # 
0xD6 0xF115 # 
0xD7 0xF250 # 
0xD8 0xF251 # 
0xD9 0xF253 # 
0xDA 0xF254 # 
0xDB 0xF461 # 
0xDC 0xF016 # 
0xDD 0xF401 # 
0xDE 0x1F52E # 🔮
0xDF 0xF2DB # 
0xE0 0xF008 # 
0xE1 0x25C7 # ◇
0xE2 0x25C8 # ◈
0xE3 0x1F311 # 🌑
0xE4 0x1F312 # 🌒
0xE5 0x1F313 # 🌓
0xE6 0x1F314 # 🌔
0xE7 0x1F315 # 🌕
0xE8 0x1F316 # 🌖
0xE9 0x1F317 # 🌗
0xEA 0x1F318 # 🌘
0xEB 0xF04C # 
0xEC 0x2714 # ✔
0xED 0x2718 # ✘
0xEE 0x25C6 # ◆
0xEF 0xF15D # 
0xF0 0xF15E # 
0xF1 0xF071 # 
0xF2 0xF449 # 
0xF3 0xF529 # 
0xF4 0xF658 # 
0xF5 0xF659 # 
0xF6 0x1f381 # 🎁
0xF7 0xf05a # 
0xF8 0xf06a # 
0xF9 0xf834 # 
0xFA 0xf835 # 
0xFB 0x2690 # ⚐
0xFC 0x2691 # ⚑
0xFD 0xf8d7 # 
0xFE 0xf0e7 # 
0xFF 0xf7d9 # 

View File

@ -1028,14 +1028,14 @@ pub const OPCODES: [Instruction; 256] = [
instr_fn: Some(breakpoint), instr_fn: Some(breakpoint),
address_fn: None, address_fn: None,
cycles: 0, cycles: 0,
name: "none", name: "breakpoint",
addr_mode: "implied", addr_mode: "implied",
}, },
Instruction { Instruction {
instr_fn: None, instr_fn: None,
address_fn: None, address_fn: None,
cycles: 0, cycles: 0,
name: "none", name: "end",
addr_mode: "implied", addr_mode: "implied",
}, },
Instruction { Instruction {

View File

@ -1,7 +1,7 @@
pub mod cpu; pub mod cpu;
mod instructions; mod instructions;
mod keyboard; mod keyboard;
mod memory; pub mod memory;
mod platform; mod platform;
pub mod video; pub mod video;
@ -91,35 +91,6 @@ impl GeorgeEmuBuilder<NoRom, NoWindow> {
window, window,
} }
} }
// pub fn window(self, mut window: Window) -> GeorgeEmuBuilder<NoRom, SomeWindow> {
// let Self {
// rom,
// cpu,
// ref cpu_controller,
// ref memory_handle,
// keyboard,
// ..
// } = self;
// let renderer = Renderer::new(
// self.cpu_controller.clone().unwrap(),
// self.memory_handle.clone().unwrap(),
// );
// window.set_input_callback(Box::new(Keyboard::new(
// self.memory_handle.as_ref().unwrap().clone(),
// )));
// GeorgeEmuBuilder {
// cpu,
// rom,
// keyboard,
// renderer: Some(renderer),
// cpu_controller: cpu_controller.clone(),
// memory_handle: memory_handle.clone(),
// window: SomeWindow(window),
// }
// }
} }
impl GeorgeEmuBuilder<SomeRom, NoWindow> { impl GeorgeEmuBuilder<SomeRom, NoWindow> {
@ -202,26 +173,6 @@ impl GeorgeEmuBuilder<NoRom, SomeWindow> {
self.cpu.as_mut().unwrap().debug = true; self.cpu.as_mut().unwrap().debug = true;
self self
} }
#[cfg(not(target_arch = "wasm32"))]
pub fn build(self) -> GeorgeEmu {
let keyboard = Keyboard::new(self.memory_handle.clone().unwrap());
GeorgeEmu(imp::GeorgeEmu::new(
self.cpu.unwrap(),
self.renderer.unwrap(),
Some(keyboard),
None,
))
}
#[cfg(target_arch = "wasm32")]
pub fn build(self) -> GeorgeEmu {
GeorgeEmu(imp::GeorgeEmu::new(
self.cpu.unwrap(),
self.renderer.unwrap(),
self.window.0,
))
}
} }
impl GeorgeEmuBuilder<SomeRom, SomeWindow> { impl GeorgeEmuBuilder<SomeRom, SomeWindow> {
@ -233,6 +184,7 @@ impl GeorgeEmuBuilder<SomeRom, SomeWindow> {
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
pub fn build(self) -> GeorgeEmu { pub fn build(self) -> GeorgeEmu {
let keyboard = Keyboard::new(self.memory_handle.clone().unwrap());
GeorgeEmu(imp::GeorgeEmu::new( GeorgeEmu(imp::GeorgeEmu::new(
self.cpu.unwrap(), self.cpu.unwrap(),
self.renderer.unwrap(), self.renderer.unwrap(),

View File

@ -20,9 +20,9 @@ impl MemHandle {
memory.write(address, data); memory.write(address, data);
} }
pub fn dump(&self) { pub fn dump(&self) -> [u8; 0x10000] {
let memory = self.0.lock().unwrap(); let memory = self.0.lock().unwrap();
let _ = memory.dump(PathBuf::from_str("./cpu_dump.bin").unwrap()); memory.dump()
} }
pub fn poke(&self, address: u16) { pub fn poke(&self, address: u16) {
let memory = self.0.lock().unwrap(); let memory = self.0.lock().unwrap();
@ -47,7 +47,7 @@ pub struct Mem([u8; 0x10000]);
impl Default for Mem { impl Default for Mem {
fn default() -> Self { fn default() -> Self {
let bytes = include_bytes!("./roms/george.rom"); let bytes = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/roms/george.rom"));
let padding = [0; 0x8000]; let padding = [0; 0x8000];
let mem: [u8; 0x10000] = { let mem: [u8; 0x10000] = {
let mut rom: [u8; 0x10000] = [0; 0x10000]; let mut rom: [u8; 0x10000] = [0; 0x10000];
@ -65,10 +65,8 @@ impl Mem {
pub fn new() -> Self { pub fn new() -> Self {
Self([0; 0x10000]) Self([0; 0x10000])
} }
pub fn dump(&self, path: PathBuf) -> io::Result<()> { pub fn dump(&self) -> [u8; 0x10000] {
let mut outfile = File::create(path)?; self.0
outfile.write_all(&self.0)?;
Ok(())
} }
pub fn read(&self, address: u16) -> u8 { pub fn read(&self, address: u16) -> u8 {

View File

@ -1,5 +1,6 @@
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
use std::io::{self, Write}; use std::io::{self, Write};
use std::{env, fs::File, io::Read, path::Path};
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
use termion::{ use termion::{
@ -43,8 +44,7 @@ const HEIGHT: usize = 380;
// } // }
// } // }
const CHAR_ROM: &[u8; 0x8000] = include_bytes!("./roms/cozette.rom"); const CHAR_ROM: &[u8; 0x8000] = include_bytes!(concat!(env!("OUT_DIR"), "/cozette.rom"));
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
const ASCII_LOOKUP: [&str; 256] = [ const ASCII_LOOKUP: [&str; 256] = [
" ", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", " ", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",