Femboy-8 Assembler


Instruction Set

Opcode Mnemonic Description
00 NOP No Operation
01 HLT Halts CPU
02 OUT [id] Outputs out of a Output port.
03 LDA [d8] Loads 8-bit word into the accumulator
04 MVA [r] Move register to accumulator
05 MVR [r] Move accumulator to register
06 INC [r] Increment a register
07 DEC [r] Decrement a register
08 ADD [r] Add the accumulator from a register
09 SUB [r] Subtract the accumulator from a register
0A AND [r] And the register and accumulator
0B IOR [r] OR the register and accumulator
0C XOR [r] XOR the register and accumulator
0D NOT [r] NOT a register
0E SAR [d8] Barrel Shift accumulator right
0F SAL [d8] Barrel Shift accumulator left
10 JUP [d8] Jump to a location
11 JPP [r] Jump to a register value
12 JPL [d8] Jump if accumulator is less than 0
13 JZO [d8] Jump if accumulator is 0
14 JPG [d8] Jump if accumulator is greater than 0
15 JLE [d8] Jump if accumulator is less than or equal to 0
16 JGE [d8] Jump if accumulator is greater than or equal to 0
17 JNZ [d8] Jump if accumulator is not 0
18 CLR [r] Clear a register
19 INP [id] Store INPUT id in accumulator
1A MPR [r] Move the value at address A register r
1B MRP [r] Move register r into address A
1C MPA [d8] Move a value in a pointer to the accummulator
1D MAP [d8] Move the accumulator to a location
1E MLT [r] Multiply register r by the accumulator
1F DIV [r] Divide register r by accumulator

Registers

Address Name Operations
00 Register 00 R/W
01 Register 01 R/W
02 Register 10 R/W
03 Register 11 R/W
04 CR Flag R
05 ZERO Flag R
06 PC R
07 ALU Result R

Ports

Address Name Type
00 Hex Display Output
01 TTY Output
00 Keyboard Input

Assembler Guide

Introduction

Hello all! I am flattered that you are using my Assembler! Let me introduce myself. Hi, i'm Pacifiky one of the creators of the CPU Femboy-8! I created this assembler to make it easier for ya'll to make programs for the f8!
Here's a guide to help get you started.

Instructions

Instructions are written like this: JUP 00 this jumps to the adress 0. The instruction will always be 3 letters long and the argument can be either a marker or a 8 bit hex value. But after the argument you can put comments.
Instructions NOP and HLT do not require any arguments.
Instructions are also separated by newlines.
In order for a full explanation of instructions please consult the instruction set.

Instruction Set

The Instruction Set is organized with OPCODE first (the hexidecimal value of the insturction), Mnemonic second (the Assembly code), then a short explanation of the instruction.
Some instructions have [] next to them. That means they require a argument whether it be 8-bit hexideimal or markers.
The words inside the brakets represent what the argument is.
[id] means a port id.
[r] means a register.
[d8] means an 8 bit hexidecimal value.

Comments

There are 2 types of comments: instruction and line comments.
Line comments are organized like this:
#This is a comment.
HLT
They use # and the assembler completely ignores the line.
Instruction comments are organized like this: HLT ;This is a comment They work on both no argument instructions and argument instructions. The comment is ignored by the assembler.

Markers

Markers are used to mark certain parts of the code in in order to make jumping easier.
As you add code, the marker value automatically updates.
Markers cannot contain spaces and can be placed on any line in the code.
Markers are removed from the code and the values are filled in by the assembler.
Markers can also be used as arguments for any instruction (if you want a location as the argument that is).
Markers are organized like this: beginning:
INP 00
JZO beginning
OUT 01
JUP beginning

Assembly

The code is entered into the INPUT textarea to the left and output is assembled on the right OUTPUT textarea.
In order to assemble your code press the "assemble" button at the bottom.

Ending

Welp that's all for this short guide on the Assembler!
Be sure to read the Instruction set, Registers, and Ports section of this page.
Have fun coding!