|
|
@ -1,19 +1,19 @@ |
|
|
|
from dataclasses import dataclass |
|
|
|
from typing import List, Set |
|
|
|
from typing import Dict, List, Optional, Set, Union |
|
|
|
|
|
|
|
from gbso.cpu import CPU |
|
|
|
from gbso.cpu import CPU, CPUState |
|
|
|
from gbso.insn import Insn |
|
|
|
from gbso.regs import R8 |
|
|
|
|
|
|
|
|
|
|
|
@dataclass |
|
|
|
class Program: |
|
|
|
outputs: Set[R8] |
|
|
|
outputs: Set[Union[R8, int]] |
|
|
|
insns: List[Insn] |
|
|
|
init_state: Optional[CPUState] = None |
|
|
|
|
|
|
|
# TODO: Memory outputs |
|
|
|
# TODO: Initialization of registers/memory |
|
|
|
|
|
|
|
def execute(self, cpu: CPU) -> None: |
|
|
|
def execute(self) -> CPU: |
|
|
|
cpu = CPU(state=self.init_state) |
|
|
|
for insn in self.insns: |
|
|
|
insn.exec(cpu) |
|
|
|
return cpu |