diff --git a/csrc/pf_guts.h b/csrc/pf_guts.h index 9782e69..1a49647 100644 --- a/csrc/pf_guts.h +++ b/csrc/pf_guts.h @@ -54,9 +54,10 @@ ** FV10 - 20170103 - Added ID_FILE_FLUSH ID_FILE_RENAME ID_FILE_RESIZE ** FV11 - 20241226 - Added ID_SLEEP_P, ID_VAR_BYE_CODE, ID_VERSION_CODE ** FV12 - 20241227 - Added Long name support, ID_FLAG_SMUDGE, ID_MASK_NAME_SIZE +** FV13 - 20250120 - Added R0 for UNRAVEL */ -#define PF_FILE_VERSION (12) /* Bump this whenever primitives added. */ +#define PF_FILE_VERSION (13) /* Bump this whenever primitives added. */ #if defined(PF_SUPPORT_LONG_NAMES) #define PF_EARLIEST_FILE_VERSION (12) /* earliest one still compatible */ @@ -323,6 +324,7 @@ enum cforth_primitive_ids ID_VERSION_CODE, ID_FLAG_SMUDGE, ID_MASK_NAME_SIZE, + ID_R_ZERO, /* R0 , base of return stack */ /* If you add a word above here, ** 1. update PF_FILE_VERSION ** 2. take away one reserved word below @@ -331,7 +333,6 @@ enum cforth_primitive_ids /* Only reserve space if we are adding FP so that we can detect ** unsupported primitives when loading dictionary. */ - ID_RESERVED05, ID_RESERVED06, ID_RESERVED07, ID_RESERVED08, diff --git a/csrc/pf_inner.c b/csrc/pf_inner.c index 985c3d5..7ade2d2 100644 --- a/csrc/pf_inner.c +++ b/csrc/pf_inner.c @@ -1598,6 +1598,11 @@ DBUG(("XX ah,m,l = 0x%8x,%8x,%8x - qh,l = 0x%8x,%8x\n", ah,am,al, qh,ql )); M_DROP; endcase; + case ID_R_ZERO: /* ( -- rbase , base of return stack ) */ + PUSH_TOS; + TOS = (cell_t)gCurrentTask->td_ReturnBase; + endcase; + case ID_ROLL: /* ( xu xu-1 xu-1 ... x0 u -- xu-1 xu-1 ... x0 xu ) */ { cell_t ri; diff --git a/csrc/pfcompil.c b/csrc/pfcompil.c index b9c8b8b..87ba056 100644 --- a/csrc/pfcompil.c +++ b/csrc/pfcompil.c @@ -337,6 +337,7 @@ PForthDictionary pfBuildDictionary( cell_t HeaderSize, cell_t CodeSize ) CreateDicEntryC( ID_R_FROM, "R>", 0 ); CreateDicEntryC( ID_RP_FETCH, "RP@", 0 ); CreateDicEntryC( ID_RP_STORE, "RP!", 0 ); + CreateDicEntryC( ID_R_ZERO, "R0", 0 ); CreateDicEntryC( ID_SEMICOLON, ";", FLAG_IMMEDIATE ); CreateDicEntryC( ID_SP_FETCH, "SP@", 0 ); CreateDicEntryC( ID_SP_STORE, "SP!", 0 ); diff --git a/fth/misc1.fth b/fth/misc1.fth index 7844df5..676aed5 100644 --- a/fth/misc1.fth +++ b/fth/misc1.fth @@ -182,3 +182,19 @@ variable CLOSEST-XT UNTIL THEN ; + +: UNRAVEL ( -- , show names of words on return stack ) + >newline ." Calling sequence:" cr + r0 rp@ - cell / + 1- \ skip call into unravel + 0 max 50 min \ clip to reasonable range + 0 + ?DO 4 spaces + rp@ i 2+ \ skip over DO LOOP control and call to UNRAVEL + cell* + @ + dup code> >name ?dup + IF id. drop + ELSE . + THEN cr? + LOOP cr +;