From: pito <pi...@vo...> - 2010-09-08 10:27:10
|
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 |