@ GNU AS assembler header file for Portable
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:50:01 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.

#ifndef Portable_Hdr
#  define Portable_Hdr

#  ifndef Get_Types
#    define Get_Types
#    include "oslib/Types.Hdr"
#  endif

#  ifndef Get_OS
#    define Get_OS
#    include "oslib/OS.Hdr"
#  endif

@Symbols for constants
#  define Portable_PortEconet 0x1
#  define Portable_PortSerial 0x8
#  define Portable_PortFDC 0x4000
#  define Portable_ControlEconetPowerEnabled 0x1
#  define Portable_ControlLCDPowerEnabled 0x2
#  define Portable_ControlExternalVideoEnabled 0x4
#  define Portable_ControlSerialEnabled 0x8
#  define Portable_ControlDualPanelEnabled 0x10
#  define Portable_ControlVideoClock 0x30
#  define Portable_ControlVideoClockShift 0x5
#  define Portable_ControlVideoClockExternal 0x0
#  define Portable_ControlVideoClockDividedCrystal 0x1
#  define Portable_ControlVideoClockCrystal 0x2
#  define Portable_ControlInvertVideoClock 0x80
#  define Portable_ControlBackLightEnabled 0x100
#  define Portable_ControlExtraDisplayLines 0x200
#  define Portable_ControlExtraDualPanelDRAM 0x400
#  define Portable_ControlSoundPowerEnabled 0x800
#  define Portable_ControlPCMCIAEnabled 0x1000
#  define Portable_ControlParallelEnabled 0x2000
#  define Portable_ControlFDCEnabled 0x4000
#  define Portable_ControlIDEEnabled 0x8000
#  define Portable_ControlLCDVideoInverted 0x10000
#  define Portable_ControlTrackerballEnabled 0x20000
#  define Portable_ControlMouseEnabled 0x40000
#  define Portable_BMUVariableVersion 0x0
#  define Portable_BMUVariableNominalCharge 0x1
#  define Portable_BMUVariableMeasuredCharge 0x2
#  define Portable_BMUVariableUsedCharge 0x3
#  define Portable_BMUVariableUsableCharge 0x4
#  define Portable_BMUVariableChargeEstimate 0x6
#  define Portable_BMUVariableInstVoltage 0x7
#  define Portable_BMUVariableInstCurrent 0x8
#  define Portable_BMUVariableInstTemperature 0x9
#  define Portable_BMUVariableFlags 0xa
#  define Portable_BMUVariableChargeRate 0xb
#  define Portable_BMUAtThreshold3 0x1
#  define Portable_BMUBatteryChanged 0x1
#  define Portable_BMULidOpen 0x2
#  define Portable_BMUAtThreshold2 0x4
#  define Portable_BMUBatteryFlat 0x4
#  define Portable_BMUAtThreshold1 0x8
#  define Portable_BMUBatteryLow 0x8
#  define Portable_BMUChargingFault 0x10
#  define Portable_BMUChargeStateKnown 0x20
#  define Portable_BMUBatteryPresent 0x40
#  define Portable_BMUChargerConnected 0x80
#  define Portable_SpeedFast 0x0
#  define Portable_SpeedSlow 0x1
#  define Portable_BMUPowerOff 0x0
#  define Portable_BMUSetAutostart 0x4
#  define Portable_BMUDisconnectCharger 0x5
#  define Portable_BMUConnectCharger 0x6
#  define Portable_SupportsSpeed 0x1
#  define Portable_SupportsIdle 0x10
#  define Portable_SupportsStop 0x20
#  define Portable_RestartKeyboard 0x1
#  define Portable_RestartClock 0x2
#  define Portable_StatusDockStationPresent 0x1
#  define Portable_StatusFloppyConnected 0x2
#  define Portable_StatusTrackerballConnected 0x4
#  define Portable_StatusLCDInUse 0x8
#  define Portable_PowerDown 0x0
#  define Portable_PowerUp 0x1
#  define Portable_PowerTidyUp 0x2
#  define Portable_PowerAboutToFreeze 0x3
#  define Portable_PowerAwakened 0x4
#  define Portable_PowerWishesToFreeze 0x5

@Symbols for structure offsets and sizes
        .struct 0
        .skip   Bits
Portable_ControlFlags          : 

        .struct 0
        .skip   Int
Portable_BMUVariable           : 

        .struct 0
        .skip   Bits
Portable_BMUFlags              : 

        .struct 0
        .skip   Bits
Portable_ProcessorSpeed        : 

        .struct 0
        .skip   Int
Portable_BMUCommand            : 

        .struct 0
        .skip   Bits
Portable_Features              : 

        .struct 0
        .skip   Int
Portable_RestartType           : 

        .struct 0
        .skip   Bits
Portable_StatusFlags           : 

        .struct 0
        .skip   Int
Portable_State                 : 


@Symbols for SWI's and SWI reason codes
.set XPortable_Speed,0x62fc0
.set Portable_Speed,0x42fc0
   @Entry
   @  R0 = eor_mask (Bits)
   @  R1 = and_mask (Bits)
   @Exit
   @  R0 = old_speed (Portable_ProcessorSpeed)
   @  R1 = new_speed (Portable_ProcessorSpeed)

.set XPortable_Control,0x62fc1
.set Portable_Control,0x42fc1
   @Entry
   @  R0 = eor_mask (Bits)
   @  R1 = and_mask (Bits)
   @Exit
   @  R0 = old_control (Portable_ControlFlags)
   @  R1 = new_control (Portable_ControlFlags)

.set XPortable_ReadBMUVariable,0x62fc2
.set Portable_ReadBMUVariable,0x42fc2
   @Entry
   @  R0 = var (Portable_BMUVariable)
   @Exit
   @  R1 = value (Int)

.set XPortable_WriteBMUVariable,0x62fc3
.set Portable_WriteBMUVariable,0x42fc3
   @Entry
   @  R0 = var (Portable_BMUVariable)
   @  R1 = value (Int)

.set XPortable_CommandBMU,0x62fc4
.set Portable_CommandBMU,0x42fc4

.set XPortable_ReadFeatures,0x62fc5
.set Portable_ReadFeatures,0x42fc5
   @Exit
   @  R1 = features (Portable_Features)

.set XPortable_Idle,0x62fc6
.set Portable_Idle,0x42fc6

.set XPortable_Stop,0x62fc7
.set Portable_Stop,0x42fc7
   @Exit
   @  R0 = restart (Portable_RestartType)

.set XPortable_Status,0x62fc8
.set Portable_Status,0x42fc8
   @Exit
   @  R0 = flags (Portable_StatusFlags)

#  define Service_Portable 0x8a
   @Entry
   @  R1 = &8A
   @  R2 = state (Portable_State)
   @  R3 = ports (Bits)
   @Exit
   @  R1 = unclaimed (Bool)
   @  R3 = ports_to_change (Bits)

#  define Event_PortableBMU 0x1c
   @Entry
   @  R0 = &1C
   @  R1 = flags (Portable_BMUFlags)

#endif
