- added instructions how to update the online documentation
[bochs-mirror.git] / cpu / data_xfer8.cc
blob07e9c0b68cc148d4e32971eb4f05c1a5d2a2f27a
1 /////////////////////////////////////////////////////////////////////////
2 // $Id: data_xfer8.cc,v 1.44 2008/09/06 21:18:08 sshwarts Exp $
3 /////////////////////////////////////////////////////////////////////////
4 //
5 // Copyright (C) 2001 MandrakeSoft S.A.
6 //
7 // MandrakeSoft S.A.
8 // 43, rue d'Aboukir
9 // 75002 Paris - France
10 // http://www.linux-mandrake.com/
11 // http://www.mandrakesoft.com/
13 // This library is free software; you can redistribute it and/or
14 // modify it under the terms of the GNU Lesser General Public
15 // License as published by the Free Software Foundation; either
16 // version 2 of the License, or (at your option) any later version.
18 // This library is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 // Lesser General Public License for more details.
23 // You should have received a copy of the GNU Lesser General Public
24 // License along with this library; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 /////////////////////////////////////////////////////////////////////////
28 #define NEED_CPU_REG_SHORTCUTS 1
29 #include "bochs.h"
30 #include "cpu.h"
31 #define LOG_THIS BX_CPU_THIS_PTR
33 void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_RLIb(bxInstruction_c *i)
35 BX_WRITE_8BIT_REGx(i->opcodeReg(), i->extend8bitL(), i->Ib());
38 void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_RHIb(bxInstruction_c *i)
40 BX_WRITE_8BIT_REGH(i->b1() & 0x03, i->Ib());
43 void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_EbGbM(bxInstruction_c *i)
45 bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
47 write_virtual_byte(i->seg(), eaddr, BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL()));
50 void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_GbEbM(bxInstruction_c *i)
52 bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
54 Bit8u val8 = read_virtual_byte(i->seg(), eaddr);
55 BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), val8);
58 void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_GbEbR(bxInstruction_c *i)
60 Bit8u op2 = BX_READ_8BIT_REGx(i->rm(), i->extend8bitL());
61 BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), op2);
64 void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_ALOd(bxInstruction_c *i)
66 AL = read_virtual_byte_32(i->seg(), i->Id());
69 void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_OdAL(bxInstruction_c *i)
71 write_virtual_byte_32(i->seg(), i->Id(), AL);
74 void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_EbIbM(bxInstruction_c *i)
76 bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
78 write_virtual_byte(i->seg(), eaddr, i->Ib());
81 void BX_CPP_AttrRegparmN(1) BX_CPU_C::XLAT(bxInstruction_c *i)
83 #if BX_SUPPORT_X86_64
84 if (i->as64L()) {
85 AL = read_virtual_byte_64(i->seg(), RBX + AL);
87 else
88 #endif
89 if (i->as32L()) {
90 AL = read_virtual_byte(i->seg(), (Bit32u) (EBX + AL));
92 else {
93 AL = read_virtual_byte_32(i->seg(), (Bit16u) (BX + AL));
97 void BX_CPP_AttrRegparmN(1) BX_CPU_C::XCHG_EbGbM(bxInstruction_c *i)
99 Bit8u op1, op2;
101 bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
103 /* pointer, segment address pair */
104 op1 = read_RMW_virtual_byte(i->seg(), eaddr);
105 op2 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
107 write_RMW_virtual_byte(op2);
108 BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), op1);
111 void BX_CPP_AttrRegparmN(1) BX_CPU_C::XCHG_EbGbR(bxInstruction_c *i)
113 Bit8u op1 = BX_READ_8BIT_REGx(i->rm(), i->extend8bitL());
114 Bit8u op2 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
116 BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), op1);
117 BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), op2);