@ GNU AS assembler header file for OSWord
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:47:40 2012
@ Jonathan Coxhead, jonathan@doves.demon.co.uk, 7 Sept 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 OSWord_Hdr
#  define OSWord_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 OSWordReadClock_OpLocalString 0x0
#  define OSWordReadClock_OpLocalBCD 0x1
#  define OSWordReadClock_OpConvertBCDToString 0x2
#  define OSWordReadClock_OpUTC 0x3
#  define OSWordWriteClock_OpTimeLocalString 0x8
#  define OSWordWriteClock_OpDateLocalString 0xf
#  define OSWordWriteClock_OpLocalString 0x18
#  define OSWordPointer_OpDefine 0x0
#  define OSWordPointer_OpSetBBox 0x1
#  define OSWordPointer_OpStep 0x2
#  define OSWordPointer_OpSetPosition 0x3
#  define OSWordPointer_OpReadPosition 0x4
#  define OSWordPointer_OpSetUnlinkedPosition 0x5
#  define OSWordPointer_OpReadUnlinkedPosition 0x6
#  define OSWordPointer_OpReadBBox 0x7
#  define OSWord_CharDefinitionECF1 0x2
#  define OSWord_CharDefinitionECF2 0x3
#  define OSWord_CharDefinitionECF3 0x4
#  define OSWord_CharDefinitionECF4 0x5
#  define OSWord_CharDefinitionDotDashPattern 0x6

@Symbols for structure offsets and sizes
        .struct 0
        .skip   Byte
OSWordReadClock_Op             : 

        .struct 0
        .skip   Byte
OSWordWriteClock_Op            : 

        .struct 0
        .skip   Byte
OSWordPointer_Op               : 

        .struct 0
OSWord_TimerBlock_b            : .skip   5*Byte
OSWord_TimerBlock              : 

        .struct 0
OSWord_CharDefinitionBlock_c   : .skip   Char
OSWord_CharDefinitionBlock_definition: .skip   8*Byte
OSWord_CharDefinitionBlock     : 

        .struct 0
OSWord_PaletteBlock_gcol       : .skip   OS_GCOL
OSWord_PaletteBlock_colour_number: .skip   Byte
OSWord_PaletteBlock_r          : .skip   Byte
OSWord_PaletteBlock_g          : .skip   Byte
OSWord_PaletteBlock_b          : .skip   Byte
OSWord_PaletteBlock            : 

        .struct 0
OSWord_CursorPositionBlock_xprev: .skip   Short
OSWord_CursorPositionBlock_yprev: .skip   Short
OSWord_CursorPositionBlock_x   : .skip   Short
OSWord_CursorPositionBlock_y   : .skip   Short
OSWord_CursorPositionBlock     : 

        .struct 0
OSWordReadClock_LocalStringBlock_op: .skip   OSWordReadClock_Op
        .struct 0
OSWordReadClock_LocalStringBlock_string_c: .skip   Char
OSWordReadClock_LocalStringBlock: 

        .struct 0
OSWordReadClock_LocalBCDBlock_op: .skip   OSWordReadClock_Op
        .struct 0
OSWordReadClock_LocalBCDBlock_date_and_time: .skip   OS_BCDDateAndTime
OSWordReadClock_LocalBCDBlock  : 

        .struct 0
OSWordReadClock_ConvertBCDToStringBlock_bcd_op: .skip   OSWordReadClock_Op
OSWordReadClock_ConvertBCDToStringBlock_bcd_date_and_time: .skip   OS_BCDDateAndTime
        .struct 0
OSWordReadClock_ConvertBCDToStringBlock_string_c: .skip   Char
OSWordReadClock_ConvertBCDToStringBlock: 

        .struct 0
OSWordReadClock_UTCBlock_op    : .skip   OSWordReadClock_Op
        .struct 0
OSWordReadClock_UTCBlock_utc   : .skip   OS_DateAndTime
OSWordReadClock_UTCBlock       : 

        .struct 0
OSWordWriteClock_Block_op      : .skip   OSWordWriteClock_Op
OSWordWriteClock_Block_string  : .skip   Char
OSWordWriteClock_Block         : 
        
        .altmacro
        .macro  OSWordWriteClock_Block_MEMBERS label
\label&_op                     : .skip   OSWordWriteClock_Op
        .endm
        
        .struct 0
        OSWordWriteClock_Block_MEMBERS OSWordWriteClock_BlockBase
OSWordWriteClock_BlockBase     : 

        .struct 0
OSWordPointer_DefineBlock_reserved: .skip   2*Byte
OSWordPointer_DefineBlock_op   : .skip   OSWordPointer_Op
OSWordPointer_DefineBlock_shape_no: .skip   Byte
OSWordPointer_DefineBlock_width: .skip   Byte
OSWordPointer_DefineBlock_height: .skip   Byte
OSWordPointer_DefineBlock_xactive: .skip   Byte
OSWordPointer_DefineBlock_yactive: .skip   Byte
OSWordPointer_DefineBlock_data : .skip   Ptr
OSWordPointer_DefineBlock      : 

        .struct 0
OSWordPointer_BBoxBlock_reserved: .skip   3*Byte
OSWordPointer_BBoxBlock_op     : .skip   OSWordPointer_Op
OSWordPointer_BBoxBlock_x0     : .skip   Short
OSWordPointer_BBoxBlock_y0     : .skip   Short
OSWordPointer_BBoxBlock_x1     : .skip   Short
OSWordPointer_BBoxBlock_y1     : .skip   Short
OSWordPointer_BBoxBlock        : 

        .struct 0
OSWordPointer_StepBlock_op     : .skip   OSWordPointer_Op
OSWordPointer_StepBlock_xstep  : .skip   Byte
OSWordPointer_StepBlock_ystep  : .skip   Byte
OSWordPointer_StepBlock        : 

        .struct 0
OSWordPointer_PositionBlock_reserved: .skip   Byte
OSWordPointer_PositionBlock_op : .skip   OSWordPointer_Op
OSWordPointer_PositionBlock_x  : .skip   Short
OSWordPointer_PositionBlock_y  : .skip   Short
OSWordPointer_PositionBlock    : 

        .struct 0
OSWord_ScreenBaseBlock_reserved: .skip   3*Byte
OSWord_ScreenBaseBlock_type    : .skip   Byte
OSWord_ScreenBaseBlock_base    : .skip   Ptr
OSWord_ScreenBaseBlock         : 

        .struct 0
OSWord_Block_timer             : .skip   OSWord_TimerBlock
        .struct 0
OSWord_Block_char_definition   : .skip   OSWord_CharDefinitionBlock
        .struct 0
OSWord_Block_palette           : .skip   OSWord_PaletteBlock
        .struct 0
OSWord_Block_cursor_position   : .skip   OSWord_CursorPositionBlock
        .struct 0
OSWord_Block_string            : .skip   OSWordReadClock_LocalStringBlock
        .struct 0
OSWord_Block_bcd               : .skip   OSWordReadClock_LocalBCDBlock
        .struct 0
OSWord_Block_convert_bcd_to_string: .skip   OSWordReadClock_ConvertBCDToStringBlock
        .struct 0
OSWord_Block_utc               : .skip   OSWordReadClock_UTCBlock
        .struct 0
OSWord_Block_write_clock       : .skip   OSWordWriteClock_Block
        .struct 0
OSWord_Block_pointer_define    : .skip   OSWordPointer_DefineBlock
        .struct 0
OSWord_Block_pointer_bbox      : .skip   OSWordPointer_BBoxBlock
        .struct 0
OSWord_Block_pointer_step      : .skip   OSWordPointer_StepBlock
        .struct 0
OSWord_Block_pointer_position  : .skip   OSWordPointer_PositionBlock
        .struct 0
OSWord_Block_screen_base       : .skip   OSWord_ScreenBaseBlock
        .struct 0
OSWord_Block_reserved          : .skip   64*Char
OSWord_Block                   : 


@Symbols for SWI's and SWI reason codes
.set XOS_Word,0x20007
.set OS_Word,0x7

#  define OSWord_ReadLine 0x0

#  define OSWord_ReadSystemClock 0x1
   @Entry
   @  R0 = &1
   @  R1 = clock (pointer to OSWord_TimerBlock)

#  define OSWord_WriteSystemClock 0x2
   @Entry
   @  R0 = &2
   @  R1 -> clock (OSWord_TimerBlock)

#  define OSWord_ReadIntervalTimer 0x3
   @Entry
   @  R0 = &3
   @  R1 = timer (pointer to OSWord_TimerBlock)

#  define OSWord_WriteIntervalTimer 0x4
   @Entry
   @  R0 = &4
   @  R1 -> timer (OSWord_TimerBlock)

#  define OSWord_ReadIOSpace 0x5

#  define OSWord_WriteIOSpace 0x6

#  define OSWord_Sound 0x7

#  define OSWord_Envelope 0x8

#  define OSWord_ReadGCOL 0x9

#  define OSWord_ReadCharDefinition 0xa
   @Entry
   @  R0 = &A
   @  R1 = definition (pointer to OSWord_CharDefinitionBlock)

#  define OSWord_ReadPalette 0xb
   @Entry
   @  R0 = &B
   @  R1 = entry (pointer to OSWord_PaletteBlock)

#  define OSWord_WritePalette 0xc
   @Entry
   @  R0 = &C
   @  R1 -> entry (OSWord_PaletteBlock)

#  define OSWord_ReadCursorPosition 0xd
   @Entry
   @  R0 = &D
   @  R1 = position (pointer to OSWord_CursorPositionBlock)

#  define OSWord_ReadClock 0xe

#  define OSWordReadClock_LocalString 0xe
   @Entry
   @  R0 = &E
   @  R1 = string (pointer to OSWordReadClock_LocalStringBlock)

#  define OSWordReadClock_LocalBCD 0xe
   @Entry
   @  R0 = &E
   @  R1 = bcd (pointer to OSWordReadClock_LocalBCDBlock)

#  define OSWordReadClock_ConvertBCDToString 0xe
   @Entry
   @  R0 = &E
   @  R1 = convert_bcd_to_String (pointer to OSWordReadClock_ConvertBCDToStringBlock)

#  define OSWordReadClock_UTC 0xe
   @Entry
   @  R0 = &E
   @  R1 = utc (pointer to OSWordReadClock_UTCBlock)

#  define OSWord_WriteClock 0xf

#  define OSWordWriteClock_TimeLocalString 0xf
   @Entry
   @  R0 = &F
   @  R1 = time (pointer to OSWordWriteClock_Block)

#  define OSWordWriteClock_DateLocalString 0xf
   @Entry
   @  R0 = &F
   @  R1 = date (pointer to OSWordWriteClock_Block)

#  define OSWordWriteClock_DateAndTimeLocalString 0xf
   @Entry
   @  R0 = &F
   @  R1 = date_and_time (pointer to OSWordWriteClock_Block)

#  define OSWord_EconetTransmit 0x10

#  define OSWord_EconetReceive 0x11

#  define OSWord_EconetMiscOp 0x12

#  define OSWord_EconetImmediateOp 0x13

#  define OSWord_EconetFSOp 0x14

#  define OSWord_Pointer 0x15

#  define OSWordPointer_Define 0x15
   @Entry
   @  R0 = &15
   @  R1 = &2 + define (pointer to OSWordPointer_DefineBlock)

#  define OSWordPointer_SetBBox 0x15
   @Entry
   @  R0 = &15
   @  R1 = &3 + bbox (pointer to OSWordPointer_BBoxBlock)

#  define OSWordPointer_Step 0x15
   @Entry
   @  R0 = &15
   @  R1 -> step (OSWordPointer_StepBlock)

#  define OSWordPointer_SetPosition 0x15
   @Entry
   @  R0 = &15
   @  R1 = &1 + pos (pointer to OSWordPointer_PositionBlock)

#  define OSWordPointer_ReadPosition 0x15
   @Entry
   @  R0 = &15
   @  R1 = &1 + pos (pointer to OSWordPointer_PositionBlock)

#  define OSWordPointer_SetUnlinkedPosition 0x15
   @Entry
   @  R0 = &15
   @  R1 = &1 + pos (pointer to OSWordPointer_PositionBlock)

#  define OSWordPointer_ReadUnlinkedPosition 0x15
   @Entry
   @  R0 = &15
   @  R1 = &1 + pos (pointer to OSWordPointer_PositionBlock)

#  define OSWordPointer_ReadBBox 0x15
   @Entry
   @  R0 = &15
   @  R1 = &3 + bbox (pointer to OSWordPointer_BBoxBlock)

#  define OSWord_WriteScreenBase 0x16
   @Entry
   @  R0 = &16
   @  R1 = &3 + screen_base (pointer to OSWord_ScreenBaseBlock)

#  define WordV 0x7

#endif
