On Wed, 8 Sep 2010, pito wrote: > A version with unused registers, crashes (anforth 4.0, > assembler.frt). > > \ Manual v 4.0 : The registers from R10 to R13 are currently unused, > > \ but may be used for the VM extended registers X and Y sometimes. > > code ++_ \ ( x1 x2 x3 -- x4 )
Looking at my assembly listing: .def temp0 = r16 .def temp1 = r17 .def tosl = r24 .def tosh = r25 PFA_PLUS: C:0039ab 9109 ld temp0, Y+ C:0039ac 9119 ld temp1, Y+ C:0039ad 0f80 add tosl, temp0 C:0039ae 1f91 adc tosh, temp1 C:0039af ce5e rjmp DO_NEXT So, that means that simple ld temp0, Y+ ld temp1, Y+ add tosl, temp0 adc tosh, temp1 ld temp0, Y+ ld temp1, Y+ add tosl, temp0 adc tosh, temp1 rjmp DO_NEXT should do the trick. Doing in Forth: R16 constant temp0 R17 constant temp1 R24 constant tosl R25 constant tosh code ++_ temp0 Y+ ld, temp1 Y+ ld, tosl temp0 add, tosh temp1 adc, temp0 Y+ ld, temp1 Y+ ld, tosl temp0 add, tosh temp1 adc, end-code hex 1000 100 10 ++_ . 1110 ok 1111 222 33 ++_ . 1366 ok It's really beneficial to study existing assembler code! It also is immediately clear that ++_ is the equivalent of + + - what I did is just + operation inlined twice. --Marcin ------------------------------------------------------------------------------ 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 Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel