While assembling this file, I produced about 1800 errors of the form <something> did not converge.
It took me a while to realize that it wasn't cyclic error, but simply that customasm required more than 10 iterations (the default limit) to complete. It actually required 19 iterations:
± customasm smb.asm -t 50
customasm v0.14.0 (x86_64-unknown-linux-gnu)
assembling `smb.asm`...
writing `smb.bin`...
resolved in 19 iterations
The weird part is that the number of iteration decreases to 4 iterations when the assertion reladdr >= !0x7f (line 7) of cpu6502_reladdr is commented out:
|
#subruledef cpu6502_reladdr |
|
{ |
|
{addr: u16} => |
|
{ |
|
reladdr = addr - $ - 2 |
|
$assert(reladdr <= 0x7f) |
|
$assert(reladdr >= !0x7f) |
|
reladdr`8 |
|
} |
|
} |
That's a bit surprising since the cpu6502_reladdr type doesn't seem to be used conditionally, meaning that the corresponding instructions using this value (bcc, bcs, beq, bni, bpe, bpl, bvc and bvs) are either invalid or 2-bytes long.
Maybe there is a subtle bug or a possible optimization for this specific use case?
While assembling this file, I produced about 1800 errors of the form
<something> did not converge.It took me a while to realize that it wasn't cyclic error, but simply that
customasmrequired more than 10 iterations (the default limit) to complete. It actually required 19 iterations:The weird part is that the number of iteration decreases to 4 iterations when the assertion
reladdr >= !0x7f(line 7) ofcpu6502_reladdris commented out:customasm/std/cpu/6502.asm
Lines 1 to 10 in ce02df0
That's a bit surprising since the
cpu6502_reladdrtype doesn't seem to be used conditionally, meaning that the corresponding instructions using this value (bcc,bcs,beq,bni,bpe,bpl,bvcandbvs) are either invalid or 2-bytes long.Maybe there is a subtle bug or a possible optimization for this specific use case?