def getlinetern(line): line = (line - 9841) tline = libSBTCVM.trunkto6(libbaltcalc.DECTOBT(line)) return tline
HPIX = 0 assmflename = arg assmnamelst = assmflename.rsplit('.', 1) tasmfile = (assmnamelst[0] + (".tasm")) tasmout = open(tasmfile, "w") tasmout.write("\n#autogenerated by SBTCVM MARK 2 GFX toolkit, from: \"" + arg + "\" \n") tasmout.write("textstart\n") tasmout.write("autogenerated by SBTCVM MARK 2 GFX \n toolkit, from: \"" + arg + "\" \n") tasmout.write("textstop\n") while HPIX != IMGh: WPIX = 0 while WPIX != IMGw: COLLIST = IMGSOURCE.get_at((WPIX, HPIX)) Wtern = trunkto3(libbaltcalc.DECTOBT((WPIX - 13))) Htern = trunkto3(libbaltcalc.DECTOBT((HPIX - 13))) #print "foo" #print COLLIST preR = COLLIST[0] preG = COLLIST[1] preB = COLLIST[2] preA = 255 #print((preR, preG, preB, preA)) postR = dropshift(preR) postG = dropshift(preG) postB = dropshift(preB) terR = codeshift(preR) terG = codeshift(preG) terB = codeshift(preB) postA = dropshift(preA)
else: freqnumxxx = "--------0" freqstr = "4Khz 1-trit SBTCVM Mark 2 sample format." length = waveFile.getnframes() #write information comments and add functional test routine. #notice how the length is linear-bias encoded (length-9841). this lets the length be much larger. #I know the length is a rough guess, and it may be off by a word or two. outfile.write(''' #tip: replace the 1s with 2s, 3s, or 4s to change the sample channel. #MK2-TWAV.py automatically calculates sample length for you. #if you are writing a specialty utility, see its code. #format: ''' + freqstr + ''' setreg1|>wavhead IOwrite1|>sam1off setreg1|''' + libSBTCVM.trunkto6(libbaltcalc.DECTOBT((length // 9 + 1) - 9841)) + ''' IOwrite1|>sam1len setreg1|''' + freqnumxxx + ''' IOwrite1|>sam1freq IOwrite1|>sam1play userwait stop ''') outfile.write("null|") #outfile=open("outdata.twav", "w") if cmd == "-2k": print("Please wait. processing wave into Ternary 1-trit 2Khz audio...") else: print("Please wait. processing wave into Ternary 1-trit 4Khz audio...") cnt = 1
for event in pygame.event.get(): keymods=pygame.key.get_mods() if event.type == QUIT: qflg=1 break if event.type == KEYDOWN and event.key == K_F1: subprocess.Popen(["python", "helpview.py", "calc.xml"]) if event.type == KEYDOWN and event.key == K_F8: pygame.image.save(screensurf, (os.path.join('CAP', 'SCREENSHOT-calc.png'))) break if event.type==MOUSEBUTTONDOWN: #button Operations code #first ROW if addx.collidepoint(event.pos)==1 and event.button==1: DR=DA + DB TR=libbaltcalc.DECTOBT(DR) STAT="SUM A & B" scupdate=1 docopy=1 if subx.collidepoint(event.pos)==1 and event.button==1: DR=DA - DB TR=libbaltcalc.DECTOBT(DR) STAT="SUBTRACT A & B" scupdate=1 docopy=1 if divx.collidepoint(event.pos)==1 and event.button==1: try: DR=DA // DB STAT="DIVIDE A & B" except ZeroDivisionError: STAT="DIVIDE BY ZERO ERROR"