mirror of
https://github.com/mgcaret/of816.git
synced 2024-12-27 19:29:58 +00:00
67 lines
1.3 KiB
Forth
67 lines
1.3 KiB
Forth
testing 7.3.2.2 Bitwise logical operators
|
|
|
|
( WE TRUST 1S, INVERT, AND BITSSET?; WE WILL CONFIRM RSHIFT LATER )
|
|
1S 1 RSHIFT INVERT CONSTANT MSB
|
|
T{ MSB BITSSET? -> 0 0 }T
|
|
|
|
T{ 1 0 LSHIFT -> 1 }T
|
|
T{ 1 1 LSHIFT -> 2 }T
|
|
T{ 1 2 LSHIFT -> 4 }T
|
|
T{ 1 F LSHIFT -> 8000 }T \ BIGGEST GUARANTEED SHIFT
|
|
T{ 1S 1 LSHIFT 1 XOR -> 1S }T
|
|
T{ MSB 1 LSHIFT -> 0 }T
|
|
|
|
T{ 1 0 RSHIFT -> 1 }T
|
|
T{ 1 1 RSHIFT -> 0 }T
|
|
T{ 2 1 RSHIFT -> 1 }T
|
|
T{ 4 2 RSHIFT -> 1 }T
|
|
T{ 8000 F RSHIFT -> 1 }T \ BIGGEST
|
|
T{ MSB 1 RSHIFT MSB AND -> 0 }T \ RSHIFT ZERO FILLS MSBS
|
|
T{ MSB 1 RSHIFT 2* -> MSB }T
|
|
|
|
\ todo: >>a << >>
|
|
|
|
T{ 0S 2* -> 0S }T
|
|
T{ 1 2* -> 2 }T
|
|
T{ 4000 2* -> 8000 }T
|
|
T{ 1S 2* 1 XOR -> 1S }T
|
|
T{ MSB 2* -> 0S }T
|
|
|
|
\ todo: u2/
|
|
|
|
T{ 0S 2/ -> 0S }T
|
|
T{ 1 2/ -> 0 }T
|
|
T{ 4000 2/ -> 2000 }T
|
|
T{ 1S 2/ -> 1S }T \ MSB PROPOGATED
|
|
T{ 1S 1 XOR 2/ -> 1S }T
|
|
T{ MSB 2/ MSB AND -> MSB }T
|
|
|
|
T{ 0 0 AND -> 0 }T
|
|
T{ 0 1 AND -> 0 }T
|
|
T{ 1 0 AND -> 0 }T
|
|
T{ 1 1 AND -> 1 }T
|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