def test_org_allows_0xnnnn_format(file_bas, file_bin): """ Should allow hexadecimal format 0x in org """ with EnsureRemoveFile(file_bin): zxbc.main( ['--parse-only', '--org', '0xC000', file_bas, '-o', file_bin]) assert zxbc.OPTIONS.org == 0xC000, 'Should set ORG to 0xC000'
def test_compile_only(file_bas, file_bin): """ Should not generate a file """ with EnsureRemoveFile(file_bin): zxbc.main(['--parse-only', file_bas, '-o', file_bin]) assert not os.path.isfile( file_bin), 'Should not create file "empty.bin"'
def test_org_loads_ok_from_config_file_format(file_bas, file_bin, config_file): """ Should allow hexadecimal format 0x in org """ with EnsureRemoveFile(file_bin): zxbc.main( ['--parse-only', '-F', config_file, file_bas, '-o', file_bin]) assert zxbc.OPTIONS.org == 31234, 'Should set ORG to 31234'
def test_cmdline_should_override_config_file(file_bas, file_bin, config_file): """ Should allow hexadecimal format 0x in org """ with EnsureRemoveFile(file_bin): zxbc.main([ '--parse-only', '-F', config_file, '--org', '1234', file_bas, '-o', file_bin ]) assert zxbc.OPTIONS.org == 1234, 'Commandline should override config file' assert zxbc.OPTIONS.optimization_level == 3, 'Commandline should override config file'
#print("Source : "+inputfile) #print("Filename : "+filenamenoext) # this is the full call to zxb #print("====================================================") print("Compiling : "+inputfile) print("ZXbasic ver : "+version.VERSION) print("") if createasm == 0: # disable warnings for fastcall with param # disable warnings for unused function # disable warnings for functions never called if headerless == 1: test=zxbc.main([inputfile,'--headerless','-W','160','-W','140','-W','150','-W','170','-S', org,'-O',optimize,'-H',heap,'-M','Memory.txt','-e','Compile.txt','-o',head_tail[0]+'/'+filenamenoext+'.bin','-I', LIB_DIR,'-I', SCRIPTS_DIR]) else: # '-e','Compile.txt' if gentape == 1: test=zxbc.main([inputfile,'-W','160','-W','140','-W','150','-W','170','-W','190','-S', org,'-O',optimize,'-H',heap,'-M','Memory.txt','-t','-B','-a','-o',head_tail[0]+'/'+filenamenoext+'.tap','-I', LIB_DIR,'-I', SCRIPTS_DIR]) else: test=zxbc.main([inputfile,'-W','160','-W','140','-W','150','-W','170','-W','190','-S', org,'-O',optimize,'-H',heap,'-M','Memory.txt','-o',head_tail[0]+'/'+filenamenoext+'.bin','-I', LIB_DIR,'-I', SCRIPTS_DIR]) else: test=zxbc.main([inputfile,'-S', org,'-O',optimize,'-H',heap,'-e','Compile.txt','-A','-o',head_tail[0]+'/'+filenamenoext+'.asm','-I', LIB_DIR,'-I', SCRIPTS_DIR]) noemu = 1 copy = 0 if test == 0: print("YAY! Compiled OK! ") if gentape == 1: print("")