negative number - How to avoid executing variables in lc3 assembly -


i making first steps in lc3 assembly programming , noticed every time try store negative value in memory, example using "st" instruction, there kind of error. in memory location stored "trap xff" instead... know how can on it??

you're getting error because variables apart of run-time code. it's best practice put variables @ end of code after halt command.

.orig x3000  main     ld r0, var1 not r0, r0 add r0, r0, #1 st r0, var2  halt  var1 .fill #5 var2 .fill #0 .end 

the reason getting errors because when storing numbers variables simulator thought commands. trap command has opcode of 1111 negative number. when simulator ran variable couldn't figure out type of trap command was, error. preventing simulator running variables won't error.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -