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

>if that bit of code was small enough (ie one or two bytes) you could simply encode those one or two bytes inside a two or three byte instruction thus saving the three-byte instruction needed to jump over it.

The 8080 and Z80 had a relative jump, which took only 2 bytes. It had a more limited jump range, but it was definitely wide enough to jump over 3 bytes.

>All that... for three bytes.

No, two.



If I recall correctly the opcode for the jump absolute was C3, and the conditional versions we C2, CA, etc. The destination was two bytes, 16 bits, little endian.

The JR - jump relative unconditional - was hex 18 followed by the number of bytes to jump, calculated from the byte after the JR instruction to account for the pipelining.

From memory - I could be wrong, but it's close enough.




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

Search: