Matthias, Marcin - here is the template for function fuX. Is the construction ok? It will be assembled by normal asm. Pito.
; amforth 4.1 ; ..core\words\fuX.asm ; ( a b c -- m l k ) Function fuX ; R( ? -- ? ) ; calculates a special function fuX ; it uses ALL registers except Y ; it calls subroutines placed within the word fuX ; does not use Y - points the data stack VE_FUX: .dw $ff03 ;? .db "fuX",0 .dw VE_HEAD .set VE_HEAD = VE_FUX XT_FUX: .dw PFA_FUX PFA_FUX: push R0 ; worst case - store everything push R1 push R2 ..... push R31 ld R10, Y+ ld R11, Y+ ; takes c from stack ld R12, Y+ ld R13, Y+ ; takes b from stack ld R14, Y+ ld R15, Y+ ; takes a from stack do_something work_with_RAM_indirect_Using_Z work_with_RAM_indirect_Using_X call sub3 do_something jmp label1 do_something label1: do_something jmp label2 ; ijmp rjmp as well do_something call sub3 do_something jmp label3 label2: do_something call sub1 ; rcall icall as well call sub2 do_something label3: do_something call sub2 st -Y, R16 st -Y, R17 ; puts m on stack st -Y, R18 st -Y, R19 ; puts l on stack st -Y, R20 st -Y, R21 ; puts k on stack pop R31 ; worst case housekeeping .... pop R2 pop R1 pop R0 jmp label_end ; jmp to the end of the word "fuX" sub1: do_something call sub3 ret sub2: do_something call sub1 ret sub3: do_something work_with_RAM_indirect_Using_Z work_with_RAM_indirect_Using_X ret label_end: jmp_ DO_NEXT ; this is the end of the word "fuX" ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Amforth-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/amforth-devel
