Skip to content

letmaik/chip8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CHIP-8 emulator written in AssemblyScript

https://letmaik.github.io/chip8/

Keys:

1 2 3 4
Q W E R
A S D F
Z X C V

CHIP-8 resources

Docs

https://github.com/mattmikolay/chip-8/wiki/CHIP%E2%80%908-Technical-Reference

http://devernay.free.fr/hacks/chip8/C8TECH10.HTM

Unit tests

https://github.com/SnoozeTime/chip8/blob/master/test/opcode_test.cc

https://github.com/DavidJowett/chip8-emulator/blob/master/test/chip8_test.c

Roms

https://github.com/dmatlack/chip8

https://github.com/JohnEarnest/chip8Archive

https://github.com/corax89/chip8-test-rom

Development notes

TypedArray views

When AssemblyScript grows heap memory, then all TypedArray views returned to JS become unusable/detached. That's why a TypedArray view should be accessed directly before it is used in JS, without doing any other work in AssemblyScript that might grow memory. Keeping long-lived views is unsafe in general.

Note that as-bind avoids such potential issues by always returning copies instead of views. This is less efficient but safer for general usage, though also a bit confusing as it's not obvious that a copy happens. Updating the array inside AssemblyScript would obviously not be reflected in the copy. See also torch2424/as-bind#47.