示例#1
0
   def writeInc(self, Operand, Destination):
      NewInstruction = ImmediateInstruction(ImmediateInstruction.EnumType.INC, self.ImmediateInstructionCounter)
      NewInstruction.Operand     = Operand
      NewInstruction.Destination = Destination

      self.ImmCodeData.append(NewInstruction)
      self.ImmediateInstructionCounter += 1
示例#2
0
   def writeMov(self, Destination, Source):
      NewInstruction = ImmediateInstruction(ImmediateInstruction.EnumType.MOV, self.ImmediateInstructionCounter)
      NewInstruction.Source      = Source
      NewInstruction.Destination = Destination

      self.ImmCodeData.append(NewInstruction)
      self.ImmediateInstructionCounter += 1
示例#3
0
   def writeConstAssigment(self, Variable, Value):
      NewInstruction = ImmediateInstruction(ImmediateInstruction.EnumType.ASSIGNCONST, self.ImmediateInstructionCounter)
      NewInstruction.Variable = Variable
      NewInstruction.Value    = Value

      self.ImmCodeData.append(NewInstruction)
      self.ImmediateInstructionCounter += 1
示例#4
0
    def writeGoto(self, Id):
        NewInstruction = ImmediateInstruction(
            ImmediateInstruction.EnumType.GOTOLABEL,
            self.ImmediateInstructionCounter)
        NewInstruction.LabelId = Id

        self.ImmCodeData.append(NewInstruction)
        self.ImmediateInstructionCounter += 1
示例#5
0
   def writeMul(self, A, B, Destination):
      NewInstruction = ImmediateInstruction(ImmediateInstruction.EnumType.MUL, self.ImmediateInstructionCounter)
      NewInstruction.A = A
      NewInstruction.B = B
      NewInstruction.Destination = Destination

      self.ImmCodeData.append(NewInstruction)
      self.ImmediateInstructionCounter += 1      
示例#6
0
    def writeInc(self, Operand, Destination):
        NewInstruction = ImmediateInstruction(
            ImmediateInstruction.EnumType.INC,
            self.ImmediateInstructionCounter)
        NewInstruction.Operand = Operand
        NewInstruction.Destination = Destination

        self.ImmCodeData.append(NewInstruction)
        self.ImmediateInstructionCounter += 1
示例#7
0
    def writeConstAssigment(self, Variable, Value):
        NewInstruction = ImmediateInstruction(
            ImmediateInstruction.EnumType.ASSIGNCONST,
            self.ImmediateInstructionCounter)
        NewInstruction.Variable = Variable
        NewInstruction.Value = Value

        self.ImmCodeData.append(NewInstruction)
        self.ImmediateInstructionCounter += 1
示例#8
0
    def writeMov(self, Destination, Source):
        NewInstruction = ImmediateInstruction(
            ImmediateInstruction.EnumType.MOV,
            self.ImmediateInstructionCounter)
        NewInstruction.Source = Source
        NewInstruction.Destination = Destination

        self.ImmCodeData.append(NewInstruction)
        self.ImmediateInstructionCounter += 1
示例#9
0
   def writeAdd(self, A, B, Destination):
      NewInstruction = ImmediateInstruction(ImmediateInstruction.EnumType.ADD, self.ImmediateInstructionCounter)
      NewInstruction.A = A
      NewInstruction.B = B
      NewInstruction.Destination = Destination
      NewInstruction.StaticCarry = False

      self.ImmCodeData.append(NewInstruction)
      self.ImmediateInstructionCounter += 1
示例#10
0
    def writeMul(self, A, B, Destination):
        NewInstruction = ImmediateInstruction(
            ImmediateInstruction.EnumType.MUL,
            self.ImmediateInstructionCounter)
        NewInstruction.A = A
        NewInstruction.B = B
        NewInstruction.Destination = Destination

        self.ImmCodeData.append(NewInstruction)
        self.ImmediateInstructionCounter += 1
示例#11
0
    def writeIf(self, A, B, IfType, TrueLabelId, FalseLabelId):
        NewInstruction = ImmediateInstruction(ImmediateInstruction.EnumType.IF,
                                              self.ImmediateInstructionCounter)
        NewInstruction.IfType = IfType
        NewInstruction.A = A
        NewInstruction.B = B
        NewInstruction.TrueLabelId = TrueLabelId
        NewInstruction.FalseLabelId = FalseLabelId

        self.ImmCodeData.append(NewInstruction)
        self.ImmediateInstructionCounter += 1
示例#12
0
   def writeIf(self, A, B, IfType, TrueLabelId, FalseLabelId):
      NewInstruction = ImmediateInstruction(ImmediateInstruction.EnumType.IF, self.ImmediateInstructionCounter)
      NewInstruction.IfType       = IfType
      NewInstruction.A            = A
      NewInstruction.B            = B
      NewInstruction.TrueLabelId  = TrueLabelId
      NewInstruction.FalseLabelId = FalseLabelId

      self.ImmCodeData.append(NewInstruction)
      self.ImmediateInstructionCounter += 1
示例#13
0
    def writeAdd(self, A, B, Destination):
        NewInstruction = ImmediateInstruction(
            ImmediateInstruction.EnumType.ADD,
            self.ImmediateInstructionCounter)
        NewInstruction.A = A
        NewInstruction.B = B
        NewInstruction.Destination = Destination
        NewInstruction.StaticCarry = False

        self.ImmCodeData.append(NewInstruction)
        self.ImmediateInstructionCounter += 1
示例#14
0
   def writeGoto(self, Id):
      NewInstruction = ImmediateInstruction(ImmediateInstruction.EnumType.GOTOLABEL, self.ImmediateInstructionCounter)
      NewInstruction.LabelId = Id

      self.ImmCodeData.append(NewInstruction)
      self.ImmediateInstructionCounter += 1