]> Shamusworld >> Repos - rmac/blob - mark.h
6502 support added back from original Madmac sources!
[rmac] / mark.h
1 //
2 // RMAC - Reboot's Macro Assembler for the Atari Jaguar Console System
3 // MARK.H - A record of things that are defined relative to any of the sections
4 // Copyright (C) 199x Landon Dyer, 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 MGLOBAL      0x0800             // Mark contains global
31 #define MPCREL       0x1000             // Mark is PC-relative
32 #define MCHEND       0x2000             // Indicates end of mark chunk
33 #define MSYMBOL      0x4000             // Mark includes symbol pointer
34 #define MCHFROM      0x8000             // Mark includes change-to-from
35
36 // Exported variables
37 extern MCHUNK * firstmch;
38
39 // Exported functions
40 void InitMark(void);
41 void StopMark(void);
42 uint32_t MarkRelocatable(uint16_t, uint32_t, uint16_t, uint16_t, SYM *);
43 uint32_t AllocateMark(void);
44 uint32_t MarkImage(register uint8_t * mp, uint32_t siz, uint32_t tsize, int okflag);
45 uint32_t MarkBSDImage(uint8_t *, uint32_t, uint32_t, int);
46 uint32_t CreateELFRelocationRecord(uint8_t *, uint8_t *, uint16_t section);
47
48 #endif // __MARK_H__
49