-
Notifications
You must be signed in to change notification settings - Fork 1
/
asm_mc68000.h
74 lines (61 loc) · 2.67 KB
/
asm_mc68000.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
/*
* Copyright 2020 Tadashi G. Takaoka
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __LIBASM_ASM_MC68000_H__
#define __LIBASM_ASM_MC68000_H__
#include "asm_base.h"
#include "config_mc68000.h"
#include "insn_mc68000.h"
namespace libasm {
namespace mc68000 {
struct AsmMc68000 final : Assembler, Config {
AsmMc68000(const ValueParser::Plugins &plugins = defaultPlugins());
void reset() override;
Error setFpu(StrScanner &scan) override;
private:
const TextOption<Assembler> _opt_fpu;
Error parseOperand(StrScanner &scan, Operand &op) const;
Error parseKFactor(StrScanner &scan, Operand &op) const;
Error checkAlignment(AsmInsn &insn, OprSize size, const Operand &op) const;
void encodeBriefExtension(AsmInsn &insn, const Operand &op, Config::ptrdiff_t disp) const;
void encodeDisplacement(AsmInsn &insn, const Operand &op, Config::ptrdiff_t disp) const;
void encodeRelativeAddr(AsmInsn &insn, AddrMode mode, const Operand &op) const;
void encodeImmediate(AsmInsn &insn, const Operand &op, OprSize size) const;
void encodeFloatControlList(AsmInsn &insn, const Operand &o) const;
void encodeFloatRegisterList(AsmInsn &insn, const Operand &o) const;
void encodeRegisterList(AsmInsn &insn, const Operand &op, bool reverse = false) const;
Error encodeOperand(
AsmInsn &insn, OprSize size, const Operand &op, AddrMode mode, OprPos pos) const;
enum Mc68881Type : char {
DATA_DCX = 'X', // 96-bit MC68881 Extended Binary Real
DATA_DCP = 'P', // 96-bit MC68881 Packed Decimal String
};
Error defineDataConstant(
AsmInsn &insn, StrScanner &scan, Mc68881Type type, ErrorAt &error) const;
Error processPseudo(StrScanner &scan, Insn &insn) override;
Error encodeImpl(StrScanner &scan, Insn &insn) const override;
const ConfigBase &config() const override { return *this; }
ConfigSetter &configSetter() override { return *this; }
static const ValueParser::Plugins &defaultPlugins();
};
} // namespace mc68000
} // namespace libasm
#endif // __LIBASM_ASM_MC68000_H__
// Local Variables:
// mode: c++
// c-basic-offset: 4
// tab-width: 4
// End:
// vim: set ft=cpp et ts=4 sw=4: