Since version 2.0


asm "<assembly code>"

The ASM directive injects bare assembly code into the compiled code, without any modification. As XC=BASIC itself produces DASM code, the injected assembly code must also be in DASM format. The code within the double quote may include newlines.


rem -- set border to black using XC=BASIC code
poke $d020, 0
rem -- now set background to black using inline assembly
asm "
    lda #$00
    sta $d021
rem -- that's all

Note: the compiler can't validate the inline assembly code. It will be barely copied into the compiled code. DASM will report any errors. You have to take special care with the ASM directive. Please consult the DASM docs carefully.

A common mistake when writing DASM code is to forget that a line must start with a label or at least one space. Note in the example above that assembly lines are prepended with spaces.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies


Enter your comment. Wiki syntax is allowed: