Interesting.
Since HP41, influenced by Forth, had more stack manipulation words (and others) than the HP71B Forth, hereunder is a try, to bring more Forth HP71B words to reach the HP41 level.
Link of new Forth or ASM words.
ASM in
https://github.com/f4iteightiz/HP71B_for...n/MAFO.TXT
Code:
Compatibility comparison:
****************************************************************
* HP41 and HP71B Forth float functions (standard or new)
* list created with HP41/ILPER with SF 15 CAT 3
* Legend: () means no need because covered by another function
* or different behaviour
* >> tbd word to be worked out
*
* .. regarding the ALPHA functions
* .. No ALPHA register on HP71B but several strings can be created and extensive output words can be used
* ARCL () put reg data into the ALPHA register, om en page 70
* STR$
* ASHF () shift the left-most six characters in the ALPHA
* SUB$ could create a new string from the character 7 on
* ASTO () store ALPHA string into Register (max 6 letters), om en page 70
* STRING define a new variable string then merge another string into it
* with the use of S<&
* AVIEW () show ALPHA string into screen, om en page 151
* ." SOMETHING "
* INTEGERVAR @ .
* STRINGVAR OUTPUT
* FVAR1 F.
* FS. the whole float stack
* CLA () Clear ALPHA register (page 41).
* Since several strings variables can be created and the display can be a line or
* a screen, diverse methods can be defined
* . Put the length of a string variable to zero means it would be cleared
* : CLEARSTR DROP DUP 1 CHARS - 0 SWAP C! 0 ;
* . Cleaning the HP71B screen line, use CR
* . Cleaning a 80column screen
* 2 STRING RES2CHR
* RES2CHR 27 CHR$ S<& 69 CHR$ S<& 2DROP
* RES2CHR OUTPUT .. OK { 0 } screen is clean
* or : PAGE 27 EMIT 69 EMIT ;
*
* 00..N Registers
* >> N REG41CR Creates an array of integer pointer of maximum N float register
* >> NN RECREG Recall the address of the NNth register
* .. further to be done for simulating the registers 00 to 329 on HP41
*
* HP41 Forth HP71B
* + F+ (Forth standard)
* - F- (Forth standard)
* * F* (Forth standard)
* / F/ (Forth standard)
* 1/X 1/X (Forth standard)
* 10^X 10^X (Forth standard)
* ABS FABS for real numbers (Forth standard)
* ACOS ACOS (Forth standard)
* ADV () advance paper if printer in system om en HP41 page 105
* activate the printer as output in Forth then use CR
* AOFF () takes the HP-41C out of ALPHA mode; HP71 entry are num AND ALPHA
* therefore no need for a switch in Forth
* AON () function places the HP-41C into ALPHA mode; HP71 entry are num AND ALPHA
* therefore no need for a switch in Forth
* ARCL see above
* ASHF see above
* ASIN ASIN (Forth standard)
* ASN () Assign. not programmable on HP41, om en page 270
* ASTO see above
* ATAN ATAN (Forth standard)
* AVIEW see above
* BEEP BEEP41 (New ASM)
* BST () Back step (om en page 132). Not programmable. See HP71B Forth debugger
* CAT LIST ( = CAT 3)
* CF ST=x y look at the ST Forth status flags in HP71B
* CHS CHS for the X register (Forth standard)
* FVCHS (New ASM float variable CHS)
* CLA see above. PAGE word would clean the screen.
* CLD () clear display (example something displayed with AVIEW):
* CR (Forth Word) or PAGE (Forth Word)
* CLP FORGET (Word).. and all words after
* CLRG CLFV (New ASM)
* CLs >> Clear statistics registers (om en page 99)
* CLST CLST (New ASM)
* CLX CLX (New ASM)
* COPY () " XYZ" LOADF, load xyz into FORTHRAM..
* HP41 Copy (download or copy).
* Requires ALPHA program name input (om en page 260).
* Not programmable in HP41.
* COS COS (Forth standard)
* D-R DEG-RAD (New ASM)
* DEC () Oct to Dec conversion page pdf 111 of om em manual
* or https://rosettacode.org/wiki/Non-decimal_radices/Convert#Forth
* in Forth, use the 8 BASE ! NUMBERINTEGER1 DECIMAL for changing the values
* in the INTEGER stack from OCT base to DECIMAL.
* example 8 BASE ! 326 DECIMAL .
* 214 OK { 0 }
* which mean 326 in OCT is 214 in decimal
* The float stack is everytime DECIMAL and any FTOI will
* be a change DECIMAL to BASE
* DEG DEGREES
* DEL () see editor
* DSE DSE (New ASM) see I DO LOOP of Forth.
* (of Variable FVARx X Y Z T L..)
* END ; (Forth standard)
* ENG ENG (Forth standard)
* ENTER^ FENTER (Forth standard)
* E^X E^X (Forth standard)
* E^X-1 () see E^X
* FACT FACT (new ASM)
* FACX (new Forth; X fractional part ignored)
* FACI (new Forth; for integer)
* FC? () look at the ST Forth status flags in HP71B
* FC?C () look at the ST Forth status flags in HP71B
* FIX FIX (Forth standard)
* FRC FP (Forth standard)
* FS? () look at the ST Forth status flags in HP71B
* FS?C () look at the ST Forth status flags in HP71B
* GRAD >> tbd GRAD Mode. 360 degrees = 2 pi radians = 400 grads page pdf 98 hp41 manual
* GRA>RAD ? since no GRADE mode. Only RADIANS and DEGREES mode so far defined in HP71B
* GRA>DEG RAD>GRAD DEG>GRAD ?
* GTO ()
* HMS >> tbd decimal hours to hour minutes seconds
* HMS+ >> tbd see https://github.com/hp71b/jpcrom/blob/main/src/hms.as
* HMS- >> tbd see https://github.com/hp71b/jpcrom/blob/main/src/hms.as
* HR >> tbd HMS to decimal hours
* INT IP (Forth standard)
* ISG ISG (New ASM) see I DO LOOP of Forth.
* (of Variable FVARx X Y Z T L..)
* LASTX LASTX (Forth standard)
* LBL () look at the Forth word ":"
* LN LN (Forth standard)
* LN1+X () see LN
* LOG LGT (Forth standard)
* MEAN >> tbd see statistics
*
* MOD PMOD (New Forth word)
* 78 7 PMOD . > 1 OK { 0 }
* -78 7 PMOD . > 6 OK { 0 }
* 78 -7 PMOD . > -6 OK { 0 }
* -78 -7 PMOD . > -1 OK { 0 }
* .. because MOD of HP41
* 78 7 MOD > 1
* -78 7 MOD > 6
* 78 -7 MOD > -6
* -78 -7 MOD > -1
* .. and MOD HP71 (standard word)
* 78 7 MOD . > 1 OK { 0 }
* -78 7 MOD . > -1 OK { 0 }
* 78 -7 MOD . > 1 OK { 0 }
* -78 -7 MOD . > -1 OK { 0 }
* .. and MOD Gforth
* 78 7 MOD . > 1 ok
* -78 7 MOD . > 6 ok
* 78 -7 MOD . > -6 ok
* -78 -7 MOD . > -1 ok
*
* OCT () Dec to Oct conversion page pdf 111 of om em manual
* in Forth, use the 8 BASE ! NUMBERINTEGER1 DECIMAL for changing the values
* in the INTEGER stack from OCT base to DECIMAL.
* example 8 BASE ! 326 DECIMAL .
* 214 OK { 0 }
* which mean 326 in OCT is 214 in decimal
* OFF () function simply turns the HP-41C power off
* ON () When you execute the function ((xEQ) ON (APHA] ),
* the turn-off feature is disabled and the HP-41C will no
* longer automatically turn itself off
* P-R P-R Polar to Radian coordinates (om en manual page 94).
* PACK () Pack program memory (page 141). Not programmable in 41
* look at Forth 71B SHRINK and GROW for similar function
* % %OF (New ASM)
* %CH %CH (New ASM)
* PI PI (New ASM)
* PROMPT () displays the contents of the ALPHA register
* and stops program execution (om en manual page 51).
* wait for data input.
* EXPECT96 in Forth
* PSE PAUSE (Forth standard)
* R^ RUP (Forth standard)
* R-D DEG-RAD (New ASM)
* R-P R-P (New ASM) Radial to Polar conversion om en page 92
* RAD RADIANS (Forth standard)
* RCL RCL (Forth standard)
* RDN RDN (Forth standard)
* RND Round HP41 om en page 78. RND (New Forth word) round according N in integer stack and
* not accordingly the activ SCI or ENG stored value
* RTN ;
* SDEV >> tbd standard deviation statistics (om en page 101)
* SCI SCI, scientific notation display om en page 33
* SF () look at the ST Forth status flags in HP71B
* s+ >> tbd statistics registers (om en page 99)
* s- >> tbd statistics registers (om en page 99)
* sREG >> tbd beginning of a block of six statistical registers (om en page 99)
* SIN SIN (Forth standard)
* SIGN XSIGN ( New ASM; put 1 in X if X>=0, else -1)
* SIGN in Forth is for integer only (not float)
* SIZE () allocate X registers (variable). Not programmable.
* in Forth: make variable declarations? a float variable list?
* SQRT SQRT (Forth standard)
* SST >> tbd with Forth bebugger. Single step (om en page 129, 132). Not programmable.
* ST+ ST+ (New ASM)
* ST- ST- (New ASM)
* ST* ST* (New ASM)
* ST/ ST/ (New ASM)
* STO STO (Forth standard)
* STOP () HP71B key ATTN Stops program execution (hp41 om en page 145).
* TAN TAN (standard Forth)
* TONE TONE (New ASM)
* VIEW FV. (New in Forth)
* X=0? X=0? (standard Forth)
* X#0? X#0? (New ASM)
* X<0? X<0? (New ASM)
* X<=0? X<=0? (New ASM)
* X>0? X>0? (New ASM)
* X=Y? X=Y? (standard Forth)
* X#Y? X#Y? (standard Forth)
* X<Y? X<Y? (standard Forth)
* X<=Y? X<=Y? (standard Forth)
* X>Y? X>Y? (standard Forth)
* X<> X<> (New ASM)
* X<>Y X<>Y (standard Forth)
* XEQ () call the word in the Forth prompt
* X^2 X^2 (standard Forth)
* Y^X Y^X (standard Forth)