dasm-assembler / dasm

Macro assembler with support for several 8-bit microprocessors

Home Page:https://dasm-assembler.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fault in -m implementation

andrew-davie opened this issue · comments


    .processor 6502
    ORG $1000


N SET 0
    REPEAT 256
    .byte N
N SET N + 1
    REPEND

The above will produce a 256 byte binary.
If the"-m#" flag is used, with # being 1,2,3, or 4, the assembler flags a size error, which is incorrect.

test.asm (8): error: Recursion too deep in code segment growing larger (4097) than max. allowed file size (4096)

Also, "-m" does not appear to range-check its value.
Probably most options don't -- but perhaps we could start to consider this.
For example, "-m-2" makes no sense, but is accepted, and assembles OK.

@thomas374b Is this something you can have a look at?

@thomas374b Is this something you can have a look at?

Yes, I will do.

The -m switch was not intended to limit the size of the created binary.

It is a safety-halt to prevent too deep recursion that could not be detected otherwise. Initially I thought 64kB would be enough to have as a fixed barrier but there are users who have architectures with banked memory. So I decided to make it configurable and set the default to 640 kB.

This switch needs to be used only on architectures with more than 10 memory banks.

It was initiated by trying to solve the "supercat" bug which created a lot of GBytes-large output file until the harddisc was full.

TY. Are you happy for me to use the above text in the manual?

... only if spelling is correct ... ;-)

Now updated via bbc091e