Post Reply 
Two's complement on the 50g - a misadventure and a challenge
09-29-2024, 04:54 AM (This post was last modified: 09-29-2024 06:46 AM by Thomas Klemm.)
Post: #2
RE: Two's complement on the 50g - a misadventure and a challenge
(09-28-2024 11:18 PM)LinusSch Wrote:  Forum usage sidenote: is there a better way to put the name of each function?
(…)
I want to add a description for each function about what it expects on the stack and what it leaves on the stack, not sure how to do that.

You could list the directory and use stack diagrams in comments:
Code:
DIR
  B\->2s @ (B -- 2s)
    \<< B\->R DUP Max2s
      IF >
      THEN 2 RCWS ^ -
      END
    \>>
  Max2s @ ( -- Max2s)
    \<< 2 RCWS 1 - ^ 1 -
    \>>
END
However, the stack diagrams seem superfluous to me in this case.
By using trigraphs I can copy and paste the code into an emulator.

It may only be me, but examples are often helpful.

Examples

16 STWS

Max2s

32767

# 7d
+/-

# 65529d

B→2s

-7
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Two's complement on the 50g - a misadventure and a challenge - Thomas Klemm - 09-29-2024 04:54 AM



User(s) browsing this thread: 1 Guest(s)