Browse Source

Finish program type

master
Forest Belton 3 years ago
parent
commit
75685cf699
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      gbso/program.py

+ 7
- 7
gbso/program.py View File

@ -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

Loading…
Cancel
Save