The Inline Assembler

Occasionally, you may run into a situation where the syntax and structure of the BASIC language is not the most suitable for a task at hand.  PowerBASIC addresses the need for optimal speed and flexibility with its built-in assembler.  Inline assembly is the process of embedding assembly-language statements (opcodes) within the overall structure of your BASIC code.  Those statements are compiled along with your BASIC code without the need for an external assembler.

This chapter discusses the different ways that PowerBASIC lets you use assembly-language code in your BASIC programs.  It also discusses some design philosophies and considerations, which you should keep in mind if you decide to write your own assembly-language procedures or functions.

The technique of interfacing with assembly-language is, by its very nature, somewhat complex.  You should be reasonably familiar with assembly-language concepts before tackling the information in this chapter.

 

See Also

Using assembly-language in your code

Flat memory model

Inline Assembler code syntax

Protected mode programming

Mnemonics and Operands

Opcodes and Mnemonics

Registers

Data types in registers

MMX registers

The stack

Balancing the stack

Tricks of the stack

Stack Overhead Reduction

Saving registers

Saving Registers at the Sub/Function level

Intermixing ASM and BASIC code

Using ESP and EBP

Saving the FPU registers

Tricks in preserving registers

Addressing and pointers

Effective addressing

Passing parameters

Parameters passed by reference or by copy

Parameters passed by value

Passing dynamic strings

Passing arrays

Accessing PowerBASIC variables by name

Commenting Assembly code