News for hackers. Stuff that matters.
Re:The HP Nanoprocessor: a high-speed processor that can't e... by recursive on Friday September 04, 2020 @03:32PM (#24378161)
If you're allowed negation, (like `-x`) then `x - (-y)` seems even better.
Re:The HP Nanoprocessor: a high-speed processor that can't e... by egsmi on Friday September 04, 2020 @03:44PM (#24378260)
Subtract is a "built-in arithmetic instructions" so it wouldn't be allowed in this environment. The idea is to implement arithmetic, but from bitwise operations. https://en.wikipedia.org/wiki/Bitwise_operation
Re:The HP Nanoprocessor: a high-speed processor that can't e... by kens on Friday September 04, 2020 @05:07PM (#24378898)
This is getting far afield from the actual Nanoprocessor, which has increment and decrement instructions. With those, you can add two numbers by repeatedly incrementing one and decrementing the other. (Which is a bit like addition using the Peano axioms.)

See page 126 of the Nanoprocessor User's Manual for code to add two numbers in this way.

https://www.hp9845.net/9845/downloads/manuals/Nanoprocessor....

Re:The HP Nanoprocessor: a high-speed processor that can't e... by egsmi on Friday September 04, 2020 @07:54PM (#24380130)
One can also use the techniques demonstrated your reversing the ALU article. :)

https://www.righto.com/2020/08/reverse-engineering-8086s.htm...

Re:The HP Nanoprocessor: a high-speed processor that can't e... by recursive on Friday September 04, 2020 @07:38PM (#24380029)
Interesting problem. In this case though, I was just offering a pointless optimization to the parent post, which also used subtraction, so I assumed it was allowed.
Re:The HP Nanoprocessor: a high-speed processor that can't e... by echlebek on Friday September 04, 2020 @04:55PM (#24378792)
Here's some background on how things like that work:

https://en.wikipedia.org/wiki/Adder_(electronics)