Beispiel #1
0
	def handle(InstructionCtor, name, transpiler, rawParams):
		p1 = rawParams[0]
		argno = int(rawParams[1], 10)
		if argno < 1:
			raise ValueError("MOVARG argno must be at least 1")
		p2 = "[BSP + %d]" % ((argno * 4) + 4)
		return Instruction.handle(InstructionCtor, "MOV", transpiler, [p1, p2])
Beispiel #2
0
	def handle(InstructionCtor, name, transpiler, rawParams):
		useopc = None
		outParams = []
		if len(rawParams) == 0:
			useopc = "RETN"
		elif len(rawParams) == 1:
			useopc = "RETNA"
			try :
				x = int(rawParams[0], 10) * 4
				if x == 0:
					useopc = "RETN"
					outParams = []
				elif x < 0:
					raise TypeError("DRET arg must be >= 0")
				else:
					outParams = ["%d" % x]
			except ValueError:
				pass
		else:
			raise ValueError("DRET only supports 0 or 1 parameter")
		return Instruction.handle(InstructionCtor, useopc, transpiler, outParams)
Beispiel #3
0
	def handle(InstructionCtor, name, transpiler, rawParams):
		lbl = "db_" + rawParams[0]
		insn = Instruction.handle(InstructionCtor, name, transpiler, [rawParams[1]])
		transpiler.emitLabel(lbl, insn)
		transpiler.emitLabel(lbl + "_len", insn.len())
		return insn