Skip to content

Add support for writing basic macros #16

@aw

Description

@aw

Hi @theandrew168 ,

Would it be possible to add support for writing basic macros in the assembly programs? I wanted to see how derzforth would change in size if I inlined all the j next instructions.

For the moment my hack in derzforth.asm is to replace <4 spaces>j next with include next.asm, which contains:

# standard forth routine: next "macro"
    lw W, 0(IP)     # W <- [IP]
    addi IP, IP, 4  # IP += 4
    lw t0, 0(W)     # t0 <- [W]
    jr t0

The binary size increased by exactly 200 bytes, which I think is worth it for the performance gain.

Either way, I think it would be interesting to have a real macro syntax or something similar to what GAS and NASM provide... doesn't have to be as complex/powerful though. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions