libsidplayfp  1.4.2
reloc65.h
1 /* reloc65 -- A part of xa65 - 65xx/65816 cross-assembler and utility suite
2  * o65 file relocator
3  *
4  * Copyright (C) 1989-1997 André Fachat (a.fachat@physik.tu-chemnitz.de)
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20 
21 /*
22  Modified by Dag Lem <resid@nimrod.no>
23  Relocate and extract text segment from memory buffer instead of file.
24  For use with VICE VSID.
25 
26  Ported to c++ by Leandro Nini
27 */
28 
29 #ifndef RELOC65_H
30 #define RELOC65_H
31 
32 class reloc65
33 {
34 public:
35  typedef enum
36  {
37  WHOLE,
38  TEXT,
39  DATA,
40  BSS,
41  ZEROPAGE
42  } segment_t;
43 
44 private:
45  bool m_tflag, m_dflag, m_bflag, m_zflag;
46  int m_tbase, m_dbase, m_bbase, m_zbase;
47  int m_tdiff, m_ddiff, m_bdiff, m_zdiff;
48 
49  segment_t m_extract;
50 
51 private:
52  static int read_options(unsigned char *buf);
53  static int read_undef(unsigned char *buf);
54 
55  int reldiff(unsigned char s);
56  unsigned char *reloc_seg(unsigned char *buf, int len, unsigned char *rtab);
57  unsigned char *reloc_globals(unsigned char *buf);
58 
59 public:
60  reloc65();
61 
68  void setReloc(segment_t type, int addr);
69 
75  void setExtract(segment_t type);
76 
83  bool reloc(unsigned char **buf, int *fsize);
84 };
85 
86 #endif
Definition: reloc65.h:32
bool reloc(unsigned char **buf, int *fsize)
Definition: reloc65.cpp:81
void setExtract(segment_t type)
Definition: reloc65.cpp:76
void setReloc(segment_t type, int addr)
Definition: reloc65.cpp:51