예제 #1
0
def _push_static(index, fileName):
    variable= fileName + '.' + index
    asm.set_areg(variable)  # @index
    asm.set_dreg_from_sgm()  # D=M
    asm.set_areg_from_reg('SP')  # @SP, A=M
    asm.set_sgm_from_dreg()  # M=D
    inc_sp()  # Mem[SP] = Mem[SP] + 1
예제 #2
0
def _push(sgm, index):
    asm.set_areg_from_reg('%s' % asm.sgm_2_reg(sgm))  # @REGISTER, A=M
    asm.inc_areg(index)  # Loop: A=A+1
    asm.set_dreg_from_sgm()  # D=M
    asm.set_areg_from_reg('SP')  # @SP, A=M
    asm.set_sgm_from_dreg()  # M=D
    inc_sp()  # Mem[SP] = Mem[SP] + 1
예제 #3
0
def _save_register(reg):
    asm.set_areg(reg)  # @reg
    asm.set_dreg_from_sgm()  # D=M
    asm.set_areg_from_reg('SP')  # @SP, A=M
    asm.set_sgm_from_dreg()  # M=D
    cs.inc_sp()  # Mem[SP] = Mem[SP] + 1