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 Divider Remainder R
07 Multiplication Overflow R

Ports

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

Memory Map

Address Name Operations
00-F5 General Purpose Memory R/W
F6 RTC (40hz) R
F7 RNG (Write to random) R/W
F8 PPU SPos R
F9 PPU CLR R/W
FA PPU BK R/W
FB PPU FLG R/W
FC PPU S R/W
FD PPU P2 R/W
FE PPU P1 R/W
FF PPU OP W

PPU Instruction Set

Address Mnemonic Description
00 NOP Raytracing nvidia graphics rtx (JOKE)
01 FLP Invokes a graphics update
02 DSP Disables the currently selected sprite using S
03 ESP Enables the currently selected sprite using S
04 CSP Creates a sprite at slot S with P1, P2, and CLR.
05 USP Updates the currently selected Sprite with P1 as it's new position
06 USD Updates the currently selected Sprite with P2 as it's new dimension or position
07 USC Updates the currently selected Sprite with CLR as it's new color
08 SCL Updates every sprite by adding P1 to it's position

PPU Registers

Name Description Operations
OP Operation for the PPU. Excecutes on write. W
P1 Used interchangeably but usually a position (changes based on OP) R/W
P2 Used interchangeably but usually a dimension (changes based on OP) R/W
S Slot register meant for Sprite i/o R/W
FLG Flag register to modify the behavior of the PPU R/W
BK The background color (RRRGGBBB) R/W
CLR This holds the color register for stuff (RRRGGBBB) R/W
SPOS This holds the current position of the sprite R

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 and GPU Color Burst! 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!


Color Burst Dev Guide (V3)

Introduction 🎉

So... you wanna make some 8k UHD graphics on the Fem-8? Well... look no further! Starting from April 30-May 12 I have created a PPU to serve your graphical needs! I called it Color Burst! You can find some Q&A and description on the project! I have also listed the PPU registers and Instruction set above if you didn't notice. Also in order to use this you need the Memory Map! But other than that, let's get started.

Format 📜

So you might be confused. "Pacifiky? How are you supposed to drive a 24-bit screen with 8 bit color, and how are you doing the coordinates? Well... here's what I did.
Color is organized like this: RRRGGBBB So yes... you won't get very precise greens for your graphics, but other than that it's fast and totally used!
Coordinates (and Dimensions) are organized like this: XXXXYYYY This makes it a bit of an inconvenience when performing arithmetic on coordinates. But also, this means that it can only drive screens less than 16x16 (tragic).

Flags 🚩

Here's how the FLG register is defined! AECg BGRM M = Pos1, Pos2 OR Pos, Dim
R = Adds 32 to r channel from then on (Tint Red)
G = Adds 32 to g channel from then on (Tint Green)
B = Adds 32 to b channel from then on (Tint Blue)
g = Uses CLR as grayscale value from then on
C = Nothing...?
E = Disable background
A = Graphics update by clock or manual

M flag:
So basically, the M flag just controls how the coordinates used when creating sprites is interpreted. Setting it to 0 would render the second sprite value as Dimension of the sprite, setting it to 1 would make it the Position of the opposite vertex to value 1 (position).

RGBg flags:
So these are the fun flags... R tints everything red on graphics update (only the output) G does green and B does blue respectively. But g... basically allows you to use the full 8-bits by turning it into a grayscale value! So at least you can get full quality photos from the 50s!

C flag:
...

E flag:
So whenever you invoke a graphics update, it erases everything to the color of the BK register! But that's kind of a problem when you want more sprites for something (like snake!). So by disabling the background, you keep everything from the last update and you can add or erase stuff when YOU want.

A flag:
So usually, grahpics updates are controlled by the flip instuction in the Instruction set but of course if you want, you can control it with the same RTC clock as used in the Memory Map which means you get a stable 40fps.

Sprites 😼

Wait a moment... is this scratch??? No it isn't but there is sprites! Each sprite is defined with 3 variables. An arbitrary position, dimension (or position by M), and color! So sadly, no you cannnot make a picture of your Minecraft skin into a spite (sad). Oh and also, you can only read a single property of the currently selected sprite. You can find that in SPos! It's just the position of the sprite and if you want to save others, you're gonna have to save that to memory sadly. But i'm planning on implementing instructions to swap the currently selected dim and color with the current registers.

Timing ⏰

So with the fem8 you probably won't have any problems with timing on the PPU. It takes 32 units of time for both graphics updates and scrolling. To put it in perspective, the fem8 uses 50 units for it's clock cycle.

Background 🧱

So every time you invoke a graphics update, everything is erased to the color in the BK register. This can be disabled by E in the flag section!

Ending

So... this is everything you need to know to use the graphics system! Now that you know everything about programming this computer I have a challenge for you:
Will it run DOOM?