Chapter 1
Overview of the ROMing Process

There are two basic approaches to supporting ROM calls. One approach is to use the ROM card as a pseudo disk drive and load the application from the ROM card into system RAM. The other approach is to rewrite the application slightly so that it will execute from ROM. In this approach, system RAM is left for Transient Program Area (TPA) and for use as a RAM disk. Such a re-design of the application also allows for faster operation and I/O.

This manual will explain how to modify programs for both of these approaches. PQXT supports both approaches in a manner transparent to the user.

In brief, the process for ROMing an application is:

PQXT Drive Structure

PQXT has four disk drives: Drives A and B accept industry standard ROM/RAM cards with capacities up to 4M bytes.

Figure 1-1: Poqet Drive Configuration

Drive C, the ROM Disk contains MS-DOS 3.3, PoqetTools, and various utilities which we have placed in ROM. Drive D is a RAM disk with a separate 24Kb silicon hard disk, used for temporary storage of files. Drive D is erased when the computer is reset. RAM cards can be used to store information on PQXT.

ROM cards, with burned in software, or SRAM cards with down-loadable software are usable in the memory card slots. OTP (One Time Programmable), EPROM, EEPROM, and Flash cards are also available for use with the system.

PQXT Specifications

In addition to the unique disk drives, PQXT has broken a number of other technological barriers in creating the industry's first palmtop PC. Many of our innovations are patent-pending; thus our concern for confidentiality and appropriate non-disclosures.

Some of these innovations are important for programmers porting software to our machine. The PQXT is fully XT compatible computer. However, because of Poqet's unique technologies, optimum power consumption and performance can be achieved by using Poqet's extended BIOS calls instead of direct hardware calls. (See Chapter 2 for more information about the extended BIOS functions.)

Specifications of PQXT

Types of PC cards available

There are several types of PC cards available for use with PQXT. A brief discussion of each of these types of cards and their advantages are discussed below.

SRAM Cards

SRAM (Static Random Access Memory) or RAM cards are the easiest type of cards to use. PQXT reads and writes RAM cards just as a desktop PC does with floppy disks. Inconveniences of these cards are higher costs and their inability to permanently store data. RAM cards are the least economical type of PC card; costing almost twice as much as Flash. Also, since the cards memory is static, a lithium battery is required to preserve the integrity of the data on the cards. While a SRAM card is in the computer, it is powered by the PC's AA batteries. Shelf life of the cards when taken out of the computer is 1-2 years, depending on the capacity of the card. (Larger capacity cards draw more current. If the battery is removed from the card, all information stored on it is lost. SRAM cards are available in 64K, 512K, 1MB, and 2MB sizes.

Flash Cards

Flash cards use Flash memory, a new technology that combines features found in RAM (random access memory) cards and ROM (read only memory) cards. Like ROM cards, Flash cards must have applications or files "loaded" on the card before it can be used with PQXT. PQXT uses Flash cards as read only devices that can't be written-to, reprogrammed or erased, while inside PQXT. In addition, Flash cards are non-volatile and do not require a battery to preserve information on the card. Flash cards also have the advantage of being less expensive than RAM cards. Like RAM cards, however, Flash cards can be programmed, erased and reprogrammed on a desktop PC that is equipped with a PC card drive, like the ThinCard Drive (Model # TMB-201-03 or equivalent) from DataBook.

Figure 7-1: Write protecting Flash cards prevents file modification

Separate commands must be used to program the cards using the ThinCard Drive. For example, TCERASE and TCXCOPY are used in place of the MS-DOS commands FORMAT and COPY. Unlike standard DOS media, Flash cards are not "byte alterable." This means the card must be erased in blocks (usually matched to a single chip in the card) instead of bytes. Flash cards are presently available in 1MB, 2MB, and 4MB sizes.

ROM cards

ROM (Read Only Memory) cards are available today as OTP (One Time Programmable) and Masked ROM. Masked ROM is used to produce large quantities of cards while keeping costs as low as possible. The card's are programmed by the manufacturer before the card is assembled, saving significant time. However, because of economies of scale, several thousand cards need to be programmed in a run before pricing is below the cost of OTP cards. Masked ROM cards for PQXT are currently available in capacities from 128KB to 8MB.

OTP cards have the ability to have information stored on them a single time. These ROM cards are used for custom programming of applications produced in lower numbers. Once the cards are "burned in," that information is permanently stored on the card and can not be erased or altered. These cards are ideal for storing applications or files that will not change. They are also useful for programming a quantity of cards too low to be produced on Masked ROM.

Programs should be tested and very stable before the cards are burned. Another area of caution is that OTP cards can't be tested by the manufacturer since verifying cards requires them to be programmed. This means if any of the semi-conductor components on the card have failed the card will fail during the programming process. OTP cards can be programmed on a desktop PC that is equipped with a PC card drive. The ThinCard Drive, for example, programs cards at the rate of about 40 minutes per megabyte. Like Flash, special commands are used to write data to OTP cards. OTP cards are available in 1MB, 2MB, 4MB, and 8MB sizes.

Figure 1-1

        Memory       SRAM         Flash        OTP          Masked
        Type                                                ROM
        ----------------------------------------------------------------
        Cost per     High         Medium       Low          Very Low
        MB
        ----------------------------------------------------------------
        Highest      2MB          4MB          8MB          8MB
        Capacity
        ----------------------------------------------------------------
        Write to     Many      External of     Once         Once
        PC card                PQ only
        ----------------------------------------------------------------
        Economic     Single    Single          <20          +1500
        Quantities
        ----------------------------------------------------------------
        Most         File      Applications/   Beta         Applications
        common use   Storage   Stable          Applications
                               Databases

Application Architecture

Using PQXT gives users access to their programs and data wherever they go. However, smaller size also reduces the amount of room available for system memory. Finding ways to reduce the overhead of programs running on the Poqet can significantly improve the performance and functionality of the computer. This section focuses on the most obvious of these - ROM Based software. An additional concept covered is the "Mother Ship/Daughter Ship" paradigm. While a detailed specification of this concept is available, the basic concept is that palmtops are intended to be a second, companion computer. Applications that run on this platform should be designed knowing that a subset of the desktop's program is all that is required. Applications can/should be designed with modular tasks that can be loaded onto a portable unit without requiring the entire application to be run.

While this concept is useful for new product design, it is more critical that the current software be ported into a ROM environment. A program that is executable from ROM as well as RAM is the ideal design for our environment. RAM, limited to 640k (models 0181 and higher), is a precious commodity, and our EMS scheme allows for programs to be executed directed from ROM. There are some caveats and architectural considerations regarding the modification of programs to execute from ROM.

Some critical concerns when ROMing software include:

It is also possible to have a small *.EXE or *.COM file in RAM which points to the program in ROM.

Compression of Programs

In addition to saving system memory, it is also critical that applications use as little disk space as possible. Compression, in many cases, can help reduce the amount of room applications require on PC cards. Some of the most important factors to be aware of when compressing files on a PC card are discussed below:

Type of Files to be Compressed

Not all files can be significantly reduced in size through compression. Text files usually can be significantly reduced while some applications benefit very little. For instance, if an application being compressed has a large number of small files, compressing these files may not reduce the amount of disk space needed to hold them. This is due to the typical cluster size allocation in MS-DOS being 512 bytes. Formatting a PC card with smaller clusters is one potential solution to this problem but may also reduce the access time of the computer on the card.

Performance After Compression

Many types of file compression will slow disk access of files or applications. Make sure the files are still able to provide acceptable performance after they have been compressed.

Amount of Improvementfrom Compression

You may find the reduction in file size from compressing a program is very low. The savings in file size may not be worth the price of the compression program.

Total Size of Files After Compression

Unless a smaller PC card can be used to hold the compressed program, a large reduction in the total amount of storage space to hold an application won't reduce the total cost of the package. For example, OTP cards are available in 1, 2, and 4 MB sizes. Reducing the total storage size of a program from 4 to 3 MB doesn't save any money since a 4MB card is still needed to store the application.

In summary, the advantages of compressing a program can vary dramatically for different jobs depending on the variables discussed earlier. To gain the most from compression requires experimenting with these variables until the best solution is found. However, the savings, when used intelligently, can be dramatic.

Preparing Master ROMS

The complexity of ROMing software depends upon whether it is decided to have the application execute from system ROM or from system RAM. If system ROM is chosen, it is a simple matter to burn a disk image of the existing application into EPROMs or OTP ROMs and load them onto the machine. In order for a program to execute from ROM a number of source code changes are necessary. ROM executable applications also require a larger amount of testing.

The general steps to create a ROM executable program are given below:

  1. Make the appropriate changes to your code, making sure the application is ROM compatible.

    There are two methods of getting your application to a media that PQXT can read. The first is using a ROM or OTP card.

    The second method is using a RAM card in your development process. These cards work well early on in your development process, when you are making code changes. Move the RAM card's write protect switch to the On position to create a "virtual" ROM card. When you are in final quality assurance testing, OTP cards are used.

    During these early stages of development, it is a good idea to evaluate whether XIP (execute in place) or file compression technology make sense.

  2. Test the program.

    If the program is now to execute from ROM, re-testing of your program (even if it was already thoroughly tested) is necessary. It should be tested under various MS-DOS error conditions, and in the Read/Write modes of the program. Also, test the program for memory management problems including potential conflicts with other TSR programs.

  3. Contact Poqet to determine the latest alternatives in mass storage available.

    The best media type can be determined by the size of the application, the need for updates to the files and the number of cards to be programmed.

  4. Send approved sample, along with the appropriate artwork to a semiconductor house for masking and manufacturing.

    This last step requires determining the number of units to be ordered. This, of course, determines the unit cost.

Memory Management ROM BIOS Interfaces

Our ROM BIOS is an IBM compatible BIOS with full functionality including international keyboard codes. It is compatible with MS-DOS 3.3. It is optimized for portable environments with particular attention to minimizing power consumption.

The ROM BIOS Memory Manager (LIM-MC) functions are available to systems and applications developers who need to page in and out internal and external memory devices, such as credit card memories and internal ROMS. These functions are handled through the standard LIM EMS memory function handler -- INT 67h.

Requests are made to Extended ROM BIOS services for memory paging. A scheme similar to LIM EMS 4.0 is used for page swapping. The interface and concept is thus familiar to application and system developers.

The required sequence for accessing/executing expanded memory is show below:

PCMCIA & JEIDA ROM Card Interface Standards

Just as floppy disks have standards that allow the same disk to be used in different brands of computers; PC cards have standards and groups that ensure compliance. To help establish a new standard for these cards, PCMCIA (Personal Computer Memory Card Industry Association) was formed in June of 1989 with Poqet as one of the founding members.

PCMCIA is a non-profit trade association with over 200 members. The association's primary objectives are to establish worldwide standards for PC cards and to promote the benefits of PC card technology. To ensure that PC card standards are accepted worldwide, PCMCIA coordinates their activities with JEIDA (Japanese Electronics Industry Development Association). PC cards are currently available in several forms including SRAM, ROM, OPT ROM, EPROM, EEPROM, and Flash types. PQXT accepts PC cards conforming to PCMCIA 1.0 and JEIDA 3.0 standards. However, because PQXT was introduced before the completion of the PCMCIA 1.0 standards, the cards differ in the following ways:

        Pin      Function    Difference from PCMCIA
        -------------------------------------------------------------------
        Pin 16   RDY/BSY     Can't monitor card's state. This is helpful
                             when working with EEPROMS.
        Pin 18   Vpp1        No programming voltage1.
        Pin 43   RFSH        Can't use PSRAMS.
        Pin 52   Vpp2        No programming voltage1.
        Pin 54   A23         Can't address past 8 MB.
        Pin 55   A24         Can't address past 16 MB.
        Pin 56   A25         Can't address past 32 MB.
        Pin 61   REG         Can't access Attribute memory.
        Pin 62   BVD2        The card shows low battery even when the
                             battery is dead.
        Pin 63   BVD1        The card shows low battery even when the
                             battery is dead.
If you plan to purchase PC cards from a vendor other than Poqet contact Poqet Customer Service first, to ensure the cards are fully compatible. Current PC card standards define two form factors, Type I and Type II. These cards operate identically varying only in their thickness.

Note: Type II cards are not currently supported by PQXT.

For additional information or specifications of PC cards, contact PCMCIA at

PCMCIA Administrative Office
1030B East Duane Ave.
Sunnyvale, CA 94086
(408) 720-0107

ROM BIOS MEMORY MANAGER

Parameter Passing Convention: AH is used to pass the function number. An error code (or 0 for success) is returned in AH. Other registers are used as required. All registers are preserved.
        Function 1: Get Status
                Passed
                        AH 40h
                Returns
                        AH Error Code

        Function 2: Get Page Frame Address
                Passed
                        AH 41h
                Returns
                        Error Code

        Function 3: Get Unallocated Page Count
                Passed
                        AH 42h
                Returns
                        Error Code
                        If AH=0,
                        BX    Number of allocated pages
                        DX    Total number of pages

        Function 4: Allocate Pages
                Passed
                        AH 43h
                        BX Number of Pages Needed
                Returns
                        AH Error Code
                        if AH=0 DX LIM-MC handle (range 1-FFH)

        Function 5: Map/Unmap Handle Pages
                Passed
                        AH 44h
                        AL Physical Page Number
                        BX Logical Page Number
                        DX LIM-MC Handle
                        If ES:DI points to Device ID RMMDEVXX
                                CX Device ID
                                0 Drive A:
                                1 Drive B:
                                2 Intemal ROM
                                Otherwise, Extended Memory is assumed.
                Returms
                        AH Error Code

        Function 6 Deallocate Pages
                Passed
                        AH 45h
                        DX LIM-MC Handle
                Returns
                        AH Error Code

        Function 7: Get Version
                Passed
                        AH 46h
                Returns
                        AH Error Code
                        AL Version Number
                        AL is returned as major/minor BCD version number:
                        0001 0000 1.0

        Function 12: Get Handle Count
                Passed
                        AH 48h
                Returns
                        H Effor Code
                        X Total number of open Handles

        Function 13: Get Handle Pages
                Passed
                        AH 4Ch
                        DX LIM-MC Handle
                Returns
                        AH Error Code
                        BX Number of pages allocated to Handle

        Error Codes
        00   Successful
        80h  Memory Manager SW Malfunction
        81h  Memory Manager HW Malfunction
        83h  Invalid Handle
        84h  Invalid Function Request
        85h  All Handles Used
        86h  Page Mapping Context Error
        87h  Not Enough System Memory
        89h  Attempt to Allocate 0 pages
        8Ah  Logical Page out of Range
        8Bh  Physical Page of Range
        8Fh  Invalid Parameter

MEMORY BLOCK SIZE RESTRICTIONS

Under v 1.0 of the ROM BIOS Memory Manager, the smallest block that can be swapped in/out is a full 64K page (i.e. four 16K pages). However, LIM-MC adheres to the LIM EMS 4.0 standard of requesting memory allocation in 16K pages. Thus page allocation should be in multiples of four 16K pages.

The longest available contiguous block of internal memory is 192K (i.e. twelve 16K pages). The available internal memory map address space used is in the range of C0000h--EFFFFh.

LIM-MC v.1.0 FUNCTION SUPPORT

LIM-MC v. 1.0 supports the following functions:
        Function        Name
        -------------------------------------------
        1               Get Status
        2               Get Page
        3               Get Unallocated Page Count
        4               Allocate Functions
        5               Map/Unmap Handle Page
        6               Deallcate Pages
        7               Get Version
        12              Get Handle Count
        13              Get Handle Pages

TESTING FOR THE PRESENCE LIM-MC

Use MS-DOS "Get Interrupt Vector," or get contents of INT 67h vector location directly. This vector points to the start of the LIM-MC entry code. Compare the Device Name field ASCII string at offset Ah into the start of the LIM-MC entry code. This should be RMMXXXX0.

ROM Card Header Specification

ROM Card

A ROM card can exist in one of three formats:

ROM Disk

A PC card needs to be "formatted" before it can be used, just as with floppy or hard drives. MS-DOS imposes a familiar structure of logical sectors on the PC card when it is formatted. On top of the sector structure is then the normal structure of reserved system sectors:

GENERAL STRUCTURE

In general, the following logical structure is used:

ROM EXECUTABLE FILES

A PC card can also contain binary image files of any nature, in particular, directly executable code. In this case the card is composed of two items:
  1. main header
  2. at least ONE file header block

MAIN HEADER

        ROM Card Signature              DB      4Ch, 59h
        Length of card in 64k blocks    DW      ?
        Signature ID                    DB      "ROMXXXXX0"
        Number of File Header Blocks    DW      ?
        ROM Header Version - MAJOR      DB
                           - MINOR      DB      0
        Reserved                        DB      15 DUP (?)
        ROM Checksum                    DB      ?
                                        Total:  32 BYTES

FILE HEADER BLOCK (FHB)

        NAME (space filled)             DB      "XXXXXXXX"
        NAME EXTENSION (space filled)   DB      "YYY"
        MAIN entry point off-set        DD      word ptr
        Reserved                        DB      17 DUP (?)
                                        Total:  32 bytes

MAIN ENTRY POINT OFFSET

This is a double word at offset 0Bh from the start of the relevant FHB. It points to the offset of the entry point of MAIN code FROM THE START OF FREE CARD SPACE (i.e. AFTER the main header and FHBs).

MIXED MODE CARD

A card may be composed of both the above structures as detailed in Sections 2 and 3. In this case, the start of either structure must lie on a 64K segment boundary.

Note: Version 1.0 of the PQ-BIOS supports only the following possible configuration for mixed mode:

Disk structure at OFFSET 0 from start of card

MAIN HEADER following ROM disk, on a 64K segment boundary

INVOKING ROM EXECUTABLE SOFTWARE

CS:IP is set as follows:

CS=Relevant LIM-MC Page Swap Segment (PSS), plus adjustment for Header and FHBs

IP=MAIN entry point offset

e.g. if the 'C0000' PSS is used, the entry point to the code is at offset 19h, and there is one FHB, CS:IP is set to: C000:0059

Memory Map

PQXT memory map is the same as the IBM-PC XT.
Copyright (c) 1989, 1990, 1991, 1992 Poqet Computer Corporation. All rights reserved.
Filename: PoqetPC/docs/poqetpc/techref/chapter1.html
Date Created: 7 Feb 96, Last Modified: 7 Dec 96
Created by Bryan Mason - E-Mail: poqetpc<at>bmason<dot>com