Skip to content

Devices

Julius de Jeu edited this page Jul 19, 2021 · 1 revision

Currently, there are various devices available.

Ram

Your standard Ram device, it's contents are lost when the emulator closes.

Rom

Can be used to load a file. It is currently used to load the kernel and the example files. It is also used to store the memory locations needed for the interrupts and reset.

Vga and Keyboard

These two go hand in hand as the i/o of the system. They are also both very cursed, since neither is actually a real device.

Vga

To access the vram, memory synced Ram is needed: Arc<Mutex<Ram>>. Thankfully any device wrapped in an Arc<Mutex<T>> can be treated as a normal device. Normally memory synced ram would not be needed, at least it is not used on any real 6502 that I found. However Rust's memory safety requirement make it mandatory to sync it between threads.

Keyboard

A keyboard is really just a stream of scancodes, with the scancode 0xE0 meaning a key was released, and 0x00 meaning no key was pressed since the last time it was checked. Scancodes are defined in src/device/vga/vecs, you can use the key_to_scancode function to figure out what scancode maps to what character. Due to the library being used, there is no way to know if the left or right shift/control/alt are used.

The keyboard is attached to the display, again using an Arc<Mutex<>>.

Clone this wiki locally