A ATARY Portfolio Technical Reference Guide First Edition september 1989 CONFIDENTIAL The information in this guide is proprietary and confidential. This guide and the information herein may be used only in accordance with the written agreement under which it was supplied. Copyright © 1989, Distributed Information Processing (DIP), Ltd. All rights reserved. Copyright in this Portfolio Technical Reference Guide, the software contained in the Portfolio, and all technical drawings of and relating to the hardware design ("the Copyright Material") is vested in Distributed Information Processing Limited ("DIP"). Accordingly no part of the Copyright Material may be reproduced, stored in a retrieval system or transmitted in any form or by any means without the prior written permission of DIP. Atari, the Atari logo and Portfolio™ are trademarks or registered trademarks of Atari Corporation. IBM PC is a trademark of International Business Machines Corporation. Lotus 1-2-3 is a trademark of Lotus Development Corporation. MS-DOS is a trademark of Microsoft Corporation. Turbo C, Sidekick are trademarks of Borland Corporation. XTALK is a trademark of Microstuf Corporation. A. ATARI Atari Corporation 1196 Borregas Avenue Sunnyvale, CA 94086 CONTENTS 1 Technical Overview of Portfolio.....................0..00000000000000.0.. 1-1 2 Hardware 2.1 System Description.......000.000cc ccc cccccceeeccceeeeeees Seam eee acess ae" 2.2 SyStEM MeMOSY..........00c ccc ccccceccccccccccccccececeeecceceeceececssseseveeeeeeeee, 2-4 2.3 Memory Cards........... sist seth eticatey nee pian sean ienietece eee ess eee geese eee 2-6 2.4 Custom ASIC Chip................ ee ee a 2-8 2.5 Power Supply Unit.......... se veces ote eee ot pees eee eee ee eee 2-9 2.6 Portfolio Expansion Porte... cccccccccccccceccecsscssssssssecccsssssssssseeeees 2-11 2./ Peripheral Design Issues............. ae eee eaesetere ee ate tse ese sete e-17 2.8 LCD Display...........0.....ccccccccccccccccccccceeecceceeeeeeeeeaes soitinddaresaslead 2-21 3 Software 3.1 General Description. ........ oc cceccccccccccccccccccceccccccuveeeeeecececeeteeesecce, al | 3.2 Differences Between Portfolio BIOS and IBM PC BIOG............ 3-4 3.3 System Specific BIOS............... Saini taleacasicudatieedamacmnaniax vdansrednsteediioee 3-6 3.4 Differences Between MS-DOS and Portfolio DOS.................. 3-23 3.5 Device Drivers and Peripheral Software.................ccccccccceeeeee. 3-24 3.6 Memory Cards... ccc ccccccccccccccccccuecccceuescecucescccueesestececeeeees 3-28 3.7 Screen Handling. ......... cece ceccccceecccueeceuueceees saiemenieeaneseeccce et 3-30 3.8 Power Management........0.0...00.cccccccccccccccueccceeeeee aeeeesasiee eee o-31 3.9 Special File Formats... ccc ccccccccccscccccucesececeuseccecreseeees 3-33 3.10 IBM PC Development System..............ccccccccccccccccceeccececceceuees sof 4 Peripherals 4.1 Portfolio Serial Communications. ......0.....00 cc cccecceccceceeeeeeeceeeeeee 4-4 4.2 Smart Parallel Interface File Transfer Protocol Description....... 4-3 4.3 IBM PC Card Drive........... oc cccccccssssssseveseeeveeeceeeeeeeeecceeecceeeees 4-4 4.4 EPROM Writer Adaptor Boards...........0... coco ccccccccccccccceeecceceeceees 4-5 Appendixes A Example .RUN Program............ ccc cccccccccccccecccccecceccccecuececuesecerecs A-1 B Diagram of Portfolio Character Set................... pees reuceusougaieaa yam B-1 C Example Peripheral Design................. ccc cccccccccccccucccucceceeceeceueees C-1 1 TECHNICAL OVERVIEW OF PORTFOLIO The Atari Portfolio is the first product that provides the functionality of a standard desktop PC in a package which can fit into a pocket. The main requirements for the Portfolio technology are that the product should be pocketable, compatible, have low power consumption and above all be inexpensive to purchase. The Portfolio is the size of a video cassette (VHS) and weighs less than one pound (450 grams). The Portfolio provides a high degree of software compatibility with the industry standard desktop microcomputer, the IBM PC. This is achieved by supplying a PC- compatible BIOS, MS-DOS-compatible operating system as well as Lotus 1-2-3 file- compatible spreadsheet. The Portfolio also provides an expansion bus connector which allows peripherals to be connected to the product. The Portfolio is inexpensive to manufacture as the software is provided on and runs from ROM and with the large scale integration of system logic, using an ASIC, the overall component cost and size are reduced. The Portfolio uses credit card-sized memory cards instead of magnetic disks, and a LCD display. These components have a low power consumption and hence the product can use the consumer standard AA batteries and achieve a long battery life. This Technical Reference Guide describes the Portfolio technology in detail and provides the necessary information for a third party to develop hardware and software applications for the Portfolio. This document only provides information specific to the Portfolio technology. If you want information on the standard IBM PC hardware, BIOS, or MS-DOS then the following publications should provide the required information: IBM Personal Computer Publications: Technical Reference (BIOS and Hardware) Disk Operating System (PC-DOS) Microsoft Press Publications ISBN Reference Peter Norton Programmer’s Guide 0-914845-46-2 The MS-DOS Encyclopedia 1-556 15-049-0 IBM ROM BIOS (Quick Reference Series) 1-556 15-135-7 MS-DOS Functions (Quick Reference) 1-556 15-128-4 1-1 2. HARDWARE 2.1. System Description | OSCILLATORS | POWER SUPPLY | | KEYBOARD | | ON BOARD RAM 4KB MDA | 124KB SYSTEM COMPATIBLE SYSTEM LOGIC INCLUDING | CHARACTER} DEDICATED | GENERATOR| VIDEO VIDEO CONTROLLER | EXPANSION PORT ASIC TONE DIALLER 128KB ROM A AND SOUNDS | CARD MEMORY 128KB ROM B BLOCK DIAGRAM OF PORTFOLIO SYSTEM et 2.1.1 Microprocessor Unit The Portfolio uses an 80C88 MPU, the same processor as the original IBM PC. It is the CMOS static version which allows the MPU clock to be halted when no processing is taking place and hence power consumption is kept to a minimum. The Portfolio is faster than the original IBM PC, the clock running at 4.9152MHz instead of 4.77MHz. However, the Portfolio processor uses minimum mode, so bus lock cannot be used. (See section 2.6 for more details.) 2.1.2 System RAM The current Portfolio uses four 32 KByte Static RAM chips, giving a total of 128KBytes. These have a very low standby current which allows them to maintain their contents for extended periods with minimal drain on batteries.(See section 2.2 for more details.) 2.1.3. System ROM The current Portfolio has in total 256 KBytes of ROM which contains all of the BIOS, DOS, command processor and application software. This ROM currently comprises of two 128 KByte chips. (See section 2.2 for more details.) 2.1.4 LCD Display The LCD is a 240 x 64 pixel display. It is driven by a set of LCD screen drivers which are controlled by a graphics LCD controller. The screen behaves in the same way as an IBM PC monochrome text screen (MDA). The controller also uses a dedicated Video RAM chip and a character generator ROM. For graphics it is pixel compatible provided the PC-compatible BIOS is used. (See sections 2.2.2, 2.8 and 3.7.) 2.1.5 Tone Dialler + Sound The Portfolio speaker is driven by a Dual Tone Multiple Frequency (DTMF) telephone dialler chip. This produces all the necessary dual tones required for tone dialling plus a set of melody tones for musical applications. The keyboard click also uses this circuit. (See section 3.3.1.) 2.1.6 ASIC This circuit contains most of the system logic. (See section 2.4 for more details.) 2.1.7 Keyboard The Portfolio uses a 63-key QWERTY ‘switch-matrix’ keyboard. The ASIC generates a set of physical scan-codes which are translated by the BIOS to IBM PC- compatible scan-codes. 2.1.8 Memory Card Connector The Portfolio contains a memory card connector on the side of the product. Credit card-sized memory cards can be inserted into this connector, allowing for data and programs to be accessed by the Portfolio software. (See section 2.2.4, 3.6.) 2.1.9 Expansion Port On the right-hand side of the product there is a 60-pin connector which provides the necessary signals for various peripherals. (See section 2.6, 2.7 and 3.5.) 2.1.10 Power Supply Unit This supplies all the power required in the system. It produces various supply lines. The circuit includes a switching regulator that steps up the voltage from 3 AA cells to OV. The regulator may be switched off. (See section 2.5 and 3.8 for more details.) rag 2.2 SYSTEM MEMORY 2.2.1 Memory Map FFFFF : SYSTEM ROM A - (128K BYTES) E0000 | SYSTEM ROM B - (128K BYTES) CREDIT CARD MEMORY (EQUIVALENT TO A: OR B:) C0000 | — MIRROR OF VIDEO RAM (NOT USED) B1000 |= , | a VIDEO RAM MDA 4K BYTES B0000 | NOT USED A0000 > , | NOT USED | EXPANSION RAM AREA UP TO 512K BYTES 9FO00 3F000 : _ aie | SYSTEM RAM - 124K BYTES (INCLUDING C:) 00000 ! Diagram of Portfolio Memory Map (all addresses in hex) 2.2.2 RAM There is a total of 128 KBytes of on-board RAM provided with the Portfolio. 4 KBytes of this RAM are mapped to BOOO0h to make up the video RAM which is compatible with the IBM PC MDA screen. This gives a total system RAM of 124 KBytes. The system RAM can be expanded up to 636 KBytes by use of memory expansion peripheral(s). The Portfolio allows the user to have an internal RAM disk (known as C:) which can be user configured. This RAM disk uses the top of the system RAM. 2.2.3 System ROMA This contains the BIOS, operating system and some of the application software. The reset vector sits at FFFFOh. This ROM cannot be mapped out of the memory map. 2.2.4 System ROMB This contains the rest of the application software. This ROM may be switched out of the memory map and replaced by either the internal memory card or an external memory card on a peripheral. The BIOS disk services would normally perform this switching function. (See section 3.6.) 2-5 2.3 Memory Cards The Portfolio uses credit card-sized memory cards which are specially designed for the Portfolio. There are similar memory cards available from other vendors. DO NOT use these cards with the Portfolio as they may harm the card and the Portfolio. These come in three main types: RAM, OTPROM and Mask ROM. (See below for explanation.) The cards are formatted to look like MS-DOS disks. It is possible to run a program directly from a card and hence reduce the amount of system RAM required. (See section 3.6.3 for more details.) 2.3.2 RAM cards The RAM cards are currently available in three main sizes: 32, 64 and 128 KBytes. The cards are made up of Static RAM and each card contains a lithium back-up cell. This cell will maintain the data on a card when it is not in a Portfolio for a year or more. 2.3.3 OTPROM cards The One Time Programmable ROMs cards that are currently available are 64 and 128 KBytes. They are read-only cards and would typically be used for holding fixed data or software. They can be programmed in a standard EPROM programmer like a normal PROM (see section 4.4). 2.3.4 Mask ROM These cards are "factory programmed" and have a low unit cost. This makes them suitable for issuing mass production software. Currently available only as 128 KByte option. 2.3.5 Future Card Sizes The Portfolio BIOS contains support for ROM and RAM cards of greater than 128 KBytes. If these become available, they will be made up of 128 KByte pages with a page register at offset OOOAN. It is imperative that NO application software uses this memory card location, no matter what the card capacity. 2-6 2.3.6 Memory Card Pin-out Below is a pin out of typical memory cards. Differences between the various card types are highlighted. (Pin 1 is on the right with the connections up and pointing to you.) Pin COMMON 1 A16 2 A15 3 4 A12 5 A7 6 A6 7 A5 8 A4 9 A3 10 A2 11 Al 12 AO 13 DO 14 D1 15 D2 16 GND if D3 18 D4 19 D5 20 D6 21 D7 22 CE 23 A10 24 25 All 26 AS air A8 28 A13 29 Al4 30 31 VCC 32 CDET Notes: NC RAM OTPROM Mask ROM 32k 64k 128k VBB VPP NC VPP NC OE OE OE/VPP OE OE WE NC NC PGM NC No internal connection. Operating supply: 5 Volts. Signal ground This is the small pin (internally connected to GND), used to detect presence of card. Card address line x. Card data line x. Card battery voltage. OTPROM program line. OV in program mode. OTPROM program voltage. 12.5V Program mode, 5V normally Low to indicate a read cycle. Low to indicate a write cycle. ay 2.4 Custom ASIC Chip The Portfolio custom ASIC chip provides most of the necessary system logic. Itis a gate array implemented using silicon gate CMOS technology, which allows for very low power and high speed operation. This Application Specific Integrated Circuit (ASIC) is used to generate all the select lines for the memory, memory cards and other system blocks. It also contains several system control functions. These functions are controlled using a set of registers which control the various parts of the system such as memory chip size. 2.4.1 System Clock The clock is 4.9152MHz, with a 50% duty cycle produced by a crystal oscillator. The clock can go in to a stop mode. A custom chip interrupt will cause the clock to restart. 2.4.2 Timer The system timer tick count is generated from a 32768Hz crystal oscillator which will generate an interrupt every 1 second or every 128 seconds. 2.4.3 Keyboard Controller The keyboard controller will scan an eight by eight push to make key-switch matrix. A pressed or released key will cause an interrupt. The processor will obtain the scan code from a control register. 2.4.4 Interrupt Handler This controls the critical error for the memory cards, keyboard and tick count interrupt. This is extended outside the ASIC to allow for external peripheral interrupts. 2.4.5 Soft Contrast for LCD A control register holds the contrast value for the LCD display. 2.5 Power Supply Unit The Portfolio has several power supply lines and control lines. These are used for various purposes and have different power characteristics as explained below. They are all available on the expansion bus. When batteries and a power supply are connected to the Portfolio simultaneously, the Portfolio will be supplied by the higher voltage ("initial source”). (See section 3.8 for software issues.) 2.5.1 Power Modes i) NO POWER MODE This is the state when no initial source is connected to the Portfolio (e.g. changing batteries). If an initial source has been supplied and then removed, the system RAM will be backed up by an internal capacitor. ii) OFF MODE This is the state the Portfolio goes into when the ‘OFF’ command is used. The custom chip and RAM are powered directly from the initial source. li) STANDBY MODE This is the state that the Portfolio will be in while waiting for a key press. The whole system is powered from the output of the internal five volt regulator. However, the system clock CCLK is halted in order to stop the processor and save power. iv) RUN MODE This the state in which the Portfolio is actually processing. The whole system is powered from the output of the five volt regulator and the system clock CCLK is running, thus causing maximum power usage. 2.5.3. VCC (Memory Card supply voltage) This line follows 5VS. It is designed to be used by an external memory card so that plugging in and pulling out a card will not cause spikes on 5VS. This line should not be used for any other purpose. 2-9 2.5.2 5VS - Five Volt switched supply line This is the output of the five volt regulator. During STANDBY and RUN modes, this line will supply five volts. At any other time this line will float low. Peripherals may be designed that use this supply. OVS is capable of supplying up to 40 mA at 5V +/- 5% to a peripheral. This assumes that the main unit is taking maximum power. The Portfolio will run correctly outside the 5% supply tolerance: however, this is not recommended. Use of 5VS by a peripheral will decrease the unit’s battery life. Also, since alkaline batteries develop a voltage drop (due to internal resistance) the low battery warning will occur when the batteries are less depleted than if the peripheral was not plugged in. 2.5.4 VRAM (Memory Power Supply) This is the supply for the system RAM: STANDBY and RUN 4.5V OFF initial source voltage - 0.5V NO POWER current voltage across a capacitor. During NO POWER Mode the voltage will decay, so care should be taken that no current is taken from this line or the system RAM could be corrupted. When the cold reset switch is pressed this line is pulled to GND through a small resistor. 2.5.5 VEXT (External voltage) This is the external power supply voltage connected directly to the external jack socket. This enables peripherals with their own power source to make use of the Portfolio external power supply. It is possible to supply the Portfolio via this connection. However, care should be taken to avoid external power supply conflicts. 2.5.6 BATD (Battery detection signal) This control signal is used to isolate system RAM from the rest of the circuit when the batteries are removed. It would normally carry the initial source but when the initial source is removed, it is pulled to GND. This line could be used by a peripheral to access the initial source. 2-10 2.6 Portfolio Expansion Port The Portfolio uses a 60-pin expansion connector which can take custom designed peripherals. (See section 4 for more details on current range of peripherals.) 2.6.1 Expansion Port Connector Pin-out Location of pin 1 - If you are looking into the Portfolio expansion port then the top pin on the right is 1 and the bottom right is 2. ABUF 1 2. SVS REDY .3 4. vCC BCOM .5 6. NCC1 NMD1i.7 8. WAKE DTR .9 10. DEN PDET .11 12. IINT CCLK 13 14. MRST HLDA .15 16. HLDO IACK Lf 18. CDET 1OM .19 20. Aig A18 21 22. Ai7 Al6 23 24. Ald Al4 20 26. Al3 Ai2 if 28. All A10 29 30. AQ A8 31 32. VRAM HLDI 33 34. ALE GND 39 36. NMIO OA7 a 38. OA6 OA5 39 40. OA4 OA3 41 42. OA2 OA1 43 44. OAO ADO 45 46. AD1 AD2 47 48. AD3 AD4 49 50. AD5 AD6 1 52. AD? EINT 3 54. NRDI VEXT ~~ .55 56. EACK BATD .57 98. NWRI VS 99 60. BBUF 2.6.2 Explanation of expansion pin names This section explains the functions of the expansion port. It assumes a knowledge of 80C88 minimum mode. Detailed Timing for relevant signals can be found in a microprocessor data sheet, ideally OKI MSM80C88ARS-2. REDY VCC BCOM NCC1 NMD 1 DTR DEN PDET INT output This line indicates to the CPU that the custom chip is ready. This line is active high. output This is the Credit Card power supply. output This is the communications select line, used for peripheral implementations. It is low if |/O locations 807X are being accessed. This signal is active within 100nS of I/O address being valid (see section 2.7). output This is the external credit card chip select line. It is low if the external credit card is selected. See BCOM for timing. input This is the external credit card detect line. It goes low to indicate that a card is plugged in. input/output This is the 80C88 data direction signal. During CPU HOLD this line may be driven. input/output This is the 80C88 data enable signal. Low indicates a data cycle. During CPU HOLD this line may be driven. input This is the peripheral detection line. It should be tied high on a terminating peripheral that has a PID. (See section 2.7 for more details. ) output This is the internal interrupt request line to the CPU (INTR). It goes high to indicate an interrupt request. gal V2 IACK EINT EACK CCLK MRST HLDI HLDO HLDA input/output This is the 80C88 interrupt acknowledge line (INTA). It goes low to request an interrupt vector after an IINT. During CPU HOLD it may be driven by external hardware. input This is the external interrupt request line. It may be driven high by external hardware on a terminating peripheral to request an interrupt. This interrupt line has lower priority than the on board interrupts. This signal is level triggered. output This is the external interrupt acknowledge line from the Portfolio. It goes low to request an interrupt vector after an EINT. It follows \INTA on the processor, but is delayed by up to 40nS. output This is the main processor clock (4.9152MHz, 50% duty cycle). Since the clock pauses when no processing is taking place, dynamic logic should not use this line. It may be used for synchronising peripheral logic. During halt mode this line is high. This signal is only available to terminating peripherals. output This indicates system reset. MRST will normally be high, except when a terminating peripheral is installed. The terminating peripheral will experi ence a short reset when inserted. If a terminating peripheral is installed then MRST goes high to indicate system reset. MRST will remain high at any time the reset key is pressed. It will also go high when the main computer system powers up. Under these conditions MRST will remain high for over 300mS. input This is the hold request line and will drive HOLD on the 88C88. It may be driven high by external hardware to requisition the system bus. output This is the 80C88 hold request line (HOLD). HLDI should be used to request a HOLD. output This is the 80C88 hold acknowledge line (HLDA). It goes high to indicate that the bus is now free. This state will be called CPU HOLD. WAKE CDET lIOM VRAM SVS GND VEXT ALE A8-A19 input This line is used by a peripheral to wake up the main computer when it is powered down. This line is set low to request wake up. Wake up can be confirmed by waiting for a falling edge on MRST. It will take 300-400mS for wake-up to be confirmed. When wake up is confirmed, the wake input should be released. input This signal is tied low to indicate to the main computer that an external credit card drive is present. input/output This is the 80C88 memory access select line. If high then a I/O cycle is taking place, if low then a memory cycle. During CPU hold this line may be driven. output This is the RAM power supply. It will backup RAM when the batteries are removed, therefore any current taken from this line should be yAs. output This is the switched 5V output. There are two 5VS lines. output Signal ground line. output This is the external power supply line. input/output This is the address latch signal from the CPU. It latches the address bus on its falling edge. During CPU HOLD this line may be driven. input/output These are the upper part of the address bus from the CPU. During CPU HOLD these lines may be driven. ADO-AD7 input/output These are the multiplexed address/data bus from the CPU. During CPU HOLD these lines may be driven. OAO-OA7 output These are the lower latched address lines. 2-14 NRDI input/output This is the 80C88 \RD signal. It goes low to indicate a CPU read cycle. During CPU HOLD this line may be driven. This is the 80C88 \WR signal. It goes low to indicate a CPU write cycle. NWRI input/output During CPU HOLD this line may be driven. BATD output This is the detect line for the batteries. It goes low if the batteries are removed without a power supply being present. This can be used to prevent accidental corruption of RAM. ABUF/BBUF input These are insertion detection pins. A terminating peripheral should have these lines connected to the adjacent 5VS line. (See section 2.7 on NMIO peripheral design.) output This is the 80C88 non-maskable interrupt request line. 2.6.3 Comparison between IBM and Portfolio expansion bus The IBM PC and Portfolio expansion buses are analogous; however, the implementation of these buses are very different. See the comparison below: bel a b) — Le d — — e IBM PC /O is partially decoded. AQ-A19 are latched address DO0-D7 are buffered data IRQ2-IRQ7 are inputs to the interrupt controller. lIOR/MOW/MEMR/MEMW are MAX mode bus control signals DRQ1-DRQ3/DACK0-DACK3/AEN/TC are DMA control signals 1/(O CH RDY inserts wait states for slow I/O. ALE is address latch enable. OSC is 14.31818 MHz Clock. CLK is 4.77 MHz, 33% duty cycle clock lO CH CK Portfolio I/O MUST be fully decoded. OA0-OA7 are latched address A8-A19 are address lines DIRECT from the processor. ADO-AD7 are multiplexed address/data lines DIRECT from the processor. EINT/EACK allow connection of peripheral with an interrupt controller. NRDI/NWRI/IOM are MIN mode bus control signals. No analogous signals, however, enough control signals exist to allow DMA control on a peripheral. No analogous signal. ALE is address latch enable No equivalent signal. CCLK is 4.9152 MHz, 50% duty clock which halts. No signal. Fag bs TYPICAL TERMINATING PERIPHERAL BBUF MAIN PERIPHERAL MRST LOGIC EINT EACK BCOM DECODE OAO0-OA3 LOGIC vy 80/7F | PIDREGISTER | ADO-AD7 ¥ ¥ NCC 1 | EXPANSION ROM GND | EXPANSION BUS | (TOWARDS PORTFOLIO) 2-16 2./ PERIPHERAL DESIGN ISSUES There are two types of peripheral that can be connected to the Portfolio. These peripherals either continue the system bus ("Through Peripheral") or not ("Terminating Peripheral"). Different considerations are required for designing these types of peripherals. Appendix C illustrates an example peripheral design. (See section 3.5 for software issues. ) 2.7.1 Terminating Peripherals (see diagram) A peripheral of this type signals its presence to the Portfolio by having PDET tied high. If PDET is high then the Portfolio expects to see a Peripheral Identifier(PID). This is read from I/O location 807Fh. The returned number must be in the range 40h-7Fh. Please note that identifiers under 40h and over 7Fh are reserved for use by DIP and must NOT be used by non-DIP applications. A read at I/O location 807Fh should NOT be used by any peripheral in ANY way other than as stated above. A terminating peripheral can have an expansion ROM which contains support software for the peripheral. This eliminates need for software to be supplied separately. The chip select for this ROM should be connected to NCC1. At various times during a boot sequence, the ROM will be checked for an identifier. If this is present then the software contained on the ROM will be executed. (See section 3.5 for more details.) The Portfolio has only limited expansion bus buffering. To make best use of this the following rules should be obeyed. i) ABUF and BBUF should be tied to the adjacent 5VS lines. This will cause the processor to hold while a connector is half in. ii) Only OAO-OA3 should be used. BCOM should be used for higher addressing on peripherals. ii) Peripherals using the external interrupt facility should be reset by MRST into a state where interrupts are disabled until the vectors are set up correctly. This is to prevent spurious interrupts occurring before the interrupt vector is set up. eo 1e TYPICAL THROUGH PERIPHERAL BBUF ABUF 5VS 5VS PDET LINE DRIVER OA0-OA3 ; —_p— | > LINES | ON EXPANSION BUS NOT EXPLICITLY MENTIONED = : > v PERIPHERAL CIRCUIT SIGNAL TO LATCH ADO ON WRITE AT 807C. LATCHED VALUE CALLED 'D’. v D=O NCC1 NCC1(OUT)=NCC1 ——)> SMC=5V (OUT) D=O SMC=NCC 1 NCC 1(OUT)=5V SMC SELECT LINE FOR SBEr "DRIVE B:" MEMORY CARD GND ’ t EXPANSION BUS EXPANSION BUS i} | (TOWARDS PORTFOLIO) (AWAY FROM PORTFOLIO) | 2-18 2.7.2 Through peripherals (see diagram) On these peripherals the system bus is continued so that further peripherals can be connected to the system. For example, a memory expansion unit would be this type of peripheral. In order that terminating peripherals will operate correctly the following recommendations should be taken into account when designing "through" peripherals. i) ABUF and BBUF should not be connected to 5VS, but brought straight through the peripheral. li) If OAO-OA3 are used on the peripheral, they should be buffered before the "through" connector. | iii) PDET should not be connected to 5VS, but brought straight through the peripheral. iv) The I/O locations 8070-807F should not be used so as to provide compatibility with terminating peripherals using these locations (such as DIP serial and parallel peripherals). 807Ch can be used as stated in vi) below. v) "Through" peripherals risk crashing the system bus as virtually no buffering exists. lt is therefore recommended that these peripherals are only inserted or removed from the Portfolio when powered down. vi) To ensure that ROM extensions on terminating peripherals function correctly, through peripherals which contain a memory card interface must supply logic that follows the following rules: * A write of zero to I/O 807Ch will cause NCC1 to be directed to the through expansion port. * A write of one to I/O 807Ch will cause NCC1 to be directed to the peripheral memory card interface. 2.7.3 Allocation of Peripheral ID (PID) bytes The PIDs have currently been allocated as follows: PID 00h Oth 02h 03h 04h 05-3Fh 40-7Fh 80h 81-FFh PERIPHERAL Communication Card Serial Port Parallel Port Printer Peripheral Modem Reserved User Peripherals File-Transfer Interface Reserved For custom user peripherals a specific PID can be allocated by contacting the Atari Portfolio Product Manager in writing, describing the use of the peripheral. 2-20 2.8 LCD Display The Portfolio uses a 240x64 pixel LCD display which uses the "Super-twist" technology. This corresponds to 8 lines of 40 characters text display. The circuit includes a graphics LCD screen controller with dedicated screen RAM chip and character set ROM, used in such a way as to be compatible as possible with an IBM Monochrome Display Adapter (MDA). (See section 3.7 for more details.) The LCD circuit has the following characteristics: * Full IBM PC Extended character set (see Appendix B) * Virtual 80x25 MDA screen page with various screen modes *PC-BIOS compatible pixel Set/Reset for graphics * Each character is implemented as an array of 6x8 pixels * Software controlled contrast * Block or underline cursor Note: Screen text attributes and various cursor modes are not supported by the Portfolio. 2-21 3 SOFTWARE 3.1 General Description 3.1.1 Overview The Atari Portfolio software is contained on ROM and predominantly executes from ROM, and hence minimizes the use of RAM. This software provides as much PC compatibility as possible given the hardware constraints. (See sections 3.2 and 3.4 for BIOS and DOS comparisons.) This software also includes some more advanced features which enable the Portfolio to be used more effectively in a portable environment than a standard PC. Most of these software features are accessed using Interrupt 61H, the Atari Portfolio specific functions. (See section 3.3.1.) To aid development of application software for the Atari Portfolio which require the use of these specific functions there is a TSR (Terminate and Stay Resident) Emulator program for the IBM PC. This program emulates most of the functions. (See section 3.10 for more information.) 3.1.2 Portfolio Programming The Portfolio obeys IBM’s own programming guidelines for PC compatibility, however these are a lot more flexible than the industry-standard definition of a ‘clone’ PC. Most ‘well-behaved’ PC programs run with no problem on the Portfolio, provided that they do not go below the BIOS to directly use the hardware. The main development issues are the screen size and memory capacity. Below are the various points to take into consideration when developing a program for the Portfolio. SCREEN - (See also section 3.7.) The Portfolio has a 40 column by 8 line text display which uses video RAM at the same address as the PC Monochrome Display Adaptor (MDA) and uses the same character set. However the Portfolio LCD controller does not support text attributes such as bold, underline and reverse or the various cursor sizes. If you want to use the Portfolio graphics facility then use the standard BIOS pixel read and write interrupt. 3-1 MEMORY - (See also section 2.2.) The Portfolio has an internal memory disk C: which can be configured in 8KB intervals, minimum 8KB. This leaves a maximum of 116 KByte usable RAM of which 10 KBytes are used by the operating system and BIOS. Therefore it is recommended that programs should not use more than 100KBytes of system RAM. If you want to use the built-in ‘pop-up’ applications with the external program then allow for some free RAM (minimum of 17 KBytes). MEMORY CARDS - (See also section 3.6.) These memory cards appear to a DOS program like a standard floppy disk. The Portfolio has DOS resident all of the time and therefore does not need to boot from a disk. If you want to automatically boot into a program then you can put AUTOEXEC.BAT ona memory card, overriding C\AUTOEXEC. RS232/SERIAL - (See also section 4.1.) The only compatible method for accessing the serial port is through the BIOS. However most off-the-shelf serial programs go directly to the hardware. KEYBOARD- (See also section 3.2.1.) The Atari Portfolio supplies full IBM PC scan-code compatibility provided access is through the BIOS. In other words it is possible to generate every keypress or combination that a standard PC can generate (SHIFT, CTRL, ALT, NUM PAD). It is also possible to generate other non-PC key combinations necessary for functions such as contrast and switching off. POWER - (See also section 3.8.) For power conservation, it is recommended that programs are designed which do not poll the keyboard continuously. ADVANCED There are also more advanced features which enable custom programs for the Portfolio to perform more sophisticated tasks, such as running programs directly from the memory cards (section 3.6), peripherals with built-in software on ROM (section 3.5), language information and access to the built-in tone dialler. 3.1.3 Troubleshooting Running well-behaved standard off-the-shelf PC Programs: * Make sure that the DISPLAY SETUP (see user manual) is set to Static PC for External programs. * lf the program writes directly to Video RAM then ensure that DISPLAY REFRESH is set to KEYBOARD or FAST TIMED, whichever is more appropriate. * Endeavor to allocate enough system RAM. Although many popular programs are ‘well-behaved’ there are also many programs which directly address the hardware. This can cause a problem on the Portfolio as the lO addresses are different. The most common of these incompatibilies occur with the keyboard and hardware interrupts. The Portfolio does not have a Programmable Interrupt Controller (PIC) or a dedicated keyboard controller, therefore some programs which access these such as Basic and XTALK will not function correctly. The Portfolio also uses a different Timer Tick than a PC which affects some ‘dirty’ programs such as Sidekick. Another hardware area that differs on the Portfolio is the use of the speaker, which should be accessed using the BIOS. 3-3 3.2 Differences Between Portfolio BIOS and IBM PC BIOS For the purposes of this document, Portfolio BIOS is defined as the program which communicates between the DOS and the hardware. (See recommended books in section 1 for more information on the standard PC BIOS.) There are a few differences between Portfolio BIOS and the standard IBM PC BIOS. These are generally in areas where the hardware differs to such an extent that complete compatibility is unobtainable. For example, in the Video Services (Int 10H) the Portfolio only has two screen modes; 80 by 25 Text and 240 by 64 Graphics. 3.2.1 Interrupt differences The following list highlights the main differences between the DIP BIOS and IBM PC BIOS: IntOS9H Keyboard The Portfolio keyboard is not at the same IO address as a standard IBM PC, therefore any program which requires the keyboard to be at port 60H will not work correctly. Int 10H Video Services service 00H, Mode 07 to OAH are supported, but only in Text or Graphics mode. Service 01H, Cursor size is set to either block or u/line. (See section 3.7.) Int 13H Disk The Portfolio has modified Memory Card/Disk services 0 to 05H and 83H. (See section 3.3.2 for more details.) Int 15H Extended No Extended services are available. Int 16H Keyboard Only service 0, 1, 2, 4 are supported. Int 18H BASIC Not supported. Int TAH Clock Only services 0-07H supported. Int 1CH Timer tick Invoked less frequently than IBM PC (see section 3.3.1). 3-4 3.2.2 Portfolio BOOT procedure On a COLD boot (batteries removed, COLD Reset switch pressed, then batteries replaced), the BIOS executes a limited Power On Self Test (POST) to verify system integrity. This will destroy data in system memory (both programs in the Transient Program Area and those on internal drive C:). The Portfolio system then performs BIOS and DOS initialization before jumping to the COMMAND processor. This will always reset the machine unless there is a hardware fault. On a Hardware WARM boot (WARM Reset switch pressed or batteries replaced without pressing the COLD Restart switch), the Portfolio performs BIOS and DOS initialization before jumping to the COMMAND processor. On a Software WARM boot (Ctrl-Alt-Del on keyboard), the sequence of operations is similar to those for a Hardware warm boot. The difference between the two is that a Hardware warm boot also resets the ASIC and Processor which may be necessary if the interrupts have been disabled because the keyboard will not recognize user key presses. 3-5 3.3 System Specific BIOS 3.3.1 Int 61H - DIP extended BIOS services Function Description OH Service Initialization 7H Format Credit Card Memory (CCM) 8H Get size of Internal disk SH Format Internal disk BH Determine if CCM present DH Get Screen size EH Get/Set Screen mode FH Get/Set Cursor mode 10H Get/Set virtual screen position 11H Move virtual screen position 12H screen refresh 15H Sound generation 16H Melody tone 17H Dial number 18H Mute states 19H Get Serial port parameters 1AH Get Peripheral ID byte 1BH Set Peripheral ID byte 1CH Preset Peripheral |O data 1EHW Get/Set Clock tick speed 1FH Get-key/Tick Screen refresh 20H Disable revectoring of Int 9H 24H Get/Set ROM space state 26H Get/Set Power State 28H Get/Set Language 2CH Get BIOS version number 2DH Turn system off 2EH Enable/Disable status line 30H File transfer via smart cable Note: There are other reserved Int 61H services which are used internally by the Operating system. It is not recommended that these services are invoked by applications software, as they may be modified or deleted in future versions of the software. Fn OOH Service Initialization 3.10 Parameters: AH OOH Returns: None Note: This service should be called once only as part of its initialization by any application program that intends to use any Int 61H function calls. Fn 07H Format Credit Card Memory 2.3, 3.6, 3.32 Parameters: AH 07H AL Drive number (0 or 1) Returns: CF Set if error during format AH Error code (See INT 13H) Note: Drive number 0 selects drive A:, and drive number 1 selects drive B:. This service should not be used to format the internal disk (drive number 2). Fn O8H Get size of Internal disk 3.3.2 Parameters: AH 08H Returns: AX Segment Address of disk BX Size of disk in Kbytes Fn OSH Format Internal disk 3.3.2 Parameters: AH OSH BX Size of disk in Kbytes Returns: lf CF=1 BX Maximum size possible (K) Note: The system is rebooted if successful. All files on drive C: will be lost. 3-7 Fn OBH Determine if CCM present and valid 2.3, 3.3.2, 3.6 Parameters: AH OBH AL Drive number (0 or 1) Returns: CF=0 #£Card present and correct lf CF=1 AH Error code (See Int 13H) Note: This can be used to determine if a valid CCM is in the specified drive. Drive number O selects drive A:, and drive number 1 selects physical drive B:. Fn ODH Get screen size 2.8, 3.7, 2.1.4 Parameters: AH ODH Returns: AX Physical screen size DX Logical screen size Note: AH/DH Row number AL/DL Column number Fn OEH Get/Set screen mode 2.1.4, 2.8, 3.7 Parameters: AH OEH AL=0 Get mode AL=1 Set mode DL New mode Returns: lf AL=0 DL Mode lf AL=1 DL Old mode 3-8 Note: The mode is changed by setting one of the following mode bits in DL: Clear bits (O0H)80 by 25 mode bit 0 (01H) 40 by 8 mode bit 1(O02H) Tracked mode bit 7 (80H) Graphics These bits are mutually exclusive. When changing to 40 by 8 mode, if the cursor position or virtual screen origin is off the screen, then the virtual screen origin will be set to (0.0), the Screen cleared and cursor homed. Fn OFH Get/Set Cursor mode 2.1.4, 2.8, 3.7 Parameters: AH OFH AL=0 Getmode AL=1 Set mode BL New Cursor mode AL=2 Force mode Returns: lf AL= 0 BL Cursor mode lf AL> O BL Old Cursor mode Note: Cursor mode is as follows: 0 Cursor off 1 Underline 2 Block Force mode automatically sets the BIOS cursor size to reflect the Keyboard Numlock state. Fn 10H Get/Set virtual screen position 2.1.4, 2.8, 3.7 Parameters: AH 10H AL 0 Get position AL 1 Set position lf AL=1 DH Row number DL Column number Returns: lf AL=0 DH Row number DL Column number Note: The virtual screen position is the top left origin of the 40 by 8 window on the logical screen. Fn 11H Move virtual screen position 2.1.4, 3.7 Parameters: AH 11H AL Number of lines to move cursor DL Direction to move cursor 1 Up 2 Down 3 Left a Right Returns: None Note: This moves the origin of the virtual screen within scroll margins. It only works if in Static or tracked mode, and has a similar effect to pressing the Alt- Cursor keys. Fn 12H Screen refresh 2.1.4, 2.8, 3.7 Parameters: AH 12H Returns: None Note: This service copies the contents of the Video RAM to the LCD controller, and is slightly faster than invoking Int 10H service 0. 3-10 Fn 15H Sound generation Parameters: AH 15H AL Sub service: 0 Key-click 1 Beep 2 Alarm Returns: None Fn 16H Melody tone generator Parameters: AH 16H CX Length of tone in 10 mSecs intervals DL Tone code (See below) 30H D5 622.3 Hz 31H E5 659.3 Hz 32H Fa 698.5 Hz 33H F#5 740.0 Hz 34H G5 784.0 Hz 35H G*F5 830.6 Hz 36H A5 880.0 Hz 37H A¥5 932.3 Hz 38H B5 987.8 Hz 39H Ce 1046.5 Hz 3AH C¥#6§ 1108.7 Hz 29H D6 1174.7 Hz 3BH D*6 1244.5 Hz 3CH E6 1318.5 Hz 3DH F6 1396.9 Hz OEH F#65 1480.0 Hz 3EH G6 1568.0 Hz 2CH GF6 1661.2 Hz 3FH A6 1760.0 Hz 04H A*6 1864.7 Hz 05H B6 1975.5 Hz 25H CY 2093.0 Hz 2FH C#7 Beli. Fiz O6H D7 2349.3 Hz 07H D*7 2489.0 Hz Returns: None En 17H Dial number 215 Parameters: AH 17H DS:SI String of characters es Length of string Returns: None Note: String to be in ASCII. Valid characters are:0123456789ABCD*#*. Letters must be in upper case. Fn 18H Mute states 2.1.5 Parameters: AH 18H AL 00 Get mute state 01 Set mute state 02 Get key click state 03 Set key click state O04 Get bleep state 05 Set bleep state O06 Get alarm state 07 Set alarm state 08 Get DTMF duration O09 Set DTMF duration fAL= 1,3,5,7or9 DL 0 Off (Muted) 1 On Returns: lf AL= 0,2,4,60r8 DL 0 Off (Muted) | On Fn 19H Get Serial port parameters 2.7, 4.1, 3.5 Parameters: AH 19H DX Serial port number Returns: lf AH=0, Composite parameters in AL lf AH<>0O, Error Note: This service returns composite parameters identical to those used by Int 14H Service 0 (Initialize). 3-12 Fn 1AH Get Peripheral ID byte 2./,3.5 Parameters: None Returns: AH Peripheral ID byte AL 0 if no peripheral installed Note: This returns the peripheral ID code for the current terminating peripheral. (See Fn 1BH.) Fn 1BH Set Peripheral ID byte 2.7, 3.5 Parameters: AH 1BH AL=0 Set Serial ID AL=1 Set Parallel ID DL Current peripheral ID Returns: None Note: There may be peripherals designed that contain circuitry that is similar to the Serial or Parallel peripherals. In order that these peripherals may use existing BIOS services they must identify themselves as being software compatible. DL should be set to the Peripheral ID code. (See Fn 1AH.) Fn 1CH Preset/Return Peripheral data 2.7, 3.5, 4.1 Parameters: AH 1CH AL=0 Preset Data values AL=1 Return Data values BH Table entry number lf AL= BL Data value DX lO address Returns: lf AL=1 BL Data value DX 1O address Note: This service is used to preset peripheral |O data in a table associating an lO address with a data value. Service 0 will actually output the data to the specified |O locations. On Power-up, the table entries will be scanned for non-zero |O address values, and the associated data will be written out. This would typically be used to restore Interrupt numbers following Power-up. The first four table entries out of 10 max are reserved. Fn 1EH Get/Set Clock tick speed 2.4, 3.8 Parameters: AH 1EH AL Subservice 0 Get speed | Set speed lf AL = 1 BX Clock tick speed 0 Tick every 128 seconds 1 Tick every second Returns: lf AL =O BX Clock tick speed 0 Tick every 128 seconds | Tick every second Note: 1 sec speed uses much more power. 3-14 Fn 1FH Get-key/NMI invoked screen refresh 2.8, 3.7, 3.8 Parameters: AH 1FH AL=0 Get refresh state AL=1 Set refresh state lf AL=1 DX New state Returns: lf AL=0 DX Current state lf AL=1 DX Old state Note: DH Refresh on NMis state DL Refresh on keys state DH/DL=0 Revectoring disabled DH/DL=1 Revectoring enabled lf bit 7 of the state is set, then the state is unchanged. Fn 20H Disable revectoring of Int 9H

32 to <=64 Kbytes 100H/256 bytes per sector >64 Kbytes 200H/512 bytes per sector This ensures that a small disk size allows a reasonable number of sectors. Since Portfolio DOS allocates one sector per data cluster, this allows the same number of small data files on a 32K CCM as a 128K CCM. 3-21 There are various Int 61H services that provide extended disk services (see section 3.3.14): Int 61H Fn 7H Format a CCM Int 61H Fn 8H Get the size of the Internal Disk Int 61H Fn 9H Format the Internal disk Int 61H Fn OBH Determine if a valid CCM is present. Note: A CCM may also contain a BIOS extension which does not affect the operation of the CCM, but can modify the Operating system or Power-down/Power- up sequence. (See section 3.5.) 3-22 3.4 Differences Between Portfolio DOS and MS-DOS For the purposes of this manual, Portfolio DOS is defined as the program which communicates between the Command processor or User application, and the BIOS. It does NOT include the Command processor. (See recommended books in section 1 for more information on the standard MS/PC-DOS.) There are a few differences between Portfolio DOS and MS-DOS. These are mainly enhancements to Portfolio DOS 2.11 to make it more DOS 3.XX compatible: Int 21H Fn 37H Get/Set Country Portfolio DOS is DOS 3.XX compatible Int 21H Fn 4BH Execute program As well as providing standard EXEC services it also allows a program to be RUN directly off a CCM (section 3.6.3). Int 28H Keyboard busy Not supported. This would normally be called during console IO polling, however Portfolio DOS does not poll the console, but actually waits for a key using Int 16H Fn OH. (See section 3.8 on power management.) Int 2AH Internal MS-DOS function not fully supported 3-23 3.5 Device Drivers and Peripheral Software 3.5.1 Device Drivers Device drivers are used by DOS to communicate with the BIOS. They provide a standard interface which isolates the DOS from the device specific BIOS. The Portfolio has the following resident device drivers in ROM: CON, CLOCK$, PRN, LPT1, AUX, COM1 and Disk driver CON performs all Console |O PRN/LPT1 perform all Parallel (Printer) 1O AUX/COM1 perform all Serial lO CLOCK$ special driver to access the BIOS Clock These are all character devices that process strings of characters one character at a time. They are all identified by their names. The Disk device driver is a Block device which requires all |O to be done in blocks. It addresses all the normal Portfolio disk drives (A, B and C). It has no name. It is possible to replace these resident device drivers (and add new ones) by the use of installable device drivers. These may be loaded by DOS using the ‘DEVICE=' command in CONFIG.SYS. If a character device is loaded that has the same name as one of the above device drivers, then it replaces it. This mechanism is used by programs such as ANSI.SYS which Is actually a CONsole device driver with added features. lf a Block device driver is added, it supplements the existing Disk device driver. An example of this is the Virtual disk driver VDISK.SYS, which would add drive D:. The structure of an installable device driver is compatible with any MS-DOS 2.11 device driver. 3-24 3.5.2 Peripheral Design There is a special design issue associated with Portfolio peripherals, due to the Portfolio auto power-down power conservation feature. This means that most peripheral devices will need to be re-initialized on power-up. (See Appendix C for more information.) There are two methods provided to fulfill this requirement: 1) Int 61H Fn 1CH This service stores a list of |O addresses and associated data values, which will be output on a power-up. If all initialization specific |O writes are made via this service, then they will automatically be repeated on all power-up sequences. A typical use for this service might be to restore an interrupt number in an interrupt driven serial peripheral. 2) Use a ROM extension. This would generally be required when the sequence of operations during power-up could not be supported by the Int 61H service. This will require the peripheral to contain an extension ROM. (See 3.5.3.) There are two exceptions to the above. The serial port parameters are read during the power-down sequence and correctly re-programmed on the subsequent power- up. The Parallel port is also initialized on Power up. Each peripheral is identified to the Portfolio by its Peripheral ID code (PID) (see section 2.7). This is actually a hardware |O location on the peripheral which may be read using Int 61H Fn 1AH. The other software issue associated with custom peripheral design concerns the Serial or Parallel peripherals. If the custom peripheral wants to use existing BIOS services then they must identify themselves as being hardware compatible: Int 61H Fn 1BH configures the BIOS to recognize a peripheral to be Serial or Parallel compatible. 3-25 3.5.3 ROM Extensions ROM extensions are sections of code that can be executed at various stages during the BOOT sequence, and during Power Up and Power Down. They may be ona Credit Card Memory (CCM) or on a extension ROM on a peripheral. A typical use of such an extension is to modify the operating system or initialize custom peripherals. There are three main types of extensions: A Specific BIOS extension, a Specific DOS extension, and Common extensions: * The Specific BIOS extension is invoked after BIOS initialization. * The Specific DOS extension is invoked after DOS initialization. * The Common extension is invoked before and after both BIOS and DOS initialization, before Command processor initialization and during Power-Down and Power-Up. The ROM extensions are searched for on Drive A, then the extension ROM and then Drive B. If a valid extension is found and executed, then the search for that particular type of extension is terminated. The format of a ROM/CCM extension is as follows: Offset Size OOH dw ? ‘Identification code 02H db £ ‘Number of 512 byte -blocks(unused) 03H db 5 dup (7) ‘Specific BIOS/DOS exten. 40H db ‘DIP ROMI!’ ‘OEM user text 50H db 5 dup (7?) ‘Pre-bios jmp vector 55H db 5 dup (7) ‘Bios-ext jmp vector 5AH db 5 dup (7?) ‘Pre-dos jmp vector 5fH db 5 dup (7) ‘Dos-ext jmp vector 64H db 5 dup (7?) ‘Post-dos jmp vector 69H db 5 dup (7?) ‘Power-Down jmp vector 6eH db 5 dup (7?) ‘Power-Up jmp vector The extension vectors occupy the first 128 bytes of the CCM/ROM. The vectors are positioned so as to allow a valid BIOS Parameter Block (BPB) on a CCM so that it can be used both as an extension CCM and as normal. The Identification code at Offset 0 determines the main extension type as below: AA55H ‘Specific BIOS extension 55AAH ‘Specific DOS extension 5555H ‘Common extensions 3-26 Thus, if the word at Offset 0 is AA55H, then after BIOS initialization a FAR CALL will be made to Offset 3. The 5 bytes following this offset allow for a short/normal/far jump to the extension code. If the word was 55AAH, the call would be made after DOS initialization. If the word is 5555H, then all the common extensions would be called at the appropriate times. Note: All the jump vectors must be set up to a suitable return when using a common extension, even if they are not used. All ROM extensions must preserve the processor registers. Extreme care must be taken when using extensions, especially those which are invoked half way through the boot sequence, as these may adversely affect the operation of the Portfolio. The Pre-BlOS extension is called almost immediately on jumping from the Reset vector, and so has no stack set up. It must return via a FAR JUMP to OFFFE:OH. All the other extensions must return via a FAR RET. It is recommended that the Post-DOS extension is used in preference to those preceding it. The OEM user text field at Offset 40H is to allow an OEM to identify the ROM. see Appendix C for examples of using an Extension ROM. 3-2/ 3.6 Memory Cards 3.6.1 Format Each credit card memory (CCM) must be formatted before use, this program creates a format analogous with a standard floppy disk format. All formatted memory cards contain only 1 sector per cluster as opposed to the 2 or more found in larger systems. (See section 3.3.2 for more details.) The Atari Portfolio BIOS has been written to handle future paged Credit Card Memories (CCM). The BIOS assumes that the page register, is one byte located at offset 10 (OAH) within the Boot sector (First sector) of the Memory card. For this reason DO NOT use this memory location in programs. 3.6.2 Autoboot Mechanism The Portfolio has the ability to invoke AUTOEXEC.BAT from drives other than drive CG: lf a memory card is in drive A: or B: and AUTOEXEC.BAT file exists, it is executed in preference to autoexec on C:. B: will have priority over A: if an AUTOEXEC.BAT exists on both A: and B:. lf itis required that the AUTOEXEC.BAT on drive C: is always executed, terminate the batch file on drive A: with the command: C:AUTOEXEC The CONFIG.SYS file is always loaded from drive C: and cannot be overridden. 3.6.3 Run A RUN file is a specially written program that can be directly executed from a Credit Card Memory (CCM) without having to be loaded into the Transient Program Area (TPA). An obvious advantage of this method of execution is that it minimizes system memory usage. A RUN file can be executed from the Command processor by typing RUN , or by invoking Int 21H Fn 4BH at the DOS level as for a normal program, but with AL set to 80H. 3-28 There are several requirements for the programs which can use the RUN command: * The program needs to be specially written to be used with the RUN command. * The program needs to be on drive A: or drive B: and it needs to occupy consecutive clusters on the disk. This situation cannot be guaranteed if a file is simply copied to the drive. * The file needs to have a .RUN extension. Writing -RUN Programs Almost all standard programs assume either that their data is in system RAM, or that they can store data in their code segment. Although a .RUN file is similar to a .COM file, care should be taken when dealing with data. The initialization code of the .RUN program has to perform the following (these points are illustrated in Appendix A): * Reduce the system memory usage down to the minimum requirement. There must be at least 10h paragraphs, |.e. the size of the PSP. * Allocate data and stack using DOS interrupt 21h fn 48h and set ss:sp to point to this block. * Copy all initialized variable data from the memory card to the allocated data block in system RAM. * The program can then perform most functions it wishes to, including any DOS calls. The program MUST terminate with DOS interrupt 21h function 4Ch “terminate process. . * The program does not need to copy the non-variable (constant) data from the ROM card into RAM before using it. This data can be used directly from the card. This means prompts or text messages need not take up any RAM. The built-in applications can be invoked while a program is being RUN using the hot keys as usual. lf during execution of a RUN file the Credit Card Memory (CCM) is removed from the drive, the next instruction to be executed on the card will be interrupted by an error handler. This displays the error message: ‘ERROR: Card Access’ and terminates the process. A RUN file may not EXEC another file from within itself. Appendix A provides an example of a RUN program which illustrates how to program a typical RUN program. 3-29 3.7 Screen Handling The Portfolio BIOS supports two main Video modes, Text and Graphics. The BIOS Video Interrupt 10H may be used to set the screen mode: Mode Type PC Resolution Portfolio Mode 7 Text (80,25) <80 25> Mode 8 Graphics (160,200) <160,64> Mode 9 Graphics (320,200) <240,64> Mode A Graphics (640,200) <240,64> As can been seen, the Portfolio interpretations of these modes is fairly simple. The Text modes are actually viewed using a 40x8 window. There are 3 sub-modes: Static PC, 40x8 and Tracked. Static PC mode is where the physical screen area acts as a window onto the larger 80x25 text screen. The window may be moved using the Alt-Cursor keys, or Int 61H Pit 2 i: 40x8 mode actually sets the logical screen size to 40 columns by 8 rows. This mode is intended for use by software written specifically for the Portfolio, such as the the Command processor and the Internal applications. Tracked mode is similar to static mode, except that the Screen window positions itself at the cursor. This mode can be set using Int 61H Fn OEH. The Video RAM (VRAM) for the text screen is at segment OBOOOH therefore it is possible to write directly to the Video RAM, but any screen refreshing must be invoked by the application. There is only one text page. There are other Int 61H Video services: Int 61H Fn ODH get the logical and physical screen sizes Int 61H Fn OFH Set cursor size Int 61H Fn 10H Set the virtual screen window origin on the 80 by 25 screen Int 61H Fn 12H Force a screen refresh. In Graphics mode, the Graphics screen has a 240 by 64 pixel resolution and can be written to or read from using BIOS pixel read/write Int 10H Fn OCH or Fn ODH respectively. The Atari Portfolio has three cursor modes: Block, Underline and Off. If the cursor size is set in the BIOS then either Block or underline mode will be set up. 3-30 3.8 Power Management The Portfolio is designed to minimize power consumption and hence maximize battery life. This is reflected in the hardware design, but is enhanced by various software features. The main power wasting operation in most computers is waiting for user entry at the keyboard. Once the Portfolio Keyboard BIOS Getkey ready service (Int 16H Fn 0) has detected keyboard inactivity, it will start to decrement a timeout counter. On timeout, the Portfolio will enter its power-down sequence. Once powered-down, any hardware interrupt will initiate a power-up sequence. This timeout is dependent on whether the machine is set to fast or slow timer ticks (Int 61H Fn 1FH), but is always between 128 and 256 seconds. lt is important that all keyboard input is done via a DOS or BIOS keyboard service that waits for a key press. Polling the keyboard continuously will quickly wear out the batteries. This will be obvious as the Portfolio will never power down. Another power wasting operation is refreshing the LCD controller from the Video RAM. If an application writes directly to the Video RAM, then it must be refreshed at appropriate intervals using Int 61H Fn 12H. It is possible to force a screen refresh on a keypress or on a timer-tick using Int 61H Fn 1FH. Many applications which run on the Portfolio, but are designed for the IBM PC require this refresh on keys as they assume automatic screen refreshing. Refresh on timer ticks is dependent on the tick speed. This can be set using Int 61H Fn 1EH. Note: The timer tick (Int 8H and Int 1CH) is not the same as the IBM PC timer tick which occurs 18.2 times a second. It is either generated once every 128 seconds, or once per second. As a general rule, an application should avoid refreshing the screen except where necessary. With refresh on both keys and timer ticks, and with timer ticks set to fast (i.e. 1 tick per second), the processor spends a lot of its time refreshing the screen. Generating sounds using Sound generation, Melody tone generation or Tone dialling (Int 61H Fn 15H, 16H or 17H respectively) can draw a high current from the Portfolio batteries. The Alarm will timeout after about 15 seconds to prevent the batteries from being overly strained. 3-31 All peripherals will add to the power consumption, unless they have their own power source. It is recommended that an external power supply is used wherever practical when using peripherals. During Disk access, Tone generation, Timer tick and on each press of the return key, the Portfolio checks to see if its batteries are running low. If a low battery is detected, the Portfolio automatically powers down after displaying a low battery message. On power up, it will display the same message to indicate to a user the reason why It powered down. It is possible to prevent the Portfolio from powering down using Int 61H Fn 26H. This service must ONLY be used if absolutely necessary, because this may force the Portfolio to operate outside its electrical specification with possible damage to the hardware. 3-32 3.9 Special File Formats 3.9.1 Diary saved file format The built in diary saves its data in a standard ASCII file format. To eliminate different date formats for different countries, the Diary stores the information in English format. Certain information, such as repeat entries and alarm information is saved along with the diary entries. The following is an example diary file: 6/07/89 14:14 Technical reference 20:00 Go home lf an entry is a repeating entry, the time is preceded by a code letter indicating the repeat period. The following table lists the code letters and their associated repeat periods: d Daily w Weekly n Non weekend, i.e. Mon-Fri m Monthly y Yearly lf an alarm is associated with an entry, the '@’ symbol is placed on the line before the time. lf an entry has an alarm and it is a repeating entry, the repeat symbol preceeds the alarm symbol. For example: 6/07/89 @ 20:00 Go home 7107/89 d 14:48 Hello there! w@ 18:10 Goto tennis The first entry is a non repeating entry with an alarm. The second is a daily repeat and the third is a weekly repeat which will sound the Portfolio’s alarm. The diary sorts the entries chronologically when it loads any given file. 3-33 3.9.2 System File Formats There are three files used by the system which obey a standard file format. These are: Clipboard (C\SYSTEM\CLIPBORD.DAT) Undelete (C\SYSTEM\UNDELETE.DAT) Permanent data (C\SYSTEM\PERMDATA.DAT) All three files are loaded into RAM when the applications are invoked. Operations affecting any of the information stored in these files only change the RAM copy. All three files are written out when the user quits all the applications, i.e. presses at the top level menu. 3.9.2.1 CLIPBORD.DAT This is the file which the applications use as the clipboard. It is a single block of data ending with a zero byte (OOh). Carriage returns are stored as ODh without the trailing OAh Line feed. The maximum size of the clipboard is 8K characters. This must include the 0 terminator. If the file does not contain a 00h termination byte, then the file is not loaded into the clipboard. Similarly, if the file is greater than the maximum number of allowed characters, it isn’t loaded. In both cases when the file is not loaded, it will be overwritten with a fresh file upon exit from the application. lf the clipboard has the normal text format of ODh,OAh the file will only load correctly into the Editor and the Diary. 3.9.2.2 UNDELETE.DAT The undelete file is used to store all the characters or blocks of data deleted from all the applications. It is made up of a number of "blocks" of data. Each block represents a group of characters deleted with one command. The format of a block is as follows:

The is the character or characters which are deleted. If a block of data is deleted containing carriage returns, these are stored as , not . The 00h byte is used to determine the length of the deleted block. 3-34 The is a one byte code indicating in which direction the deletion was made. If the data was deleted to the left, i.e. using the BACKSPACE key, then this byte will contain . If the data was deleted from the right, i.e. using , this byte will be . The maximum number of characters which the undeletion file can contain is 2000. If the file contains more than this number of bytes, then it will be ignored and replaced with a new file upon exiting from the application. lf the UNDELETE.DAT file doesn’t have the correct format, the effects are unpredictable. It is likely the data in the file will be inaccessable. 3.9.2.3 PERMDATA.DAT The format of the system data file is as follows: Byte(s) Function in Hex 0 Non zero: undelete buffer enabled. 1 Non zero: undelete buf is saved on exit 2 Non zero: clipboard is enabled. 3 Non zero: clipboard is saved on exit 4.6 Reserved. Worksheet: 7 Non zero: frame on upon entry. 8..56 Drive/Path/Name of last used file. 57 0: Autoload last spreadsheet, Offh don’t 58..5b 3 character 0 terminated currency string. 5c Initial decimal point, ’.’(2eh) or ',’(2dh) 5d Printer default paper width. 5e..60 Reserved. Diary: 61 Non zero: frame on upon entry. 62..b0 Drive/Path/Name of last used file. b1..b4 Reserved. Editor: b5 Non zero: frame on upon entry. b6..104 Drive/Path/Name of last used file. 105..106 Top line on screen 0 is first line in file 107..108 Current cursor line no, 0 is first line. 109..10a Cursor: number of bytes into current line. 10b Right margin. 10¢ Non zero: word wrap on. b0d..10e Reserved. 3-35 10f 110..15e 15f..168 169..16f 170 171..1bf 1cO 1¢1..1¢2 1c3..1ca 1cb..1d5 1d6..1e0 1e1..1eb lec..1f6 1f7 1f8 119 lia 1fb lic..24a 24b..24e 24f 250 251 252..2d1 2d2 2d3 2d4 2d5 2d6 2d/ 2d8 2d9 Address book: Non zero: frame on upon entry. Drive/Path/Name of last used file. Dial prefix in ASCII, zero terminated. Reserved. Calculator: Non zero: frame on upon entry. Reserved. M1 sign: Bit 7 set for negative number. Mi exp: signed word, 0:1.000<=mant<2.000 Mi mantissa. Memory 2. Memory 3. Memory 4. Memory 5. Format: 0-General, 1-Fixed, 2-Sci., 3-Eng. Number of decimal places Separators: 0 - none, non-zero-separators Decimal point: 0 -’.’, non-zero ’,’ Setup: Reserved. Drive/Path/Name of printer file destination Reserved. Printer dest, 0:Parallel, 1:Serial, 2:file. Lines per printer page. Printer setup code length. setup codes, ASCII chars, i.e. ESC=1Bh. End of line code 0 1 2 Number of top paper margin lines. Bottom paper margin lines. Left paper margin character indent. Baud rate 0 110 150 300 600 1200 2400 4800 9600 None Odd Even 7 bits. 8 bits. 1 stop bit. 2 stop bits. Parity Data bits Stop bits =—-OWJON WD OAT 7 Of WN — The PERMDATA.DAT file currently contains 730 bytes. 3-36 3.10 IBM PC Development system The Portfolio contains a few system specific extended BIOS functions which are accessed using interrupt 61H. If you want to emulate these functions when developing programs on a standard IBM PC then this is possible by running the program I61.EXE on aPC. This program will remain Terminate and Stay Resident (TSR) and hence enable you easily develop custom programs. To ensure upward compatibility of your programs, if you plan to use any 161 functions then make sure that you use 161 Fn OH first. (See section 3.3.1.) Int 61H Services supported by IBM hosted version: Fn No Function description Supported OH Service Initialization J 7H Format Credit Card Memory Xx 8H Get size of Internal disk J 9H Format Internal disk X BH Determine if CCM present X DH Get/Set Screen size i EW Get/Set Screen mode v FH Get/Set Cursor mode / 10H Get/Set virtual screen position v 11H Move virtual screen position X 12H Screen refresh X 15H Sound generation J 16H Melody tone v 17H Dial number v 18H Mute states v 19H Get Serial port parameters f 1AH Get Peripheral ID byte X 1BH Set Peripheral ID byte Xx 1CH Preset Peripheral |O data X 1EH Get/Set Clock tick speed i 1FH Get-key/Tick Screen refresh V2 20H Disable revectoring of Int 9H Y2 24H Get/Set ROM space state X 26H Get/Set Power State x 28H Get/Set Language v 2CH Get BIOS version number vo 2DH Turn system off x 2EH Enable/Disable status line vo 30H File transfer via smart cable J Key: J Service supported X Service not supported Y2 Service partly supported 3-37 4 PERIPHERALS 4.1 Portfolio Serial Communications 4.1.1 Hardware Specification Standard: EIA RS232C compatible Line Voltages: +/- OV Current Loop: Not Supported Connector: 9 Pin D-Shell Plug (AT compatible) Connector Pin out: Pin Name 1 CD Carrier Detect 2 RD Receive Data 3 TD Transmit Data 4 DTR Data Terminal Ready 5 GND Signal Ground 6 DSR Data Set Ready rj RTS Request To Send 8 CTS Clear To Send 9 Rl Ring Indicator Interface IC: 82C50A Base Address of 82c50: Stored at Memory Location 400h Interrupt Support: Yes (see below) Divisor Clock: 1.8432 MHz 4.1.2 10 Registers Since the same computer interface (with the exception of interrupt handling) is used on the Portfolio as on the IBM PC/AT, the IO registers have the same function. The base address for the serial port may be found by reading memory location 400h in the BIOS data area. If the value at this address is XXXXh, then the IO registers are thus: lO Address Register of 82c50A XXXX+0 R RBR Receiver Buffer Register W THR Transmitter Buffer Register XXXX+1 R/W IER Interrupt Enable Register XXXX+2 R/W IIR Interrupt Identification XXXX+3 R/w LCR Line Control! Register XAXXX+4 R/W MCR Modem Control Register XXXX+5 R/W LSR Line Status Register XXXX+6 R/W MSR Modem Status Register XXXX+7 R/W SCR Scratch Register 4.1.3 Interrupt Support Since the Portfolio does not contain an 8259 compatible Peripheral Interrupt Controller, interrupts are handled in a different way than on an IBM PC/AT. The serial port has register called the Serial Interrupt Vector Register (SIVR). An eight bit number can be written to this register. This number is the interrupt number that is to be used with the serial port. For example, writing 10 to SIVR will cause a call to the double word pointer held at memory address 10*4. SIVR is at I/O location 807Fh and is write only. It should be set up before 82c50A interrupts are enabled. When an interrupt is generated by the 82c50A, it is passed on to the CPU. If no other interrupts are pending then the CPU will read the contents of SIVR and service that interrupt number. Interrupts are acknowledged by accessing the 82c50A and reading IIR. This will allow the operation required to service and acknowledge the interrupt to be determined. 4.1.4 Other Useful Information To determine whether a serial port is installed, it is recommended that use is made of BIOS Interrupt 11h - Get Equipment List. Since the Portfolio will attempt to power down while waiting for a key stroke (INT 16h service OOh), it is recommended that terminal emulation software polls the keyboard until a key is waiting in the buffer (INT 16h service 01h). To set up SIVR it is recommended that INT 61h service 1Ch is used: AH = 1Ch AL =0 ‘set up |O address BH=5 ‘lO table entry 5 BL = Byte to write DX = 10 address Use of this function will ensure that SIVR is always set up correctly (unless table entry 5 is reused for a different address). In order to maintain future compatibility it is recommended that on exit from the program, the table entry used above have its address set to zero. This should be followed by a write of 2Ah to I/O 807Fh. 4-2 4.2 Smart Parallel Interface File Transfer Protocol Description The IBM PC and many compatibles have uni-directional centronics parallel ports. In order to allow an inexpensive but useful peripheral it was decided that the Portfolio parallel centronics port would allow programs to be sent to and from IBM PGs as well as to a printer. This is accomplished by using a synchronous serial transfer protocol. Status lines on the IBM PC which can be accessed through the BIOS are used as inputs on the IBM. The Portfolio parallel port is fully bi-directional. The file transfer BIOS should be used with the following considerations (see section 3.3.1) * Before sending or receiving the ports should be opened. * Sending a block expects the other end to be receiving a block, and visa versa. * A timeout will occur if there is no answer within 500mS. * Sending a block will automatically transfer the length of the block. The receiver will return an error if the buffer is too small. * On any failure, wait 500mS (to allow the other end to timeout) and attempt to re- transmit/receive the block. * A error at one end will normally cause an error at the other, so block order should not be lost. * A checksum will be sent with each block to provide simple error detection. * At the end of the transfer the ports should be closed. 4-3 4.3. IBM PC Card Drive The IBM PC card drive consists of an expansion bus card and plastic box with a cable. The expansion card can be used in a IBM PC/AT or compatible. The cable is used to connect the card to the plastic box. There is a slot in the front of the box that allows the insertion of a Credit-card memory, as used on the Portfolio. By running the appropriate block device driver software, the card drive can access the card in the same way as a normal disk. The card uses a block of four I/O locations. These are located at a start address indicated by optional links on the board. When these are changed from the default setting, the device drive driver must be told of the change in the CONFIG.SYS file. 4.4 EPROM Writer Adaptor Boards PROM programming adaptors are available which allow PROM (OTP) memory cards to be programmed using a standard PROM programmer. The adaptors convert the PROM card to the same outline as a standard DIL PROM. Use model HPC-501 to program 512 KBit cards and model HPC-502 for 1 Mbit cards. When programming the PROM card the PROM programmer should be set up as a Fujitsu PROM. If however, Fujitsu settings are not available, some of the other 12.5V PROM programming specifications will also work. The ideal programming specification is: VPP 12.5V 64 KByte use 27C512 __— (Ideally Fujitsu CMOS) 128 KByte use 27C1001 (Ideally NEC CMOS) Once the correct ROM type has been chosen use the following procedure to make a copy of a RAM card: i) Select a PROM card with the same capacity as the RAM card and use the correct adaptor for the card capacity li) Place adaptor in PROM socket of the programmer, ensure that it is inserted the correct way. lii) Place RAM card in to adaptor and LOAD the contents in to the programmer using the relevant option. iv) Place PROM card in to the adaptor and program as for a normal PROM chip. WARNING: 1) DO NOT ATTEMPT TO PROGRAM THE RAM CARD 2) Some PROM programmers do not like the power being turned ON and OFF so remove the cards before switching ON or OFF. 4-5 APPENDIX A: EXAMPLE .RUN PROGRAM Section 3.6 highlights the main design issues to take into account when creating a .RUN program. Included on the Portfolio Emulator Disk are the following files: RNRN.ASM Assembler .RUN program MAIN.C Example C .RUN Program RU C.ASM C Header BUILD.BAT creates program using Turbo C tools The above files illustrate two programs which use the Atari Portfolio .RUN function. RNRN is an assembler program which prints out the original calling parameters and then three numbers. MAIN is a program which illustrates a .RUN program written in C. RU_C.ASM is the C Header necessary for Borland’s Turbo C compiler and BUILD.BAT illustrates how to create the program using Turbo C tools. Notes on interfacing 'C’ files to the RUN command For 'C’ files, several more segments need to be declared to ensure 'C’ gets the data and code in the correct positions in the .RUN file. The .COM file is converted into a .RUN file by renaming. RN_C.ASM is the header which can be used to interface to a’’C’ program. If ’C’ source files are being used without any provided ’C’ libraries then the file RU_C can be used as the header directly. If library code is required the header will need to be enhanced to perform the necessary library initialization. The RN_C.ASM header works with Turbo C and can be used as a guide to modifying other 'C’ headers used by different ’C’ compiler libraries. Most 'C’ headers supplied with 'C’ compilers can be assembled for different memory models. The example code in RN_C.ASM needs to be placed in the ’C’ startup header and assembled for the SMALL model (sometimes called TINY). TITLE RNRN.ASM comment * (c) Copyright DIP, 1989 Example .RUN program * DGROUP group text, data, cdata STACKSIZE equ 400 . ; code segment. _text segment public byte ‘CODE’ assume cs: text,ds: data org 0 ' byte in stack. > IP is 0 on entry. Pit Eee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee rnrn_main RUN command test routine. f * r * fr . r . r Fr process. r ' ' - Parameters: : None - Returns: ; None On entry, DS, SS and ES all point to the PSP in RAM. ; CS is a ptr into the credit card, so may actually be in ROM! ; When this routine is executed, the whole of RAM is allocated to the Ree ee ee ee eee ee ee eee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee tJ 10h paras to keep the PSP. modify memory. error reducing memory. alloc for initialised data, uninitialised data and a * stack. calc paras in init data area. add in paras in stack. allocate memory. allocate stack and data. no memory. set stack to point to RAM. preserve PSP pointer. bytes in initialised data. - copy from here. source is on memory card. ; target is allocated RAM. copy init data from card to RAM. restore PSP ptr. rnrn_ main proc near mov bx, 10h - mov ah, 04ah ; int 21h jc rnrn_err : mov bx, OFFSET rnrn_uend ; sub bx,OFFSET rnrn dstart ; add bx, 0fh mov cl,4 shr bx, cl ; add bx, STACKSIZE/16 : mov ah, 48h . int 2lh ; ac rnrn_err : mov SS, aX : mov sp, OFFSET rnrn_uend+STACKSIZE push es ; mov cx, OFFSET rnrn_dend sub cx,OFFSET rnrn dstart ; mov Si,QFFSET DGROUP:rnrn dstart push cs pop ds ; xor di,di mov es, ax : cld rep movsb : pop es ; mov $1, 5dh mov cx, ll rnrn_fcbl: mov inc mov int loop mov mov rnrn_fcb2: mov inc mov int loop push pop mov cal] inc mov call mov mov cal] xor jmp rnrn_ err: mov push pop mov int mov rnrn_end: push mov int pop mov int rorn_main rnrn_disp AL Returns: None =i #2 Si St te He ee hw Parameters: di,es:[si] ; 31 ah,2 éih ; rnrn_fcbl si,6dh cx,11 dl,es:[si] Si ah,¢ 21h : rnrn_fcb2 Ss ds . al, rnrn_val : rnrn_disp : _rnrn_val al, rnrn val rnrn_disp eee eee oe oe eo ieee 2 eo ee ee eee ee ee ea a ea # ot 2 ft ee oF ite te eee | te Ee Be i | ff a a - 2. Fee eee -f* @ © 2 ee & ia # 2 © of 2 Po oo i mh oe a4 . & eee we eee -—ee eee ee B:-8: | She PER ERE LR SRE REE see eee ss | BERR! tt | ees | eee lt Ce a# eo & o' fF Pee ee if ot te 2 oh 1 ee ee BEBBEEES § BEES PT | eee aes one ee ‘4 Par ss | BB: :: |} + + aoe B:-8: | ee ee ee ee | TT TT TT =. = Bas ‘aaa "t+ Bee a ee # oe Me Meee oe at Be ot ft "Ree wee Shee ee ae ee eMe ee ee Me Mee = | eee Bee ee #e oe Be ee ae fe foe) Mees lee ee eee » # Ms Ma « @ ao # a oe Mt Be a soe Be we 2 -—- ~ = = : = OO | --+-——_—--t —— = — se eee ee # # a @ ee ee Ce ee | | ee eee eee fee eee ee ean * a a ee Ano ee | ee | | | ee oe | ee ee | ee Cee | | ee cee | ee ee. eee ee eee |e Mee ome Ms ms | mses ee Mee ee Mee eee ee |e ee BR Be fe me |) ea a Be fe Be ol et lc oe oe: |) oe: ee eee | os Me Meee “mB: ms ‘i: eee: Ce ee es es oe ee ee ee en ee eee see Be eee a. a4 se Mee «Ms | se ee Os | | i oe Me Bas a ‘esses Ce ee Ce Ce! Ce ee ee ee. ee ees ee ee oe oe eme eee |e oe oe ee eee | oe Be Be ee sees = ee Bee o* bt Be a oes BBs: | + Et See: | eee: ee on et Be os + BBM « se == |e = Me se es | es * Be et a # oe # Be ew « a tr ee — — Se — ee —ae == 5 —___—— a eo. fe eee ee ee eee eee ft eee ee oe | ek a he ee ' oe # ee we #2 2 et tee bee eee ee a ee ee ee bee eo te ee ee ee ewe . . eee Pee ee hee ses Me ee ja: ms +e see MMe fe soa t Mes | + _ eee a: + PPM: |+ »- eee: « ee | | Ce ee) | ee a # Me Ms Me « ts oe # # Be wo ee ee [ees Bs: SB ee ee i Be ee ee Mee ee | ee a ee a me le Be me ‘me oss | oe: oe ce ie fo . es MMe ee Be eo | a Be * * 2 Ba & Be * Me Ms = Me Meee ee Me le Me se ee Be ta Bo Be soe se oo Be ss se oe = |= Bi: + * a “B+ me oe oe i Me Meee oe Ce en ee ee m-«@--:- 7 ee! ee ee ee eee ee ee ee Ce Cee! fen re = a 7M: Be os Me Me se ae Bam: s+ +M@++ |+ + RR * 2 ¢ 2 Me © | e & ee es jr = Mme « *s + im. » | 1 oe 2 MMe = = ses Be + BR: | BB oes: | See: ee | |) en | ee ee eee | | ees re | --- eee jee nese es maf mp == 1 | TrRe 8 Fe ee sf fe Fe oe ‘see Cee Pee Eee Sieh = a elgien A olla alo ity 8 8 8 ef ot es ee ae ae ee a a a a ee Meee ae '*: Bee: + + Be Be oo: MMs: (+ + eRe *' + Bee: *: +: Bem ee ee) ost ee ees | Be + Bs ** + ms Mess Ms |e se ee le "BE: BB B+ ee Be Be an oe oe = Me Me we *# * Be oes oe Be fe fb at es Ba es Me es Bae 2 B= = Be « Mts ce Be Be see wo oe Be "BB+ +m: |e we we Be *-e Be Be Be om | "Bem: | ees os geen: |m: -seBe: ': Seo: ae eee ee Me Mee mse Mesos Ms me Mites et et Me oe Be Be me ‘Bis Ms Ms Me Be Bs me | i Ms Ms «se Be me me om: |e meme se Meee ome eo Me ome ooMe se Mae SMMMe es fe BM fe Bm fee ee ee ee fe Be | ee fe fe a a a | ee: |} =} ) == ij a oe teete at = (tk ee Se ee -- Ce ee ee ee ee ee ee ee iat * & 2 @ Be 8 ae ew * : Be = Me « oe ee ot Be @ ‘1 BBE i soe © 8 - 2 8 ot Ba te oe B= Be Be « # Me = = Be oon oe Be ao ke of # se Me ee ee *: BeBe Be oe Be ae te Be * @ ee wo 2 # _- # . BEERS EH: « 4 ao # @ @ eo 8 * * oo Be ee ee ao @ ie 2 & oO “2. @ a ee ee es a a oe ee Pe ee Pe ee ee ee et oo + Ps « [| yj: | | fT see ee ee "+: Bee: |= =: Bee: os = BM + —?) Tee se eo Be se Be oe # # # @ Be se # BBs e & ee oe ee ee ae ee oe Meee me a ee Pe | |) ee | eee! Cee! fees 6 aes Cee i #2 Be 2 2 Be Messe 2 Be oe Mee woe oe e Bee # & 2 Bee se aaneeee- er ee ee ewes .: mm: |) le me jee ee naa a 7 be # 8 ee oe # 2 fe oe & eee | Es = = Be Me +m = Mesa ete +f et + oe ee ee | Ms «= Ms Me « Mee Mee Me Mette eee oo 2 *¢ Be ee ee | Mis s MMe o Ms ts Me s a BEERS: a = oo ¢ 2 Ma a Mes es eee a | Mee Mee ee |e Be Be | Bee ee oe Me Me we 8 i 1 ft ti] ft | var fed oe st it tt ite ea ee ae See 5E8: |: 2B t] Mm: : « ows i | : '*# @ # HF # Mee #6 ! a ee ee a | : = = : tafe je eee eee se ee oe Ce ee ee | oes * 2 2 8B we “se 2 2 eo oo ee es Pe ee eee fee ee ee fee ee ee Pree ee ee 7 if @ + tp ft ft fo MMM@iescs | s Ses en eee eee ee Mtetainueene | as Be se: | See: Peceeece [(Meccccee (Mecen ee [seen e cms BSR EEE - : i: @: @: Mee Mes me Be ee ee | ee ee Mes Mee es |e ee fee Bee es |e meas eee ee eee ee ee ee fees Mee Me « me Mee Mes Ms Mee eee es Mess ss Be @M:+=@--M. Mss Meee s |e oe Be oe tae it ta rt | eet Mee eee Me fee eee eee eee Be ee Meta ts ts Be (Mee Mee Me Mee ee Me Meee ee me ee Mee Bee |e ee ee es ee | ee ee oe Be eee eee Co ee oe eee ee ee ey ee |B: | + eee: : | SESE: BESS: SERERee: | eee: See os eee: | See SEE eeen: it tt te oe ct te tt om cc -¢# # fo 8 2 oe | it tt ot re ee i tt ft oP oe te es ee ee ofc? eo fo fc fo ee OF ‘Ree: - “MMe «= @: | Mes ee eee Be ss | Bes Be - oe os Bs + | Me ee es _B@: me: += See: jae se ad Mie Me ss Me Mt+tMet cms |e este: | Sees * Me Mes «Me |) Mes Bee Be |e Be et ee ll Me | Me « Be Me *Bm: Mm: + i oes Be Mees Bs Me | Be Bes tt Be eee Met se memes me [mee me me | coe | | | he ee ome |me Be ee | se Os Mess: me Mess = Be |e et ee oe B= Be 2 a | Meee ee ee [ee ee Mee Mee Me eee of 7 cee eee eee eo MMe = + | es «es oe | Un ee | oe | *MMee eae eee eee ee #4 - #8 =e es ee eee eee ee eee lee ee ee ed ‘i # i oo Be Ba ee oes ee |e ee et ee oe eee eee ee ee J+. . BEEBE E EE - st Bs ss is Me we Bes (Meee a MreeenuaMe |e # oe Mee es se ee ees |e ote pM@eMer ees ot ss + Ba Pa Pa MMs « Ms « « Mis «Ms sme ee ee ee os Bs ts 8 4 Mm: ++ Mss _Bm« Be. « it ft fe ee pee ee eae .# * 4 fo oo ef ft te ee of eee eee fee ee ee ee BEEBE EE - ee fee eee ee | |e se se i fe ee ee Be oe ee +B: = .- | Ds ee et | ce oe fe ét* « BEB ‘Be: bees «MMe et eee 27 Me fee eee ees |e: |e ee ee ee: | eee: | eee | ‘Bean - = |e: me |e me ee | ee eee fe re | rs es st EEE = # #o * 2 ee ee «MMe ee ee oe ee ee eee + DO oso BeBe Be Ce semaes = ie — ee | ee Ce see et eee fe eee ee Ce ite ee eo oe | et * #2 * 2 2 we +R: « ‘ERB +e se es Oe oo. 8 # '* Bs +s feteeee ss | DPT ee eM@Me ss | * eee ee ee re oo ee | oe oe Tl ‘+m: +: Bs «© « ‘Bee: oe Be = = | ss es S05: on: oe + Lie Ce foe |] ft | ee fT + BSE ‘Bem: « ‘ BSERE Bem: oe ee es | a a el 6hLre: ee: ee = ee ee ee jae: eee BE-H:- bm + ‘ieee: = os Ms « EEE: &« Fa tan tt + | DDS ooo MMe «= | iam: ‘BeBe oe ee = Me Tf ft ft tt eee ee a | fi # oe oe ee * «DMs « oe Mee se Fee | rrr ss | i ee |e *BO@B@e:: |: Bees od am & mi a] aa = uw wo Ps oo on o S pli au = wn APPENDIX C Example peripheral design As an illustration of a typical Atari Portfolio peripheral we have designed a peripheral which flashes an LED in time with the system tick. In order that this peripheral operates transparently to the user we have used a ROM extension. Peripheral Specification i) have a single LED which will toggle on a timer tick. ii) have a PID of 64h. lii) have all software on an extension ROM. iv) only operate with the machine powered on. v) be a terminating peripheral. vi) the peripheral will power up with the LED off. Hardware Design (see schematic) see section 2.6 & 2.7 for more information. * There is decode logic to read the PID from 807Fh. (Since there is no need find out if the LED is on or off, the latch will be decoded for a write at 807Fh, to save decoding logic.) * Each successive write to 807Fh will toggle the LED * If the latch is set, the LED will be ON * If the latch is reset, the LED will be OFF * The circuit will be powered from 5VS * The buffering signals ABUF/BBUF and PDET are also used Software Design (see listing of file PDEM.ASM) * A ROM extension will be used to hook a TSR onto INT 1Ch * Each call to INT 1Ch will toggle the LED by writing to I/O 807Fh. * If the peripheral is removed, the TSR will de-install itself. * On power up, the LED is assumed to be reset. ROM Extensions (see listing of XROM.ASM) This example program illustrates how to design a simple ROM extension. It can either function as a specific BIOS, specific DOS, or Common extension, according to the ID code at 0C000:0. Each extension module identifies itself, and where it was invoked from. It is a good demonstration of the potential power of ROM extensions. WadHdidsd SidwUx3 AGS JILGWAHIS JOON TH ia iy tt L Ry Qiv a: = raat cd “e4C) ‘aT Qu enh Ga Se 99U bi bo Gh ef Fy PUD meal au ig Ty oad ao LaOd NOISNHdxS __ O01 SNOLAISNWOD WO SOW) SI 9S2e7? BeJHr/ SI] 319 UNH CEDHP, SI] 3109 afl PRODHE?, Gi Aol PoDHb? SI 13) —— ?>$31U0H EvD_ | lvo_, ONO ——— iSdW SnG+ C-2 [ooo kokokokokokokokokokokoko kok aw AoA wom dkokokok k aokokokokokokar rok ako koko Module: PDEM. ASM : Copyright: DIP Ltd, 1989 ; ; Peripheral ROM Extension DOSX cseg xrom main bixt type bixt size bixt gdos bixt_user xrom prac INTR_NUMB genx _vect Pee eee ee ee eee ee ee ee ee ee ee ee eee ee ee ee ee ee ee ee XROM assume cs:cseg,ds:dseg equ 055aaH ;Specific DOS extension segment org OH :Extension Vector table label near *Start label for MASM dw DOSX ;Identification code db 0 “Num 51? byte blocks in ROM org 3H label byte ;Specific DOS extension jmp genx vect “Specific extension vector org 40H label byte ‘OEM user text db "Crt Plant Periph’ ;The plan is to allocate some memory, Copy a section ; of code to memory, and then point the Specified ; vector to that code. proc FAR equ lcH ‘TIMER TICK labe] near push ax ‘Preserve registers push bx * required to set up push ds * local stack ‘Allocate User RAM. Note that this can ONLY be done ; after DOS initialisation. mov bx, (ALOC SIZE+0fH)/10H ;Paras to allocate mov ali, 48H ‘Allocate memory int 21H mov ds,ax *Set DS to allocated RAM mov stak save,ss ;Preserve Caller stack mov Stak save+2,sp shl bx, 1 ‘Convert size to bytes shl bx,1 shl bx, 1 shl bx, 1 -Set up User stack. mov SS ,aX ;oet up stack at top mov sp, bx - of allocated memory push cx ‘Preserve registers push dx = YOU MUST ALWAYS PRESERVE push Si > ALL USER REGS push di push bp push es xrom proc PID CODE LEDS PORT tick code ;Copy the ISR to the allocated area push push pop mov push pop mov mov cld rep pop ds ‘Preserve DS cs ;set up Source ds si,offset tick code SS ;9et up destination es di,offset load base cx,CODE SIZE ;Bytes to copy ‘Initialise flag movsb :Copy TSR to RAM ds “Restore DS ;Get the specified vector, and set it to the ISR mov int mov mov mov mov int mov int pop pop pop pop pop pop mov mov pop pop pop ret endp ax, 3500H+INTR NUMB ;Get current Int 1CH 21H tick vect, bx ;Preserve vector tick _vect+2,es ax,2500H+INTR NUMB ;Set interrupt vector dx,offset load base 21H 7 ax,1501H -Generate Confidence BEEP 61H es ‘Restore registers bp di $1 dx Cx ss,stak save *Restore Caller STACK sp,stak savet2 ds ‘Restore remaining regs bx dx *FAR return to caller ;Interrupt Service Routine (ISR) equ equ label push push push push push mow int or uF cmp jne 64H ;Peripheral PID code 807TH ;LEDs I/0 address byte *TSR code ax *Preserve registers dx bx ds es ah, laH ‘Get Peripheral PID 61H al,al ‘Peripheral installed? tick none ‘No, so uninstall ah,PID CODE ;Correct peripheral? tick_none ;No, so uninstall ;Peripheral installed, so toggle LEDs mov dx, LEDS PORT ‘Toggle LED address C-4 tick none: tick exit: CODE SIZE cseg dseg data sptr stak save tick vect load base LOAD SIZE ALOC. SIZE dseg out dx,al ‘AL unimportant jmp short tick exit Set assume cs:dseg ;Force DSEG offset ;Invalid Peripheral, so uninstall! TSR mov ax,2500H+INTR_NUMB ;set interrupt vector mov bx,offset tick vect ;Get old vector mov ds,cs:[bx+2] mov dx,cs:[bx] int 21H ;Now vector reset, free allocated memory push cs *Seqment of block pop es mov ah, 49H “Free memory int 21H pop es ‘Restore registers pop ds pop dx pop bx pop ax jmp dword ptr cs:tick vect ;Jump to old TSR equ $-tick code ;Size of ISR ends ;Data segment TEMPLATE (No initialised data here!) segment label byte ‘Start of Data dw ? ‘Caller stack stored here dw ? dw ? ‘Old vector stored here dw ? label byte ‘Start of ISR equ ($-data sptr)+CODE SIZE ;Load module size equ LOAD SIZE+100H ‘Load module + Stack ends end xrom main CS 2 2) 2 we ee we we ee Te ee ee hale LF CR BIOX DOSX BIDO cseg xrom main bixt type bixt size bixt_gbio bixt_gqdos bixt_user bixt_preb: bixt bext: bixt_pdos: bixt_dext: bixt ados: bixt pwdn: bixt_pwup: xrom_proc genx_vect Module: Copyright: DIP Ltd, 1989 ROM Extension DEMO program A ROM extension may be run from a Credit Card Memory or an Extension ROM. The Extension code must preserve ALL registers! The Pre-BIOS vector MUST return by a FAR JMP to OFFFE:0, as no stack is set up at this stage EKEKEKEKAREEREREE REAR ERE RARER EER ERE EERE EERE ERR ERE RRA ERE REE EEEKS XROM. ASM =f =e =e 2 SP ee ee Pt ee OU lea hUme hms BREE EEE EEE EEA AA AAR AERA RAR AAA RA AAA RK KERR RRKKR ER ERA EEEE - XROM assume cs:cseg equ OaH ‘Line feed equ OdH ‘Carriage return equ Oaa55H *Specific BIOS extension equ 055aaH "Specific DOS extension equ 05555H -Complete control segment org OH -Extension Vector table label near dw BIOX ‘Identification code db 0 ‘Num 512 byte blocks in ROM org 3H label byte sspecific BIOS extension label byte Specific DOS extension jmp genx _vect specific extension vector org 40H label byte | ;OEM user text db "Test ROM (C) DIP’ org 50H jmp preb_vect -Pre-bios jmp vector org 55H jmp bext_vect *Bios-ext jmp vector org 5aH jmp pdos_vect -Pre-dos jmp vector org 5fH jmp dext_vect ‘Dos-ext jmp vector org 64H jmp ados vect -Post-dos jmp vector org 69H jmp pwdn vect *Power down jmp vector org 6eH jmp pwup vect Power up jmp vector proc FAR Determine extension type label near C-6 push bp -Preserve BP cmp cs:[0],BI0X ;Specific BIOS extension ? jne not_genb >No mov bp,offset gbio text ;specific BIOS extn text jmp short xrom_disp not genb: cmp cs:[0],DOSX :Specific DOS extension ? jne not_gend ;No mov bp,offset gdos_ text ‘Specific DOS extn text jmp short xrom disp not gend: mov bp,offset invl text ; Invalid text jmp short xrom_ disp preb_ vect label near jmp dword ptr cs:preb retn ;Pre-BIO0S extension preb retn dw 0 dw OfffeH bext_ vect label near ;Post-BIOS extension push bp mov bp,offset bext text jmp short xrom disp pdos_vect label near -Pre-DOS extension push bp mov bp,offset pdos text jmp short xrom disp dext_vect label near ;DOS extension push bp mov bp,offset dext text jmp short xrom disp ados vect label near ;Post-DOS extension push bp mov bp,otfset ados text jmp short xrom disp pwdn vect label near ;Power-Down extension push bp mov bp,offset pwdn text jmp short xrom disp pwup vect label near *Power-Up extension push bp mov bp,offset pwup text jmp short xrom disp xrom disp label near ‘Main display routine push ax *Preserve registers push bx push cx push dx push es call disp text ‘Display text in BP mov ax,2400H Get ROM state int 61H or d|,dl ‘Normal ROM ? not_norm: not_drva: not_drvb: not_xrom: stat_disp: xrom proc —t: =i: 22 = + es disp text disp text gbio_ text gdos_text bext_ text Main Display routine jnz not_norm "No, so skip mov bp,offset norm text ‘Get normal ROM text jmp short stat disp dec dl] ‘Drive A? jnz not _drva ;No, so skip mov bp,otfset drva_text ;Get Drive A text jmp Short stat disp dec dl ‘Drive B ? jnz not_drvb ;No, so skip mov bp,offset drvb_ text “Get Drive B text jmp short stat disp dec dl ‘Drive B ? jnz not_xrom ‘No, so skip mov bp,offset xrom text ;Get Drive B text jmp Short stat disp mov bp,offset invl text cal] disp text ‘Display text in BP mov bp,offset crif_ text ;Finally CR, LF cal] disp text pop es ;Restore registers pop dx pop cx pop bx pop ax pop bp ret ;FAR return endp 7G iio okkgioigiaioooioiok kg gok gk gokokokiokkdokokokokkokwokog dw koko» f * r f r RARER REE EEE RRR RRR RARER ER KR RRR EEE EEE REA KEE ERE AKEEEEREE EEK r proc near xor bh, bh -Page 0 mov ah,3 ;Get cursor position in DX int 10H push cs ‘Access text pop es xor ch,ch ‘Initialise mov cl,es:[bp] ‘Get length inc bp ‘Advance to text mov ax,1301H ‘Write string int 10H ret endp db gdos_text-$-1 db "Spec BIOS Extension - ' db bext_text-$-1 db "Spec DOS Extension - ' db pdos_text-$-1 db ‘Com BIOS Extension - ' C-8 pdos_ text dext_text ados_ text pwdn_text pwup text norm text drva_ text drvb text xrom text invl text crilf text cseg db db db db db db db db db db db db ab db db db db db db db db ends end dext_text-$-1 'Pre-DOS Extension - ados_text-$-1 t ‘Com DOS Extension - ' pwdn_text-$-1 "Past-DOS Extension - pwup_text-$-1 ‘Power Down Extension norm text-$-1 ‘Power Up Extension - drva_ text-$-1 "Normal ROM' drvb_text-$-1 "CCM Drive A' xrom text-$-1 "CCM Drive B' inv]_text-$-1 "Extn ROM' crlf_text-$-1 ‘Invalid’ am iE xrom main