Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Converting USER RPL to SYSTEM RPL

418 views
Skip to first unread message

snr...@gmail.com

unread,
May 10, 2014, 10:34:14 AM5/10/14
to
What is the easiest way to convert a large USER RPL program into SYSTEM RPL? I have a large USER RPL program I wrote for the HP49G (not + version) that I want to speed up. I'm very familiar with USER RPL, just never attempted SYSTEM RPL.

mnhol...@outlook.com

unread,
May 11, 2014, 12:54:23 PM5/11/14
to
Documentation:

http://www.hpcalc.org/hp49/docs/programming/

Introduction to SysRPL - Queensland Surveyor 2.0
Programming in System RPL (PDF) 2nd Edition
Programming in System RPL (Programs) 2nd Edition
Programming the 49G Text Editor

SDK:

http://www.hpcalc.org/search.php?query=sdk

Debug4x HP 48/49 SDK 2.2 Build 168

TW

unread,
May 12, 2014, 10:21:04 AM5/12/14
to
On Saturday, May 10, 2014 8:34:14 AM UTC-6, snr...@gmail.com wrote:
> What is the easiest way to convert a large USER RPL program into SYSTEM RPL? I have a large USER RPL program I wrote for the HP49G (not + version) that I want to speed up. I'm very familiar with USER RPL, just never attempted SYSTEM RPL.

Also note that while the impression may be there that converting a userRPL program into sysRPL will magically make it run hugely faster, this is not really the case. While that will be true if you are doing some very frequent looping, certain operations that don't fit well with userRPL commands (string manipulation comes to mind), or a few other types of things, as a general rule sysRPL will be just slightly faster to user in my experience. If you do ANY type of symbolic manipulation then it will be identically fast is essence.


Perhaps by describing your program and some of the special types of constructs or operations you do would help people recommend how or what to focus on.

James Cloos

unread,
May 13, 2014, 2:13:33 PM5/13/14
to
>>>>> "T" == TW <timwe...@gmail.com> writes:

T> Also note that while the impression may be there that converting a
T> userRPL program into sysRPL will magically make it run hugely faster,
T> this is not really the case.

Indeed. If you want real speed you have to code the important stuff in
assembly.

Saturn assembly is a bit of a pain, with 4 general purpose registers --
only two of which can do mem load/save -- and 5 scratch registers. But
the results are worth it.

Don't forget to save and restore the flag register; rpl and the display
routines depend on it. Use the list of rom assembly entry points to
your advantage.

And if you are starting with user code, first convert to rpl and then
convert the slow sections to assembly as needed.

The lib I converted did a lot of adds and mults; allocating some ram (I
allocated a long-enough string on the stack in rpl and used that for my
scratch ram in the assembly) and doing the math to/from ram rather than
pushing and popping the stack likely is why it was so much faster.

-JimC
--
James Cloos <cl...@jhcloos.com> OpenPGP: 0x997A9F17ED7DAEA6

snr...@gmail.com

unread,
May 16, 2014, 9:56:17 PM5/16/14
to
Hi Thanks for the documentation. I've been reading on my free time but am a bit overwhelmed. Think If I had some source code of a decent System RPL text editor that would help me a lot.

snr...@gmail.com

unread,
May 16, 2014, 10:02:11 PM5/16/14
to
Hi Thanks for the insight. Fortunately my program is one big DO loop sounds like I'm structured like a POL in system RPL. I'm writing a program to decode text and ultimately send text to be converted into various radio signals on my KX3 Ham radio. I have a portion of the slow USER RPL code below. I've tried using both local variables and stack manipulation to get faster speeds.

«
« DSP DSPN WRP STRG
« 0 STRG SIZE WRP / CEIL DUP DUP DSPN MIN - SWAP 1 -
FOR I STRG I WRP * 1 + I 1 + WRP * SUB OVER DSP + DISP 1 +
NEXT DROP
»
» 1 WRP DECD
«
«
DO DECD
IF
THEN "TB;"
DO XMIT
UNTIL
END .05 WAIT BUFLEN DROP SRECV CLOSEIO DROP DUP SIZE 1 - 6 SWAP SUB RECSTR SWAP + DUP SIZE DUP 300 - SWAP SUB DUP -72 FS? { 1 6 33. } { 1 4 22. } IFTE 4 ROLL WRP EVAL 'RECSTR' STO
END
UNTIL KEY
END
»
« PICK3 PICK3 POS STRG MRK MDF PSN
«
IF MDF -1 ==
THEN STRG 1 PSN 2 - SUB MRK + STRG PSN 1 - DUP SUB STRG PSN 1 + STRG SIZE SUB + +
ELSE
IF MDF 1 ==
THEN STRG 1 PSN 1 - SUB STRG PSN 1 + DUP SUB MRK + + STRG PSN 2 + STRG SIZE SUB +
END
END
»
» { { "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" " "
« "Sel Msg Dec Off Utl Sel" { "MEM1 " "MEM2 " "MEM3 " } 2 CHOOSE NOT "" IFT
»
« -72. SF -90 SF "" CLLCD
»
« -72. CF -90 CF "" CLLCD
»
« ""
»
« ""
» ""
« 4 PICK DUP " " POS 2 - 1 SWAP SUB " " + 5 PICK DUP " " POS 1 + OVER SIZE SUB + 5 ROLL DROP 4 ROLLD ""
» "" "" "" "" } { 11. 12. 13. 14. 15. 16. 21. 22. 23. 31. 32. 33. 41. 42. 43. 44. 51. 52. 53. 54. 55. 61. 62. 63. 64. 65. 102. 92. 93. 94. 82. 83. 84. 72. 73. 74. 104. 25. 85. 95. 35. 71. 81. 45. 103. 75. 105. 91. } } REC MOV TXT
« CLLCD " "
DO REC EVAL DUP
IF DUP 34. == SWAP 36 == OR
THEN SWAP " " PICK3 34 == -1 1 IFTE MOV EVAL DUP -72 FS? { 8 4 33. } { 6 4 22. } IFTE 4 ROLL WRP EVAL SWAP
ELSE TXT OBJ DROP PICK3 POS GETI EVAL UNROT DROP2 ROT DUP " " POS ROT " " + REPL DUP UNROT -72 FS? { 8 4 33. } { 6 4 22. } IFTE 4 ROLL WRP EVAL
END
UNTIL DUP 103. ==
« 1 'DECD' STO
»
« DUP 75. ==
« 0 'DECD' STO
» IFT
» IFTE 81. ==
END
»
»
»

snr...@gmail.com

unread,
May 16, 2014, 10:09:38 PM5/16/14
to
I'm not sure if I'm up to the task of Saturn Assembly, but would make an attempt at it if I thought I could overcome the learning curve.

Dave Hayden

unread,
May 26, 2014, 11:55:06 AM5/26/14
to
I know you said this is for a 49G, but if you get a 50g then you could write the slow parts in C code. C is about 100 times faster than UserRPL. The programs are much larger, but if you store them on an SD card then the increased space is only a factor if you run out of RAM. In other words it won't really affect the space in your HOME directory.
0 new messages