Chip8 Assembler
Well I finished my Chip 8 Assembler. Working on speeding up my emulator right now, it works more or less but its amazing slow so I've done all my assembler testing on Hap's Fish n' chips emu.
The assembler has a built in chip8/schip code editor with most of the usual 'code editor' features:
Its quite fast as you might imagine dealing with such a simple instruction set and tiny programs.
The program in the screenshot above is a simple C8 program I wrote that is included in the attached rar. It was assembled with the assembler and when running it looks like this:
The compiled program and the source for it is included in the attached rar. It requires .NET 2.0 to run.
I figure pretty much noone has been waiting for a new Chip8 assembler but I wrote it, so here it is!
Update: I updated the rar file after fixing some bugs in the assembler, also added support for the FX30 opcode (point I to the hi res font char in X) which wasn't in the main Winter's doc but is used in games and documented in the CHIPPER docs. There are some stupid UI bugs I'll quash soon and update again, but nothing that will keep someone from using it.
Well I finished my Chip 8 Assembler. Working on speeding up my emulator right now, it works more or less but its amazing slow so I've done all my assembler testing on Hap's Fish n' chips emu.
The assembler has a built in chip8/schip code editor with most of the usual 'code editor' features:

Its quite fast as you might imagine dealing with such a simple instruction set and tiny programs.
The program in the screenshot above is a simple C8 program I wrote that is included in the attached rar. It was assembled with the assembler and when running it looks like this:

The compiled program and the source for it is included in the attached rar. It requires .NET 2.0 to run.
I figure pretty much noone has been waiting for a new Chip8 assembler but I wrote it, so here it is!
Update: I updated the rar file after fixing some bugs in the assembler, also added support for the FX30 opcode (point I to the hi res font char in X) which wasn't in the main Winter's doc but is used in games and documented in the CHIPPER docs. There are some stupid UI bugs I'll quash soon and update again, but nothing that will keep someone from using it.
Code:
C8Asm Quick Docs
Note: These docs are not a substitute for 'real' chip8/schip docs. It does not cover particulars of when VF is set and why, etc.
Its main purpose is simply to list the mnemonics and syntax for the opcodes.
; starts a comment, comments are terminated at a newline.
All number literals are in hexadecimal and are preceded by # (ie, #FFFF)
Labels must be on their own line and terminate with a colon (:) (ie, label:)
Whitespace is mostly irrelevant except in special cases (like the required newline following a label declaration)
Opcode mnemonics are case insensitive.
The registers are as follows:
V# where # is 0-F - The 16 general purpose chip8 registers.
I - The memory pointer register.
[I] - Access value pointed at I (used for the reg->mem, mem->reg opcodes)
ST - Sound Timer
DT - Delay Timer
K - Key
F - Low Res Font
HF - High Res Font
Instructions:
high
Sets SCHIP graphics mode
Opcode: 00FF
low
sets CHIP8 graphics mode
Opcode: 00FE
cls
Clears the screen
Opcode: 00E0
exit
Quit program
Opcode: 00FD
sclr
Scroll 4 pixels right
Opcode: 00FB
scll
Scroll 4 pixels left
Opcode: 00FC
scld [literal]
Scroll [literal] pixels down. Ex: scld #4 will scroll down 4 pixels
Opcode: 00CK
dw [literal]
Echo [literal] into the bytestream. Ex: dw #FFFF will write #FFFF into the executable.
Opcode: None, Assembler directive.
call [label]
Calls a chip8/schip subroutine located at [label].
Opcode: 2NNN
jp [label]
Preforms an unconditional jump to [label]
Opcode: 1NNN
jp [label], [register]
Preforms an unconditional jump to [label] + contents of [register] Ex: jp main, V0
Opcode: BNNN
ret
Return from a chip8/schip subroutine.
Opcode: 00EE
drw [register1], [register2], [literal]
Draws a sprite 8x[literal] lines at [reg1],[reg2]. If [literal] is 0 it draws a 16x16 sprite. Ex: drw V0, V1, #3
Opcode: DXYK
se [register], [literal]
Skip next line iff [register] == [literal]
Opcode: 3XKK
se [reg1], [reg2]
Skip next line iff [reg1] == [reg2]
Opcode: 5XY0
sne [register], [literal]
Skip next line iff [register] != [literal]
Opcode: 4XKK
sne [reg1], [reg2]
Skip next line iff [reg1] != [reg2]
Opcode: 9XY0
skp [register]
Skip next line iff the key in [register] is pressed.
Opcode: EX9E
sknp [register]
Skip next line iff the key in [register] is not pressed.
Opcode: EXA1
rnd [register], [literal]
Stores a random number in [register] with the range 0-[literal]
Opcode: CXKK
add [register], [literal]
Adds [literal] to [register]
Opcode: 7XKK
add [reg1], [reg2]
Adds [reg2] to [reg1]
Opcode: 8XY4
add I, [register]
Adds [register] to I.
Opcode: FX1E
sub [reg1], [reg2]
Subtracts [reg2] from [reg1]
Opcode: 8XY5
subn [reg1], [reg2]
[reg1] = [reg2] - [reg1]
Opcode: 8XY7
or [reg1], [reg2]
[reg1] = [reg1] | [reg2]
Opcode: 8XY1
and [reg1], [reg2]
[reg1] = [reg1] & [reg2]
Opcode: 8XY2
xor [reg1], [reg2]
[reg1] = [reg1] ^ [reg2]
Opcode: 8XY3
shl [register]
[register] << 1
Opcode: 8X0E
shr [register]
[register] >> 1
Opcode: 8X06
bcd [register]
Stores the BCD representation of M(I)..M(I+2) in [register]
Opcode: FX33
hps [register]
Store registers V0 to [register] in HP Flags where [register] < 8
Opcode: FX75
hpl [register]
Load registers V0 to [register] from HP Flags where [register] < 8
Upcode: FX85
ld [register], [literal]
Loads [literal] into [register]
Opcode: 6XKK
ld [reg1], [reg2]
Loads [reg2] into [reg1]
Opcode: 8XY0
ld I, [label]
Loads the address of [label] into I.
Opcode: ANNN
ld F, [register]
Points I to the lowres font char stored in [register]
Opcode: FX29
ld HF, [register]
Points I to the hires font char stored in [register]
Opcode: FX30
ld [I], [register]
Saves registers V0 to [register] in memory starting at location I.
Opcode: FX55
ld [register], [I]
Loads registers V0 to [register] from memory starting at location I.
Opcode: FX65
ld [register], DT
Stores the contents of DT into [register]
Opcode: FX07
ld DT, [register]
Stores [register] into DT
Opcode: FX15
ld ST, [register]
Stores [register] into ST
Opcode: FX18
ld [register], K
Waits for keypress and stores result in [register]
Opcode: FX0A
Last edited: