X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=jonesforth.S;h=45e6e854a5d2a4c3f26af264dfce56379d401425;hb=master;hp=c7309fde1574548f8bd0a558caf29e6e7bcd048c;hpb=465979550d58288f6bee28c49064d9c841a6f45f;p=jonesforth.git diff --git a/jonesforth.S b/jonesforth.S index c7309fd..45e6e85 100644 --- a/jonesforth.S +++ b/jonesforth.S @@ -1,11 +1,11 @@ /* A sometimes minimal FORTH compiler and tutorial for Linux / i386 systems. -*- asm -*- By Richard W.M. Jones http://annexia.org/forth This is PUBLIC DOMAIN (see public domain release statement below). - $Id: jonesforth.S,v 1.43 2007-10-10 13:01:05 rich Exp $ + $Id: jonesforth.S,v 1.47 2009-09-11 08:33:13 rich Exp $ gcc -m32 -nostdlib -static -Wl,-Ttext,0 -Wl,--build-id=none -o jonesforth jonesforth.S */ - .set JONES_VERSION,43 + .set JONES_VERSION,47 /* INTRODUCTION ---------------------------------------------------------------------- @@ -716,17 +716,40 @@ code_\label : // assembler code follows pop %eax pop %ebx pop %ecx + push %ebx push %eax push %ecx - push %ebx NEXT defcode "-ROT",4,,NROT pop %eax pop %ebx pop %ecx + push %eax + push %ecx + push %ebx + NEXT + + defcode "2DROP",5,,TWODROP // drop top two elements of stack + pop %eax + pop %eax + NEXT + + defcode "2DUP",4,,TWODUP // duplicate top two elements of stack + mov (%esp),%eax + mov 4(%esp),%ebx + push %ebx + push %eax + NEXT + + defcode "2SWAP",5,,TWOSWAP // swap top two pairs of elements of stack + pop %eax + pop %ebx + pop %ecx + pop %edx push %ebx push %eax + push %edx push %ecx NEXT