fox32

32 bit fantasy computer


add

Encoding

xx000001

Variable size is allowed.

Operation

destdest + src

Description

The contents of src are added to dest, and the result is stored in dest.

Flags

Z - set if the result is zero, otherwise reset.

C - set if the destination overflowed, otherwise reset.

Examples

If register r0 contains 0x04 and register r1 contains 0x08, upon execution of add r0, r1, register r0 will contain 0x0C.
If register r0 contains 0x04, upon execution of add r0, 0x08, register r0 will contain 0x0C.
If address 0x00008000 contains 0x04, upon execution of add.8 [0x00008000], 0x08, address 0x00008000 will contain 0x0C.


and

Encoding

xx000011

Variable size is allowed.

Operation

destdest & src

Description

The contents of src are bitwise ANDed with dest, and the result is stored in dest.

Flags

Z - set if the result is zero, otherwise reset.

C - no change.

Examples

If register r0 contains 0x1F and register r1 contains 0x10, upon execution of and r0, r1, register r0 will contain 0x10.
If register r0 contains 0x1F, upon execution of and r0, 0x10, register r0 will contain 0x10.
If address 0x00008000 contains 0x1F, upon execution of and.8 [0x00008000], 0x10, address 0x00008000 will contain 0x10.


bcl

Encoding

10010110

Variable size is not allowed.

Operation

src bit number of dest ← 0

Description

Bit src in dest is cleared.

Flags

Z - no change.

C - no change.

Examples

If register r0 contains 0x1F and register r1 contains 0x00, upon execution of bcl r0, r1, register r0 will contain 0x1E.
If register r0 contains 0x1F, upon execution of bcl r0, 0x00, register r0 will contain 0x1E.
If address 0x00008000 contains 0x1F, upon execution of bcl [0x00008000], 0x00, address 0x00008000 will contain 0x1E.


brk

Encoding

10100000

Variable size is not allowed.

Description

Print register contents to the terminal.

Flags

Z - no change.

C - no change.


bse

Encoding

10000110

Variable size is not allowed.

Operation

src bit number of dest ← 1

Description

Bit src in dest is set.

Flags

Z - no change.

C - no change.

Examples

If register r0 contains 0x1E and register r1 contains 0x00, upon execution of bse r0, r1, register r0 will contain 0x1F.
If register r0 contains 0x1E, upon execution of bse r0, 0x00, register r0 will contain 0x1F.
If address 0x00008000 contains 0x1E, upon execution of bse [0x00008000], 0x00, address 0x00008000 will contain 0x1F.


bts

Encoding

10100110

Variable size is not allowed.

Operation

Z ← !(src bit number of dest)

Description

Bit src in dest is tested and the result is inverted and stored in Z.

Flags

Z - set if the specified bit is zero, otherwise reset.

C - no change.


call

Encoding

10011000

Variable size is not allowed.

Operation

[stack pointer]instruction pointer + size offset
instruction pointersrc

Description

The current instruction pointer plus the size of the current instruction is pushed to the stack, then the instruction pointer is set to src.

Flags

Z - no change.

C - no change.


cmp

Encoding

xx000111

Variable size is allowed.

Operation

Zdest - src

Description

The contents of src are subtracted from dest, and the result is discarded.

Flags

Z - set if the result is zero, otherwise reset.

C - set if the destination overflowed, otherwise reset.


dec

Encoding

xx110001

Variable size is allowed.

Operation

destdest - 1

Description

The contents of dest are subtracted by one, and the result is stored in dest.

Flags

Z - set if the result is zero, otherwise reset.

C - set if the destination overflowed, otherwise reset.


div

Encoding

xx100010

Variable size is allowed.

Operation

destdest / src

Description

The contents of dest are divided by src, and the result is stored in dest.

Flags

Z - set if the result is zero, otherwise reset.

C - no change.


halt

Encoding

10010000

Variable size is not allowed.

Description

The CPU is halted until an interrupt occurs.

Flags

Z - no change.

C - no change.


icl

Encoding

10011100

Variable size is not allowed.

Description

Disables interrupts.

Flags

Z - no change.

C - no change.


in


inc


ise


jmp


loop


mov


movz


mul


nop


not


or


out


pop


push


rcall


rem


ret


reti


rjmp


rloop


rol


ror


rta


sla


sra


srl


sub


xor