[ucsim] Update email and file info, fix stm8 flash controller
[sdcc.git] / sdcc / sim / ucsim / src / sims / pblaze.src / regspblaze.h
blob8c0e10e31f46063facc98b949a7cd6e00a168d7a
1 /*
2 * Copyright (C) 2012-2013 Jiří Šimek
3 * Copyright (C) 2013 Zbyněk Křivka <krivka@fit.vutbr.cz>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
23 #ifndef REGPBLAZE_HEADER
24 #define REGPBLAZE_HEADER
26 #include "ddconfig.h"
28 #define REGISTER_BANK_A 0x01
29 #define REGISTER_BANK_B 0x02
31 #define FLAGS_GET(bit_position) (sfr->get(FLAGS) & bit_position)
32 #define FLAGS_GET_C (sfr->get(FLAGS) & bmC)
33 #define FLAGS_GET_Z (sfr->get(FLAGS) & bmZ)
34 #define FLAGS_GET_I (sfr->get(FLAGS) & bmI)
36 #define FLAGS_SET(flag_value, bit_position) \
37 if (flag_value) \
38 sfr->set_bit1(FLAGS, bit_position); \
39 else \
40 sfr->set_bit0(FLAGS, bit_position);
42 #define FLAGS_SET(flag_value, bit_position) \
43 if (flag_value) \
44 sfr->write(FLAGS, sfr->read(FLAGS) | bit_position); \
45 else \
46 sfr->write(FLAGS, sfr->read(FLAGS) & ~bit_position);
47 #define FLAGS_SET_C(flag_value) FLAGS_SET(flag_value, bmC)
48 #define FLAGS_SET_Z(flag_value) FLAGS_SET(flag_value, bmZ)
49 #define FLAGS_SET_I(flag_value) FLAGS_SET(flag_value, bmI)
52 #define S0 0x00
53 #define S1 0x01
54 #define S2 0x02
55 #define S3 0x03
56 #define S4 0x04
57 #define S5 0x05
58 #define S6 0x06
59 #define S7 0x07
60 #define S8 0x08
61 #define S9 0x09
62 #define SA 0x0a
63 #define SB 0x0b
64 #define SC 0x0c
65 #define SD 0x0d
66 #define SE 0x0e
67 #define SF 0x0f
69 #define S0b 0x10
70 #define S1b 0x11
71 #define S2b 0x12
72 #define S3b 0x13
73 #define S4b 0x14
74 #define S5b 0x15
75 #define S6b 0x16
76 #define S7b 0x17
77 #define S8b 0x18
78 #define S9b 0x19
79 #define SAb 0x1a
80 #define SBb 0x1b
81 #define SCb 0x1c
82 #define SDb 0x1d
83 #define SEb 0x1e
84 #define SFb 0x1f
86 #define FLAGS 0x20
87 #define SP 0x21
89 // bit position of each flag in FLAGS register
90 #define bmC 0x01
91 #define bmZ 0x02
92 #define bmI 0x04
94 #endif
96 /* Emd of pblaze.src/regspblaze.h */