Marcin, I am ansewering to you in this thread: No, R16 and R17 are
ok for my cpu, but not correct from OS prospecive. I've spent a
sleepless night with playing with registers against definitions in
macros.asm (it seems Registers 10,11,12,13, are not used by OS but
in reality code crashes) and the preliminary result is:

\ ----- Test AvrAsm -----

\ : loadtos, 16 Y+ ld, 17 Y+ ld, ; \ define macro
\ : savetos, -Y 17 st, -Y 16 st, ; \ tosl=r22, tosh=r23

: loadtos, 24 Y+ ld, 25 Y+ ld, ; \ define macro
: savetos, -Y 25 st, -Y 24 st, ; \ tosl=r22, tosh=r23

code dup_ savetos, end-code \ insert asm code
code drop_ loadtos, end-code


code ++_      \ ( x1 x2 x3 -- x4 ) 
R18 push,
R19 push,
\ R24 push,
\ R25 push,  

R18 0 ldi,
R19 0 ldi,

R24 Y+ ld,
R25 Y+ ld,
R18 R24 add,
R19 R25 adc,

R24 Y+ ld,
R25 Y+ ld,
R18 R24 add,
R19 R25 adc,

R24 Y+ ld,
R25 Y+ ld,
R18 R24 add,
R19 R25 adc,


R24 R18 mov,
R25 R19 mov,

\ R24 255 ldi,
\ R25 128 ldi,

-Y R25 st,
-Y R24 st,

\ R25 pop,
\ R24 pop,
R19 pop,
R18 pop,
end-code

> 100 200 300 ++_
ok
> .s
0 16381 28171 
ok
> 100 200 300 ++_
ok
> .s
0 16379 28471 
1 16381 28471 
ok
> 

> 100 dup_
ok
> .s
0 16379 100 
1 16381 100 
ok
> 300 dup_
ok
> .s
0 16375 300 
1 16377 300 
2 16379 100 
3 16381 100 
ok
> drop_
ok
> .s
0 16377 300 
1 16379 100 
2 16381 100 
ok
> drop_ drop_ drop_
ok
> .s
ok
> 
The loadtos and savetos works somehow, but I am not able to run ++_
My current understanding is something still overwrites registers
used. Based on used set of registers the results vary. It would be
nice to have a list (or a brief Guide) which Registers one may use
in such assembler run within forth. Pito



----- PŮVODNÍ ZPRÁVA -----
Od: "pito" <[email protected]>
Komu: [email protected], [email protected]
Předmět: [Amforth-devel] Assembler - initial issues or bug
Datum: 8.9.2010 - 1:52:22

> Hi, I started with LP asm (amforth 4.0):
> \ ----- Test AvrAsm -----
> : loadtos, 16 Y+ ld, 17 Y+ ld, ; \ define macro
> : savetos, -Y 17 st, -Y 16 st, ; \ tosl=r22,
> tosh=r23
> 
> code dup_  savetos, end-code   \ insert asm code
> code drop_ loadtos, end-code
> 
> and I get:
> > 10 dup_
> ok
> > .s
> 0 16379 10 
> 1 16381 9546 
> ok
> > 20 dup_
> ok
> > .s
> 0 16375 20 
> 1 16377 9546 
> 2 16379 10 
> 3 16381 9546 
> ok
> > drop_ drop_
> ok
> > .s
> 0 16379 20 
> 1 16381 9546 
> ok
> > 
> 
> the ++_ demo crashes... Any help, new update, or I
> did something
> wrong (I loaded assembler.frt of course). P.
> 
> 
> ------------------------------------------------------------------------------
> > 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



------------------------------------------------------------------------------
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