Greetings,
I am taking an assembly class, and I'd like to use my 50g as opposed
to an emulated 16c.
However, I do not understand is why a negative sign does not appear in
the display of my hp 50g when I set 2's complement, but it does on a
hp 16c.
For example:
(BASE menu selected)
1: 16 [STWS] --(set word size to 16bit)
1: # FFE2h
Press [F2] to convert to DEC
1: # 65506d
Press [+/-] to set to 2's complement.
1: # 30d
....
Now on an HP-16c, wordsize also set to 16bit.
1: FFE2 h
Press [DEC] to convert to DEC
1: 65506 d
Press [ f ] then [2] to set to 2's complement.
1: -30 d
....
I'm curious as to why my 50g does not display a negative sign.
Thanks.
Regards,
Pal
|
|
0
|
|
|
|
Reply
|
greenchile505 (14)
|
3/9/2007 5:42:21 AM |
|
> Greetings,
>
> I am taking an assembly class, and I'd like to use my 50g as opposed
> to an emulated 16c.
>
> However, I do not understand is why a negative sign does not appear in
> the display of my hp 50g when I set 2's complement, but it does on a
> hp 16c.
>
> For example:
>
> (BASE menu selected)
>
> 1: 16 [STWS] --(set word size to 16bit)
>
> 1: # FFE2h
>
> Press [F2] to convert to DEC
>
> 1: # 65506d
>
> Press [+/-] to set to 2's complement.
>
> 1: # 30d
>
> Now on an HP-16c, wordsize also set to 16bit.
>
> 1: FFE2 h
>
> Press [DEC] to convert to DEC
>
> 1: 65506 d
>
> Press [ f ] then [2] to set to 2's complement.
>
> 1: -30 d
>
>
> I'm curious as to why my 50g does not display a negative sign.
>
> Thanks.
>
> Regards,
> Pal
On binary numbers sign doesn't make much sense (sign is the highest bit)
even if it's set this doesn't necesarily mean that it IS a negative number
(only if your ASM routine considers it as a negative -then it is :-)
-thats one reason why it's not displayed
finally...
when you have 65506d (which is negative number), once you apply
2's complement you get *positive* number 30.
note...
when you change to DEC your number is NOT converted to decimal
it's rather displayed in decimal form but the number is not changed
Conclusion:
so your question actualy is : where that (-) sign comes from on 16C :-)
manjo
|
|
0
|
|
|
|
Reply
|
manjo
|
3/9/2007 1:22:35 PM
|
|
On Thu, 08 Mar 2007 23:42:21 -0600, Pal wrote:
> I am taking an assembly class, and I'd like to use my 50g
> as opposed to an emulated 16c.
>
> However, I do not understand is why a negative sign
> does not appear in the display of my hp 50g
> when I set 2's complement, but it does on a hp 16c.
How do you "set 2's complement" on HP49/50?
Although HP16C gives you *three* choices
for both base conversion and arithmetic
(unsigned, one's complement, two's complement),
the HP48/49/50 series has always offered
only *one* choice (unsigned).
You need programs to make signed interpretations,
e.g. for all HP48/49/50, respecting the current word size:
\<< DUP 0. \>=3D { R\->B } { NEG R\->B NEG } IFTE
\>> 'SR\->B' STO
\<< DUP 1. R\->B RR < { B\->R } { NEG B\->R NEG } IFTE
\>> 'SB\->R' STO
Below are some conversions between binary and *integer* for HP49/50
(but again unsigned); these are intended to be most efficient,
rather than most trivial, also to work with lists:
Notes:
o Must be entered in "Exact" mode.
o Sets word size to 64 (use above for 32, 16, 8, ...)
\<< 8. SQ STWS 0 MAX 18446744073709551615 MIN DUP R\->B DUP B\->R R\->I
ROT - I\->R 8. ALOG SWAP OVER ADD SWAP R\->B - - \>> 'I\->B' STO
\<< 8. SQ STWS DUP B\->R R\->I DUP R\->B ROT - 8. ALOG SWAP OVER
R\->B ADD B\->R SWAP - R\->I - \>> 'B\->I' STO
I presume that you can do exactly as in the first two programs above,
to make signed versions of the B<->I programs,
which now give you enough range to express all results exactly
(reals with 12-digit mantissas can run out of significant digits,
hence give only an approximation above 10^12)
There have also been HP16C emulators which run on HP48/49;
one of those (the most complete)
has not, IIRC, always been a free offering,
but here's what can be found on www.hpcalc.org:
http://www.hpcalc.org/search.php?query=3D16C
Gee, why didn't we ask for built-in 'I\->B' and 'B\->I' ?
(Add to "wish list,"
in case there's still any life in the development arena :)
[r->] [OFF]
|
|
0
|
|
|
|
Reply
|
John
|
3/10/2007 4:26:59 AM
|
|
On Mar 9, 9:26 pm, "John H Meyers" <jhmey...@nomail.invalid> wrote:
> On Thu, 08 Mar 2007 23:42:21 -0600, Pal wrote:
> > I am taking an assembly class, and I'd like to use my 50g
> > as opposed to an emulated 16c.
>
> > However, I do not understand is why a negative sign
> > does not appear in the display of my hp 50g
> > when I set 2's complement, but it does on a hp 16c.
>
> How do you "set 2's complement" on HP49/50?
>
> Although HP16C gives you *three* choices
> for both base conversion and arithmetic
> (unsigned, one's complement, two's complement),
> the HP48/49/50 series has always offered
> only *one* choice (unsigned).
>
> You need programs to make signed interpretations,
> e.g. for all HP48/49/50, respecting the current word size:
>
> \<< DUP 0. \>= { R\->B } { NEG R\->B NEG } IFTE
> \>> 'SR\->B' STO
>
> \<< DUP 1. R\->B RR < { B\->R } { NEG B\->R NEG } IFTE
> \>> 'SB\->R' STO
>
> Below are some conversions between binary and *integer* for HP49/50
> (but again unsigned); these are intended to be most efficient,
> rather than most trivial, also to work with lists:
>
> Notes:
>
> o Must be entered in "Exact" mode.
>
> o Sets word size to 64 (use above for 32, 16, 8, ...)
>
> \<< 8. SQ STWS 0 MAX 18446744073709551615 MIN DUP R\->B DUP B\->R R\->I
> ROT - I\->R 8. ALOG SWAP OVER ADD SWAP R\->B - - \>> 'I\->B' STO
>
> \<< 8. SQ STWS DUP B\->R R\->I DUP R\->B ROT - 8. ALOG SWAP OVER
> R\->B ADD B\->R SWAP - R\->I - \>> 'B\->I' STO
>
> I presume that you can do exactly as in the first two programs above,
> to make signed versions of the B<->I programs,
> which now give you enough range to express all results exactly
> (reals with 12-digit mantissas can run out of significant digits,
> hence give only an approximation above 10^12)
>
> There have also been HP16C emulators which run on HP48/49;
> one of those (the most complete)
> has not, IIRC, always been a free offering,
> but here's what can be found onwww.hpcalc.org:http://www.hpcalc.org/search.php?query=16C
>
> Gee, why didn't we ask for built-in 'I\->B' and 'B\->I' ?
> (Add to "wish list,"
> in case there's still any life in the development arena :)
>
> [r->] [OFF]
John,
Thank you for the programs. I will attempt to program my hp 50g with
your code and note the results.
Regarding setting 2's compliment on the hp 50g, pressing [+/-] does
seem not right compared to using the explicit 1's, 2's, & UNSGN
buttons found on the hp 16c. However, despite the hp 50g's ommission
of "SET COMPL" functionality, if pressing [+/-] toggles the decimal
representation of # E2h as 65506 and 30, what is the difference,
besides the missing negative sign? In the example "30" looks alot like
"- 30"... How in this case is [+/-] behaving exactly?
Thank you much,
Pal
|
|
0
|
|
|
|
Reply
|
greenchile505
|
3/10/2007 7:52:02 PM
|
|
On Sat, 10 Mar 2007 13:52:02 -0600, Pal wrote:
[what does +/- do for "user binary" integers?]
Complements every binary bit, then adds 1
(masking the result to the current word size).
You could also say that it first subtracts 1,
then complements -- result is the same.
It's actually the same as CHS on HP16C
for unsigned binary values (try it!)
When you think of the binary values as if signed (2's comp),
however, then the result is indeed to change the sign,
but all subsequent *internal* operation on HP48/49/50
continues to interpret it as unsigned anyway;
thus the value when interpreted internally as decimal
does not become negative (it's 2^W higher,
where W is the current word size),
and you could always use the previously posted examples
to make your own signed decimal value interpreter accordingly.
[r->] [OFF]
|
|
0
|
|
|
|
Reply
|
John
|
3/10/2007 10:09:47 PM
|
|
On Mar 9, 9:26 pm, "John H Meyers" <jhmey...@nomail.invalid> wrote:
> \<< DUP 0. \>= { R\->B } { NEG R\->B NEG } IFTE
> \>> 'SR\->B' STO
>
> \<< DUP 1. R\->B RR < { B\->R } { NEG B\->R NEG } IFTE
> \>> 'SB\->R' STO
John, thank you again for the programs. I have been trying to enter
your program but I am afraid I cannot figure out the 50g equivalent
of:
\>=
I keep getting an Invalid Syntax error. It is in the first line of the
first program. I think it is an ascii translation of some keys on the
50g, but I do not know which.
If you could explain I would appreciate it. I think I have the rest
figured out ok.
Regards,
Pal
|
|
0
|
|
|
|
Reply
|
pgyore
|
3/28/2007 3:22:05 AM
|
|
In article <1175052125.915724.117160@p77g2000hsh.googlegroups.com>,
pgyore@gmail.com wrote:
> On Mar 9, 9:26 pm, "John H Meyers" <jhmey...@nomail.invalid> wrote:
>
> > \<< DUP 0. \>= { R\->B } { NEG R\->B NEG } IFTE
> > \>> 'SR\->B' STO
> >
> > \<< DUP 1. R\->B RR < { B\->R } { NEG B\->R NEG } IFTE
> > \>> 'SB\->R' STO
>
> John, thank you again for the programs. I have been trying to enter
> your program but I am afraid I cannot figure out the 50g equivalent
> of:
>
> \>=
>
> I keep getting an Invalid Syntax error. It is in the first line of the
> first program. I think it is an ascii translation of some keys on the
> 50g, but I do not know which.
The backslash indicates an ascii sequence representing an HP character
for which there is no corresponding ACSCII character.
"\<=" represents the less than or equal character keyed in by left-shift
X.
>
> If you could explain I would appreciate it. I think I have the rest
> figured out ok.
>
>
> Regards,
> Pal
|
|
0
|
|
|
|
Reply
|
Virgil
|
3/28/2007 3:58:24 AM
|
|
On Tue, 27 Mar 2007 22:58:24 -0500:
> The backslash indicates an ascii sequence representing an HP character=
> [ISO-8859-1] for which there is no corresponding ACSCII character.
>
> "\<=3D" represents the less than or equal character [LS X]
And \>=3D is "greater or equal" [LS Y], as used in the posted program.
"Ascii \xx symbols and %%HP headers"
http://groups.google.com/group/comp.sys.hp48/msg/52e9cc3ee2b369b8
[r->] [OFF]
|
|
0
|
|
|
|
Reply
|
John
|
3/28/2007 4:40:46 AM
|
|
On Mar 27, 9:40 pm, "John H Meyers" <jhmey...@nomail.invalid> wrote:
> On Tue, 27 Mar 2007 22:58:24 -0500:
>
> > The backslash indicates an ascii sequence representing an HP character
> > [ISO-8859-1] for which there is no corresponding ACSCII character.
>
> > "\<=" represents the less than or equal character [LS X]
>
> And \>= is "greater or equal" [LS Y], as used in the posted program.
>
> "Ascii \xx symbols and %%HP headers"http://groups.google.com/group/comp.sys.hp48/msg/52e9cc3ee2b369b8
>
> [r->] [OFF]
Thank you Virgil and John. And thank you for the full reference card,
John. I knew I saw that before but I did not know what terms to use to
search for it. Perhaps I should have tried "digraph" or
"ISO-8859-1" ;)
....
By the way, I also scanned the hp16 emulators / simulators at hpcalc
using 16c filtered link you sent me, John, and it looked as though the
"HP 16C Simulator" was the only one with a tiny blue hp 49 icon next
to it. Perhaps now is a good time to clear up a potential
misconception. Do programs for the 48 series work on an hp 50g, or
should I keep to the programs with a tiny blue hp 49 icon, as I have
in the past. I might like to try several older programs, but I was
afraid of compatibility issues.
Also, the HP 16C Simulator archive contains 3 files. One is a .src
file, which contains (ascii) source code. Another is a .txt file,
which contains a few words from the author and again the source code.
The third is a .dir file, which appears to contain binary data. There
is no minimal install instructions. After receiving your programs
(which I have not yet typed into my calculator due to writing this), I
do not know if I should even bother with the simulator. But I am
curious! Can I install?
Thanks again,
Pal
|
|
0
|
|
|
|
Reply
|
pgyore
|
3/28/2007 5:07:31 AM
|
|
On Wed, 28 Mar 2007 00:07:31 -0500:
> what terms to use to search for [ascii translation chart];
> perhaps "digraph"
That's the exact same word I just rubbed into the
bloodhound's face before barking "go find it, Rufus!"
at which command he parked himself directly above the spot
from which the body of the old post could be exhumed.
In case anyone wants to borrow Rufus for himself, he lives at
http://groups.google.com/advanced_search?q=3Dgroup:comp.sys.hp48
> By the way, I also scanned the hp16 emulators / simulators at hpcalc
> and it looked as though the "HP 16C Simulator" was the only one
> with a tiny blue hp 49 icon next to it.
Tiny?
You must have one of those 3072x2304 monitors,
which make Mount Everest look like an anthill :)
> Perhaps now is a good time to clear up a potential
> misconception. Do programs for the 48 series work on an hp 50g,
> or should I keep to the programs with a tiny blue hp 49 icon,
> as I have in the past. I might like to try several older programs,
> but I was afraid of compatibility issues.
Is anyone afraid of accidentally plugging a USA-model
110-volt toaster into a 220-volt outlet in Switzerland?
Why no, because the plug won't fit!
Binary files from 48 series won't be accepted when copied
to 49/50 series calcs, and vice-versa.
Source files, on the other hand,
contain words which a compiler within each calc
will translate on the spot to the correct addresses for that calc,
so the issue of incompatible ROM addresses almost vanishes
(except for SYSEVAL & LIBEVAL, whose arguments *are*
ROM addresses and/or other possibly incompatible numbers).
Only a close inspection of the downloadable zip contents
fully reveals what kind of content is in each file:
%%HP:... or \<<...\>> etc. [text source]
HPHP48-x... [48 series binary]
HPHP49-x... [49/50 series binary] [48Gii too]
"This wonderful program..." [The Fine Manual?]
(may contain source text within, or even poetry)
Binary files are sure to load exactly as originally created,
and can only load on the identical series calc.
Source files get [re]compiled as they are being transferred,
so when transferred between different series (or occasionally
even between same series with different stuff loaded),
imperfect reproduction may ensue from different vars,
libs, command names/functions, whole numbers compiling
as "Exact" (integer) vs. "Approximate" (real) objects,
hardware differences (screen size, port numbers),
and other quantum perturbations and uncertainties.
SysRPL source may be either more compatible or less compatible
than UserRPL, depending on more factors than these marginal notes
can contain.
> Also, the HP 16C Simulator archive contains 3 files. One is a .src
> file, which contains (ascii) source code. Another is a .txt file,
> which contains a few words from the author and again the source code.
> The third is a .dir file, which appears to contain binary data.
> There are no minimal install instructions. I do not know
> whether I should even bother with the simulator.
> But I am curious! Can I install?
Binary files can only be meant for installing,
so why not give them their opportunity to do just that?
If there's only source and no binary, then of course
one has to resort to compiling, just like Unix geeks
who have never downloaded a binary executable in their lives,
only "tarballs" with source and "make" files :)
And don't forget to always have paid-up insurance (backup)
before you let any strange contractors into your house :)
[r->] [OFF]
|
|
0
|
|
|
|
Reply
|
John
|
3/28/2007 7:30:00 AM
|
|
On Mar 28, 12:30 am, "John H Meyers" <jhmey...@nomail.invalid> wrote:
(snipped)
> And don't forget to always have paid-up insurance (backup)
> before you let any strange contractors into your house :)
John,
Thank you for ALL the advice. From what it sounds, I can play with
program distributions that contain source code (which may or may not
work), and stay away from binaries (which may or may not work). Unless
they're compiled specifically for my model machine. In which case they
may or may not work.
Got it.
I did manage to key in your 'SR->B' and 'SB->R' successfully. Thank
you, thank you. I look forward to learning UserRPL soon, having
finally learned RPN and understanding the stack.
Is there a flag I can set to have the calc NOT automatically add
spaces when adding symbols such as \-> or DUP or other.. I struggled
for some time with "Syntax Error" simply because my R->B was typed as
R -> B. (I realize this is a minor thing).
Thanks!
Pal
|
|
0
|
|
|
|
Reply
|
greenchile505
|
3/28/2007 5:25:30 PM
|
|
On Wed, 28 Mar 2007 12:25:30 -0500, wrote:
> From what it sounds, I can play with program distributions
> that contain source code (which may or may not work),
> and stay away from binaries (which may or may not work).
> Unless they're compiled specifically for my model machine.
> In which case they may or may not work.
Oh dear, is that what I said? ;-)
Well, I meant to *encourage* trying any binaries first.
There is no danger of accidentally executing
a binary program that's not made for your calc series,
because if you transfer a binary for the wrong series,
it simply sits there as a string beginning with either
"HPHP48-x" or "HPHP49-x" and won't do anything else,
so what I meant was that just as the cables for one calc
can't even be plugged into the other, neither can any
binary program be accidentally plugged into the wrong calc.
If there is a binary for your series, then that's
the *most* likely to just work upon installing,
because loading a binary bypasses all the potential
issues associated with re-compiling.
> Is there a flag I can set to have the calc NOT
> automatically add spaces when adding symbols
> such as \-> or DUP or other.. I struggled
> for some time with "Syntax Error" simply because my
> R->B was typed as R -> B
Stay in *Alpha* mode whenever you are "spelling out"
command names, and no extra spaces will appear.
When *not* in Alpha mode, most keys (except digits)
enter an entire command at a time, and automatically
insert spaces between commands (even the \-> key
also acts as an entire command, all by itself,
unless typed in Alpha mode).
If you can find the menu that contains the whole command
you want to enter (e.g. MTH BASE contains R\->B and B\->R),
then pressing that key enters the entire command as one "token";
you can decide which is faster -- spelling out
or finding the function on the keyboard or in a menu
(the CATalog can also be used, saving time with
longer command names or repeating the same command).
o Alpha ON to spell out character-by character.
o Alpha OFF to insert one complete command per key,
which automatically inserts spaces in between.
The \-> key acts like one character in Alpha mode.
The \-> key otherwise generates a separate \-> *command*
"By George, he's got it!"
[Eliza Doolittle, after Henry Higgins finally proposed :]
Audrey Hepburn - L'Ange des Enfants
http://www.audrey1.com/films/lady.html
|
|
0
|
|
|
|
Reply
|
John
|
3/28/2007 9:39:21 PM
|
|
|
11 Replies
220 Views
(page loaded in 0.651 seconds)
|