Skip to content

Commit

Permalink
Added reset button to toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkwhoffmann committed Aug 10, 2019
1 parent 6002ec0 commit 688b999
Show file tree
Hide file tree
Showing 36 changed files with 217 additions and 79 deletions.
32 changes: 13 additions & 19 deletions Amiga/Amiga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,14 @@ Amiga::configureFifoBuffering(bool value)
configure(VA_FIFO_BUFFERING, value);
}

void
Amiga::reset()
{
suspend();
HardwareComponent::reset();
resume();
}

void
Amiga::_initialize()
{
Expand All @@ -513,24 +521,6 @@ Amiga::_powerOn()

// For debugging, we start in debug mode and set a breakpoint
debugMode = true;

// cpu.bpManager.setBreakpointAt(0xFC570E); // Blitter
// cpu.bpManager.setBreakpointAt(0xFE8A6E); // All Blitter stuff done
// cpu.bpManager.setBreakpointAt(0xFEA1D8); // DSKPT
// cpu.bpManager.setBreakpointAt(0xFEA212); //
// cpu.bpManager.setBreakpointAt(0xfeaa22);
// cpu.bpManager.setBreakpointAt(0xfe85a6); // After MFM decoding with Blitter
// cpu.bpManager.setBreakpointAt(0x05005A);
// cpu.bpManager.setBreakpointAt(0xFD8186); //
// cpu.bpManager.setBreakpointAt(0xFD8192); //

// cpu.bpManager.setBreakpointAt(0xFF5A60); // Copy(Init) slow ram stuff

// cpu.bpManager.setBreakpointAt(0xFF4D68); // Jumps to init routine
// cpu.bpManager.setBreakpointAt(0xFD465C); // Start of video init
// cpu.bpManager.setBreakpointAt(0xFD466C); // Audio init

// cpu.bpManager.setBreakpointAt(0xFD7952); // Bitplane init

// cpu.bpManager.setBreakpointAt(0xFD7962); // AROS ERROR
// cpu.bpManager.setBreakpointAt(0xF890C6); //
Expand Down Expand Up @@ -611,8 +601,12 @@ Amiga::_reset()

RESET_SNAPSHOT_ITEMS

masterClock = 0;
makeActiveInstance();
m68k_init();
m68k_pulse_reset();

amiga->putMessage(MSG_RESET);
ping();
}

void
Expand Down
2 changes: 2 additions & 0 deletions Amiga/Amiga.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ class Amiga : public HardwareComponent {
// Methods from HardwareComponent
//

void reset() override;

private:

void _initialize() override;
Expand Down
8 changes: 7 additions & 1 deletion Amiga/Computer/Agnus/Agnus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,19 @@ Agnus::_initialize()
void
Agnus::_powerOn()
{
}

void Agnus::_reset()
{
RESET_SNAPSHOT_ITEMS

// Start with a long frame
lof = 1;
frameInfo.numLines = 313;

// Initialize lookup tables
clearDMAEventTable();

// Clear the event table
for (unsigned i = 0; i < SLOT_COUNT; i++) {
slot[i].triggerCycle = NEVER;
Expand Down
2 changes: 1 addition & 1 deletion Amiga/Computer/Agnus/Agnus.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ class Agnus : public HardwareComponent

void _initialize() override;
void _powerOn() override;
void _reset() override { RESET_SNAPSHOT_ITEMS }
void _reset() override;
void _inspect() override;
void _dump() override;
size_t _size() override { COMPUTE_SNAPSHOT_SIZE }
Expand Down
7 changes: 7 additions & 0 deletions Amiga/Computer/Agnus/Blitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ Blitter::_initialize()
void
Blitter::_powerOn()
{
}

void
Blitter::_reset()
{
RESET_SNAPSHOT_ITEMS

copycount = 0;
linecount = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion Amiga/Computer/Agnus/Blitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class Blitter : public HardwareComponent {

void _initialize() override;
void _powerOn() override;
void _reset() override { RESET_SNAPSHOT_ITEMS }
void _reset() override;
void _inspect() override;
void _dump() override;
size_t _size() override { COMPUTE_SNAPSHOT_SIZE }
Expand Down
24 changes: 15 additions & 9 deletions Amiga/Computer/CIA/CIA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,28 @@ CIA::_initialize()
void
CIA::_powerOn()
{
CNT = true;
INT = 1;

}

void
CIA::_reset()
{
RESET_SNAPSHOT_ITEMS

CNT = true;
INT = 1;

counterA = 0xFFFF;
counterB = 0xFFFF;
latchA = 0xFFFF;
latchB = 0xFFFF;

// PA = 0xFF;
// PB = 0xFF;
latchA = 0xFFFF;
latchB = 0xFFFF;

updatePA();
updatePB();

CRA = 0x4; // seen in SAE
CRB = 0x4; // seen in SAE

// The OVL bit influences the memory layout. Hence, we need to update it.
amiga->mem.updateMemSrcTable();
}
Expand Down
2 changes: 1 addition & 1 deletion Amiga/Computer/CIA/CIA.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ class CIA : public HardwareComponent {

void _initialize() override;
void _powerOn() override;
void _reset() override { RESET_SNAPSHOT_ITEMS }
void _reset() override;
void _inspect() override;
void _dump() override;
size_t _size() override { COMPUTE_SNAPSHOT_SIZE }
Expand Down
6 changes: 6 additions & 0 deletions Amiga/Computer/CPU/CPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ CPU::~CPU()
void
CPU::_powerOn()
{
}

void
CPU::_reset()
{
RESET_SNAPSHOT_ITEMS
clearTraceBuffer();
}

Expand Down
2 changes: 1 addition & 1 deletion Amiga/Computer/CPU/CPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class CPU : public HardwareComponent {
private:

void _powerOn() override;
void _reset() override { RESET_SNAPSHOT_ITEMS }
void _reset() override;
void _inspect() override;
void _dump() override;
size_t _size() override;
Expand Down
7 changes: 7 additions & 0 deletions Amiga/Computer/Denise/Denise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ Denise::_initialize()
void
Denise::_powerOn()
{
}

void
Denise::_reset()
{
RESET_SNAPSHOT_ITEMS

memset(bBuffer, 0, sizeof(bBuffer));
memset(iBuffer, 0, sizeof(iBuffer));
memset(zBuffer, 0, sizeof(zBuffer));
Expand Down
2 changes: 1 addition & 1 deletion Amiga/Computer/Denise/Denise.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ class Denise : public HardwareComponent {

void _initialize() override;
void _powerOn() override;
void _reset() override { RESET_SNAPSHOT_ITEMS }
void _reset() override;
void _inspect() override;
void _dump() override;
size_t _size() override { COMPUTE_SNAPSHOT_SIZE }
Expand Down
22 changes: 14 additions & 8 deletions Amiga/Computer/Denise/PixelEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,7 @@ PixelEngine::_initialize()
void
PixelEngine::_powerOn()
{
// Initialize frame buffers
workingLongFrame = &longFrame[0];
workingShortFrame = &shortFrame[0];
stableLongFrame = &longFrame[1];
stableShortFrame = &shortFrame[1];
frameBuffer = &longFrame[0];

// Create a recognizable debug pattern
// Initialize frame buffers with a checkerboard debug pattern
for (unsigned line = 0; line < VPIXELS; line++) {
for (unsigned i = 0; i < HPIXELS; i++) {

Expand All @@ -71,6 +64,19 @@ PixelEngine::_powerOn()
shortFrame[0].data[pos] = shortFrame[1].data[pos] = col;
}
}
}

void
PixelEngine::_reset()
{
RESET_SNAPSHOT_ITEMS

// Initialize frame buffers
workingLongFrame = &longFrame[0];
workingShortFrame = &shortFrame[0];
stableLongFrame = &longFrame[1];
stableShortFrame = &shortFrame[1];
frameBuffer = &longFrame[0];

updateRGBA();
}
Expand Down
2 changes: 1 addition & 1 deletion Amiga/Computer/Denise/PixelEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class PixelEngine : public HardwareComponent {

void _initialize() override;
void _powerOn() override;
void _reset() override { RESET_SNAPSHOT_ITEMS }
void _reset() override;
size_t _size() override { COMPUTE_SNAPSHOT_SIZE }
size_t _load(uint8_t *buffer) override { LOAD_SNAPSHOT_ITEMS }
size_t _save(uint8_t *buffer) override { SAVE_SNAPSHOT_ITEMS }
Expand Down
9 changes: 9 additions & 0 deletions Amiga/Computer/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ Memory::_powerOn()
updateMemSrcTable();
}

void
Memory::_reset()
{
RESET_SNAPSHOT_ITEMS

// Set up the memory lookup table
updateMemSrcTable();
}

void
Memory::_dump()
{
Expand Down
2 changes: 1 addition & 1 deletion Amiga/Computer/Memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class Memory : public HardwareComponent {

void _initialize() override;
void _powerOn() override;
void _reset() override { RESET_SNAPSHOT_ITEMS }
void _reset() override;
void _dump() override;

size_t _size() override;
Expand Down
21 changes: 14 additions & 7 deletions Amiga/Computer/Paula/AudioUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ AudioUnit::AudioUnit()
void
AudioUnit::_powerOn()
{
clearRingbuffer();

bufferUnderflows = 0;
bufferOverflows = 0;

volume = 100000;
targetVolume = 100000;
}

void
Expand Down Expand Up @@ -74,6 +67,20 @@ AudioUnit::_pause()
clearRingbuffer();
}

void
AudioUnit::_reset()
{
RESET_SNAPSHOT_ITEMS

clearRingbuffer();

bufferUnderflows = 0;
bufferOverflows = 0;

volume = 100000;
targetVolume = 100000;
}

void
AudioUnit::enableDMA(int nr)
{
Expand Down
2 changes: 1 addition & 1 deletion Amiga/Computer/Paula/AudioUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class AudioUnit : public HardwareComponent {
void _powerOn() override;
void _run() override;
void _pause() override;
void _reset() override { RESET_SNAPSHOT_ITEMS }
void _reset() override;
void _inspect() override;
void _dump() override;
size_t _size() override { COMPUTE_SNAPSHOT_SIZE }
Expand Down
10 changes: 9 additions & 1 deletion Amiga/Computer/Paula/DiskController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@ DiskController::_initialize()
void
DiskController::_powerOn()
{
prb = 0xFF;

}

void
DiskController::_reset()
{
RESET_SNAPSHOT_ITEMS

prb = 0xFF;
selected = -1;
dsksync = 0x4489;
}
Expand Down
2 changes: 1 addition & 1 deletion Amiga/Computer/Paula/DiskController.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class DiskController : public HardwareComponent {

void _initialize() override;
void _powerOn() override;
void _reset() override { RESET_SNAPSHOT_ITEMS }
void _reset() override;
void _ping() override;
void _inspect() override;
void _dump() override;
Expand Down
7 changes: 7 additions & 0 deletions Amiga/Computer/Paula/UART.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ UART::_initialize()
void
UART::_powerOn()
{

}

void
UART::_reset()
{
RESET_SNAPSHOT_ITEMS
outBit = 1;
}

Expand Down
2 changes: 1 addition & 1 deletion Amiga/Computer/Paula/UART.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class UART : public HardwareComponent {

void _initialize() override;
void _powerOn() override;
void _reset() override { RESET_SNAPSHOT_ITEMS }
void _reset() override;
void _inspect() override;
void _dump() override;
size_t _size() override { COMPUTE_SNAPSHOT_SIZE }
Expand Down
8 changes: 8 additions & 0 deletions Amiga/Peripherals/Joystick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ Joystick::_initialize()
void
Joystick::_powerOn()
{

}

void
Joystick::_reset()
{
RESET_SNAPSHOT_ITEMS

button = false;
axisX = 0;
axisY = 0;
Expand Down
2 changes: 1 addition & 1 deletion Amiga/Peripherals/Joystick.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Joystick : public HardwareComponent {

void _initialize() override;
void _powerOn() override;
void _reset() override { RESET_SNAPSHOT_ITEMS }
void _reset() override;
void _dump() override;
size_t _size() override { COMPUTE_SNAPSHOT_SIZE }
size_t _load(uint8_t *buffer) override { LOAD_SNAPSHOT_ITEMS }
Expand Down
Loading

0 comments on commit 688b999

Please sign in to comment.