;    s.ModeExHdr
;
;******************************************************************************
;
;    This file is assembled with ObjAsm to an object file. This is linked with
;    another object file containing the body of ModeEx to form a relocatable
;    module providing an extra 'soft' screen mode: Mode 63.
;
;    The module header code included here may be useful for adjustment to form
;    the headers of other relocatable modules.
;
;    Points demonstrated here include:
;        - Constructing a relocatable module using assembly language
;        - ObjAsm directives
;        - GETting header files
;

; Use the GET directive to include a list of SWI names as if typed here

        GET     ^.AsmHdrs.h.SWINames

; symbol IMPORTs and AREA directive

        AREA    |!!!Module$$Header|, CODE, READONLY

        IMPORT  |__RelocCode|            ; Link symbol for relocation routine

        IMPORT  |ModeEx_Service|         ; service call handler in RM body
        IMPORT  |ModeEx_FastService|     ; fast service call handler in RM body


Service_ModeExtension * &50

;******************************************************************************
;
;   Module code starts here
;

        ENTRY

Module_BaseAddr
        DCD     RM_Start   -Module_BaseAddr
        DCD     RM_Init    -Module_BaseAddr
        DCD     RM_Die     -Module_BaseAddr
        DCD     RM_Service -Module_BaseAddr  ; IMPORTed
        DCD     RM_Title   -Module_BaseAddr
        DCD     RM_HelpStr -Module_BaseAddr
        DCD     RM_HC_Table-Module_BaseAddr
 [ {CONFIG}<>26
        DCD     0                            ; SWI base
        DCD     0                            ; SWI table
        DCD     0                            ; SWI handler
        DCD     0                            ; SWI decoding code
        DCD     0                            ; Messages filename
        DCD     RM_Flags   -Module_BaseAddr
 ]

RM_Title
        =       "ModeEx", 0

RM_HelpStr
        =       "ModeEx", 9, 9
        =       "0.03 (05 Sep 2002)", 0
        ALIGN

 [ {CONFIG}<>26
RM_Flags
        DCD     1       ; 32-bit compatible
 ]

;******************************************************************************
;
;       RM_Start - Start entry point for entry as current application
;

RM_Start * Module_BaseAddr          ; set table entry to zero, as ModeEx is
                                    ; only a service module, not an application

;******************************************************************************
;
;       RM_Init - Initialisation entry point
;

RM_Init
        STMDB   r13!, {r14}
        BL      |__RelocCode|       ; initialise absolute code pointers

; if any workspace is needed, claim it here

        LDMIA   r13!, {r15}

;******************************************************************************
;
;       RM_Die - Die entry
;

; if any workspace is needed, free it here

RM_Die * Module_BaseAddr            ; set table entry to zero

;******************************************************************************
;
;       RM_Service - Service call handler
;
RM_ServiceTable                                        ; Fast service call table (for RISC OS 4 and above)
        DCD     0                                      ; Flags word: unused at present
        DCD     |ModeEx_FastService| - Module_BaseAddr ; Offset of fast service call entry point
        DCD     Service_ModeExtension                  ; Service call numbers list (in ascending order)
        DCD     0                                      ; End of list
RM_Service
        MOV     R0, R0
        B       |ModeEx_Service|    ; jump to routine in module body

;******************************************************************************
;
;       RM_HC_Table - Help and command keyword table
;

RM_HC_Table * Module_BaseAddr       ; set table entry to zero
                                    ; as module supports no *commands


        END
