;----------------------------------------------------------------------------
;
; $Source: /cvsroot/riscossmbserver/smbserver/src/riscos/s/asm_dec,v $
; $Date: 1999/05/16 12:00:08 $
; $Revision: 1.1 $
; $State: Exp $
; $Author: david $
;
; Declare registers and SWIs we will be calling.
;
; $Log: asm_dec,v $
; Revision 1.1  1999/05/16 12:00:08  david
; Initial revision
;
; Revision 1.1  1996/11/06 22:01:41  unixlib
; Initial revision
;
; Revision 1.5  1996/10/30 21:58:59  unixlib
; Massive changes made by Nick Burret and Peter Burwood.
;
; Revision 1.4  1996/09/16 21:23:51  unixlib
; CL_0002 Nick Burret
; Minor changes to file handling
; Change most error numbers, and use in assembler sources (SJC)
; Various minor bug fixes and compatability changes.
;
; Revision 1.3  1996/07/21 22:15:12  unixlib
; CL_0001 Nick Burret
; Improve memory handling. Remove C++ library incompatibilities.
; Improve file stat routines.
;
; Revision 1.2  1996/05/06 09:01:33  unixlib
; Updates to sources made by Nick Burrett, Peter Burwood and Simon Callan.
; Saved for 3.7a release.
;
; Revision 1.1  1996/04/19 22:02:19  simon
; Initial revision
;
;----------------------------------------------------------------------------

; Bits that control which bits are compiled into UnixLib. Note, this must be
; kept in sync with <sys/syslib.h>, <signal.h> and <errno.h>.

; Is an alloca() failure fatal? Nick says yes, Linux says no.
ALLOCA_FATAL    EQU    1
; Do paranoid checks ?
PARANOID    EQU    1
; Use dynamic areas for heap on RISC OS 3.5+
DYNAMIC_AREA    EQU    1
; Align things to 4K boundaries for exec
|__4K_BOUNDARY|    EQU    0

; registers

r0    RN    0
r1    RN    1
r2    RN    2
r3    RN    3
r4    RN    4
r5    RN    5
r6    RN    6
r7    RN    7
r8    RN    8
r9    RN    9
r10    RN    10
r11    RN    11
r12    RN    12
r13    RN    13
r14    RN    14
r15    RN    15

a1    RN    0    ; Argument 1
a2    RN    1    ; Argument 2
a3    RN    2    ; Argument 3
a4    RN    3    ; Argument 4
v1    RN    4    ; Variable 1
v2    RN    5    ; Variable 2
v3    RN    6    ; Variable 3
v4    RN    7    ; Variable 4
v5    RN    8    ; Variable 5
v6    RN    9    ; Variable 6

sl    RN    10    ; Stack limit / stack chunk handle
fp    RN    11    ; frame pointer
ip    RN    12    ; Tempory workspace, used in procedure entry
sp    RN    13    ; Stack pointer
lr    RN    14    ; Link register
pc    RN    15    ; Program counter

f0    FN    0
f1    FN    1
f2    FN    2
f3    FN    3
f4    FN    4
f5    FN    5
f6    FN    6
f7    FN    7

NFlag    EQU    &80000000    ; Negative flag
ZFlag    EQU    &40000000    ; Zero flag
CFlag    EQU    &20000000    ; Carry flag
VFlag    EQU    &10000000    ; Overflow flag
IFlag    EQU    &08000000    ; IRQ disable
FFlag    EQU    &04000000    ; FIRQ disable


    MACRO
    NAME    $name
    DCB    "$name",0
    ALIGN
    DCD    &FF000000 + (:LEN: "$name"+3) :AND &FFFFFFFC
    MEND

EXIT_SUCCESS    EQU    0
EXIT_FAILURE    EQU    1

SIGHUP    EQU    1    ;   hangup
SIGINT    EQU    2    ;   terminal interrupt
SIGQUIT EQU    3    ; * ^\ from terminal
SIGILL    EQU    4    ; * illegal instruction
SIGTRAP EQU    5    ; * trace trap - unused
SIGIOT    EQU    6    ;   abort
SIGABRT EQU    6    ;   abort
SIGEMT    EQU    7    ; * EMT (h/ware error)
SIGFPE    EQU    8    ; * FPE trap
SIGKILL EQU    9    ;   kill signal
SIGBUS    EQU    10    ; * bus error
SIGSEGV EQU    11    ; * segmentation violation
SIGSYS    EQU    12    ; * bad system call
SIGPIPE EQU    13    ;   broken pipe
SIGALRM EQU    14    ;   alarm call
SIGTERM EQU    15    ;   termination signal
SIGURG    EQU    16    ;   urgent or out-of-band data
SIGSTOP    EQU    17    ;   stop, unblockable
SIGTSTP    EQU    18    ;   keyboard stop
SIGCONT    EQU    19    ;   continue
SIGCHLD    EQU    20    ;   child process has terminated/stopped
SIGCLD    EQU    SIGCHLD
SIGTTIN    EQU    21    ;   background read from tty
SIGTTOU    EQU    22    ;   background write to tty
SIGIO    EQU    23    ;   file descriptor is ready to perform I/O
SIGPOLL    EQU    SIGIO
SIGXCPU    EQU    24    ;   CPU time limit exceeded
SIGXFSZ    EQU    25    ;   file size limit exceeded
SIGVTALRM EQU    26    ;   alarm call
SIGPROF EQU    27    ;   profiler alarm call
SIGWINCH EQU    28    ;   window size change
SIGINFO EQU    29    ;   information request
SIGUSR1 EQU    30    ;   user signal 1
SIGUSR2 EQU    31    ;   user signal 2
SIGLOST EQU    32    ;   resource lost
SIGERR    EQU    33    ;   RiscOS error

EOPSYS    EQU    106    ; RISC OS error

OS_WriteS    EQU    &000001
OS_NewLine    EQU    &000003
OS_Exit        EQU    &000011
OS_EnterOS    EQU    &000016
OS_GenerateError    EQU    &00002B

X_Bit    EQU    &20000

XOS_WriteC            EQU    &000000 + X_Bit
XOS_WriteS            EQU    &000001 + X_Bit
XOS_Write0            EQU    &000002 + X_Bit
XOS_NewLine            EQU    &000003 + X_Bit
XOS_ReadC            EQU    &000004 + X_Bit
XOS_CLI                EQU    &000005 + X_Bit
XOS_Byte            EQU    &000006 + X_Bit
XOS_Word            EQU    &000007 + X_Bit
XOS_File            EQU    &000008 + X_Bit
XOS_Args            EQU    &000009 + X_Bit
XOS_GBPB            EQU    &00000C + X_Bit
XOS_Find            EQU    &00000D + X_Bit
XOS_GetEnv            EQU    &000010 + X_Bit
XOS_IntOn            EQU    &000013 + X_Bit
XOS_EnterOS            EQU    &000016 + X_Bit

XOS_SetCallBack            EQU    &00001B + X_Bit
XOS_Module            EQU    &00001E + X_Bit
XOS_ReadVarVal            EQU    &000023 + X_Bit
XOS_FSControl            EQU    &000029 + X_Bit
XOS_ChangeDynamicArea        EQU    &00002A + X_Bit
XOS_CallAfter            EQU    &00003B + X_Bit
XOS_CallEvery            EQU    &00003C + X_Bit
XOS_RemoveTickerEvent        EQU    &00003D + X_Bit
XOS_ChangeEnvironment        EQU    &000040 + X_Bit
XOS_ReadMonotonicTime        EQU    &000042 + X_Bit
XOS_WriteN            EQU    &000046 + X_Bit
XOS_ReadMemMapInfo        EQU    &000051 + X_Bit
XOS_AddCallBack            EQU    &000054 + X_Bit
XOS_SerialOp            EQU    &000057 + X_Bit
XOS_DynamicArea            EQU    &000066 + X_Bit
XOS_PlatformFeatures        EQU    &00006D + X_Bit
XOS_SynchroniseCodeAreas    EQU    &00006E + X_Bit
XOS_CallASWI            EQU    &00006F + X_Bit
XOS_CallASWIR12            EQU    &000071 + X_Bit
XOS_ConvertHex8            EQU    &0000D4 + X_Bit

XFPEmulator_Version        EQU    &040480 + X_Bit
XSharedCLibrary_LibInitAPCS_R    EQU    &080681 + X_Bit
XSharedCLibrary_LibInitModule    EQU    &080682 + X_Bit

XMessageTrans_ErrorLookup    EQU    &041506 + X_Bit

XTaskWindow_TaskInfo        EQU    &043380 + X_Bit

    END
