Very angry virtual machine
Find a file
2024-04-21 20:47:21 +02:00
app Renaming opcodes and implementing toStrings for all the instructions 2024-04-16 15:34:30 +02:00
gradle/wrapper Initial 2024-04-16 06:14:37 +02:00
.gitattributes Initial 2024-04-16 06:14:37 +02:00
.gitignore Initial 2024-04-16 06:14:37 +02:00
gradlew Initial 2024-04-16 06:14:37 +02:00
gradlew.bat Initial 2024-04-16 06:14:37 +02:00
makefile Makefile for convenience 2024-04-16 06:14:45 +02:00
README.md Mermaid diagram for classes 2024-04-21 20:47:21 +02:00
settings.gradle.kts Initial 2024-04-16 06:14:37 +02:00

HateLace - A Simple Computer

classDiagram
    class Computer {
        - Memory memory
        - Program program
        + Computer(Memory Memory)
        + void load(Program program)
        + void run()
    }
    class Memory {
        + abstract Word read(Address address)
        + abstract int size()
        + abstract void write(Address address, Word data)
        + abstract void dump()
    }
    class ProgramCounter {
        - int PC
        - int SysTick
        - boolean haltFlag
        + ProgramCounter()
        + ProgramCounter(int PC)
        + int getPC()
        + int getSysTicks()
        + int incPC()
        + int setPC(int PC)
        + boolean halted()
        + void halt()
    }
    class Program
    class Instruction {
        + abstract void execute(Memory memory, ProgramCounter pc)
        # abstract String opcode()
        # abstract Object[] operands()
        + abstract String toString()
    }
    class ArrayList
    class Word {
        + abstract <T> T getValue()
        + abstract Word add(Word other)
        + abstract Word subtract(Word other)
        + abstract Word multiply(Word other)
        + abstract Word divide(Word other)
        + abstract String toString()
        + abstract boolean equals(Object other)
    }
    class Address {
        - int address
        + Address(int address)
        + int getAddress()
        + String toString()
    }
    class LongWord {
        - Long value
        + LongWord(Long value)
        + Long getValue()
        + Word add(Word other)
        + Word subtract(Word other)
        + Word multiply(Word other)
        + Word divide(Word other)
        + String toString()
        + boolean equals(Object other)
    }
    class LongMemory {
        - long[] memory
        + LongMemory()
        + LongMemory(int size)
        + Word read(Address address)
        + int size()
        + void write(Address address, Word data)
        + void dump()
    }
    Memory <|-- LongMemory
    Word <|-- LongWord
    Program <-- ArrayList
    Program --|> Instruction
    Program : +toString()
    Computer --> Memory
    Computer --> Program
    Computer --> ProgramCounter