; Assembler header file for Portable
; Written by DefMod (Dec  9 2012) on Sun Dec  9 15:43:51 2012
; Jonathan Coxhead, jonathan@doves.demon.co.uk, 9 Jun 1995

; OSLib---efficient, type-safe, transparent, extensible,
; register-safe API coverage of RISC OS
; 
; Copyright (c) 1994-2012 Jonathan Coxhead and OSLib maintainers
; 
; Licence:
; 
;    OSLib is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 1, or (at your option)
; any later version - and this with the following clarification and
; special exception:
; 
;    Linking this library statically or dynamically with other modules
; is making a combined work based on this library. Thus, the terms
; and conditions of the GNU General Public License cover the whole
; combination.
; 
;    As a special exception, the copyright holders of this library
; give you permission to link this library with independent modules
; to produce an executable, regardless of the license terms of these
; independent modules, and to copy and distribute the resulting
; executable under terms of your choice, provided that you also meet,
; for each linked independent module, the terms and conditions of the
; license of that module. An independent module is a module which is
; not derived from or based on this library. If you modify this
; library, you may extend this exception to your version of the library,
; but you are not obliged to do so. If you do not wish to do so, delete
; this exception statement from your version.
; 
;    OSLib is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
; 
;    You should have received a copy of the GNU General Public License
; along with this programme; if not, write to the Free Software
; Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, USA.

        [       :LNOT: :DEF: Portable_Hdr
        GBLS    Portable_Hdr

        [       :LNOT: :DEF: Get_Types
        GBLS    Get_Types
        ]
        [       :LNOT: :DEF: Types_Hdr
Get_Types                       SETS    "GET oslib/Types.Hdr"
        |
Get_Types                       SETS    ""
        ]
        $Get_Types

        [       :LNOT: :DEF: Get_OS
        GBLS    Get_OS
        ]
        [       :LNOT: :DEF: OS_Hdr
Get_OS                          SETS    "GET oslib/OS.Hdr"
        |
Get_OS                          SETS    ""
        ]
        $Get_OS

;Symbols for constants
Portable_PortEconet             *       &1
Portable_PortSerial             *       &8
Portable_PortFDC                *       &4000
Portable_ControlEconetPowerEnabled *       &1
Portable_ControlLCDPowerEnabled *       &2
Portable_ControlExternalVideoEnabled *       &4
Portable_ControlSerialEnabled   *       &8
Portable_ControlDualPanelEnabled *       &10
Portable_ControlVideoClock      *       &30
Portable_ControlVideoClockShift *       5
Portable_ControlVideoClockExternal *       0
Portable_ControlVideoClockDividedCrystal *       1
Portable_ControlVideoClockCrystal *       2
Portable_ControlInvertVideoClock *       &80
Portable_ControlBackLightEnabled *       &100
Portable_ControlExtraDisplayLines *       &200
Portable_ControlExtraDualPanelDRAM *       &400
Portable_ControlSoundPowerEnabled *       &800
Portable_ControlPCMCIAEnabled   *       &1000
Portable_ControlParallelEnabled *       &2000
Portable_ControlFDCEnabled      *       &4000
Portable_ControlIDEEnabled      *       &8000
Portable_ControlLCDVideoInverted *       &10000
Portable_ControlTrackerballEnabled *       &20000
Portable_ControlMouseEnabled    *       &40000
Portable_BMUVariableVersion     *       &0
Portable_BMUVariableNominalCharge *       &1
Portable_BMUVariableMeasuredCharge *       &2
Portable_BMUVariableUsedCharge  *       &3
Portable_BMUVariableUsableCharge *       &4
Portable_BMUVariableChargeEstimate *       &6
Portable_BMUVariableInstVoltage *       &7
Portable_BMUVariableInstCurrent *       &8
Portable_BMUVariableInstTemperature *       &9
Portable_BMUVariableFlags       *       &A
Portable_BMUVariableChargeRate  *       &B
Portable_BMUAtThreshold3        *       &1
Portable_BMUBatteryChanged      *       &1
Portable_BMULidOpen             *       &2
Portable_BMUAtThreshold2        *       &4
Portable_BMUBatteryFlat         *       &4
Portable_BMUAtThreshold1        *       &8
Portable_BMUBatteryLow          *       &8
Portable_BMUChargingFault       *       &10
Portable_BMUChargeStateKnown    *       &20
Portable_BMUBatteryPresent      *       &40
Portable_BMUChargerConnected    *       &80
Portable_SpeedFast              *       &0
Portable_SpeedSlow              *       &1
Portable_BMUPowerOff            *       &0
Portable_BMUSetAutostart        *       &4
Portable_BMUDisconnectCharger   *       &5
Portable_BMUConnectCharger      *       &6
Portable_SupportsSpeed          *       &1
Portable_SupportsIdle           *       &10
Portable_SupportsStop           *       &20
Portable_RestartKeyboard        *       &1
Portable_RestartClock           *       &2
Portable_StatusDockStationPresent *       &1
Portable_StatusFloppyConnected  *       &2
Portable_StatusTrackerballConnected *       &4
Portable_StatusLCDInUse         *       &8
Portable_PowerDown              *       &0
Portable_PowerUp                *       &1
Portable_PowerTidyUp            *       &2
Portable_PowerAboutToFreeze     *       &3
Portable_PowerAwakened          *       &4
Portable_PowerWishesToFreeze    *       &5

;Symbols for structure offsets and sizes
        ^       0
        #       Bits
Portable_ControlFlags           *       @

        ^       0
        #       Int
Portable_BMUVariable            *       @

        ^       0
        #       Bits
Portable_BMUFlags               *       @

        ^       0
        #       Bits
Portable_ProcessorSpeed         *       @

        ^       0
        #       Int
Portable_BMUCommand             *       @

        ^       0
        #       Bits
Portable_Features               *       @

        ^       0
        #       Int
Portable_RestartType            *       @

        ^       0
        #       Bits
Portable_StatusFlags            *       @

        ^       0
        #       Int
Portable_State                  *       @


;Symbols for SWI's and SWI reason codes
XPortable_Speed                 *       &62FC0
Portable_Speed                  *       &42FC0
   ;Entry
   ;  R0 = eor_mask (Bits)
   ;  R1 = and_mask (Bits)
   ;Exit
   ;  R0 = old_speed (Portable_ProcessorSpeed)
   ;  R1 = new_speed (Portable_ProcessorSpeed)

XPortable_Control               *       &62FC1
Portable_Control                *       &42FC1
   ;Entry
   ;  R0 = eor_mask (Bits)
   ;  R1 = and_mask (Bits)
   ;Exit
   ;  R0 = old_control (Portable_ControlFlags)
   ;  R1 = new_control (Portable_ControlFlags)

XPortable_ReadBMUVariable       *       &62FC2
Portable_ReadBMUVariable        *       &42FC2
   ;Entry
   ;  R0 = var (Portable_BMUVariable)
   ;Exit
   ;  R1 = value (Int)

XPortable_WriteBMUVariable      *       &62FC3
Portable_WriteBMUVariable       *       &42FC3
   ;Entry
   ;  R0 = var (Portable_BMUVariable)
   ;  R1 = value (Int)

XPortable_CommandBMU            *       &62FC4
Portable_CommandBMU             *       &42FC4

XPortable_ReadFeatures          *       &62FC5
Portable_ReadFeatures           *       &42FC5
   ;Exit
   ;  R1 = features (Portable_Features)

XPortable_Idle                  *       &62FC6
Portable_Idle                   *       &42FC6

XPortable_Stop                  *       &62FC7
Portable_Stop                   *       &42FC7
   ;Exit
   ;  R0 = restart (Portable_RestartType)

XPortable_Status                *       &62FC8
Portable_Status                 *       &42FC8
   ;Exit
   ;  R0 = flags (Portable_StatusFlags)

Service_Portable                *       &8A
   ;Entry
   ;  R1 = &8A
   ;  R2 = state (Portable_State)
   ;  R3 = ports (Bits)
   ;Exit
   ;  R1 = unclaimed (Bool)
   ;  R3 = ports_to_change (Bits)

Event_PortableBMU               *       &1C
   ;Entry
   ;  R0 = &1C
   ;  R1 = flags (Portable_BMUFlags)

        ]
        END
