Hi,

> Generated jump goes one word too far (it is "jump 5 words forward"
> and not "jump 4 words forward"). It can even be seen
> that the length of a macro expansion is wrongly estimated
> (it says the whole code is 7 words, while it is only 6).
> 
> avrasm2 generally does not allow using not-yet-defind
> labels in macros like this.

really? I doubt it.

> 
> So there are two workarounds for amforth:
> 
> 1) revert to amforth 4.4 hardcoded "rjmp" since we can
>    assume the distance is pretty small here.
> 
> 2) add a nop after "rjmp" in the "jmp_" macro to keep
>    sizes of the macro expansion constant.

That would contradict one of the 2 intentions of
the macro: size savings (the other one is speed).

> 
> 
> Solutions:
> 
> 1) AVRA may disallow forward refences in the macros.
> 
> 2) Detecting the impossibility to determine
>    the value.
> 
> 3) ...

3) get an smart jump instruction.

I vote for 3) ;)

Does the patch

diff --git a/core/dict_core.inc b/core/dict_core.inc
index b7ddeb1..d88f9f6 100644
--- a/core/dict_core.inc
+++ b/core/dict_core.inc
@@ -74,8 +74,8 @@
 .include "words/dodo.asm"
 .include "words/doqdo.asm"
 .include "words/i.asm"
-.include "words/doloop.asm"
 .include "words/doplusloop.asm"
+.include "words/doloop.asm"
 .include "words/unloop.asm"


help? Does the quick fix from workaround
1) give a working system?


Matthias


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to