# Weird things I learned while writing an x86 emulator

DevFeed: [Weird things I learned while writing an x86 emulator](<https://devfeed.tech/articles/weird-things-i-learned-while-writing-an-x86-emulator-39728.md>)

Original publisher: [Read original article](<https://www.timdbg.com/posts/useless-x86-trivia/>)

Author: Tim Misiak

Published: 2023-02-02T07:54:20Z

Content type: article

Language: en

Sources: [TimDbg](<https://devfeed.tech/sources/timdbg.md>)

Topics: [Emulator](<https://devfeed.tech/topics/emulator.md>), [x86](<https://devfeed.tech/topics/x86.md>), [Assembly](<https://devfeed.tech/topics/assembly.md>), [cpu](<https://devfeed.tech/topics/cpu.md>), [Encoding](<https://devfeed.tech/topics/encoding.md>), [debugging](<https://devfeed.tech/topics/debugging.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [execution](<https://devfeed.tech/topics/execution.md>)

Tags: [assembly](<https://devfeed.tech/tags/assembly.md>), [breakpoint](<https://devfeed.tech/tags/breakpoint.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [code](<https://devfeed.tech/tags/code.md>), [compilers](<https://devfeed.tech/tags/compilers.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [emulator](<https://devfeed.tech/tags/emulator.md>), [encoding](<https://devfeed.tech/tags/encoding.md>), [execution](<https://devfeed.tech/tags/execution.md>), [software](<https://devfeed.tech/tags/software.md>), [time-travel-debugging](<https://devfeed.tech/tags/time-travel-debugging.md>), [x86](<https://devfeed.tech/tags/x86.md>)

## AI overview

The author shares x86 and amd64 encoding trivia learned while writing a CPU emulator for Time Travel Debugging. The article explains why alternate instruction encodings matter for software breakpoints, code size, compiler behavior, and CPU understanding.

## Source excerpt

If you've read my first post about assembly language, you might expect that this is another post on how to understand assembly language. I will write more about that at some point, but this post is not that. Instead, this post is going to talk about some of the weird things and random trivia I learned while writing an x86 and amd64 emulator. The emulator I wrote was for Time Travel Debugging.