rustzx / rustzx

ZX Spectrum emulator written in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

thread 'main' panicked at 'attempt to add with overflow' tap.rs:68:13 -m128 - loading tape

georgik opened this issue · comments

Behavior: Load Wonderful Dizzy .tap, rutzx fails with error after displaying load-screen:

thread 'main' panicked at 'attempt to add with overflow', C:\projects\rustzx\rustzx-core\src\emulator\fastload\tap.rs:68:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\rustzx.exe -m128 --tape .\dizzy.tap` (exit code: 101)

Tap: https://yolkfolk.com/wonderful-dizzy/

Command:

cargo run --bin rustzx -- -m128 --tape .\dizzy.tap

Environment: Windows 10 21H1, rustc 1.56.0-nightly (ae90dcf02 2021-08-09)

It seems to be a problem with 128K mode.
tap.rs:68:13 fails after loading tape to 65535. The increment fails, because dest counter is u16:
let mut dest = emulator.cpu.regs.get_reg_16(RegName16::IX);

@georgik Thanks for the report! Huh, interesting, maybe dizzy intentionally loads some data with destination pointer overflow. Does it load/work correctly when compiled with --release? (Rust does not check for overflow in release)

@pacmancoder Thank you for the response. Your hint is correct. Build with --release works.