Skip to content

lkdjiin/c8dasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C8dasm

c8dasm is a utility to disassemble a Chip8 binary file.

Installation

Install it as:

$ gem install c8dasm

Usage

$ c8dasm chip8file

Example

$ c8dasm MAZE
200:a21e  LD I, 21e     ;Puts 21e into register I.
202:c201  RND V2, 01    ;Puts random byte AND 01 into register V2.
204:3201  SE V2, 01     ;Skip next instruction if V2 = 01.
206:a21a  LD I, 21a     ;Puts 21a into register I.
208:d014  DRW V0, V1, 4 ;Draws 4-byte sprite from I at (V0, V1)
20a:7004  ADD V0, 04    ;V0 = V0 + 04.
20c:3040  SE V0, 40     ;Skip next instruction if V0 = 40.
20e:1200  JP 200        ;Jump to location 200.
210:6000  LD V0, 00     ;Puts the value 00 into register V0.
212:7104  ADD V1, 04    ;V1 = V1 + 04.
...

License

GPLv3

Standard Chip-8 Instructions (What's remain to do)

  • 00E0 - CLS
  • 00EE - RET
  • 0nnn - SYS addr
  • 1nnn - JP addr
  • 2nnn - CALL addr
  • 3xkk - SE Vx, byte
  • 4xkk - SNE Vx, byte
  • 5xy0 - SE Vx, Vy
  • 6xkk - LD Vx, byte
  • 7xkk - ADD Vx, byte
  • 8xy0 - LD Vx, Vy
  • 8xy1 - OR Vx, Vy
  • 8xy2 - AND Vx, Vy
  • 8xy3 - XOR Vx, Vy
  • 8xy4 - ADD Vx, Vy
  • 8xy5 - SUB Vx, Vy
  • 8xy6 - SHR Vx {, Vy}
  • 8xy7 - SUBN Vx, Vy
  • 8xyE - SHL Vx {, Vy}
  • 9xy0 - SNE Vx, Vy
  • Annn - LD I, addr
  • Bnnn - JP V0, addr
  • Cxkk - RND Vx, byte
  • Dxyn - DRW Vx, Vy, nibble
  • Ex9E - SKP Vx
  • ExA1 - SKNP Vx
  • Fx07 - LD Vx, DT
  • Fx0A - LD Vx, KEY
  • Fx15 - LD DT, Vx
  • Fx18 - LD ST, Vx
  • Fx1E - ADD I, Vx
  • Fx29 - LD F, Vx
  • Fx33 - LD B, Vx
  • Fx55 - LD [I], Vx
  • Fx65 - LD Vx, [I]

TODO

Check input file.

Option --help and --version.

Data range display option, for instance:

$ c8dasm --data=21a,221 MAZE
200:a21e  LD I, 21e     ;Puts 21e into register I.
202:c201  RND V2, 01    ;Puts random byte AND 01 into register V2.
204:3201  SE V2, 01     ;Skip next instruction if V2 = 01.
206:a21a  LD I, 21a     ;Puts 21a into register I.
208:d014  DRW V0, V1, 4 ;Draws 4-byte sprite from I at (V0, V1)
20a:7004  ADD V0, 04    ;V0 = V0 + 04.
20c:3040  SE V0, 40     ;Skip next instruction if V0 = 40.
20e:1200  JP 200        ;Jump to location 200.
210:6000  LD V0, 00     ;Puts the value 00 into register V0.
212:7104  ADD V1, 04    ;V1 = V1 + 04.
214:3120  SE V1, 20     ;Skip next instruction if V1 = 20.
216:1200  JP 200        ;Jump to location 200.
218:1218  JP 218        ;Jump to location 218.
21a:80    @.......
21b:40    .@......
21c:20    ..@.....
21d:10    ...@....
21e:20    ..@.....
21f:40    .@......
220:80    @.......
221:10    ...@....

Contributing

  1. Fork it ( https://github.com/[my-github-username]/c8dasm/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

Chip8 disassembler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages