This is a question that's giving me a lot of trouble, but which I need to understand for my Final Exam in 2 weeks. I don't know if it's the wording, but I have no idea how to arrive at a concrete answer. Here's the question:
"Bob plans to make changes to the mechanism of LC-3 TRAP instructions. He has two ideas: Make use of the bit [8:11] of TRAP instructions. The first instruction of the trap routine is stored at the address specified in the TRAP instruction, rather than the starting address of the trap routine. In his new design, he still wants to implement as many TRAP routines as the original LC-3 TRAP. Calculate on average how many lines of instructions each TRAP routine will have in his new design."
I know TRAP has 3 fundamental TRAP Vectors, x20, x25, and x23? What does the "how many lines of instructions" even mean?
Is your class using the Mc Graw Hill LC-3 Simulator? Because reading through their text on the TRAP command, bits [8:11] aren't even sent to the MAR to load from memory, they're just dropped. Only bits [7:0] are used because they point to a location in the Trap Vector Table.
The Vector table is only using 6 of its 256 available trap vectors, so you could make 250 of your own Trap calls.
After trying what "Bob" was trying to do I get the following error "1024 can not be represented as an 8 bit trap vector" and when I try and manually fill in my own trap call (ex. TRAP400 .FILL xF400 ;which is 1111 0100 0000 0000) It won't run its subroutine.
That being said, your question can only mean that Bob is making his own version of the LC-3 and would like to increase the amount of trap vectors he can use. If that's the case then using bits [11:0] he could have 4,095 trap commands or 4,089 if you do not include the original 6.
I hope that helps.