开发者

Change value at specific address in assembly

开发者 https://www.devze.com 2023-02-13 08:14 出处:网络
I\'m writing assembly in LC-3. I have a register, R1, that points to a specific address. How do I change the value at that address to 0? Unfortunately, this is due really soon, so prompt help would be

I'm writing assembly in LC-3. I have a register, R1, that points to a specific address. How do I change the value at that address to 0? Unfortunately, this is due really soon, so prompt help would be greatly appreciated! Thanks!

PS: If you don't know LC-3, here are the 15 instructions: ADD,开发者_StackOverflow中文版 AND, BR, JMP, JSR, JSRR, LD, LDI, LDR, LEA, NOT, RET, RTI, ST, STI, STR, TRAP


You'd start by zeroing another register (e.g., R0). Since there's no instruction to clear a register, one obvious choice would to AND that register with an immediate value of 0 (another would be to subtract the register from itself). Likewise, the instruction set doesn't have a simple "store indirect", but it does have a "store indirect with offset" (STR), so your source register would be the one you cleared, the destination register would be R1, and the offset would be 0 (#0).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号