                    Portfolio Specific BIOS Interrupt 61h
                    -------------------------------------

Rewritten from Portfolio Technical Reference Guide 
by PiLA (pila@maloka.waw.pl)

Int 61h - DIP extended BIOS services

Function        Description

00h             Service Initialization
07h             Format Credit Card Memory (CCM)
08h             Get size of Internal disk
09h             Format Internal disk
0Bh             Determine if CCM present
0Dh             Get Screen size
0Eh             Get/Set Screen mode
0Fh             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 IO data
1Eh             Get/Set Clock tick speed
20h             Disable revectoring of Int 09h
24h             Get/Set ROM space state
26h             Get/Set Power State
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.

Note from PiLA: If you get these "hidden" Int 61h services list, please
                let me know at my e-mail address: pila@maloka.waw.pl. Thanks.


Fn 00h Service Initialization
-----------------------------
Parameters:
        AH      00h
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
--------------------------------
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 08h Get size of Internal disk
--------------------------------
Parameters:
        AH      08h
Returns:
        AX      Segment Address of disk
        BX      Size of disk in Kbytes


Fn 09h Format Internal disk
---------------------------
Parameters:
        AH      09h
        BX      Size of disk in Kbytes
Returns:
        If CF=1
        BX      Maximum size possible (K)

Note: The systemn is rebooted if successful. All files on drive C: will be
      lost.


Fn 0Bh Determine if CCM present and valid
-----------------------------------------
Parameters:
        AH      0Bh
        Al      Drive number (0 or 1)
Returns:
        CF=0    Card present and correct
        If 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 0 selects A:, and drive number 1 selects physical drive B:.


Fn 0Dh Get screen size
----------------------
Parameters:
        AH      0Dh
Returns:
        AX      Physical screen size
        DX      Logical screen size

Note:
        AH/DH   Row number
        AL/DL   Column number


Fn 0Eh Get/Set screen mode
--------------------------
Parameters:
        AH      0Eh
        AL=0    Get mode
        AL=1    Set mode
        DL      New mode
Returns:
        If AL=0
        DL      Mode
        If AL=1
        DL      Old mode

Note: The mode is changed by setting one of the following mode bits in DL:
        
        Clear bits (00h)        80 by 25 mode
        bit 0 (01h)             40 by 8 mode
        bit 1 (02h)             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 0Fh Get/Set Cursor mode
--------------------------
Parameters:
        AH      0Fh
        AL=0    Get mode
        AL=1    Set mode
        BL      New Cursor mode
        AL=2    Force mode
Returns:
        If AL=0
        BL      Cursor mode
        If AL>0
        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
--------------------------------------
Parameters:
        AH      10h
        AL      0       Get position
        AL      1       Set positon
        If AL=1
        DH      Row number
        DL      Column number
Returns:
        If 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
-----------------------------------
Parameters:
        AH      11h
        AL      Number of lines to move cursor
        DL      Direction of move cursor
                1       Up
                2       Down
                3       Left
                4       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 similar effect
      pressing Alt+Cursor keys.


Fn 12h Screen refresh
---------------------
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.


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      Lenght of tone in 10 mSecs intervals
        DL      Tone code (See below)

        30h     D#5     622.3 Hz
        31h     E-5     659.3 Hz
        32h     F-5     698.5 Hz
        33h     F#5     740.0 Hz
        34h     G-5     784.0 Hz
        35h     G#5     830.6 Hz
        36h     A-5     880.6 Hz
        37h     A#5     932.3 Hz
        38h     B-5     987.8 Hz
        39h     C-6     1046.5 Hz 
        3Ah     C#6     1108.7 Hz
        29h     D-6     1174.7 Hz
        3Bh     D#6     1244.5 Hz
        3Ch     E-6     1318.5 Hz
        3Dh     F-6     1396.9 Hz
        0Eh     F#6     1480.0 Hz
        3Eh     G-6     1568.9 Hz
        2Ch     G#6     1661.2 Hz
        3Fh     A-6     1760.0 Hz
        04h     A#6     1864.7 Hz
        05h     B-6     1975.5 Hz
        25h     C-7     2093.0 Hz
        2Fh     C#7     2217.5 Hz
        06h     D-7     2349.3 Hz
        07h     D#7     2489.0 Hz
Returns:
        None


Fn 17h Dial number
------------------
Parameters:
        AH      17h
        DS:SI   String of characters
        CX      Lenght of string
Returns:
        None

Note: String to be in ASCII. Valid characters are: 0 1 2 3 4 5 6 7 8 9 A B C
      D * #. Letters must be in upper case.


Fn 18h Mute states
------------------
Parameters:
        AH      18h
        AL      00      Get mute state
                01      Set mute state
                02      Get key click state
                03      Set key click state
                04      Get beep state
                05      Set beep state
                06      Get alarm state
                07      Set alarm state
                08      Get DTMF duration
                09      Set DTMF duration
        If AL=1, 3, 5, 7 or 9
        DL      0       Off (Muted)
                1       On
Returns:
        If AL=0, 2, 4, 6 or 8
        DL      0       Off (Muted)
                1       On


Fn 19h Get Serial port parameters
---------------------------------
Parameters:
        AH      19h
        DX      Serial port number
Returns:
        If AH=0, Composite parameters in AL
        If AH<>0, Error

Note: This service returns composite parameters identical to those used by
      Int 14h service 0 (Initialize).


Fn 1Ah Get Peripheral ID byte
-----------------------------
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
-----------------------------
Parameters:
        AH      1Bh
        AL=0    Set Serial ID
        AL=1    Set Parallel ID
        DL      Current periheral ID
Returns:
        None

Note: There may be peripherals designed that contain circuitry that is 
      similiar 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
------------------------------------
Parameters:
        AH      1Ch
        AL=0    Preset Data values
        AL=1    Return Data values
        BH      Table entry number
        If AL=0
        BL      Data value
        DX      IO address
Returns:
        If AL=1
        BL      Data value
        DX      IO address

Note: This service is used to preset peripheral IO data in a table 
      associating an IO address with a data value. Service 0 will actually
      output the data to the specified IO locations. On Power-up, the table
      entries will be scanned for non-zero IO 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
-------------------------------
Parameters:
        AH      1Eh
        AL      Subservice
                0       Get speed
                1       Set speed
        If AL=1
        BX      Clock tick speed
                0       Tick every 128 seconds
                1       Tick every second
Returns:
        If AL=0
        BX      Clock tick speed
                0       Tick every 128 seconds
                1       Tick every second

Note: 1 sec speed uses much more power.


Fn 1Fh Get-key/NMI invoked screen refresh
-----------------------------------------
Parameters:
        AH      1Fh
        AL=0    Get refresh state
        AL=1    Set refresh state
        If AL=1
        DX      New state
Returns:
        If AL=0
        DX      Current state
        If 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

        If bit 7 of the state is set, then the state is unchanged.


Fn 20h Disable revectoring of Int 9h
------------------------------------
Parameters:
        AH      20h
        AL=0    Get revectoring of Int 9h state
        AL=1    Set revectoring of Int 9h state
        If AL=1
        DL=0    Disable revectoring
        DL=1    Enable revectoring
Returns:
        If AL=0
        DL=0    Revectoring disabled
        DL=1    Revectoring enabled

Note: This is used to automatically revector Int 9h to the BIOS. This prevents
      applications software from setting up its own Int 9h. Note that 
      Portfolio keyboard IO address is not IBM compatible. This service is
      automatically invoked on a boot.


Fn 24h Get/Set ROM/CCM space state
----------------------------------
Parameters:
        AH      24h
        AL=0    Get ROM state
        AL=1    Set ROM state
        If AL=1
        DL      New ROM state
        DH      New CCM state
Returns:
        If AL=0
        DL      Current ROM state
        DH      Current CCM state
        If AL=1
        DL      Old ROM state
        DH      Old CCM state

Note: ROM state in DL is as follows:
        DL=0    Normal applications ROM
        DL=1    CCM Drive A:
        DL=2    CCM Drive B:
        DL=3    Expansion ROM

        CCM state in DH is as follows:

        DH=0    CCM Drives Disable(d)
        DH=1    CCM Drive A: Permanently enable(d)
        DH=2    CCM Drive B: Permanently enable(d)

        CF=0    No error
        CF=1    Invalid option or error

Note: This service should be used with care, as it can swap either Memory
      cards or an extension ROM into the C000:0 to 0DFFF:F address range.
      This range is normally used by the internal applications ROM. Its
      primary use is to allow advanced users direct access extension
      ROMs and Memory cards.


Fn 26h Get/Set Power control
----------------------------
Parameters:
        AH      26h
        AL=0    Get Power control state
        AL=1    Set Power control state
        If AL=1
        DL      New state
Returns:
        If AL=0
        DL      Current state
        If AL=1
        DL      Old state

Note:   DL=0 Normal Power-down on low battery
        DL=1 Prevent Power-down but display warning
        DL=2 Prevent Power-down with no warning

      This is used to prevent the Portfolio from powering down on a low
      battery. It is not recommended for use except for conditions in which
      a power down might be critical to an application or peripheral.


Fn 28h Get/Set Text/Keyboard language
-------------------------------------
Parameters:
        AH      28h
        AL=0    Get Languages
        AL=1    Set Languages
        AL=3    Language table pointers
        If AL=1
        DX      New languages
Returns:
        If AL=0
        DX      Current languages
        If AL=1
        DX      Old languages
        If AL=3
        ES:CX   Keyboard table pointer
        ES:DX   Language table pointer

Note:   DH      Text language
        DL      Keyboard language

      Both DH and DL will be 0, 1 or 2, corresponding to the language in the
      ROM.

      If bit 7 of the language/keyboard code is set, then it remains 
      unchanged.

      The tables consist of a count byte, followed by the language 
      identification codes for the resident languages. These are as follows:

        ENGLISH         0
        FRENCH          1
        GERMAN          2
        SPANISH         3
        ITALIAN         4
        SWEDISH         5
        DANISH          6

Fn 2Ch Get BIOS version number
------------------------------
Parameters:
        AH      2Ch
Returns:
        DS:BX   Address of BIOS version number

Note: The version number consists of a Major and Minor version number, 
      followed by a '$' terminator. A typical example is: '1.050$'


Fn 2Dh Turn system off
----------------------
Parameters:
        AH      2Dh
Returns:
        None

Note: This is similiar to typing OFF at the command line.


Fn 2Eh Enable/Disable system status line
----------------------------------------
Parameters:
        AH      2Eh
        AL=0    Disable status line
        AL=1    Enable status line
                DH      Row number
                DL      Column number
Returns:
        None

Note: This is similiar to invoking the status line using the LOCK key.


Fn 30h File Transfer services
-----------------------------
Parameters:
        AH      30h
        AL      0       Transmit block
                1       Receive block
                2       Open ports
                3       Close ports
                4       Wait 500mS
        DS:DX   Start of Data buffer
        If AL=0
        CX      Bytes to Send
        If      AL=1
        CX      Maximum buffer size
Returns:
        If AL=1
        CX      Bytes Received
        DL      Error Code
                0       No error
                1       Buffer size too small
                2       Timeout on transmision
                3       Checksum failure
                4       Invalid sub-service
                5       Peripheral not installed

Note: This is used by the File Transfer utility built into System Setup.
