msx: fix loading small cartridge images
[qemu/z80.git] / target-z80 / genreg_template.h
blob6be8ac8d3f9a11151b83ee819c6b41214874792d
1 /*
2 * Z80 translation (templates for various register related operations)
4 * Copyright (c) 2007-2009 Stuart Brady <stuart.brady@gmail.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library 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 GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
21 /* Loads */
23 static inline void glue(gen_movb_v_,REGHIGH)(TCGv v)
25 tcg_gen_ld8u_tl(v, cpu_env,
26 offsetof(CPUState, regs[glue(R_,REGPAIR)]) +
27 BYTE_OFFSET(cpu_env->regs[], 1));
30 static inline void glue(gen_movb_v_,REGLOW)(TCGv v)
32 tcg_gen_ld8u_tl(v, cpu_env,
33 offsetof(CPUState, regs[glue(R_,REGPAIR)]) +
34 BYTE_OFFSET(cpu_env->regs[], 0));
37 static inline void glue(gen_movw_v_,REGPAIR)(TCGv v)
39 tcg_gen_ld16u_tl(v, cpu_env,
40 offsetof(CPUState, regs[glue(R_,REGPAIR)]) +
41 WORD_OFFSET(cpu_env->regs[], 0));
44 /* Stores */
46 static inline void glue(glue(gen_movb_,REGHIGH),_v)(TCGv v)
48 tcg_gen_st8_tl(v, cpu_env,
49 offsetof(CPUState, regs[glue(R_,REGPAIR)]) +
50 BYTE_OFFSET(cpu_env->regs[], 1));
53 static inline void glue(glue(gen_movb_,REGLOW),_v)(TCGv v)
55 tcg_gen_st8_tl(v, cpu_env,
56 offsetof(CPUState, regs[glue(R_,REGPAIR)]) +
57 BYTE_OFFSET(cpu_env->regs[], 0));
60 static inline void glue(glue(gen_movw_,REGPAIR),_v)(TCGv v)
62 tcg_gen_st16_tl(v, cpu_env,
63 offsetof(CPUState, regs[glue(R_,REGPAIR)]) +
64 WORD_OFFSET(cpu_env->regs[], 0));