-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdecode.h
90 lines (76 loc) · 4.34 KB
/
decode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
¬°¤*,¸¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸
¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯
__/¯\____ ___/\__ _/\__ _/\_ _/\__ _/\___ ___/\__ __/\_ _/\__
\_ ____/_> ____ \_/ _ \_ \ < /_ \_/ _>> ____ \_ > \_/ _ \_
_> ___/ ¯>__> <<__// __ _/ |> ></ _/> </ ¯ \\__> <<__// /\ // __ _/
_> \7 <__/:. \__/:. \> \_/ L/ _____/. 7> .\_/:. \__/ <_/ </:. \> \_
|:::::::::::::::::::::::/:::::::::::::>::::::::/::::::::::::::::::::::::/:::::|
|¯¯\::::/\:/¯\::::/¯¯¯¯<::::/\::/¯¯\:/¯¯¯¯¯¯\::\::/¯¯\::::/¯¯\::::/¯¯¯¯<::::/¯|
|__ |¯¯| T _ |¯¯¯| ___ |¯¯| |¯| _ T ______ |¯¯¯¯| _ |¯¯¯| _ |¯¯¯| ___ |¯¯| _|
\|__|/\|/ \|___|/ \|__|/\|_|/ \|/ \| |/ \|___|/ \|___|/dNo\|__|/
¬°¤*,¸¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸
¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯
This file is part of Etripator,
copyright (c) 2009--2024 Vincent Cruz.
Etripator is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Etripator is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Etripator. If not, see <http://www.gnu.org/licenses/>.
¬°¤*,¸¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸
¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯
*/
#ifndef ETRIPATOR_DECODE_H
#define ETRIPATOR_DECODE_H
#include "config.h"
#include "label.h"
#include "section.h"
#include "memory_map.h"
#include "comment.h"
/// Finds any jump address from the current section.
/// \param [in] section Current section.
/// \param [in] map Memory map.
/// \param [in out] repository Label repository.
/// \return true upon success.
/// \return false if an error occured.
bool label_extract(Section *section, MemoryMap *map, LabelRepository *repository);
/// Process data section. The result will be output has a binary file or an asm file containing hex values or strings.
/// \param [out] out File output.
/// \param [in] section Current section.
/// \param [in] map Memory map.
/// \param [in] repository Label repository.
/// \param [in] comments Comments repository.
/// \param [in] extra_infos Display extra informations as comments (if none set).
/// \return true upon success.
/// \return false if an error occured.
bool data_extract(FILE *out, Section *section, MemoryMap *map, LabelRepository *repository, CommentRepository *comments, int extra_infos);
/// Process code section.
/// \param [out] out File output.
/// \param [in out] logical Current logical address.
/// \param [in] section Current section.
/// \param [in] map Memory map.
/// \param [in] repository Label repository.
/// \param [in] comments Comments repository.
/// \param [in] extra_infos Display extra informations as comments (if none set).
/// \return true if rts, rti or brk instruction was decoded.
/// \return false otherwise.
int decode(FILE *out, uint16_t *logical, Section *section, MemoryMap *map, LabelRepository *repository, CommentRepository *comments, int extra_infos);
/// Computes section size.
/// \param [in] sections Section array.
/// \param [in] index Index of the current section.
/// \param [in] count Number of sections.
/// \param [in] map Memory map.
/// \return Section size.
int32_t compute_size(SectionArray *sections, int index, int count, MemoryMap *map);
/// Output hardware IO port and RAM labels.
/// \param [out] out File output.
/// \param [in] map Memory map.
/// \param [in] repository Label repository.
void label_dump(FILE *out, MemoryMap *map, LabelRepository *repository);
#endif // ETRIPATOR_DECODE_H