From: pito <pi...@vo...> - 2010-09-08 11:01:41
|
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 ) R10 push, \ save everything R11 push, R12 push, \ shall this be pushed and popped ? R13 push, R10 0 ldi, \ x4 - accumulates result, zero it R11 0 ldi, R12 Y+ ld, \ loadtos R13 Y+ ld, \ load data x3 from stack R10 R12 add, \ add x4 = x3 + 0 R11 R13 adc, R12 Y+ ld, R13 Y+ ld, \ load data x2 from stack R10 R12 add, \ add x4 = x2 + x3 + 0 R11 R13 adc, R12 Y+ ld, R13 Y+ ld, \ load data x1 from stack R10 R12 add, \ add x4 = x1 + x2 + x3 + 0 R11 R13 adc, R12 R10 mov, \ mov x4 to, R12 R10 movw, R13 R11 mov, -Y R13 st, \ savetos, save x4 to tos -Y R12 st, R13 pop, \ load back everything R12 pop, R11 pop, R10 pop, end-code |