diff --git a/jumpforth.S b/jumpforth.S index 9c198f0..3b8b876 100644 --- a/jumpforth.S +++ b/jumpforth.S @@ -459,7 +459,7 @@ defcode ABS 0: push %eax NEXT -/* ( n1 n2 -- n1*n2 ) ( ignores overflow ) */ +/* ( n1|u1 n2|u2 -- n3|u3 ) Multiply (signed or unsigned) */ defcode MUL,"*" pop %eax pop %ebx @@ -467,7 +467,7 @@ defcode MUL,"*" push %eax NEXT -/* ( n1 n2 -- d ) Multiply, producting a double-cell result */ +/* ( n1 n2 -- d ) Multiply signed, producting a double-cell result */ defcode MMUL,"M*" pop %eax pop %ebx @@ -476,14 +476,6 @@ defcode MMUL,"M*" push %edx NEXT -/* ( u1 u2 -- u1*u2 ) ( ignores overflow ) */ -defcode UMUL,"U*" - pop %eax - pop %ebx - mull %ebx - push %eax - NEXT - /* ( u1 u2 -- ud ) Multiply unsigned, producting a double-cell result */ defcode UMMUL,"UM*" pop %eax @@ -516,6 +508,21 @@ defcode DSUB,"D-" sbbl %ebx,(%esp) NEXT +/* ( d1|ud1 d2|ud2 -- d3|ud3 ) Double-cell multiplication */ +defcode DMUL,"D*" + pop %ecx + pop %eax + pop %ebx + pop %edx + imul %edx,%ecx + imul %eax,%ebx + mul %edx + add %ebx,%ecx + add %ecx,%edx + push %eax + push %edx + NEXT + defcode DNEGATE notl 4(%esp) notl (%esp)