def __init__(self): self.mem = MEMORY(SICXE_SIZE_MEMORY) self.devices = Devices(SICXE_SIZE_DEVICES) self.registers = reg.registers self.cu = CU(self)
def compfrm(register: FLOAT, sw: INT, mem: MEMORY, addr, isImmediate=False): operand = addr if isImmediate else mem.getfloat(addr) cc = SICXE_CC_GT if register > operand else SICXE_CC_LT if register < operand else SICXE_CC_EQ sw.setbits(cc, (6, 8), BIG)
def addrm(register: INT, mem: MEMORY, addr, isImmediate=False): operand = addr if isImmediate else mem.getword(addr, True) register.add(operand, setSelf=True)
def stch(register: INT, mem: MEMORY, addr): mem.setbyte(addr, register.getbits((0, 8), False, LITTLE))
def divfrm(register: FLOAT, mem: MEMORY, addr, isImmediate=False): operand = addr if isImmediate else mem.getfloat(addr) register.truediv(operand, setSelf=True)
def stf(register: FLOAT, mem: MEMORY, addr): mem.set(addr, register.dec, 6)
def st(register: INT, mem: MEMORY, addr): mem.setword(addr, register)
def ldch(register: INT, mem: MEMORY, addr, isImmediate=False): operand = addr if isImmediate else mem.getbyte(addr) if operand < 0 or operand > 0xff: raise Exception('cannot be longer the a byte') register.setbits(operand, (0, 8), LITTLE)
def ldf(register: FLOAT, mem: MEMORY, addr, isImmediate=False): if isImmediate: register.set(addr) else: register.dec = mem.get(addr, 6)
def ld(register: INT, mem: MEMORY, addr, isImmediate=False): operand = addr if isImmediate else mem.getword(addr, False) register.set(operand)