Simpletron machine and indirect addressing

霸气de小男生 提交于 2019-12-06 09:28:46

I believe that's correct. But Simpletron is so trivial that self-modifying code is only three instructions:

// address to load is in accumulator
ADD loadinstruction // construct load instruction
STORE $ + 1         // write instruction to next word of memory
...                 // placeholder filled in by write instruction
// value is in accumulator

loadinstruction: .data 2000

This is only possible because Simpletron's program shares memory with its data. Some computer architectures don't do this; the PIC line of microcontrollers, for example. (Where the RAM is 8 bits wide but the program memory is 14 bits wide!) You also can't modify the program if it's in ROM, obviously enough.

I don't know if this was the specific reason why indirect addressing modes were developed, but it's certainly an important one.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!