hn.today

x86 Is an Octal Machine

gist.github.com7 points0 comments
Screenshot of x86 Is an Octal Machine

The text argues that 8086-family instruction encoding becomes easier to understand when written in octal rather than the conventional hexadecimal or binary notation. It treats each byte as three octal digits and claims that groups of opcode ranges correspond to recurring instruction patterns inherited from the 8080/8085/Z80. In its account, many instructions follow an opcode-plus-operand-field structure: the three-digit field identifies a register and a memory-or-register addressing mode, while any following bytes provide a displacement or constant. The MOV examples show how the same fields select byte or word transfers, register combinations, and segment-register operations.

A central illustration is the arithmetic family: one octal digit selects add, OR, ADC, SBB, AND, subtract, XOR, or compare, while neighboring digits distinguish operand directions and sizes. The text also maps the 16-bit addressing field to combinations of BX, SI, DI, and BP, with optional signed-byte or word displacements and default DS or SS segments. It explains register roles and the conventional stack-frame setup, including ENTER and LEAVE. Conditional jumps are identified as a notable exception, with their conditions encoded as hexadecimal digits. The discussion then turns to the 80386 and later processors, noting that they extend the older scheme with 32-bit operations and additional segment registers.

Read on gist.github.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Lua as a Query Language

Lua as a Query Language

Lua can serve as a dynamic query language by expressing relational operations as Lua code that builds an AST for a Rust backend, avoiding a custom parser and Rust recompilation for ad hoc queries. Lua variables provide reusable views and built-in language features support query constructs such as filters and arithmetic. (remy.wang)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.