コード例 #1
0
def main():
    global bus, ram, ppi, alu, cu
    bus = Bus()
    ram = RAM(0x0, 64)
    ppi = PPI(0x40)
    bus.AddMemoryPeripheral(ram, 0x0, 0x0+64*1024-1)
    bus.AddIOPeripheral(ppi, 0x40, 0x40+3)
    
    
    alu = ALU()
    cu = CU(alu, bus)
    
    ppi.SetInterruptCallPA(partial(cu.RST, 5.5, ppi))
    ppi.SetInterruptCallPB(partial(cu.RST, 6.5, ppi))
    
    openFile()
    i = 0
    for wd in words:
        ram.Write(0x8000+i, wd)
        i += 1
    
    
    #ram.Write(0x002C, 0x6F)
    #ram.Write(0x002D, 0xC9)
    ram.Write(0x002c, 0xdb)
    ram.Write(0x002d, 0x40)
    ram.Write(0x002e, 0xc9)
    cu.Reset()
    cu.SetPC(0x8000)
    
    thread = Thread(target=execute)
    thread.start()
    
    ppi.a = 0xbb
    while cu.running:
        pass
#        cmd = input("Enter a command: ")
#        if cmd == "quit":
#            cu.running = False
#        elif cmd == "stba":
#            ppi.StrobeA()
#        elif cmd == "stbb":
#            ppi.StrobeB()
#        elif cmd == "show":
#            print("")
#            alu.Show()
#            #print("\n")
#            #ram.Show()
#            print("\n")
#            ppi.Show()

    ram.ShowRange(parser.labels["TABLE"], parser.labels["TABLE"]+0x63)
    alu.Show()
コード例 #2
0
ファイル: Emulator.py プロジェクト: phynicz/8085-simulator
from RAM import RAM
from Bus import Bus
from PPI import PPI
from Assembler import Assembler
from PPIWindow import PPIWindow

from threading import Thread
from functools import partial
import re
import time
from enum import Enum
import sys, os

bus = Bus()
ram = RAM(0x0, 64)
bus.AddMemoryPeripheral(ram, 0x0, 0x0 + 64 * 1024 - 1)

alu = ALU()
cu = CU(alu, bus)


def AddPPI(addr):
    ppi = PPI(addr)
    bus.AddIOPeripheral(ppi, addr, addr + 3)
    ppi.SetInterruptCallPA(partial(cu.RST, 5.5, ppi))
    ppi.SetInterruptCallPB(partial(cu.RST, 6.5, ppi))
    return ppi


class State(Enum):
    none = 0