mirror of
https://github.com/nineties/planckforth
synced 2024-12-26 21:58:42 +01:00
Add shift operations
This commit is contained in:
parent
354e5ac4b7
commit
1d4b77fd90
2 changed files with 13 additions and 6 deletions
|
@ -458,6 +458,9 @@ alias-builtin and &
|
|||
alias-builtin or |
|
||||
alias-builtin xor ^
|
||||
alias-builtin u< u
|
||||
alias-builtin lshift (
|
||||
alias-builtin rshift )
|
||||
alias-builtin arshift %
|
||||
alias-builtin runtime-info_ V
|
||||
|
||||
\ Rename existing FORTH words
|
||||
|
@ -658,6 +661,10 @@ allot-cell : &find! [ ' L , , ] ; \ ( c-addr -- nt ) Throw exception at error
|
|||
\ ( a b c -- (a<=c & c<b) )
|
||||
: within tuck > -rot <= and ;
|
||||
|
||||
\ arithmetic shift
|
||||
: 2* 1 lshift ;
|
||||
: 2/ 1 arshift ;
|
||||
|
||||
\ === Conditional Branch ===
|
||||
\ <condition> if <if-true> then
|
||||
\ <condition> if <if-true> else <if-false> then
|
||||
|
@ -2465,7 +2472,7 @@ need-defined (read)
|
|||
' ['] compile [compile] literal
|
||||
+ - * /mod / mod negate not and or xor invert within max min abs
|
||||
< > <= >= = <> 0< 0> 0<= 0>= 0= 0<> 1+ 1-
|
||||
u< u> u<= u>=
|
||||
u< u> u<= u>= lshift rshift 2* 2/
|
||||
|
||||
true false
|
||||
|
||||
|
|
10
planck.xxd
10
planck.xxd
|
@ -80,11 +80,11 @@
|
|||
000001f8: 6283 0408 0000 0000
|
||||
000001fc: f081 0408 013d 0000 =: equal
|
||||
00000204: 7083 0408 0000 0000
|
||||
00000208: fc81 0408 017b 0000 {: shl
|
||||
00000208: fc81 0408 0128 0000 (: shl
|
||||
00000210: 7e83 0408 0000 0000
|
||||
00000214: 0882 0408 017d 0000 }: shr
|
||||
00000214: 0882 0408 0129 0000 ): shr
|
||||
0000021c: 8683 0408 0000 0000
|
||||
00000220: 1482 0408 0129 0000 ): sar
|
||||
00000220: 1482 0408 0125 0000 %: sar
|
||||
00000228: 8e83 0408 0000 0000
|
||||
0000022c: 2082 0408 0176 0000 v: argv
|
||||
00000234: 9683 0408 0000 0000
|
||||
|
@ -174,9 +174,9 @@
|
|||
00000370: 585b 39c3 0f94 c00f (equal) popl %eax; popl %ebx; cmpl %eax,%ebx
|
||||
00000378: b6c0 50ad ff20 0000 setl %al; movzbl %al, %eax; pushl %eax; next;
|
||||
|
||||
0000037e: 5958 d3e0 50ad ff20 (shl) popl %ecx; popl %eax; shll %cl,%eax next;
|
||||
0000037e: 5958 d3e0 50ad ff20 (shl) popl %ecx; popl %eax; shll %cl,%eax;next;
|
||||
|
||||
00000386: 5958 d3e8 50ad ff20 (shr) popl %ecx; popl %eax; shrl %cl,%eax next;
|
||||
00000386: 5958 d3e8 50ad ff20 (shr) popl %ecx; popl %eax; shrl %cl,%eax;next;
|
||||
|
||||
0000038e: 5958 d3f8 50ad ff20 (sar) popl %ecx; popl %eax; sarl %cl,%eax; next;
|
||||
|
||||
|
|
Loading…
Reference in a new issue