;
; header
;
; Standard header
;
;  1994-1998 Straylight
;

;----- Licensing note -------------------------------------------------------
;
; This file is part of Straylight's core library (corelib).
;
; Corelib 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 2, or (at your option)
; any later version.
;
; Corelib 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 Corelib.  If not, write to the Free Software Foundation,
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

		[	:LNOT::DEF:header__dfn
		GBLL	header__dfn

;----- Register names -------------------------------------------------------

; --- The standard ones ---

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

; --- Standard pseudonyms ---

SP		RN	13
LR		RN	14
PC		RN	15

; --- Lowercase version ---

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

; --- APCS names ---

a1		RN	0
a2		RN	1
a3		RN	2
a4		RN	3
v1		RN	4
v2		RN	5
v3		RN	6
v4		RN	7
v5		RN	8
v6		RN	9
sl		RN	10
fp		RN	11
ip		RN	12
sp		RN	13
lr		RN	14
pc		RN	15

; --- Floating point register names ---

F0		FN	0
F1		FN	1
F2		FN	2
F3		FN	3
F4		FN	4
F5		FN	5
F6		FN	6
F7		FN	7

; --- Lowercase floating point names ---

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

;----- ARM processor flags --------------------------------------------------

; --- Processor flags ---

FIQ_disable	EQU	1<<26
IRQ_disable	EQU	1<<27

V_flag		EQU	1<<28
C_flag		EQU	1<<29
Z_flag		EQU	1<<30
N_flag		EQU	1<<31

; --- Processor modes ---

USR_mode	EQU	0
FIQ_mode	EQU	1
IRQ_mode	EQU	2
SVC_mode	EQU	3

;----- Various useful macros ------------------------------------------------

; --- Macro: PAD ---
;
; Arguments:	len == length to pad to
;		string == the string to write
;		byte == byte to fill with (default == 0)
;
; Use:		Writes a string out, and pads it to a given length.  If the
;		string is too long, it gets truncated.


		MACRO
$label		PAD	$len,$string,$byte
		LCLA	b
		LCLA	i

		IF	"$len"=""
b		SETA	0
		ELSE
b		SETA	$byte
		ENDIF

		ALIGN
$label
i		SETA	:LEN: "$string"

		IF	i>$len
		DCB	"$string" :LEFT: $len
		ELSE
		DCB	"$string"
		WHILE	i<$len
		DCB	b
i		SETA	i+1
		WEND
		ENDIF

		MEND

; --- Macro: BARRIER ---
;
; Arguments:	--
;
; Use:		Inserts a cache barrier in the code (SWI &FF0000) for
;		executing dynamically-generated code.

		MACRO
$label		BARRIER
		ALIGN
$label
;		SWI	&F00000			;Covered by NDA currently
		MEND

;----- That's all, folks ----------------------------------------------------

		]

		END


