1//============================================================================
2//
3// SSSS tt lll lll
4// SS SS tt ll ll
5// SS tttttt eeee ll ll aaaa
6// SSSS tt ee ee ll ll aa
7// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8// SS SS tt ee ll ll aa aa
9// SSSS ttt eeeee llll llll aaaaa
10//
11// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
12// and the Stella Team
13//
14// See the file "License.txt" for information on usage and redistribution of
15// this file, and for a DISCLAIMER OF ALL WARRANTIES.
16//============================================================================
17
18#include "Debugger.hxx"
19#include "CartDebug.hxx"
20
21#include "RiotRamWidget.hxx"
22
23// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24RiotRamWidget::RiotRamWidget(GuiObject* boss, const GUI::Font& lfont,
25 const GUI::Font& nfont, int x, int y, int w)
26 : RamWidget(boss, lfont, nfont, x, y, w, 0, 128, 8, 128),
27 myDbg(instance().debugger().cartDebug())
28{
29}
30
31// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
32uInt8 RiotRamWidget::getValue(int addr) const
33{
34 const CartState& state = static_cast<const CartState&>(myDbg.getState());
35 return instance().debugger().peek(state.rport[addr]);
36}
37
38// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
39void RiotRamWidget::setValue(int addr, uInt8 value)
40{
41 const CartState& state = static_cast<const CartState&>(myDbg.getState());
42 instance().debugger().poke(state.wport[addr], value);
43}
44
45// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
46string RiotRamWidget::getLabel(int addr) const
47{
48 const CartState& state = static_cast<const CartState&>(myDbg.getState());
49 return myDbg.getLabel(state.rport[addr], true);
50}
51
52// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
53void RiotRamWidget::fillList(uInt32 start, uInt32 size, IntArray& alist,
54 IntArray& vlist, BoolArray& changed) const
55{
56 const CartState& state = static_cast<const CartState&>(myDbg.getState());
57 const CartState& oldstate = static_cast<const CartState&>(myDbg.getOldState());
58
59 for(uInt32 i = 0; i < size; ++i)
60 {
61 alist.push_back(i+start);
62 vlist.push_back(state.ram[i]);
63 changed.push_back(state.ram[i] != oldstate.ram[i]);
64 }
65}
66
67// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
68uInt32 RiotRamWidget::readPort(uInt32 start) const
69{
70 const CartState& state = static_cast<const CartState&>(myDbg.getState());
71 return state.rport[start];
72}
73
74// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
75const ByteArray& RiotRamWidget::currentRam(uInt32) const
76{
77 const CartState& state = static_cast<const CartState&>(myDbg.getState());
78 return state.ram;
79}
80