home *** CD-ROM | disk | FTP | other *** search
- /* This source file is part of the LynxLib miscellaneous library by
- Robert Fischer, and is Copyright 1990 by Robert Fischer. It costs no
- money, and you may not make money off of it, but you may redistribute
- it. It comes with ABSOLUTELY NO WARRANTY. See the file LYNXLIB.DOC
- for more details.
- To contact the author:
- Robert Fischer \\80 Killdeer Rd \\Hamden, CT 06517 USA
- (203) 288-9599 fischer-robert@cs.yale.edu */
-
- #ifndef TOSMEM_H
- #define TOSMEM_H
-
- #ifndef TOS_H
- #include <tos.h>
- #endif
-
- #ifndef STDDEF_H
- #include <stddef.h>
- #endif
-
- typedef struct PD
- {
- long p_lowtpa; /* -> base of TPA */
- long p_hitpa; /* -> end of TPA */
- long p_tbase; /* -> base of text segment */
- long p_tlen; /* size of text segment */
- long p_dbase; /* -> base of data segment */
- long p_dlen; /* size of data segment */
- long p_bbase; /* -> base of BSS segment */
- long p_blen; /* size of BSS segment */
- TRANS_BUF *p_dta; /* Disk Transfer Address (DTA) */
- struct PD *p_parent; /* -> parent's PD */
- long dummy1; /********** ??? **********/
- char *p_env; /* -> environment string */
- char p_stdhdl[6]; /* assigned device handles to standard devices */
- /* stdhdl: 0=stdin,1=stdout,2=stdaux,3=stdprn */
- /* devhdl: 0xff=CON:,0xfe=AUX:,0xfd=PRN: */
- char dummy2; /********** ??? **********/
- char p_curdrv; /* default drive */
- char dummy3[72]; /********** ??? **********/
- char p_cmdlin[128]; /* commandline image */
- }
- /* typedef */ BASEPAGE;
-
- extern BASEPAGE _start[];
- #define BP (&_start[-1])
-
-
- /* ------------------- Disk Boot Sector --------------------- */
- typedef BYTE SEC[512];
-
- /* Boot sector offsets, cf. pg 739 of dev. kit documentation */
- #define BS_BRANCH 0x0
- #define BS_RESERVED 0x2
- #define BS_SERIAL 0x8
- #define BS_BPS 0xB
- #define BS_SPC 0xD
- #define BS_RES 0xE
- #define BS_NFATS 0x10
- #define BS_NDIRS 0x11
- #define BS_NSECTS 0x13
- #define BS_MEDIA 0x15
- #define BS_SPF 0x16
- #define BS_SPT 0x18
- #define BS_NSIDES 0x1A
- #define BS_NHID 0x1C
- #define BS_BOOT_CODE 0x1E
-
- /* ------------------------ The FAT---------------------------- */
- #define FAT_SECT 1 /* Starting sector of the first FAT */
-
-
- /* ----------------------- Memory Descriptor ------------------ */
- typedef struct MD
- {
- struct MD *m_link; /* -> next MD (or NULL) */
- char *m_start; /* -> base of block */
- LONG m_length; /* #bytes in block */
- BASEPAGE *m_own; /* owner's PD */
- }
- /* typedef */ MD;
-
- /* ------------------- Memory Parameter Block ---------------- */
-
- typedef struct MPB
- {
- MD *mp_mfl; /* -> memory free list */
- MD *mp_mal; /* -> memory allocated list */
- MD *mp_rover; /* roving ptr */
- }
- /* typedef */ MPB;
-
- /* ------------------ System Header Block ---------------------- */
- /* */
- /* This structure is pointed to by SYSBASE (0x4f2) */
-
- typedef struct os_header {
- unsigned bra; /* (0x0) branch to reset handler */
- unsigned version; /* (0x2) TOS version number */
- char *reset_handler; /* (0x4) pointer to reset handler */
- struct os_header *sysbase;/* (0x8) pointer to this block */
- char *osram_end; /* (0xc) pointer to end of os ram */
- long junk1; /* (0x10) (unused) */
- char *magic; /* (0x14) pointer to GEM mem usage block */
- long build_date; /* (0x18) system build date */
- unsigned os_config; /* (0x1c) OS configuration bits */
- unsigned tos_date; /* (0x1e) TOS system build date */
- char *root; /* (0x20) pointer to OS pool */
- unsigned *kbshift; /* (0x24) pointer to keyboard shift word */
- BASEPAGE **run; /* (0x28) pointer to current process ptr */
- } OS_HEADER;
-
- #endif
-