Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One could make a case against using 0x00 as NOP to prevent a rogue program from NOPping its way across zero-filled pages and into other parts of memory.


If that was the goal, wouldn't you want to reserve 0x00 as a HALT or some sort of interrupt-firing instruction?


If 0x00 isn't a valid opcode, as soon as one is hit, the CPU will fire an invalid instruction interrupt (if it supports invalid instruction interrupts), allowing the operating system (if any) to do something about it.

However, since the original comment was about the Z80 which according to http://www.z80.info/decoding.htm treats invalid instructions as a NOP, the point is moot.

By the way, z80.info is the type of site that made me fall in love with the web -- it's full of information compiled by people doing it not for AdSense impressions, but just for the love of sharing knowledge. I miss the days when all of my Google searches would take me to these sites instead of the contentless content farms of today.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: