Assembler

This is basically about assembler (.java) for reading a define file that has extension (.src) and writing it or the output is file extension is (.xxx)... The Assembler has a role during the execuation which are:
1- Invalid opcode
2- Missing opcode
3- Illegal comment
4- Illegal constant
5- Illegal memory address.

I have done so far number 1. 3 and 5 but i want to develop my code and do 2- Missing opcode and 4- Illegal constant...

Because you're using a Scanner and because of its default delimiters, that's relatively tricky - you'll only find a missing int code when you try to parse an instruction (since the number is missing) as an int.

I would be inclined to read lines and split into a 2-element array. You can then count the elements and take action if < 2 and !stop

Check the element count - it will tell you if the opcode is missing (or at least either instruction or opcode)

0

adam_progAuthor Commented: 2009-07-20

I tried to put the array but it still only print one line... I only want to print or write the all content on the file... as anyone can help or can fix my code...i appreciate... thanks.. here is the code