Download bkasm User`s Guide
Transcript
5.1. Basics #eat 63 MARES OATS /* C code */ Any of bkasm’s directives can be written in either style, and then some. bkasm never cares about leading whitespace on a line, so you may indent your directives however you like. With assembly-style directives, you can put the first argument either before or after the directive. These lines all mean the same thing: #eat MARES MARES #eat .eat .eat OATES MARES OATS MARES OATES OATS ; ; ; ; c-style c-style, indented asm-style, subject first asm-style, directive first Assembly-style directives are recommended, since bkasm is, after all, an assembler, and writing your directives as subject, verb, object when the directive is a verb is recommended as well, since that’s how we structure sentences in English. But if your fingers naturally reach for the pound sign when you think about directives, that’s okay with bkasm. One syntactic construct supported by many assemblers that is not okay with bkasm is the pseudo-op, which is a directive that looks like an assembly instruction: SYMBOL DATA set ds VALUE 1 ; WRONG in bkasm! ; WRONG in bkasm! bkasm requires all directives to be marked with a dot or a pound sign.∗ Enforcing separate namespaces for directives and instructions is essential for forward compatibility, especially with a retargetable assembler, and it also allows you to visually distinguish the code from the metadata. A directive will never generate executable code—it can only indicate what you’d like done with the code you do write. It’s good to keep the concepts distinct. bkasm provides a lot of interesting directives, most of which will be described throughout this chapter. You may also use Appendix C as a quick reference. Targets are allowed to define additional directives as well. The 1k target doesn’t define anything worth mentioning, but the linker knows about plenty of extra directives, and they will be covered in Chapter 6. 5.1.1 The .option Directive Directive: ∗ .option NAME=VALUE For compatibility with 1kasm, there actually are a few directives which can go dotless. But don’t do that.