#ifndef FILES_SEGMENTS_H
#define FILES_SEGMENTS_H TRUE

/*
**   $VER: segments.h V0.8B
**
**   Segment Definitions.
**
**   (C) Copyright 1996-1997 DreamWorld Productions.
**       All Rights Reserved.
*/

#ifndef DPKERNEL_H
#include <games/dpkernel.h>
#endif

/****************************************************************************
** Segment object.
*/

#define SEGVERSION   1
#define TAGS_SEGMENT (ID_SPCTAGS<<16)|ID_SEGMENT

struct Segment {
  struct Head Head;        /* 00: Standard structure header */
  struct Segment *Prev;    /* 12: Previous segment */
  struct Segment *Next;    /* 16: Next segment */
  LONG   MemType;          /* 20: Memory type (eg MEM_DATA) */
  APTR   Address;          /* 24: Pointer to segment start */
  struct FileName *Source; /* 28: Source of segment */

  /* Private fields below */

  APTR   prvDOSSeg;
};

#define SGA_Prev     (12|TAPTR)
#define SGA_Next     (16|TAPTR)
#define SGA_MemType  (20|TLONG)
#define SGA_Source   (28|TAPTR)

/****************************************************************************
** This structure is identical to the standard segment struct but defines
** the Address as a function (ANSI-C prevents function<->data type
** conversion).
*/

struct CodeSegment {
  struct Head Head;
  struct Segment *Prev;
  struct Segment *Next;
  LONG   MemType;
  __asm void (*Address)(register __d0 LONG ID,
                        register __d1 LONG Version,
                        register __d2 LONG Revision,
                        register __a1 struct DPKBase *,
                        register __a0 BYTE *Arguments);
  struct FileName *Source;

  /*** Private fields below ***/

  APTR   prvDOSSeg;
};

#endif /* FILES_SEGMENTS_H */
