2016-02-03 10:24:58 +00:00
|
|
|
auto V30MZ::read(Size size, uint16 segment, uint16 address) -> uint32 {
|
|
|
|
uint32 data = read(segment * 16 + address);
|
2016-01-31 07:59:44 +00:00
|
|
|
if(size == Word) data |= read(segment * 16 + ++address) << 8;
|
2016-02-03 10:24:58 +00:00
|
|
|
if(size == Long) data |= read(segment * 16 + ++address) << 16;
|
|
|
|
if(size == Long) data |= read(segment * 16 + ++address) << 24;
|
2016-01-31 07:59:44 +00:00
|
|
|
return data;
|
2016-01-28 11:39:49 +00:00
|
|
|
}
|
|
|
|
|
2016-01-31 07:59:44 +00:00
|
|
|
auto V30MZ::write(Size size, uint16 segment, uint16 address, uint16 data) -> void {
|
|
|
|
write(segment * 16 + address, data);
|
|
|
|
if(size == Word) write(segment * 16 + ++address, data >> 8);
|
2016-01-30 06:40:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
|
2016-02-03 10:24:58 +00:00
|
|
|
auto V30MZ::in(Size size, uint16 address) -> uint16 {
|
|
|
|
uint16 data = in(address);
|
|
|
|
if(size == Word) data |= in(++address) << 8;
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto V30MZ::out(Size size, uint16 address, uint16 data) -> void {
|
|
|
|
out(address, data);
|
|
|
|
if(size == Word) out(++address, data >> 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
|
2016-02-02 10:51:17 +00:00
|
|
|
auto V30MZ::fetch(Size size) -> uint16 {
|
2016-01-31 07:59:44 +00:00
|
|
|
uint16 data = read(size, r.cs, r.ip);
|
|
|
|
return r.ip += size, data;
|
2016-01-30 06:40:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
|
2016-02-02 10:51:17 +00:00
|
|
|
auto V30MZ::pop() -> uint16 {
|
2016-01-31 07:59:44 +00:00
|
|
|
uint16 data = read(Word, r.ss, r.sp);
|
|
|
|
return r.sp += Word, data;
|
2016-01-30 06:40:35 +00:00
|
|
|
}
|
|
|
|
|
2016-02-02 10:51:17 +00:00
|
|
|
auto V30MZ::push(uint16 data) -> void {
|
2016-01-31 07:59:44 +00:00
|
|
|
r.sp -= Word;
|
|
|
|
write(Word, r.ss, r.sp, data);
|
2016-01-30 06:40:35 +00:00
|
|
|
}
|