Mon, 21 Jan 2013, 19:43
A student writes: > Dr. Patt, > > On the assignment page for Lab 1, it says that the following should > return error code 2 (invalid op-code): > > .ORIG x1000 > ABC > .END > > However, couldn't the assembler simply see the ABC as a label and > assemble fine? Or are blank labels not allowed in the language? > > Thank You, > <<name withheld to protect the student who suggests blank labels>> Actually, the documentation says that every line in your assembly language program should be a legitimate LC-3b assembly language statement. Since labels are optional, and there is nothing on the line after ABC, the assembler will assume ABC must be the opcode, and there are no operands and no comment. It is not a legitimate opcode, ergo error code 2. Certainly, we could have allowed a line to consist of just a label in order, for example, to allow two labels to point to the same location, as in .orig x3000 add r1,r1,#0 label1 label2 add r1,r1,#5 halt .end Both label1 and label2 would point to x3001. We decided not to allow that. If we had allowed it, what should the assembler report for the program .orig x1000 abc .end Good luck with the first lab. Yale Patt