Prev: Icon at top of 48gii Screen
Next: INPUT Command HP 49G+
From: CT_Surveyor on 20 Apr 2010 22:01 I am converting some of my UserRPL programs to SysRPL, and have run into a problem with the DISPXY command. The syntax for this entry in SysRPL is supposed to be: :: xCLEAR xCLLCD "your text string" { #x #y } % n (n=0 for minifont or 2 for system font) ~xDISPXY % 7 xFREEZE ; This code snippet compiles okay in Debug4X, no error messages, but when I try to run it, the emulator either warmstarts, freezes up, or crashes with a memory lost. I suspect the problem is in the { #x #y } argument. In UserRPL, these two numbers are formatted as shown, but when Debug4X compiles the source code, it seems to change the numbers somehow, such that a { #0 #0 } becomes { ¤13 ¤13 } in SysRPL object code . I have tried every alternative format I can think of, including the obvious ones like { BINTn BINTn } and { # 0d # 0d } and nothing seems to work. I am running version 2.2 build 137 of Debug4X and the ROM image in the emulator is version 2.15. Since this command works just fine in UserRPL, there must be a way to run it in SysRPL, right? Any help appreciated!
From: Katie on 20 Apr 2010 22:08 > crashes with a memory lost. I suspect the problem is in the { #x #y } > argument. In UserRPL, these two numbers are formatted as shown, but You are right. Those need to be HEX objects. I'd recommend putting the data on the stack, and running the ->S2 command from menu 256. You will see immediately that there is a difference. :-) TW
From: Han on 20 Apr 2010 22:14 On Apr 20, 9:01 pm, CT_Surveyor <lgchar...(a)gmail.com> wrote: > I am converting some of my UserRPL programs to SysRPL, and have run > into a problem with the DISPXY command. The syntax for this entry in > SysRPL is supposed to be: > > :: > xCLEAR > xCLLCD > "your text string" > { #x #y } > % n (n=0 for minifont or 2 for system font) > ~xDISPXY > % 7 > xFREEZE > ; > > This code snippet compiles okay in Debug4X, no error messages, but > when I try to run it, the emulator either warmstarts, freezes up, or > crashes with a memory lost. I suspect the problem is in the { #x #y } > argument. In UserRPL, these two numbers are formatted as shown, but > when Debug4X compiles the source code, it seems to change the numbers > somehow, such that a { #0 #0 } becomes { ¤13 ¤13 } in SysRPL object > code . I have tried every alternative format I can think of, including > the obvious ones like { BINTn BINTn } and { # 0d # 0d } and nothing > seems to work. > > I am running version 2.2 build 137 of Debug4X and the ROM image in the > emulator is version 2.15. > > Since this command works just fine in UserRPL, there must be a way to > run it in SysRPL, right? Any help appreciated! First, the '~' denotes that the token which follows is the name of an internal library command. Change to ~xDISPXY to just xDISPXY. Secondly, the UserRPL syntax is indeed { # 0d # 0d }. However, in SysRPL syntax, # 0d is written as: HXS hh hhhhhhhhhhhhhhhh where the first two 'hh' digits represent the length (in hexadecimal) and the remaining 16 hexadecimals are the nibbles of the hexadecimal string, in reverse order. For most user hex strings, the length is 10 (in hexadecimal), or 16 in decimal (16 nibbles = 64 bits). So # 131d would be # 83h (in UserRPL); in SysRPL it would take the form: HXS 10 3800000000000000 I hope that helps.
From: Han on 20 Apr 2010 22:20 On Apr 20, 9:14 pm, Han <handuongs...(a)gmail.com> wrote: > On Apr 20, 9:01 pm, CT_Surveyor <lgchar...(a)gmail.com> wrote: > > > > > I am converting some of my UserRPL programs to SysRPL, and have run > > into a problem with the DISPXY command. The syntax for this entry in > > SysRPL is supposed to be: > > > :: > > xCLEAR > > xCLLCD > > "your text string" > > { #x #y } > > % n (n=0 for minifont or 2 for system font) > > ~xDISPXY > > % 7 > > xFREEZE > > ; > > > This code snippet compiles okay in Debug4X, no error messages, but > > when I try to run it, the emulator either warmstarts, freezes up, or > > crashes with a memory lost. I suspect the problem is in the { #x #y } > > argument. In UserRPL, these two numbers are formatted as shown, but > > when Debug4X compiles the source code, it seems to change the numbers > > somehow, such that a { #0 #0 } becomes { ¤13 ¤13 } in SysRPL object > > code . I have tried every alternative format I can think of, including > > the obvious ones like { BINTn BINTn } and { # 0d # 0d } and nothing > > seems to work. > > > I am running version 2.2 build 137 of Debug4X and the ROM image in the > > emulator is version 2.15. > > > Since this command works just fine in UserRPL, there must be a way to > > run it in SysRPL, right? Any help appreciated! > > First, the '~' denotes that the token which follows is the name of an > internal library command. Change to ~xDISPXY to just xDISPXY. > Secondly, the UserRPL syntax is indeed { # 0d # 0d }. However, in > SysRPL syntax, # 0d is written as: > > HXS hh hhhhhhhhhhhhhhhh > > where the first two 'hh' digits represent the length (in hexadecimal) > and the remaining 16 hexadecimals are the nibbles of the hexadecimal > string, in reverse order. For most user hex strings, the length is 10 > (in hexadecimal), or 16 in decimal (16 nibbles = 64 bits). So # 131d > would be # 83h (in UserRPL); in SysRPL it would take the form: > > HXS 10 3800000000000000 > > I hope that helps. Allow me to clarify. The general syntax is HXS <length> <nibbles> where <length> is number (in hex) of digits in <nibbles>, and <nibbles> are the nibbles of your hexadecimal in reverse order. (I.e. the length is not _fixed_ at some value between 00 and FF (255 decimal). Most user hex strings are capped at 64 bits, or 16 nibbles. Since 16 is 10 in hex, you will see HXS 10 hhhhhhhhhhhhhhhh for most hex strings.
From: John H Meyers on 20 Apr 2010 23:08
On 4/20/2010 9:20 PM: > # 131d would be # 83h (in UserRPL); > in SysRPL it would take the form: > HXS 10 3800000000000000 Since "hex strings" are inherently variable length, even though the results of UserRPL binary arithmetic and compiling are always normalized to 64 bits, you are free to omit "leading" zeros, and to shorten the length accordingly in your code (e.g. HXS 2 38) For another example, note the results of <any non-ROM object> BYTES DROP [r->] [OFF] |