kondrak / rust64 Goto Github PK
View Code? Open in Web Editor NEWCommodore 64 emulator written in Rust
License: MIT License
Commodore 64 emulator written in Rust
License: MIT License
I found this: https://github.com/Just-A-Mango/rustcommodore
Which is pretty much a carbon copy with a changed license
This could be linked to Issue #4 but it's best to investigate when it's done.
Certain programs have very low responsiveness to joystick and keyboard - either because of timing problems or due to IO states being updated on VBlank only (unlikely but worth checking out).
I guess the function signature must have changed recently. What's the last compatible version?
Compiling rust64 v0.0.1 (file:///tmp/rust64-master)
src/c64/mod.rs:52:72: 52:81 error: mismatched types:
expected `minifb::WindowOptions`,
found `minifb::Scale`
(expected struct `minifb::WindowOptions`,
found enum `minifb::Scale`) [E0308]
src/c64/mod.rs:52 window: Window::new("Rust64", SCREEN_WIDTH, SCREEN_HEIGHT, Scale::X1).unwrap(),
^~~~~~~~~
src/c64/mod.rs:52:72: 52:81 help: run `rustc --explain E0308` to see a detailed explanation
src/c64/mod.rs:176:29: 176:35 error: this function takes 0 parameters but 1 parameter was supplied [E0061]
src/c64/mod.rs:176 self.window.update(&self.vic.borrow_mut().window_buffer);
^~~~~~
src/c64/mod.rs:176:29: 176:35 help: run `rustc --explain E0061` to see a detailed explanation
src/debugger/mod.rs:37:73: 37:82 error: mismatched types:
expected `minifb::WindowOptions`,
found `minifb::Scale`
(expected struct `minifb::WindowOptions`,
found enum `minifb::Scale`) [E0308]
src/debugger/mod.rs:37 debug_window: Window::new("Debug window", DEBUG_W, DEBUG_H, Scale::X2).unwrap(),
^~~~~~~~~
src/debugger/mod.rs:37:73: 37:82 help: run `rustc --explain E0308` to see a detailed explanation
src/debugger/mod.rs:38:79: 38:88 error: mismatched types:
expected `minifb::WindowOptions`,
found `minifb::Scale`
(expected struct `minifb::WindowOptions`,
found enum `minifb::Scale`) [E0308]
src/debugger/mod.rs:38 raster_window: Window::new("VIC", RASTER_DEBUG_W, RASTER_DEBUG_H, Scale::X1).unwrap(),
^~~~~~~~~
src/debugger/mod.rs:38:79: 38:88 help: run `rustc --explain E0308` to see a detailed explanation
src/debugger/mod.rs:103:31: 103:37 error: this function takes 0 parameters but 1 parameter was supplied [E0061]
src/debugger/mod.rs:103 self.debug_window.update(&self.window_buffer);
^~~~~~
src/debugger/mod.rs:103:31: 103:37 help: run `rustc --explain E0061` to see a detailed explanation
src/debugger/mod.rs:107:32: 107:38 error: this function takes 0 parameters but 1 parameter was supplied [E0061]
src/debugger/mod.rs:107 self.raster_window.update(&self.raster_buffer);
^~~~~~
src/debugger/mod.rs:107:32: 107:38 help: run `rustc --explain E0061` to see a detailed explanation
error: aborting due to 6 previous errors
Could not compile `rust64`.
$ RUST_BACKTRACE=full cargo run prgs/colors.prg
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/rust64 prgs/colors.prg`
Read rom/basic.rom: 8192 bytes
Read rom/chargen.rom: 4096 bytes
Read rom/kernal.rom: 8192 bytes
thread 'main' panicked at 'attempted to leave type `c64::sid::SIDAudioDevice` uninitialized, which is invalid', /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/core/src/mem/mod.rs:660:9
stack backtrace:
0: 0x55cd977fbb20 - std::backtrace_rs::backtrace::libunwind::trace::h4dee703919bfd40a
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
1: 0x55cd977fbb20 - std::backtrace_rs::backtrace::trace_unsynchronized::h457e839f1a563e20
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x55cd977fbb20 - std::sys_common::backtrace::_print_fmt::h86a55fb30f8393c8
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/sys_common/backtrace.rs:67:5
3: 0x55cd977fbb20 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7b3d6cac46d277e1
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/sys_common/backtrace.rs:46:22
4: 0x55cd978126ef - core::fmt::write::h127419eb46f2ecc9
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/core/src/fmt/mod.rs:1092:17
5: 0x55cd977fa105 - std::io::Write::write_fmt::h6010cfbb4726588b
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/io/mod.rs:1578:15
6: 0x55cd977fd66b - std::sys_common::backtrace::_print::h79b4f9652330cc9d
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/sys_common/backtrace.rs:49:5
7: 0x55cd977fd66b - std::sys_common::backtrace::print::h330bb326a76af8cf
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/sys_common/backtrace.rs:36:9
8: 0x55cd977fd66b - std::panicking::default_hook::{{closure}}::heb6a42a7d50a472e
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/panicking.rs:208:50
9: 0x55cd977fd133 - std::panicking::default_hook::h17e521ba6d68d6e1
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/panicking.rs:225:9
10: 0x55cd977fdc1d - std::panicking::rust_panic_with_hook::h70db735e3a6e70cb
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/panicking.rs:591:17
11: 0x55cd977fd7e7 - std::panicking::begin_panic_handler::{{closure}}::h777c71c8e5a7e25c
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/panicking.rs:495:13
12: 0x55cd977fbfdc - std::sys_common::backtrace::__rust_end_short_backtrace::h3e9bf30168899554
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/sys_common/backtrace.rs:141:18
13: 0x55cd977fd779 - rust_begin_unwind
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/panicking.rs:493:5
14: 0x55cd97774331 - core::panicking::panic_fmt::h5322a082d19786c3
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/core/src/panicking.rs:92:14
15: 0x55cd9777427d - core::panicking::panic::haebb15b6842d6229
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/core/src/panicking.rs:50:5
16: 0x55cd977bbd27 - core::mem::uninitialized::h24e51381cf1d7cc8
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/core/src/mem/mod.rs:660:9
17: 0x55cd977bbd27 - sdl2::audio::AudioDevice<CB>::open_playback::hbb0609a3db1dfcec
at /home/fred/.cargo/registry/src/github.com-1ecc6299db9ec823/sdl2-0.25.0/src/sdl2/audio.rs:571:39
18: 0x55cd97797025 - sdl2::audio::<impl sdl2::sdl::AudioSubsystem>::open_playback::h6be543906219f018
at /home/fred/.cargo/registry/src/github.com-1ecc6299db9ec823/sdl2-0.25.0/src/sdl2/audio.rs:74:9
19: 0x55cd977a5200 - rust64::c64::sid::SID::new_shared::hb9fd972e7558784d
at /home/fred/Workspace/rust64/src/c64/sid.rs:149:27
20: 0x55cd977aa2ad - rust64::c64::C64::new::h19d4a6aba81882f5
at /home/fred/Workspace/rust64/src/c64/mod.rs:55:22
21: 0x55cd9779b713 - rust64::main::h3d420d3cccf68bfa
at /home/fred/Workspace/rust64/src/main.rs:40:19
22: 0x55cd97778dab - core::ops::function::FnOnce::call_once::h296ac6feada574eb
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/core/src/ops/function.rs:227:5
23: 0x55cd97788c9e - std::sys_common::backtrace::__rust_begin_short_backtrace::hbdf6d0329017f8d7
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/sys_common/backtrace.rs:125:18
24: 0x55cd97775e11 - std::rt::lang_start::{{closure}}::h04ebee1a1b54fc53
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/rt.rs:66:18
25: 0x55cd977fe01a - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hbcc915e668c7ca11
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/core/src/ops/function.rs:259:13
26: 0x55cd977fe01a - std::panicking::try::do_call::h6b0f430d48122ddf
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/panicking.rs:379:40
27: 0x55cd977fe01a - std::panicking::try::h6ba420e2e21b5afa
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/panicking.rs:343:19
28: 0x55cd977fe01a - std::panic::catch_unwind::h8366719d1f615eee
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/panic.rs:431:14
29: 0x55cd977fe01a - std::rt::lang_start_internal::h965c28c9ce06ee73
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/rt.rs:51:25
30: 0x55cd97775df0 - std::rt::lang_start::hfee6940d3a632ed3
at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/rt.rs:65:5
31: 0x55cd9779b97c - main
32: 0x7fbd32a4ab25 - __libc_start_main
33: 0x55cd9777499e - _start
34: 0x0 - <unknown>
Update: Tried to debug this on my own. Wasn't able to, but figured out that if I used the sid::SID
normally reserved for Redox OS (which I guess has no sound) then it works for me, also with no sound. I didn't need sound so I was happy with that. YMMV.
https://crates.io/crates/cpal/ as a substitute to SDL audio.
Some programs crash due to getting out of array bounds when drawing sprites; need to investigate what causes it.
When BA line in C64 is low, the CPU is blocked from performing a read access, however writes can still be performed. Current implementation is blocked even during writes which causes the VIC and CPU to get out of sync when doing certain cycle-based effects.
The new CPU has to break every instruction into steps instead of performing it right away and just sleeping for a fixed amount of cycles.
This is a task for when the sprites are done.
When I run this onefiler demo from Censor Design the SID emulation code throws the following panic after a few seconds:
thread '<unnamed>' panicked at 'attempt to subtract with overflow', src/c64/sid.rs:635:25
Line 635 in a579a3c
rustc --version
: rustc 1.21.0-nightly (a7e0d3a81 2017-08-11)Is there a way to turn clock-speed up or down?
Turbo would be nice for blazing past some passages,
and slowing it way down to watch program execution would be pretty smooth too.
https://mobile.twitter.com/doyousketch2/status/892515790989258752
If Backspace is used as Inst/Del, then what do we use as Backspace?
Arrows don't seem to control cursor keys, so I'm at a loss.
I found this while I was browsing github today and thought it would be useful to you. https://github.com/digitalstreamio/resid-rs
I found possible copypast issue in CIA::process_irq(&mut self) function (see link below).
Perhaps timer B is needed to check after timer A?
Lines 479 to 504 in 3e9d295
Using nightlies of rustc 1.6.0 and cargo, I'm getting this:
Compiling rust64 v0.0.1 (file:///home/petevine/rust64-master)
error: linking with `cc` failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-m32" "-L" "/home/petevine/rust-1.6.0-i686_generic-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib" "/home/petevine/rust64-master/target/release/rust64.0.o" "-o" "/home/petevine/rust64-master/target/release/rust64" "-Wl,--gc-sections" "-pie" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/petevine/rust64-master/target/release" "-L" "/home/petevine/rust64-master/target/release/deps" "-L" "/home/petevine/rust64-master/target/release/build/minifb-2aa994e1058bdbef/out" "-L" "/home/petevine/rust-1.6.0-i686_generic-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/home/petevine/rust64-master/target/release/deps/libsdl2-a33e4f65d83406e9.rlib" "/home/petevine/rust64-master/target/release/deps/libbitflags-d74836c21f733435.rlib" "/home/petevine/rust64-master/target/release/deps/libsdl2_sys-4d48b2804feab331.rlib" "/home/petevine/rust64-master/target/release/deps/libnum-61d250199d58c512.rlib" "/home/petevine/rust64-master/target/release/deps/librustc_serialize-dd25d8ce21e6e6df.rlib" "/home/petevine/rust64-master/target/release/deps/librand-0dfc279509c37449.rlib" "/home/petevine/rust64-master/target/release/deps/liblibc-b5b8c3df079ca7f9.rlib" "/home/petevine/rust64-master/target/release/deps/libminifb-2aa994e1058bdbef.rlib" "/home/petevine/rust64-master/target/release/deps/liblibc-6f18902dd8f75ffb.rlib" "/home/petevine/rust-1.6.0-i686_generic-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libstd-71b07a99.rlib" "/home/petevine/rust-1.6.0-i686_generic-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libcollections-71b07a99.rlib" "/home/petevine/rust-1.6.0-i686_generic-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/librustc_unicode-71b07a99.rlib" "/home/petevine/rust-1.6.0-i686_generic-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/librand-71b07a99.rlib" "/home/petevine/rust-1.6.0-i686_generic-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/liballoc-71b07a99.rlib" "/home/petevine/rust-1.6.0-i686_generic-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/liballoc_system-71b07a99.rlib" "/home/petevine/rust-1.6.0-i686_generic-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/liblibc-71b07a99.rlib" "/home/petevine/rust-1.6.0-i686_generic-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libcore-71b07a99.rlib" "-l" "SDL2" "-l" "SDL2" "-l" "X11" "-l" "c" "-l" "m" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "compiler-rt"
note: /home/petevine/rust64-master/target/release/deps/libminifb-2aa994e1058bdbef.rlib(minifb-2aa994e1058bdbef.0.o): In function `open::hd1d4ea4516f64359Iaa':
minifb.0.rs:(.text._ZN4open20hd1d4ea4516f64359IaaE+0x8a): undefined reference to `mfb_open'
/home/petevine/rust64-master/target/release/deps/libminifb-2aa994e1058bdbef.rlib(minifb-2aa994e1058bdbef.0.o): In function `update::hc9bb91620a8d30c8tba':
minifb.0.rs:(.text._ZN6update20hc9bb91620a8d30c8tbaE+0x18): undefined reference to `mfb_update'
/home/petevine/rust64-master/target/release/deps/libminifb-2aa994e1058bdbef.rlib(minifb-2aa994e1058bdbef.0.o): In function `close::h59fa405eefe9bc584ba':
minifb.0.rs:(.text._ZN5close20h59fa405eefe9bc584baE+0xe): undefined reference to `mfb_close'
collect2: error: ld returned 1 exit status
error: aborting due to previous error
Could not compile `rust64`.
@emoon @petevine Creating an issue from the further discussion at:
#1 (comment)
I try to run a demo: https://hd0.linusakesson.net/files/lft-sommargubbe.prg
But it does not work:
Unknown instruction: AXS at $16E4
I assume it is some undocumented hack instruction that lft uses here but maybe it is a good next step for extending the implementation... ๐
Easy to import by others.
I'd like to help emulate iec and disk/tape drives but I'm not sure exactly how you had planned to do it. I've looked through cia.rs, and I see you have iec_lines as a field in there. Does this represent a data byte or clock, data, and atn combined? I also noticed you have $DD00 marked TODO but I need a bit more guidance on how you were thinking of architecting this. I'm a bit of a noob here but thought I'd see if you wanted help and could guide me in the right direction.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.