.
Programmable calculatorsAtari Portfolio HPC-004
.


Datasheet

 

Years of production: - Display type: Dot matrix
New price: - Display color: Blue-green
Display technology: LCD
Size: 4"8"1" Display size: 24064 pixels
Weight: 18 oz
Entry method: Algebraic with precedence
Batteries: 3"AA" Advanced functions: spreadsheet
External power: 6VDC 300mA Memory functions: +/-, spreadsheet cells
I/O: Portfolio Bus, memory cards
Programming model: Spreadsheet
Precision: 13 digits Program functions: Conditionals
Memories: 128 kB Program display: Spreadsheet display
Program steps: 128 kB Program editing: Spreadsheet editing

pfolio.jpg (64913 bytes)Long before the HP Jornada, long before today's Pocket PC craze, there was a company that had an idea: why not shrink an IBM compatible PC to pocket size? With that, the first "instant on", pocket size multifunction personal computer was born, loaded with "productivity applications" such as a simple text processor and spreadsheet program.

In a sense, the Portfolio was slightly ahead of its time. It is equipped with a very modest amount of memory (128 kilobytes in the base model), some of which is used for a RAM disk. The default configuration reserves 32 kilobytes for the RAM drive, leaving a little under 96 kilobytes in which applications can run. Another shortcoming is the lack of compatible interfaces built into the product: its memory card port is proprietary, while serial/parallel port support is available only through optional external interfaces.

That said, the Portfolio is definitely a groundbreaking machine: for the first time, it demonstrated the suitability of the IBM PC architecture for use in a handheld productivity device. In short: it works.

Oh yes, and it does of course function as a calculator. In more ways than one, in fact. In addition to its spreadsheet functionality, it also has a built-in basic calculator program.

What the Portfolio doesn't have is programmability. Not even DOS's venerable DEBUG is present on this machine. So if you are eager to write your own programs, and you aren't content with the limited programmability that a spreadsheet application provides, you have two choices: build your own applications on a desktop PC and transfer them to the Portfolio, or...

Well, when I acquired my Portfolio, it came without the optional interface, so I had no choice in the matter: I had to find another way to write programs for it. Here is how.

It is, of course, possible to enter the bytes of a program directly from the keyboard using the ECHO command. But the ECHO command makes some assumptions: it may translate some characters in ways you don't like (e.g., convert CR characters to CRLF sequences) and it may not accept other characters at all. Fortunately, I was able to construct a very simple DOS COM application that didn't use any problematic characters:

0100 B407          MOV     AH,07
0102 80C401        ADD     AH,01
0105 CD21          INT     21
0107 88C2          MOV     DL,AL
0109 B402          MOV     AH,02
010B CD21          INT     21
010D EBF1          JMP     0100

This, of course, is the assembly listing of this little program, but how can you enter it in binary form? Why, by making use of Alt key sequences of course. In order for this to work, you need to first enable the numeric keypad of the Portfolio by simultaneously pressing the Lock and Atari keys. Shown below is how you can then create the file CAT.COM. Three-digit Alt-sequences are marked using the backspace character, while control characters are marked using ^:

C>echo \180^G\128\196^A\205!\136\194\180^B\205!\235\241>cat.com
C>

If you entered this command line correctly, you now have a file named cat.com in your RAM drive. This program really doesn't do much more than ECHO; the only advantage is that it does not translate character sequences in any way, and it can be used to enter any character except ^C and ^S. So with the help of CAT.COM, you're ready to enter another program:

0100 B408          MOV     AH,08
0102 CD21          INT     21
0104 3C78          CMP     AL,78
0106 7428          JZ      0130
0108 3C3A          CMP     AL,3A
010A 7C02          JL      010E
010C 0409          ADD     AL,09
010E B104          MOV     CL,04
0110 D2E0          SHL     AL,CL
0112 24F0          AND     AL,F0
0114 50            PUSH    AX
0115 B408          MOV     AH,08
0117 CD21          INT     21
0119 3C78          CMP     AL,78
011B 74E9          JZ      0106
011D 3C3A          CMP     AL,3A
011F 7C02          JL      0123
0121 0409          ADD     AL,09
0123 240F          AND     AL,0F
0125 5B            POP     BX
0126 08D8          OR      AL,BL
0128 88C2          MOV     DL,AL
012A B402          MOV     AH,02
012C CD21          INT     21
012E EBD0          JMP     0100
0130 CD20          INT     20

To enter this program, invoke CAT.COM and then start entering bytes as follows:

C>cat >h2c.com
\180  ^H  \205   !    <    x    t    (
  <    :    |   ^B   ^D   ^I  \177  ^D
\210 \224   $  \240   P  \180  ^H  \205
  !    <    x    t  \233   <    :    |
 ^B   ^D   ^I    $   ^O    [   ^H  \216
\136 \194 \180  ^B  \205   !  \235 \208
\205  spc
^C
C>

Altogether you need to enter 50 characters, followed by Control-C, which is used to exit the program. If you did everything right, you now have H2C.COM, a 50-byte executable, on your RAM drive.

H2C.COM is sophistication itself: this program can translate hexadecimal sequences to byte code. In other words, we can now use the built-in editor to write programs! And this leads us to the last program, a version of the classic Hello, World! application, this one written using my W compiler:

write := 0x8B55, 0x8BEC, 0x085E, 0x4E8B, 0x8B04, 0x0656, 0x00B8,
	 0xCD40, 0x7321, 0x3102, 0x8BC0, 0x5DE5, 0x90C3
_() :=
{
	write(1, "Hello, World!\r\n", 15)
}

Translated into assembler, this code looks as follows:

0100 BF3B01        MOV     DI,013B
0103 BB8100        MOV     BX,0081
0106 021E8000      ADD     BL,[0080]
010A B88200        MOV     AX,0082
010D 8827          MOV     [BX],AH
010F 80FB81        CMP     BL,81
0112 7502          JNZ     0116
0114 88D8          MOV     AL,BL
0116 50            PUSH    AX
0117 E80600        CALL    0120
011A 83C402        ADD     SP,+02
011D CD20          INT     20
011F C3            RET
0120 55            PUSH    BP
0121 89E5          MOV     BP,SP
0123 B80100        MOV     AX,0001
0126 50            PUSH    AX
0127 8D451A        LEA     AX,[DI+1A]
012A 50            PUSH    AX
012B B80F00        MOV     AX,000F
012E 50            PUSH    AX
012F 8D5D00        LEA     BX,[DI+00]
0132 FFD3          CALL    BX
0134 83C406        ADD     SP,+06
0137 89EC          MOV     SP,BP
0139 5D            POP     BP
013A C3            RET
013B 55            PUSH    BP
013C 8BEC          MOV     BP,SP
013E 8B5E08        MOV     BX,[BP+08]
0141 8B4E04        MOV     CX,[BP+04]
0144 8B5606        MOV     DX,[BP+06]
0147 B80040        MOV     AX,4000
014A CD21          INT     21
014C 7302          JNB     0150
014E 31C0          XOR     AX,AX
0150 8BE5          MOV     SP,BP
0152 5D            POP     BP
0153 C3            RET
0154 90            NOP

To enter this code, create the file HELLO.HEX using the built-in editor and then enter the following text:

BF 3B 01 BB 81 00 02 1E 80 00 B8 82 00 88 27 80
FB 81 75 02 88 D8 50 E8 06 00 83 C4 02 CD 20 C3
55 89 E5 B8 01 00 50 8D 45 1A 50 B8 0F 00 50 8D
5D 00 FF D3 83 C4 06 89 EC 5D C3 55 8B EC 8B 5E
08 8B 4E 04 8B 56 06 B8 00 40 CD 21 73 02 31 C0
8B E5 5D C3 90 48 65 6C 6C 6F 2C 20 57 6F 72 6C
64 21 0D 0A x

When you're done and verified the result, remove all spaces and concatenate all into a single line of text. Save the file; it should be a file 201 bytes in length. (Yes, that's a lowercase x at the end.)

Now run the following:

C>h2c <hello.hex >hello.com

If everything went well, the result is a 100-byte file, HELLO.COM, on drive C:. Run it:

C>hello
Hello, World!
C>

I'd have tried to further develop this idea (maybe to build a simplistic debugger), but I have, in the meantime, acquired a parallel interface for my Portfolio. So, I no longer need to write bootstrap programs by hand!



This Web page copyright 2002 Viktor T. Toth
Page last modified: May 26, 2002