1. 11

  2. 3

    We don’t support anywhere near the complete instruction-set which an assembly language programmer would expect.

    x86 was not a great target choice…

    1. 3

      golang’s multi-target assembler offers a way to define unsupported opcodes via BYTE/WORD directives [1].

      May be that’s the way forward for this assembler (especially since it is written in golang itself)

      [1] https://golang.org/doc/asm

      “.. The assemblers are designed to support the compiler so not all hardware instructions are defined for all architectures: if the compiler doesn’t generate it, it might not be there. If you need to use a missing instruction, there are two ways to proceed. One is to update the assembler to support that instruction, which is straightforward but only worthwhile if it’s likely the instruction will be used again. Instead, for simple one-off cases, it’s possible to use the BYTE and WORD directives to lay down explicit data into the instruction stream within a TEXT. Here’s how the 386 runtime defines the 64-bit atomic load function…”

    2. 2

      The tedium in an assembler is dealing with all the relocations. If you intend to support more than one target, then things get even more messy.

      1. 1

        This is great. Thanks for sharing. For my project I opted to avoid text entirely and instead make an assembler library with a C API.