]> Shamusworld >> Repos - rmac/blob - mark.h
3b2aa539efc76ad4202c2b66fb5a9d5e2cd89051
[rmac] / mark.h
1 //
2 // RMAC - Reboot's Macro Assembler for all Atari computers
3 // MARK.H - A record of things that are defined relative to any of the sections
4 // Copyright (C) 199x Landon Dyer, 2011-2017 Reboot and Friends
5 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
6 // Source utilised with the kind permission of Landon Dyer
7 //
8
9 #ifndef __MARK_H__
10 #define __MARK_H__
11
12 #include "rmac.h"
13
14 // A mark is of the form:
15 // .W    <to+flags>     section mark is relative to, and flags in upper byte
16 // .L    <loc>          location of mark in "from" section
17 // .W    [from]         new from section
18 // .L[L] [symbol]       symbol involved in external reference (LL for 64-bit pointers)
19 #define MCHUNK struct _mchunk
20 MCHUNK {
21    MCHUNK * mcnext;                             // Next mark chunk
22    PTR mcptr;                                   // Vector of marks
23    uint16_t mcalloc;                    // # marks allocted to mark block
24    uint16_t mcused;                             // # marks used in block
25 };
26
27 #define MWORD        0x0000             // Marked word
28 #define MLONG        0x0100             // Marked long
29 #define MMOVEI       0x0200             // Mark RISC MOVEI instruction
30 #define MDOUBLE      0x0400             // Marked double float
31 #define MEXTEND      0x0800             // Marked extended float
32 #define MSINGLE      0x0880             // Marked single float (TODO: merge with MLONG?)
33 #define MGLOBAL      0x0800             // Mark contains global
34 #define MPCREL       0x1000             // Mark is PC-relative
35 #define MCHEND       0x2000             // Indicates end of mark chunk
36 #define MSYMBOL      0x4000             // Mark includes symbol pointer
37 #define MCHFROM      0x8000             // Mark includes change-to-from
38
39 // Exported variables
40 extern MCHUNK * firstmch;
41
42 // Exported functions
43 void InitMark(void);
44 void StopMark(void);
45 uint32_t MarkRelocatable(uint16_t, uint32_t, uint16_t, uint16_t, SYM *);
46 uint32_t AllocateMark(void);
47 uint32_t MarkImage(register uint8_t * mp, uint32_t siz, uint32_t tsize, int okflag);
48 uint32_t MarkBSDImage(uint8_t *, uint32_t, uint32_t, int);
49 uint32_t CreateELFRelocationRecord(uint8_t *, uint8_t *, uint16_t section);
50
51 #endif // __MARK_H__
52