Marcin, yes to study the manual is important! However, we do not do
it quite often..
I've seen the manual and therefore I am using register allowed.
loadtos and savetos works with 24 and 25(? as used in loadtos,
savetos), and I used 10-13 and 14-21 for ++_ routine. However
results differs. So my understanding is you shall be careful to use
those registers so freely as described in manual. Maybe someone
experienced helps with the bug in the ++_ routine, which crashes:

code ++_      \ ( x1 x2 x3 -- x4 ) 
R10 push,   \ save everything
R11 push,
R24 push,   \ shall this be pushed and popped ?
R25 push,  

R10 0 ldi,   \ x4 - accumulates result, zero it
R11 0 ldi,

R24 Y+ ld,   \ loadtos
R25 Y+ ld,   \ load data x3 from stack
R10 R24 add, \ add x4 = x3 + 0
R11 R25 adc,

R24 Y+ ld,
R25 Y+ ld,   \ load data x2 from stack
R10 R24 add, \ add x4 = x2 + x3 + 0
R11 R25 adc,

R24 Y+ ld,
R25 Y+ ld,    \ load data x1 from stack
R10 R24 add,  \ add x4 = x1 + x2 + x3 + 0
R11 R25 adc,


R24 R10 mov,       \ mov x4 to R25,24  R24 R10 movw,
R25 R11 mov,

\ R24 255 ldi,      \ for testing purposes
\ R25 128 ldi,

-Y R25 st,          \ savetos, save x4 to tos
-Y R24 st,

R25 pop,            \ load back everything
R24 pop,
R11 pop,
R10 pop,
end-code





------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Amforth-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to