/ch8asm

Assembler for Chip8

Primary LanguageC++


Instruction : clr
Description : Clears the screen
Operands :

clr

Instruction : ret
Description : Returns from routine
Operands :

ret

Instruction : jmp
Description : Jump to instruction
Operands :

jmp	instruction_label
jmp	literal

Instruction : call
Description : Calls a routine
Operands :

call	instruction_label
call	literal

Instruction : se
Description : Skips an instruction if operands are equal
Operands :

se	vx,	literal
se	vx,	vx

Instruction : sne
Description : Skips an instruction if operands are not equal
Operands :

sne	vx,	literal
sne	vx,	vx

Instruction : mov
Description : Moves the second operand's value into the first
Operands :

mov	vx,	literal
mov	vx,	vx
mov	vx,	dly
mov	ptr,	instruction_label
mov	ptr,	literal
mov	snd,	vx
mov	dly,	vx

Instruction : add
Description : Adds the second operand's value to the first
Operands :

add	vx,	literal
add	vx,	vx
add	ptr,	vx

Instruction : or
Description : Bitwise OR between operands
Operands :

or	vx,	vx

Instruction : and
Description : Bitwise AND between operands
Operands :

and	vx,	vx

Instruction : xor
Description : Bitwise XOR betwen operands
Operands :

xor	vx,	vx

Instruction : sub
Description : Subtracs the second operand's value from the first
Operands :

sub	vx,	vx

Instruction : shr
Description : Bitshifts operand right by 1
Operands :

shr	vx

Instruction : shl
Description : Bitshifts operand left by 1
Operands :

shl	vx

Instruction : subo
Description : Subtracts the first operand from the second and puts it in the first operand
Operands :

subo	vx,	vx

Instruction : spt
Description : Sets the ptr to the sprite in the operand
Operands :

spt	vx

Instruction : bcd
Description : Sets the binary coded decimal in the first operand at the current ptr location
Operands :

bcd	vx

Instruction : dump
Description : Dumps the registers up to the first operand at the current ptr
Operands :

dump	vx

Instruction : load
Description : Loads the registers up to the first operand at the current ptr
Operands :

load	vx

Instruction : draw
Description : Draws a sprite from ptr at the first operand for x and the second operand for y with a sprite height of the third operand
Operands :

draw	vx,	vx,	literal

Instruction : rnd
Description : Sets the first operand to a random number between 0-255 bitwise and with second operand
Operands :

rnd	vx,	literal

Instruction : mjmp
Description : Sets the ptr to the first operand + the current value of register 0
Operands :

mjmp	instruction_label
mjmp	literal

Instruction : sk
Description : Skips the next instruction if the key in the first operand is held
Operands :

sk	vx

Instruction : snk
Description : Skips the next instruction if the key in the first operand is not held
Operands :

snk	vx

Instruction : wtk
Description : Waits for a key press and then puts the result in the first operand
Operands :

wtk	vx