Minimize Usage of Pseudo-instructions

Even the Assembly language isn't immune to feature creep.

The GNU Assembler, and probably many other assemblers, implements pseudo-instructions for convenience. In some instances it would require manual calculation of an address not to use one. For these its justified, because your well on your way to writing human-readable machine code if you don't use them.

But many pseudo-instructions save no more than a couple lines that are easy to write by hand.

If you only write Assembly when your forced to, as many capitalists recommend, then none of this matters. But if your a programmer who writes a lot of Assembly in pursuit of abusing his computer less, then this is not good, because the convenience it provides is outweighed by the knowledge lossed in the abstraction.

In 80386 Assembly, the ENTER and LEAVE pseudo-instruction expands to just two instructions which never vary. enter leave

is the same as push %ebp mov %ebp, %esp mov %esp, %ebp pop %ebp

These are simple enough to be implemented with a macro. Use macros or type the instructions out yourself so you depend less on Intel micro code and know what is happening.

In ARM Assembly there are pseudo-instructions that serve a similiar purpose. push {r4, r5} pop {r4, r5}

is the same as: stmdb sp!, {r4, r5} ldm sp!, {r4, r5}

Pseudo-instructions cannot get much more stupid than this. Not only do they not save a line, but you could save an additional byte per psuedo-instruction by using a macro instead.

Believe it or not, theres a pseudo-instruction for a psuedo-instruction in ARM Assembly. The LDR pseudo-instruction calculates the PC offset for you; this is good. But you can add another abstraction on top of that by using the equal sign. label: .long 0 ldr r0, =label

is the same as label: .long 0 ldr r0, label_adr label_adr: .long label

Here the Assembler generates new labels as if it were a C compiler. This is feature creep if I've ever seen it. Write all the labels yourself; it isn't hard and it hides less.

By using only the pseudo-instructions that calculate addresses, you will maintain a healthier relationship with your computer. All with little effort.