EE 360N - Programming Assignment 1 Clarifications

  1. A valid label cannot be the same as an opcode or a pseudo-op. A valid label should start with a character (other than 'x') and should be alphanumeric.

  2. Your assembler needs to recognize only labels as operands for LEA, BR, and JSR instructions. For example, if the following line is in an input assembly program, your assembler can exit with error code 4:
    LEA    R1, x100
    

  3. Your assembler should assemble NOP as 0x0000 (never branch), instead of 0x8000.
    Your assembler should assemble RTI as 0x8000.

  4. Examples of error code

    1) Error code 1 : undefined label

    A label is used by an instruction but the label is not in the symbol table.
     
      eg.) 
    	.ORIG x3000
    	 LEA R0, DATA1
    	.END 
    
           DATA1 is not defined in the assembly code. 
    
    2) Error code 2 : invalid instruction

    An invalid instruction is one that is not defined in the LC-3b ISA
      
      eg.)  
    	.ORIG x1000
    	 MUL R0, R1, R2 
    	.END
    
      or 
    
    	.ORIG x1000
    	 ABC 
    	.END 
    
    3) Error code 3 : invalid constant

    An invalid constant is a constant that is too large to be assembled into an LC-3b instruction. An odd constant that follows .ORIG is also an invalid constant.
        
      eg.)
    	.ORIG x1000
    	 ADD R0, R1, #20  ; error 
    	.END 
    
       or 
    
    	.ORIG x1001       ; error 
    	ADD R0, R1, #1
    	.END
    
    4) Error code 4 : errors which do not belong to any of the above categories.
      eg.)
    	.ORIG x1000
    	 ADD R0, R1 
    	.END 
      or 
    	.ORIG x1000
    	.FILL
    	.END 
      or 
    	.ORIG x1000
    	 NOT R1, R2, R3
    	.END
    


  5. You can assume that there will be at most 255 labels in an assembly program. You can also assume that the number of characters on a line will not exceed 255.