2个不稳定版本
使用旧的Rust 2015
0.6.0 | 2016年3月4日 |
---|---|
0.0.1 | 2015年8月28日 |
#164 in 模拟器
256 星级 & 9 关注者
275KB
6K SLoC
Rust64 - 用Rust编写的C64模拟器
这是我学习Rust编程语言并娱乐的一种尝试。目标是尽可能清晰地展示Commodore 64的工作原理以及启动程序后幕后发生的事情。模拟基于周期,目前相当精确。
模拟器内置了一个可视化的调试器,可以查看RAM、颜色RAM、VIC寄存器、CIA寄存器和SID寄存器中每个内存页的内容。VIC窗口是一个ICU64风格的栅格调试器,其中每个像素代表一个VIC周期,并且任何在那个时间发生的事件。
主要依赖项
- minifb: https://crates.io/crates/minifb (直接可用)
- sdl2: https://crates.io/crates/sdl2 (需要额外步骤,见 此处 的说明)
需要Rust 1.58.0或更高版本来编译和运行。
YouTube演示 #1
YouTube演示 #2
屏幕截图
构建说明
cargo build
cargo run --release
您可以将.prg文件作为命令行参数传递,以便在模拟器启动后将它加载到内存中(只需输入RUN即可启动程序)
cargo run --release prgs/colors.prg
以双倍窗口大小运行
cargo run --release x2 prgs/colors.prg
以双倍窗口大小和启用调试窗口运行
cargo run --release x2 debugger prgs/colors.prg
C64和特殊键映射
ESC - Run/Stop
END - Restore
TAB - Control
LCTRL - C=
` - <-
- - +
INS - &
HOME - CLR/Home
BSPACE - INST/DEL
[ - @
] - *
DEL - ^
; - :
' - ;
\ - =
F11 - start asm output to console (very slow!)
F12 - reset C64
RCTRL - joystick fire button
NUMLOCK - toggle between joystick ports 1 and 2 (default: port 2)
In debugger window:
PGUP/PGDWN - flip currently displayed memory page
HOME/END - switch currently displayed memory banks between RAM, Color RAM, VIC, CIA and SID
待办事项
- 串行总线/磁盘驱动器(d64、t64、tap)
- 实现剩余未记录的操作
- 一旦cpal支持OSX,从SDL2切换到cpal进行音频
- 改进SID模拟
已知问题
- 缺失的串行总线可能导致某些特定程序执行不正确或陷入无限循环
- 需要非常精确时间调度的复杂程序尚未正确运行
这是一个开闭状态的WIP项目,因此更新频率可能会有所不同。
资源
以下文档和网站被用于创建此模拟器
- http://www.zimmers.net/cbmpics/cbm/c64/vic-ii.txt
- http://frodo.cebix.net/(启发了VIC-II和SID实现)
- https://www.c64-wiki.com
- http://www.oxyron.de/html/opcodes02.html
- http://www.6502.org/tutorials/6502opcodes.html
- http://www.pagetable.com/c64rom/c64rom_en.html
- http://archive.6502.org/datasheets/mos_6526_cia.pdf
- https://www.yoyogames.com/tech_blog/95
- http://code.google.com/p/hmc-6502/source/browse/trunk/emu/testvectors/AllSuiteA.asm
- https://#/J40UKu7RBf
- http://www.waitingforfriday.com/index.php/Commodore_SID_6581_Datasheet
- http://sta.c64.org/cbm64mem.html
- https://svn.code.sf.net/p/vice-emu/code/testprogs/
- http://www.classiccmp.org/cini/pdf/Commodore/ds_6581.pdf
特别感谢
- Daniel Collin 和 Magnus "Pantaloon" Sjöberg 提供了大量的测试程序!
- Jake Taylor 提供了通用的Rust技巧!
依赖项
~18MB
~383K SLoC