R.N

Topics relating to various Forth models on the 6502, 65816, and related microprocessors and microcontrollers.
Post Reply
Powersoft
Posts: 31
Joined: 13 May 2021
Location: Hellevoetsluis-NL

R.N

Post by Powersoft »

I found in the FD-V05N1.PDF an intersting article “Add a Breapoint Tool”. (Leo Brodie)
There was one word I could not find back.

“N.R”

What is the meaning of this word?

Cheers,

Jan
User avatar
Dr Jefyll
Posts: 3526
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: R.N

Post by Dr Jefyll »

Wild guess: non-reentrant (??) :roll: But can you link us to that PDF, please? Also clarify -- is it RN or NR? You topic title is different from what's in the text. :wink:

-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
Powersoft
Posts: 31
Joined: 13 May 2021
Location: Hellevoetsluis-NL

Re: R.N

Post by Powersoft »

It’s came from:

Forth Dimensions
Volume 5
Number 1
Page 19

“Add a Break Point Tool”
Autor: Leo Brodie
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: R.N

Post by BigEd »

Here we are:
https://archive.org/details/Forth_Dimen ... 8/mode/1up
Screen60-Forth-R.N.png
(Looks to me like code rather than an annotation but perhaps I can't parse what I see!)
Powersoft
Posts: 31
Joined: 13 May 2021
Location: Hellevoetsluis-NL

Re: R.N

Post by Powersoft »

Could this be a word printing the return stack, because first is printing the stack contence!
User avatar
Dr Jefyll
Posts: 3526
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: R.N

Post by Dr Jefyll »

Powersoft wrote:
Could this be a word printing the return stack
I suspect you're right. There's a ." that tells the user to expect S to be printed; then the word S. apparently prints S. And there's a ." that tells the user to expect R to be printed, and the word R.N apparently prints R.

But I don't know why the word that prints S is called S. whereas the word that prints R is called S.N. <shrug> :roll:

-- Jeff

ps- thx, Ed!
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
JimBoyd
Posts: 931
Joined: 05 May 2017

Re: R.N

Post by JimBoyd »


After reading the article, I agree that it is most likely the word BREAK displays the contents of the data and return stacks before going into a custom QUIT loop. It is possible R.N only displays some of the return stack, but that doesn't really matter.
As for the odd names, the article is from the Summer of 1983. Leo Brodie states that this technique was invented by Frank Seuberling , adapted by Kim Harris and brought to his attention by John Clark. I'm not sure when the name .S became widely used for the word which displays the contents of the data stack and I don't even know if there is a standard name for a word which displays the contents of the return stack. In Fleet Forth, I use the name .RS for that.

Here is a version of this tool which is smaller. It eliminates the return stack check by using a technique from Scott Ballantyne's Blazin' Forth for the Commodore 64.
BREAK switches off the variable CON before entering the loop. To exit the loop, use the word CONT to switch CON on.

Code: Select all

VARIABLE CON
: CONT   CON ON ;  ( CONTINUE)
: BREAK  ( -- ) ( COMPILE BREAK INTO : DEF)
   CR ." BREAK S= " .S CR ." R= " .RS
   BLK OFF CON OFF
   BEGIN
      QUERY INTERPRET ." AOK" CR
      CON @
   UNTIL ;

SamCoVT
Posts: 344
Joined: 13 May 2018

Re: R.N

Post by SamCoVT »

The accompanying text for that article says:
Quote:
Another pleasant addition has been the stack dumps — both data stack and return stack — on line 6. BREAK will run fine without either of these if you haven't got them yet.
That confirms that R.N prints the return stack. My guess is that R.N is "Print Return Stack with Names". Articles in other issues of Forth Dimensions were discussing how to turn stack addresses into names, with this mention that seems pretty close in Volume 17,Number 3, page 15 talking about debugging:
Quote:
I added checks to INTERPRET, and used to add ?STACK in misbehaving definitions. The word R. that prints the trace of return addresses (using the R@ 2- @ >NAME .NAME principle) turned out to be very useful in ABORT diagnostics.
This shows a word named R. that is doing something similar. I didn't find a code listing for R.N directly.
IamRob
Posts: 357
Joined: 26 Apr 2020

Re: R.N

Post by IamRob »

My extremely limited educated guess is that "S." is already defined in a lot of Forth's to print the data stack and was just used, whereas "R.N' is newly defined. Since ".R" and "D.R" and ">R, R>, R" are already used in FigForth, it seems to me that "R." can become confusing. If I saw "R.", I would take it as printing the top Return Stack value since "R" and "R>" already put the top address on the data stack, whereas "R.N" would print all the values on the Return Stack.
JimBoyd
Posts: 931
Joined: 05 May 2017

Re: R.N

Post by JimBoyd »

SamCoVT wrote:
The accompanying text for that article says:
Quote:
Another pleasant addition has been the stack dumps — both data stack and return stack — on line 6. BREAK will run fine without either of these if you haven't got them yet.
That confirms that R.N prints the return stack. My guess is that R.N is "Print Return Stack with Names". Articles in other issues of Forth Dimensions were discussing how to turn stack addresses into names, with this mention that seems pretty close in Volume 17,Number 3, page 15 talking about debugging:
Quote:
I added checks to INTERPRET, and used to add ?STACK in misbehaving definitions. The word R. that prints the trace of return addresses (using the R@ 2- @ >NAME .NAME principle) turned out to be very useful in ABORT diagnostics.
This shows a word named R. that is doing something similar. I didn't find a code listing for R.N directly.

Fleet Forth's word .RS displays the addresses on the return stack as well as the associated names. I thought it was the norm for a word which displays the return stack contents to display both addresses and associated names.
Using R@ 2- @ >NAME .NAME to display the names works well enough for a stack trace in most cases, but the name QUIT does not appear in the display of the return stack trace. This technique does not display the name of the word containing a given address, but the name of the word which caused that address to be placed on the return stack when it was executed. As I said, this works well for troubleshooting in most cases. I mentioned here that I needed a more accurate version of .RS for some experiments I was running in Fleet Forth.
Post Reply