Computer
1 Stars     2 Views    

Author: Foo54

Forked from: Foo54/Computer

Project access type: Public

Description:

8 Bit Computer with its own OS
Each command consists of 4 bits for an op code and 8 bits for instructions [op code][instructions]
Labels are 10 bits long and store a index in the code to jump to
Colors are 24 bits long and store a color to display to the screen
There are 4 registers: register 1, 2, 3, and 4

Commands:

The order arguments are presented in is the order they should appear, moving from most significant to least significant bit
ALU:
 - OP CODE 0
 - takes 3 arguments [AA][BB][CODE]
  > Register A (2 bits)
  > Register B (2 bits)
  > ALU OP CODE (4 bits)
    0) C = A + B
    1) C = A - B
    2) C = A * B
    3) C = A // B
    4) C = A % B
    5) C = A & B
    6) C = A | B
    7) C = A ^ B
    8) C = ~A
    9) C = -A
    10) C = A = B
    11) C = A != B
    12) C = A >= B
    13) C = A > B
    14) C = A <= B
    15) C = A < B
 - OP CODEs 10 through 15 are either 0 or 1
 - C is stored in register 0
SET:
 - OP CODE 1
 - takes 1 argument [NEWVALUE]
  > Value (8 bits)
 - sets register 0 to Value
DUPLICATE:
 - OP CODE 2
 - takes 2 arguments [AA][BB][xxxx]
  > Register A (2 bits)
  > Register B (2 bits)
 - sets Register B to Register A
READ:
 - OP CODE 3
 - takes 1 argument [RADDRESS]
  > Read Address (8 bits)
 - Reads RAM address Address and stores it in Register 1
WRITE:
 - OP CODE 4
 - takes 1 argument [WADDRESS]
  > Write Address (8 bits)
 - Stores Register 1 in RAM address Address
MARK:
 - OP CODE 5
 - takes 1 argument [LADDRESS]
  > Label Address (8 bits)
 - Stores Label address Address in Label Storage
JUMP:
 - OP CODE 6
 - takes the same arguments as ALU
 - if C is not 0, then move pointer to Value in Label Storage
 - Otherwise, do nothing
7 SEGMENT DISPLAY:
 - OP CODE 9
 - takes 2 arguments: [RE][x][S][xxxx]
  > Register (2 bits)
  > Segment (1 bit)
 - there is 1 ignored bit in-between Register and Segment
 - Sets 7 Segment Display Segment to value in first 4 bits of Register (will break if over 10)
DRAW:
 - OP CODE 10
 - Takes 3 arguments: [XX][YY][COLR]
  > X Register (2 bits)
  > Y Register (2 bits)
  > Color Address (4 bits)
 - Sets pixel at (X, Y) to Colors address Address
BULB:
 - OP CODE 11
 - Takes 2 arguments: [B][x][CL][xxxx]
  > Bulb (1 bit)
  > Color (2 bits)
 - Sets Bulb Bulb to No Color (color 0), Red (color 1), or Green (color 2)
INPUT:
 - OP CODE 12
 - Takes 0 arguments: [xxxxxxxx]
 - Sets Register 0 to the button input values (button x sets bit x - 1 to true if pressed, bit 0 is least significant bit, only 1 button can be pressed at a time)
END:
 - OP CODE 13
 - Takes 0 arguments: [xxxxxxxx]
 - Terminates the program, reset button must be pressed to re-enable
WAIT:
 - OP CODE 14
 - Takes 0 arguments: [xxxxxxxx]
 - Does Nothing, any jumps should point to a WAIT to ensure that commands are not skipped unintentionally

Created: May 02, 2024

Updated: May 03, 2024


Comments

You must login before you can post a comment.