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 | #include "Cart4KSC.hxx" |
21 | #include "Cart4KSCWidget.hxx" |
22 | |
23 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
24 | Cartridge4KSCWidget::Cartridge4KSCWidget( |
25 | GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont, |
26 | int x, int y, int w, int h, Cartridge4KSC& cart) |
27 | : CartDebugWidget(boss, lfont, nfont, x, y, w, h), |
28 | myCart(cart) |
29 | { |
30 | // Eventually, we should query this from the debugger/disassembler |
31 | uInt16 start = (cart.myImage[0xFFD] << 8) | cart.myImage[0xFFC]; |
32 | start -= start % 0x1000; |
33 | |
34 | ostringstream info; |
35 | info << "4KSC cartridge, non-bankswitched\n" |
36 | << "128 bytes RAM @ $F000 - $F0FF\n" |
37 | << " $F080 - $F0FF (R), $F000 - $F07F (W)\n" |
38 | << "Accessible @ $" << Common::Base::HEX4 << start << " - " |
39 | << "$" << (start + 0xFFF); |
40 | |
41 | addBaseInformation(4096, "homebrew intermediate format" , info.str()); |
42 | } |
43 | |
44 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
45 | void Cartridge4KSCWidget::saveOldState() |
46 | { |
47 | myOldState.internalram.clear(); |
48 | |
49 | for(uInt32 i = 0; i < internalRamSize(); ++i) |
50 | myOldState.internalram.push_back(myCart.myRAM[i]); |
51 | } |
52 | |
53 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
54 | uInt32 Cartridge4KSCWidget::internalRamSize() |
55 | { |
56 | return 128; |
57 | } |
58 | |
59 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
60 | uInt32 Cartridge4KSCWidget::internalRamRPort(int start) |
61 | { |
62 | return 0xF080 + start; |
63 | } |
64 | |
65 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
66 | string Cartridge4KSCWidget::internalRamDescription() |
67 | { |
68 | ostringstream desc; |
69 | desc << "$F000 - $F07F used for Write Access\n" |
70 | << "$F080 - $F0FF used for Read Access" ; |
71 | |
72 | return desc.str(); |
73 | } |
74 | |
75 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
76 | const ByteArray& Cartridge4KSCWidget::internalRamOld(int start, int count) |
77 | { |
78 | myRamOld.clear(); |
79 | for(int i = 0; i < count; i++) |
80 | myRamOld.push_back(myOldState.internalram[start + i]); |
81 | return myRamOld; |
82 | } |
83 | |
84 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
85 | const ByteArray& Cartridge4KSCWidget::internalRamCurrent(int start, int count) |
86 | { |
87 | myRamCurrent.clear(); |
88 | for(int i = 0; i < count; i++) |
89 | myRamCurrent.push_back(myCart.myRAM[start + i]); |
90 | return myRamCurrent; |
91 | } |
92 | |
93 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
94 | void Cartridge4KSCWidget::internalRamSetValue(int addr, uInt8 value) |
95 | { |
96 | myCart.myRAM[addr] = value; |
97 | } |
98 | |
99 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
100 | uInt8 Cartridge4KSCWidget::internalRamGetValue(int addr) |
101 | { |
102 | return myCart.myRAM[addr]; |
103 | } |
104 | |
105 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
106 | string Cartridge4KSCWidget::internalRamLabel(int addr) |
107 | { |
108 | CartDebug& dbg = instance().debugger().cartDebug(); |
109 | return dbg.getLabel(addr + 0xF080, false); |
110 | } |
111 | |