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 "CartCDFInfoWidget.hxx"
19
20// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
21CartridgeCDFInfoWidget::CartridgeCDFInfoWidget(
22 GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
23 int x, int y, int w, int h, CartridgeCDF& cart)
24 : CartDebugWidget(boss, lfont, nfont, x, y, w, h)
25{
26 uInt16 size = 8 * 4096;
27
28 ostringstream info;
29 info << describeCDFVersion(cart.myCDFSubtype) << " cartridge\n"
30 << "32K ROM, seven 4K banks are accessible to 2600\n"
31 << "8K CDF RAM\n"
32 << "CDF registers accessible @ $FFF0 - $FFF3\n"
33 << "Banks accessible at hotspots $FFF5 to $FFFB\n"
34 << "Startup bank = " << cart.startBank() << "\n";
35
36#if 0
37 // Eventually, we should query this from the debugger/disassembler
38 for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF5; i < 7; ++i, offset += 0x1000)
39 {
40 uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
41 start -= start % 0x1000;
42 info << "Bank " << i << " @ $" << HEX4 << (start + 0x80) << " - "
43 << "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
44 }
45#endif
46
47 addBaseInformation(size, "AtariAge", info.str());
48}
49
50// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
51string CartridgeCDFInfoWidget::describeCDFVersion(CartridgeCDF::CDFSubtype subtype)
52{
53 switch(subtype)
54 {
55 case CartridgeCDF::CDFSubtype::CDF0:
56 return "CDF (v0)";
57
58 case CartridgeCDF::CDFSubtype::CDF1:
59 return "CDF (v1)";
60
61 case CartridgeCDF::CDFSubtype::CDFJ:
62 return "CDFJ";
63
64 default:
65 throw runtime_error("unreachable");
66 }
67}
68