
; Amnesia module header
; This header was part of the module code which was assembled using !ExtAsm.
; Copyright A.Southgate 1994 but may be freely distributed and used in the
; creation of other code.

#set Service_Amnesia=&80320; issued when the Amnesia area is discarded.
                           ; used by Stasis to kill sound voices.
#set errorlim	= 100
#set def_tables = 32       

; coordinate shift value

#set coordshift = 12

; block flags

#set BF_static		= 1
#set BF_qwa		= 1<<1
#set BF_intoff		= 1<<2

; area types

#set A_type_tidy	= 0
#set A_type_messy	= 1
#set A_type_static	= 2

; flags used is R2 during table processing/scanning

#set R_skip_advance	= 1
#set R_tst		= 1<<1
#set R_alive		= 1<<31

; flags used in R0 during table processing/scanning

#set PF_advance		= 1<<23
#set PF_plot		= 1<<22
#set PF_process		= 1<<21

; the Amnesia object flags

#set Amf_plot		= 1<<0
#set Amf_user_plot	= 1<<1
#set Amf_velocity	= 1<<2
#set Amf_gravity	= 1<<3
#set Amf_use_plot_ofs	= 1<<4
#set Amf_anim		= 1<<5
#set Amf_make_objsize	= 1<<6
#set Amf_colch		= 1<<7
#set Amf_attn_timer	= 1<<8
#set Amf_dest_timer	= 1<<9
#set Amf_attn		= 1<<10
#set Amf_timer2		= 1<<11
#set Amf_zero_vec	= 1<<12
#set Amf_game_horiz	= 1<<13
#set Amf_game_vert	= 1<<14
#set Amf_plot_window	= 1<<15
#set Amf_kill_window	= 1<<16
#set Amf_colch_window	= 1<<17
#set Amf_save		= 1<<18
#set Amf_reserved	= 1<<19
#set Amf_noleft		= 1<<20
#set Amf_noright	= 1<<21
#set Amf_noup		= 1<<22
#set Amf_nodown		= 1<<23
#set Amf_attn_mask	= &FF<<24

;imask are the events which are never returned to the user

#set Amf_imask  = Amf_plot + Amf_velocity + Amf_gravity + Amf_use_plot_ofs + Amf_anim + Amf_make_objsize + Amf_colch + Amf_dest_timer + Amf_zero_vec + Amf_plot_window + Amf_save + Amf_colch_window + Amf_timer2

; the variable block at R12

struct Amn_v {
  .areastart	DCD 0
  .areatype	DCD 0
  .areasize	DCD 0
  .gamewindow	DBD 4; 4 words
  .plotwindow	DBD 4; 4 words
  .killwindow	DBD 4; 4 words
  .plotxofs     DCD 0
  .plotyofs	DCD 0
  .gravx	DCD 0
  .gravy	DCD 0
  .colch0	DCD 0
  .colch1	DCD 0
  .colch3	DCD 0
  .colchsave	DBD 4; 4 words - save area for colch regs
  .colchboxes	DBD 8; 8 words - store area for bounding boxes
  .errorctr	DCD 0
  .errorblock   DCD 0
  .errortable   DCD 0
  .buffer 	DBD 16 ; 16 words
  .temp0  	DCD 0
  .temp1  	DCD 0
  .temp2  	DCD 0
  .sizeof
}

; the block header structure

struct Amn_b {
  .id		DCD 0
  .ptr  	DCD 0
  .name		DBB 8 ; 8 bytes
  .size		DCD 0
  .flags	DCD 0
  .sizeof
}

; the table header structure

struct Amn_t {
  .id		DCD 0
  .ptr 		DCD 0
  .name		DBB 8 ; 8 bytes
  .size		DCD 0
  .flags	DCD 0
  .objsize	DCD 0
  .number	DCD 0
  .tabflags	DCD 0
  .next		DCD 0
  .sizeof
}

; the saved table file header

struct Amn_save {
  .id		DCD 0
  .name		DBB 8 ; 8 bytes
  .objsize	DCD 0
  .number	DCD 0
  .gap		DCD 0
  .sizeof
}

; the area header (block 0)

struct Amn_h {
  .id		DCD 0
  .ptr		DCD 0
  .name		DBB 8 ; 8 bytes
  .size		DCD 0
  .flags	DCD 0
  .type		DCD 0
  .areasize	DCD 0
  .tlist	DCD 0
  .sizeof
}

; the object structure

struct Amn_o {
  .type		DCD 0
  .flags	DCD 0
  .x		DCD 0
  .y		DCD 0
  .xvec		DCD 0
  .yvec		DCD 0
  .timer	DCD 0
  .size		DCD 0
  .timer2	DCD 0
  .sizeof
}

; the collision checking table header

struct Amn_c {	
  .id		DCD 0
  .ptr		DCD 0
  .name		DBB 8 ; 8 bytes
  .size		DCD 0
  .flags	DCD 0
  .writeofs	DCD 0
  .sizeof
}

; a collision checking table entry
  
struct Amn_cent {
  .ofs		DCD 0
  .minx         DCD 0
  .miny         DCD 0
  .maxx         DCD 0
  .maxy         DCD 0
  .sizeof
} 

;the table list header
  
struct Amn_tlist {
  .number	DCD 0
  .sizeof
}
