Basm

From CPCWiki - THE Amstrad CPC encyclopedia!
Revision as of 07:28, 28 September 2023 by Krusty (Talk | contribs) (Created page with "== About == Benediction ASsembler (BASM in short) is a modern Z80 assembler. He has taken its inspiration from various Z80 assembler (Maxam/Winape, sjasmplus, rasm, vasm, BRA...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

About

Benediction ASsembler (BASM in short) is a modern Z80 assembler. He has taken its inspiration from various Z80 assembler (Maxam/Winape, sjasmplus, rasm, vasm, BRASS, glass, zasm) as well as assemblers from other platforms (asm11, sarcasm). It is tailored for Amstrad CPC demomaking and has been successfully used to develop the Amstrad CPC demo Can Robots Take Control?[1]. It has been still improved since and will serve for futur productions too.

The documentation [2] is quite minimal at the moment, but included example code should be still valid and assembled properly. The user base being quite small, lots of bugs can remain. Do note hesitate to fill issues https://github.com/cpcsdk/rust.cpclib/issues or propose fixes.


Features of Interest

  • Possibility to assemble fake instructions (e.g. ld hl, de).
  • Possibility to use standard directives (e.g. incbin 'file.asm).
  • Rare directives and functions (e.g. ld a, opcode(xor a)).
  • Macros definition and usage (e.g. MY_MACRO_WITH_TWO_ARGS 1, "string").
  • Function definition and usage (e.g. db 5, my_function(3)).
  • Expressions able to handle numbers, strings, lists, matrices.
  • Handling of Amstrad CPC snapshots.
  • Possibility to execute directly the assembled project in the Amstrad CPC thanks to the M4/CPC WIFI card.
  • Multi-pass (in fact, BASM uses as many passes as needed).
  • Multiplatform (mainly tested on Linux and Windows).
  • Embedding of various ASM source files inside BASM that can be used by the users.
  • Possibility to write LOCOMOTIVE BASIC for easily writing Amstrad CPC bootstrap loaders.

Hello World

An hello world representative of the functionalities of BASM would be:


    snainit "../cpclib-sna/src/cpc6128.sna" ; should be uneeded by properly specifying sna properties
    org 0x4000
    run $
    ld hl, text_content
loop
        ld a, (hl)
        or a
        jp z, finished
        call TXT_OUTPUT
        inc hl
        jp loop
finished
    jp $
text_content
    db "Hello, world!", 0
    include "inner://firmware/txtvdu.asm"


Links