;======================================================================
;
;	SetCPU V1.60
;	by Dave Haynie, April 13, 1990
;	Released to the Public Domain
;
;	Assembly Header File
;
;	All assembly files need this included
;
;======================================================================

;======================================================================
;
;	Macros & constants used herein.  The Manx assembler is supposed
;	to handle the 68881 and some of the 68020/30 instructions, but
;	these macros will help out on older assemblers, and complete the
;	set of instructions I need.
;
;======================================================================

CALLSYS		macro   *
		jsr     LVO\1(A6)
		endm

PMOVE_		macro	*
		ifc '\1','tc'
		    ifc '\2','(sp)'
			dc.w	$f017	; PMOVE tc,(sp)
			dc.w	$4200
			mexit
		    endc
		    ifc '\2','(a0)'
			dc.w	$f010	; PMOVE tc,(a0)
			dc.w	$4200
			mexit
		    endc
		endc
		ifc '\1','crp'
		    ifc '\2','(a0)'
			dc.w	$f010	; PMOVE	crp,(a0)
			dc.w	$4e00
			mexit
		    endc
		endc
		ifc '\1','(a0)'
		    ifc '\2','crp'
			dc.w	$f010	; PMOVE	(a0),crp
			dc.w	$4c00
			mexit
		    endc
		    ifc '\2','tc'
			dc.w	$f010	; PMOVE (a0),tc
			dc.w	$4000
			mexit
		    endc
		endc
		ifc '\1','(a1)'
		    ifc '\2','crp'
			dc.w	$f011	; PMOVE (a1),crp
			dc.w	$4c00
			mexit
		    endc
		endc
		endm
PFLUSHA_	macro	*
		dc.w	$f000
		dc.w	$2400
		endm

MOVEC_		macro	*
		ifc '\1','cacr'
		    ifc '\2','d0'
			dc.w	$4e7a	; MOVEC	cacr,d0
			dc.w	$0002
			mexit
		    endc
		    ifc '\2','d1'
			dc.w	$4e7a	; MOVEC	cacr,d1
			dc.w	$1002
			mexit
		    endc
		endc
		ifc '\2','cacr'
		    ifc '\1','d0'
			dc.w	$4e7b	; MOVEC d0,cacr
			dc.w	$0002
			mexit
		    endc
		    ifc '\1','d1'
			dc.w	$4e7b	; MOVEC d1,cacr
			dc.w	$1002
			mexit
		    endc
		endc
		ifc '\1','vbr'
		    ifc '\2','d0'
			dc.w	$4e7a	; MOVEC	vbr,d0
			dc.w	$0801
			mexit
		    endc
		endm

CIB_ENABLE	EQU	0
CIB_FREEZE	EQU	1
CIB_ENTRY	EQU	2
CIB_CLEAR	EQU	3
CIB_BURST	EQU	4

CDB_ENABLE	EQU	8
CDB_FREEZE	EQU	9
CDB_ENTRY	EQU	10
CDB_CLEAR	EQU	11
CDB_BURST	EQU	12
CDB_WALLOC	EQU	13

CIB_ENABLE40	EQU	15
CDB_ENABLE40	EQU	31

AFB_68030	EQU	2
AFB_68040	EQU	3
AFB_68882	EQU	5

ATNFLGS		EQU	$129

LVOSupervisor	EQU	-30
LVOSuperState	EQU	-150
LVOFindTask	EQU	-294
LVOAllocTrap	EQU	-342
LVOFreeTrap	EQU	-348
LVOCacheClearU	EQU	-636
LVOCacheControl	EQU	-648

ANYCREG		EQU	$00dff010

;======================================================================
;
;	Need just a little more stuff
;
;======================================================================

	NOLIST
	include "exec/types.i"
	include "exec/execbase.i"
	include "exec/tasks.i"
	LIST

;======================================================================
;
;	The assembly version of my tag structure
;
;======================================================================

 STRUCTURE	TAG,0
   ULONG 	TAG_TAGSIZE		; Size of this tag
   ULONG	TAG_PROGVER		; The program version
   APTR		TAG_MAINTABLE		; The main ROM table
   APTR		TAG_ROMHI		; The main ROM image
   UWORD 	TAG_ROMTYPE		; Type of MMU ROM
   UWORD 	TAG_PATCHES		; The number of other patches applied
   APTR 	TAG_PATCHLIST		; List of installed patches
   APTR		TAG_DEVS		; Translated device ROMs
   ULONG	TAG_TC			; Precomputed TC used for KICK.
   ULONG	TAG_CRP_0		; Precomputed CRP used for KICK.
   ULONG	TAG_CRP_1
   UWORD	TAG_CONFIG		; Configuration status.
   ULONG	TAG_BERRSIZE		; Size of bus error handler.
   APTR		TAG_OLDBERR		; The old BERR routine.
   APTR		TAG_BERRHANDLER		; My BERR routine.
   SHORT	TAG_WRAPUP		; Upper address wrap bound.
   SHORT	TAG_WRAPDOWN		; Lower address wrap bound.
   ULONG	TAG_TABLESIZE		; Main table size.
   APTR		TAG_RESETCODE		; Actual reset routine
   ULONG	TAG_ROMSIZE		; Size of ROM image
   ULONG	TAG_ROMLOC		; Where does the fool thing go?
   ULONG	TAG_ROMSTART		; And where do we start it up? 
   APTR		TAG_ROMLO		; Secondary ROM image, if needed
   APTR		TAG_SYSSTACK		; Physical system stack image
   ULONG	TAG_SYSSTKSIZE		; System Stack allocated size
   ULONG	TAG_RESETSIZE		; Size of the reset code.
   APTR		TAG_OLDRESET		; Old Reset Code
   LABEL	TAG_SIZE

;TAG_TC		EQU	28
;TAG_CRP_0	EQU	32
;TAG_RESETCODE	EQU	62
;TAG_ROMSTART	EQU	74

	machine mc68020
		mc68881

