Пример #1
0
def lifitri(trits, fill=WORDSIZE, lim=-1, char='0'):
	# limit/fill trits to certain lengths
	if lim == -1:
		lim = fill
	int = btcalc.BTTODEC(trits)
	if abs(int) > btcalc.mpi(lim):
		XXerrorXX
	#return trits.rjust(fill, char)  # obsolete
	return ('{:' + char + '>' + str(fill) + '}').format(trits)
Пример #2
0
	def p4(self):
		print("pass 4: Rom validity check")
		for item in self.datainstlist:
			#print(item)
			inst=int(item[0])
			data=int(item[1])
			if inst<libbaltcalc.mni(9) or inst>libbaltcalc.mpi(9):
				print("Out of range instruction word found!")
				print("source line: " + str(item[2]))
				return 1
			if data<libbaltcalc.mni(9) or data>libbaltcalc.mpi(9):
				print("Out of range data word found!")
				print("source line: " + str(item[2]))
				return 1
		if len(self.datainstlist)>19683:
			print("Memory Space Overflow!")
			return 1
		return 0
Пример #3
0
 elif (usercalllst[0]).lower() == "decbt":
     try:
         arg = usercalllst[1]
         #print libbaltcalc.DECTOBT(int(arg))
         print btint(int(arg))
     except IndexError:
         print "please specify one decimal integer"
     except TypeError:
         print "Please specify one decimal integer."
     except ValueError:
         print "Please specify one decimal integer."
 elif (usercalllst[0]).lower() == "mpi":
     try:
         arg = usercalllst[1]
         #calculate the MPI of the user-specifed number of trits
         print libbaltcalc.mpi(int(arg))
     except IndexError:
         print "please specify one decimal integer"
     except TypeError:
         print "Please specify one decimal integer."
     except ValueError:
         print "Please specify one decimal integer."
 elif (usercalllst[0]).lower() == "mni":
     try:
         arg = usercalllst[1]
         #calculate the MPI of the user-specifed number of trits
         print libbaltcalc.mni(int(arg))
     except IndexError:
         print "please specify one decimal integer"
     except TypeError:
         print "Please specify one decimal integer."
Пример #4
0
				docopy=1
			if copyabx.collidepoint(event.pos)==1 and event.button==1:
				DB=DA
				TB=libbaltcalc.DECTOBT(DB)
				STAT="COPY A TO B"
				scupdate=1
				
			if invertax.collidepoint(event.pos)==1 and event.button==1:
				DA=( - DA)
				TA=libbaltcalc.DECTOBT(DA)
				STAT="INVERT A"
				scupdate=1
			#row 2
			if mpix.collidepoint(event.pos)==1 and event.button==1:
				if abs(DA)<=mcalclimit:
					DR=libbaltcalc.mpi(abs(DA))
					TR=libbaltcalc.DECTOBT(DR)
					STAT="mpi of A (DEC)"
					scupdate=1
					docopy=1
				else:
					STAT="mpi of over 36 is too large"
					scupdate=1
			if mcvx.collidepoint(event.pos)==1 and event.button==1:
				if abs(DA)<=mcalclimit:
					DR=libbaltcalc.mcv(abs(DA))
					TR=libbaltcalc.DECTOBT(DR)
					STAT="mcv of A (DEC)"
					scupdate=1
					docopy=1
				else: