private void assemble() {
        if(sourceFile == null) {
            printError("-i : No source file specified");
        }
        
        if(assembler == null) {
            printError("-f : No format specified");
        }
               
        print("...Assembling " + sourceFile.getName());
        
        assembler.assemble(sourceFile);
        
        print("..." + assembler.getErrors().length + " error(s) found");
        
        try {
            PrintWriter output = null;
            
            if(! assembler.hasErrors()) {
                if(! machineCode) {
                    print("...saving .pco file");
                    
                    output = new PrintWriter(new FileWriter(baseFileName + ".pco"));
                    
                    for(Instruction instruction : assembler.getInstructions()) {
                        output.print(instruction.getInstruction());
                        output.println(" ;" + instruction.getSourceCode());
                    }
                }else {
                    print("Machine code file varified");
                }
            }else {
                print("...saving .err file");
                
                output = new PrintWriter(new FileWriter(baseFileName + ".err"));
                for(AssemblyError error : assembler.getErrors()) {
                    output.println(error.toString());
                }
            }
            
            if(output != null) {
                output.close();
            }
        }catch (IOException e) {
            printError(e.getMessage());
        }   
    }