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

Long number problem

4 views
Skip to first unread message

John H Meyers

unread,
Aug 27, 2002, 6:34:34 AM8/27/02
to mans...@powerup.com.au
Blair wrote:

[ L<->R "window" scrolling may show an ellipsis instead of a character,
so that "full window width" scrolling never shows some characters ]

Note that changing the shift to one less may also sometimes be "wrong";
i.e. sometimes the final (or first) digit could appear *again*,
even though it may also have appeared in the previous window,
so don't rush off a quick "fix" that leaves another problem
in its place (of which some still remain in the HP49).

In fact, if the display shows multiple lines, I suggest
that you may never satisfy all desires (no characters missed,
nor any characters repeated) for all the lines simultaneously
(what are you going to do, shift some lines more than others?) --
unless you never show the full width at all, reserving the "end"
character on the screen only for an ellipsis
(which would also offend some folks), so "you just can't win."

Much the same could be said of the state of the world,
and the common, short-sighted ways of making them worse.

But here's a completely different viewer,
which displays any string, or any object
that can be displayed as a string,
"wrapping" lines only where necessary,
and allowing fast page-up, page-down
(with no lines missing and no lines ever duplicated!)

This is better for programs and other listings
than arbitrarily making all lines the same length,
although it's no better for single, large integers.

--------------------------------------------------

A simple, page-by-page HP48/49 object viewer,
which displays objects as text in a full-screen view,
just as they would appear in the command-line editor,
with one-key "page down" [+], "page up" [-],
and "home/start of file" [*] keys
(long lines are "wrapped," so there is no need to go "right/left").

This viewer can even display a large string which occupies
most of memory, even if only a few hundred bytes remain free.

The version below runs on the HP49G;
for the HP48, some key numbers and *syseval*addresses*
are different (it will crash an HP48 if not translated).

Programs which automatically translate most syseval address arguments
in UserRPL programs (plus other related goodies) may be found here:
http://groups.google.com/groups?selm=8618et%24p7v%241%40nnrp1.deja.com
http://www.hpcalc.org/search.php?query=systrans

The programs below may be entered manually or downloaded;
if you run and then discard the single file below,
it will automatically install everything for you.

The reason for leaving a few functions as separate programs
is so that you may call these same generally useful functions
from any other programs.

Note that the HP49 font size (which you can adjust)
determines how many lines will appear per page:

font8: 8 lines per page (same as HP48 fixed font)
font7: 9 lines per page
font6: 10 lines per page

-----------------------------------------------------------


%%HP: T(3)F(.); @ HP49G version (see comments above and below)

@ Each address for SYSEVAL has been tagged with a :name:
@
@ The :name: is unnecessary for execution, and may be omitted,
@ but it serves as documentation,
@ and enables automatic translation to HP48 addresses
@ (with the aid of a separate translator program)

\<< 1. FREEZE 64. FONTH / IP { } \-> n h \<< @ lines per screen
{ DUP @ leave original object unchanged on stack
EDC @ External prog: display non-string object as text for editing
1. DO @ On stack: "complete text" current_byte_number
@ Display one full screen:
CLLCD 1. n FOR i @ as many lines as fit on screen
@ each line ends at the next newline, or else 22 characters
DUP2 DUP 22. + SUB 1. OVER "\010" POS @ newline (Right+[.])
DUP NOT 22. * + SUB DUP
@ i DISP (but DISP thinks screen is fixed at 56 pixels, not 64)
i 1. :COERCE2: #3F481h SYSEVAL :Disp5x7: #25EBCh SYSEVAL
@ If last screen line always blank, update your very old HP49 rom!
@ Advance the pointer by the length of each displayed line:
SIZE + NEXT
@ Originally we did 0. WAIT DROP here, but now:

@ Process keys for: Page Up / Page Down / Home / Off
@ Trap Cancel, use zero for keycode (avoids "Interrupted" msgbox)
-55. CF 0. IFERR WAIT THEN END
{ @ Press [+] for Page Down (all undefined keys do the same)
\<< DUP 'h' STO+ \>> @ byte numbers for traversed pages
85. @ [-] for Page Up
\<< DROP h TAIL DUP 'h' STO SIZE { h HEAD } 1. IFTE \>>
75. @ [*] for Home (start of file)
\<< DROP 1. { } 'h' STO \>>
0. @ Allow Cancel key to exit
{ DROP 1E7 }
101. @ OFF key turns off (key number is 91 for HP48)
{ OFF DROP h SIZE { h HEAD } 1. IFTE }
} DUP ROT IP POS 1. + GET EVAL @ Dispatch on key code

UNTIL DUP2 SWAP SIZE > END DROP2 @ Detect end of file

} FSX \>> \>> @ External function for full-screen applications

'MORE' STO @ or pick your own "main program" name

@ Display any non-string object, exactly the same as the editor
\<< DUP TYPE 2. \=/ { :EDITDECOMP$: #25ECEh SYSEVAL } IFT \>>
'EDC' STO

@ Run any program with 64-pixel screen height (no menu)
\<< CLLCD
:TURNMENUOFF: #2F034h SYSEVAL
IFERR EVALX THEN 1. ELSE 0. END
:TURNMENUON: #2F031h SYSEVAL
:RECLAIMDISP: #25EF4h SYSEVAL
{ ERRN DOERR } IFT \>>
'FSX' STO

@ General error trapper, restores flags & path, cleans up stack
\<< QUOTE DEPTH RCLF PATH \-> d. f. p. \<<
IFERR EVAL THEN 1. ELSE 0. END
CLOSEIO f. STOF p. EVAL
{ DEPTH d. - 1. + DROPN ERRN DOERR } IFT \>> \>>
'EVALX' STO

@ Get font height in pixels
@ (just store the fixed value 8 into 'FONTH' for HP48)
\<< :GetFontHeight: #2623Dh SYSEVAL :UNCOERCE: #262F6h SYSEVAL \>>
'FONTH' STO

@ End of downloadable HP49 file


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----

0 new messages