Update of /cvsroot/win32forth/win32forth/src/kernel
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv25565/src/kernel
Modified Files:
fkernel.f
Log Message:
Added IMPORT: and modified see for it. Used in generic.f (as a test). NOTE you need the new fkernel.exe to metacompile.
Index: fkernel.f
===================================================================
RCS file: /cvsroot/win32forth/win32forth/src/kernel/fkernel.f,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** fkernel.f 29 Jun 2008 05:27:46 -0000 1.46
--- fkernel.f 16 Jul 2008 20:48:25 -0000 1.47
***************
*** 431,434 ****
--- 431,455 ----
next c;
+ CODE S-REVERSE ( n[k]..2 1 0 k -- 0 1 2..n[k] ) \ w32f
+ \ *G Reverse n items on stack \n
+ \ ** Usage: 1 2 3 4 5 5 S_REVERSE ==> 5 4 3 2 1
+ lea ecx, -4 [esp] \ ecx points 4 under top of stack
+ lea ebx, 4 [ecx] [ebx*4] \ ebx points 4 over stack
+ \ bump pointers, if they overlap, stop
+ @@1: sub ebx, # 4 \ adjust top
+ add ecx, # 4 \ adjust bottom
+ cmp ecx, ebx \ compare
+ jae short @@2 \ ecx passing ebx, so exit
+ \ rotate a pair
+ \ xor a,b xor b,a xor a,b swaps a and b
+ mov eax, 0 [ebx] \ bottom to eax
+ xor 0 [ecx], eax \ exchange top and eax
+ xor eax, 0 [ecx]
+ xor 0 [ecx], eax
+ mov 0 [ebx], eax \ eax to bottom
+ jmp short @@1 \ next pair
+ @@2: pop ebx \ tos
+ next c;
+
CODE 3REVERSE ( n1 n2 n3 -- n3 n2 n1 ) \ exchange first and third items on data stack
mov ecx, 4 [esp]
|