[comp.sys.handhelds] HP48 terminal emulator

rsteele@XN.LL.MIT.EDU (Rob Steele) (03/13/90)

It's wierd having Kermit file transfer without terminal emulation.
The following is TERM, a dumb terminal emulator for the HP48SX.
It's slow and chokes easily on fast input.  Still, it might be
usefull to someone.  It uses whatever communications parameters
you establish in [I/O] [SETUP] and works by alternatly polling the
keypad and the input buffer.  The alpha key functions as a shift-
lock.

This is my first whack at programming the 48 and I would apreciate
some criticism regarding style.  Like, how are you supposed to comment
a program?

Five dollars to the first person who rewrites this to be interrupt
driven.

Rob Steele
MIT Lincoln Laboratory
They didn't hire me for my opinions.


TERM, 1063 bytes, # 3B1Fh checksum

%%HP: T(3)A(D)F(.);
\<<
    # 0d

    \-> col
    
    \<<
        1
        
        "..........ABCDEF....GHIJKL....MNOPQR....STUVWX....
YZ........789/......456*......123-......0. +"

        "..........abcdef....ghijkl....mnopqr....stuvwx....
yz........789/......456*......123-......0. +"

        \<<
            DUP RCL 55 8 CHR REPL SWAP STO
        \>>
        
        \<<
            PICT DUP { # 0d # 0d } OVER
            { # 0d # 8d } { # 130d # 63d } SUB REPL
            {# 0d # 56d } # 131d # 8d BLANK REPL
             # 0d 'col' STO
        \>>
        
        \-> caps uctbl lctbl addbs nl
        
        \<<
            'uctbl' addbs EVAL
            'lctbl' addbs EVAL
        
            -40 CF
            OPENIO
            { # 0d # 0d } PVIEW
            7 FREEZE
            nl EVAL
            
            WHILE 1 REPEAT
                IF KEY THEN
                    IF DUP 61 == THEN
                        DROP caps NOT 'caps' STO
                    ELSE
                        IF caps THEN
                            uctbl
                        ELSE
                            lctbl
                        END
                        SWAP DUP SUB XMIT DROP
                    END
                END

                IF BUFLEN DROP THEN
                    1 SRECV DROP DUP NUM
                    CASE
                        DUP 8 == THEN
                            DROP2
                            IF col # 0d > THEN
                                col # 6d - 'col' STO 
                            END
                        END
                        
                        13 == THEN
                            DROP nl EVAL
                        END
                        
                        2 \->GROB
                        PICT col # 56d 2 \->LIST ROT REPL
                        # 6d 'col' STO+
                        IF col # 131d > THEN
                            nl EVAL
                        END
                    END
                END
            END
        \>>
    \>>
\>>

prestonb@hpcvra.CV.HP.COM (Preston Brown) (03/14/90)

>Like, how are you supposed to comment a program?

When composing the program on a PC you can use a @ for 
commemts.  Anything after an @ on a line is discarded
when the program is downloaded.

\<< DUP DROP           @ This is a comment
\>>

Preston

daveo@hpcvra.CV.HP.COM (Dave Ochs) (03/14/90)

>>Like, how are you supposed to comment a program?
>
>When composing the program on a PC you can use a @ for 
>commemts.  Anything after an @ on a line is discarded
>when the program is downloaded.
>
>\<< DUP DROP           @ This is a comment
>\>>

Also, anything between to @'s (on a single line) is a comment.

\<< DUP @ this is a comment @ DROP
\>>