COSCUP x RubyConf TW 2021

使用 Rust 及 WebAssembly 打造 Gameboy (LR35902) Emulator
07-31, 12:40–13:10 (Asia/Taipei), TR309
Language: 漢語


您是否知悉並同意如採遠端形式分享,需提供預錄影片(您需同意大會才能接受您的稿件) – yes slido url

https://app.sli.do/event/4cgvg7ie

hackmd url

https://hackmd.io/@coscup/ryHfQ6vAu/%2F%40coscup%2FH19empDCu

Translate Title

Gameboy (LR35902) emulator in Rust and WebAssembly

Abstract

受到 Rust 實作的 RISC-V emulator rvemu 的感召,作者選擇為一個更為簡單的系統 LR35902 打造 emulator,LR35902 這個名字大家或許不熟悉,但若提到使用它的產品:Gameboy 就可說是無人不曉了,我們打造的 emulator,也能載入經典遊戲 Tetris 的 gb 檔,實際執行遊戲。
實作硬體 emulator 各部分也能讓我們再次了解 LR35902 的結構,包括 CPU、指令集、記憶體配置、GPU、中斷、讀取輸入等等,舉一反三,實作了 LR35902 emulator, RISC-V emulator 的實作也難不倒人了。
更酷炫的是,Gameboy emulator 利用 Rust 提供的工具鏈,能夠輕鬆編譯為 WebAssembly ,放到瀏覽器裡執行,本演講一併介紹如何將 Rust 編譯為 WebAssembly,展示 Rust 現下最便利的 WebAssembly 開發工具的實力。

參考內容:
https://github.com/d0iasm/rvemu
https://yodalee.me/2020/12/2020_rust_gameboy/
https://yodalee.me/2021/04/2021_rust_gameboy2/

Talk Length

36

English Abstract

Inspired by rvemu, a RISC-V emulator implemented in Rust, this talk chose a much simpler system LR35902, to implement its emulator. The LR35902 may be unfamiliar to you, but the product that uses it, Gameboy, is well-known to everyone. The emulator we made is able to load the gb file of the classical game Tetris, and really play it.
By implementing the emulator, we can understand the structure of LR35902, including CPU, instruction set, memory layout, GPU, interrupt, and input, etc. By implementing LR35902 emulator, we can also learn how to build an emulator for RISC-V processor with similar concept inside.
Furthermore, with the support of Rust toolchain, we can easily compile the emulator into WebAssembly and run it in the browser. The talk will also show how to compile Rust into WebAssembly, and show why Rust is the best tool to develop WebAssembly.

Reference:
https://github.com/d0iasm/rvemu
https://yodalee.me/2020/12/2020_rust_gameboy/
https://yodalee.me/2021/04/2021_rust_gameboy2/

Difficulty

中階

other info

https://yodalee.me