KOMAP 4-bit computer v3

  • KOMAP
    4th Sep 2021 Member 0 Permalink

    Program runs from up to the down

    Each line consists of the command name and the value (constant value or memory address)

    Commands are:

    • 0000 - LODA - loads value from the given memory address to the A-register
    • 0001 - LODB - loads value from the given memory address to the B-register
    • 0010 - SETA - sets the given constant value to the A-register
    • 0011 - SETB - sets the given constant value to the B-register
    • 0100 - SAVEA - saves the value from the A-register to the given memory address
    • 0101 - SAVEB - saves the value from the B-register to the given memory address
    • 0110 - SUM - sums values from the A and B registers and saves it to the given memory address
    • 0111 - AND - does AND logic operation on A and B registers and saves it to the given memory address
    • 1000 - OR - does OR logic operation on A and B registers and saves it to the given memory address
    • 1001 - LSH - does left bit shifting on A-register and saves the result in the given memory address
    • 1010 - RSH - does right bit shifting on A-register and saves the result in the given memory address
    • 1011 - WRT - writes value from the given memory address to the output console
    • 1100 - GOUP - goes up in the code on the given constant number of lines
    • 1101 - GODW - goes down in the code on the given constant number of lines
    • 1110 - IF - runs the code below if the value from the given memory address is > 0, otherwise skips 1 line of code below
    • 1111 - HALT - stops the program

    Memory address is a value between 0000 and 0011

    Edited once by KOMAP. Last: 4th Sep 2021