def getlinetern(line):
    line = (line - 9841)
    tline = libSBTCVM.trunkto6(libbaltcalc.DECTOBT(line))
    return tline
Beispiel #2
0
    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
outfile = "assmout.trom"
#define IOmaps
IOmapread = {"random": "--0------"}
IOmapwrite = {}
#populate IOmaps with memory pointers
scratchmap = {}
scratchstart = "---------"
shortsccnt = 1
scratchstop = "---++++++"
IOgen = scratchstart
while IOgen != scratchstop:
    #scratchmap[("mem" + str(shortsccnt))] = IOgen
    IOmapread[("mem" + str(shortsccnt))] = IOgen
    IOmapwrite[("mem" + str(shortsccnt))] = IOgen
    IOgen = libSBTCVM.trunkto6(libbaltcalc.btadd(IOgen, "+"))
    shortsccnt += 1
#scratchmap[("mem" + str(shortsccnt))] = scratchstop
IOmapread[("mem" + str(shortsccnt))] = scratchstop
IOmapwrite[("mem" + str(shortsccnt))] = scratchstop


def getlinetern(line):
    line = (line - 9841)
    tline = libSBTCVM.trunkto6(libbaltcalc.DECTOBT(line))
    return tline


tracecomp = 0

Beispiel #4
0
outfile="assmout.trom"
#define IOmaps
IOmapread={"random": "--0------"}
IOmapwrite={"dispmode": "--0---+-+", "dispoffset": "--0---+0-", "dispupdate": "--0---+00"}
#populate IOmaps with memory pointers
scratchmap={}
scratchstart="---------"
shortsccnt=1
scratchstop="---++++++"
IOgen=scratchstart
while IOgen!=scratchstop:
	#scratchmap[("mem" + str(shortsccnt))] = IOgen
	IOmapread[("mem" + str(shortsccnt))] = IOgen
	IOmapwrite[("mem" + str(shortsccnt))] = IOgen
	IOgen=libSBTCVM.trunkto6(libbaltcalc.btadd(IOgen, "+"))
	shortsccnt += 1
#scratchmap[("mem" + str(shortsccnt))] = scratchstop
IOmapread[("mem" + str(shortsccnt))] = scratchstop
IOmapwrite[("mem" + str(shortsccnt))] = scratchstop

def getlinetern(line):
	line=(line-9841)
	tline=libSBTCVM.trunkto6(libbaltcalc.DECTOBT(line))
	return tline

tracecomp=0
#used to write to the compiler log if the compiler is in tracelog mode
def complog(textis):
	if tracecomp==1:
		compilerlog.write(textis)