1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-25 18:30:07 +00:00

Add end-of-Blit interrupt.

Along with a slightly easier path for posting interrupts, in C++ compilation unit terms.
This commit is contained in:
Thomas Harte 2021-10-13 15:09:19 -07:00
parent 8960f471a0
commit 9be23ecc34
6 changed files with 67 additions and 27 deletions

View File

@ -203,6 +203,9 @@ bool Blitter::advance() {
} else {
// Copy mode.
// int lc = 0;
// printf("*** [%d x %d]\n", width_, height_);
// Quick hack: do the entire action atomically.
for(int y = 0; y < height_; y++) {
for(int x = 0; x < width_; x++) {
@ -224,6 +227,9 @@ bool Blitter::advance() {
}
if(channel_enables_[3]) {
// if(!(lc&15)) printf("\n%06x: ", pointer_[3]);
// ++lc;
uint16_t a_mask = 0xffff;
if(x == 0) a_mask &= a_mask_[0];
if(x == width_ - 1) a_mask &= a_mask_[1];
@ -235,6 +241,8 @@ bool Blitter::advance() {
c_,
minterms_);
// printf("%04x ", ram_[pointer_[3] & ram_mask_]);
pointer_[3] += direction_;
}
}
@ -244,8 +252,10 @@ bool Blitter::advance() {
pointer_[2] += modulos_[2] * channel_enables_[2];
pointer_[3] += modulos_[3] * channel_enables_[3];
}
// printf("\n");
}
posit_interrupt(InterruptFlag::Blitter);
height_ = 0;
return true;

View File

@ -69,6 +69,10 @@ void Chipset::posit_interrupt(InterruptFlag flag) {
update_interrupts();
}
void DMADeviceBase::posit_interrupt(InterruptFlag flag) {
chipset_.posit_interrupt(flag);
}
template <int cycle> void Chipset::output() {
// Notes to self on guesses below:
//
@ -501,13 +505,12 @@ void Chipset::perform(const CPU::MC68000::Microcycle &cycle) {
// Raster position.
case Read(0x004): {
const uint16_t position = uint16_t(y_ >> 8);
LOG("Read vertical position high " << PADHEX(4) << position);
// LOG("Read vertical position high " << PADHEX(4) << position);
cycle.set_value16(position);
} break;
case Read(0x006): {
// const uint16_t position = uint16_t(((line_cycle_ << 6) & 0xff00) | (y_ & 0x00ff));
const uint16_t position = 0xd1ef; // TODO: !!!
LOG("Read position low " << PADHEX(4) << position);
const uint16_t position = uint16_t(((line_cycle_ << 6) & 0xff00) | (y_ & 0x00ff));
// LOG("Read position low " << PADHEX(4) << position);
cycle.set_value16(position);
} break;
@ -521,15 +524,15 @@ void Chipset::perform(const CPU::MC68000::Microcycle &cycle) {
// Joystick/mouse input.
case Read(0x00a):
case Read(0x00c):
LOG("TODO: Joystick/mouse position " << PADHEX(4) << *cycle.address);
// LOG("TODO: Joystick/mouse position " << PADHEX(4) << *cycle.address);
cycle.set_value16(0x8080);
break;
case Write(0x034):
LOG("TODO: pot port start");
// LOG("TODO: pot port start");
break;
case Read(0x016):
LOG("TODO: pot port read");
// LOG("TODO: pot port read");
cycle.set_value16(0xff00);
break;
@ -543,20 +546,24 @@ void Chipset::perform(const CPU::MC68000::Microcycle &cycle) {
break;
case Write(0x09e):
LOG("Write disk control");
ApplySetClear(paula_disk_control_);
disk_controller_.set_control(paula_disk_control_);
// TODO: should also post to Paula.
break;
case Read(0x010):
LOG("Read disk control");
cycle.set_value16(paula_disk_control_);
break;
case Write(0x07e):
disk_controller_.set_sync_word(cycle.value16());
assert(false); // Not fully implemented.
break;
case Read(0x01a):
LOG("TODO: disk status");
assert(false); // Not yet implemented.
break;
// Refresh.
@ -591,17 +598,17 @@ void Chipset::perform(const CPU::MC68000::Microcycle &cycle) {
case Write(0x09a):
ApplySetClear(interrupt_enable_);
update_interrupts();
// LOG("Interrupt enable mask modified by " << PADHEX(4) << cycle.value16() << "; is now " << std::bitset<16>{interrupt_enable_});
LOG("Interrupt enable mask modified by " << PADHEX(4) << cycle.value16() << "; is now " << std::bitset<16>{interrupt_enable_});
break;
case Read(0x01c):
cycle.set_value16(interrupt_enable_);
LOG("Interrupt enable mask read: " << PADHEX(4) << interrupt_enable_);
// LOG("Interrupt enable mask read: " << PADHEX(4) << interrupt_enable_);
break;
case Write(0x09c):
ApplySetClear(interrupt_requests_);
update_interrupts();
LOG("Interrupt request modified by " << PADHEX(4) << cycle.value16() << "; is now " << std::bitset<16>{interrupt_requests_});
// LOG("Interrupt request modified by " << PADHEX(4) << cycle.value16() << "; is now " << std::bitset<16>{interrupt_requests_});
break;
case Read(0x01e):
cycle.set_value16(interrupt_requests_);

View File

@ -24,27 +24,11 @@
#include "Blitter.hpp"
#include "Copper.hpp"
#include "DMADevice.hpp"
#include "Flags.hpp"
#include "MemoryMap.hpp"
namespace Amiga {
enum class InterruptFlag: uint16_t {
SerialPortTransmit = 1 << 0,
DiskBlock = 1 << 1,
Software = 1 << 2,
IOPortsAndTimers = 1 << 3, // i.e. CIA A.
Copper = 1 << 4,
VerticalBlank = 1 << 5,
Blitter = 1 << 6,
AudioChannel0 = 1 << 7,
AudioChannel1 = 1 << 8,
AudioChannel2 = 1 << 9,
AudioChannel3 = 1 << 10,
SerialPortReceive = 1 << 11,
DiskSyncMatch = 1 << 12,
External = 1 << 13, // i.e. CIA B.
};
enum class DMAFlag: uint16_t {
AudioChannel0 = 1 << 0,
AudioChannel1 = 1 << 1,

View File

@ -13,6 +13,8 @@
#include <cstddef>
#include <cstdint>
#include "Flags.hpp"
namespace Amiga {
class Chipset;
@ -22,6 +24,8 @@ class DMADeviceBase {
DMADeviceBase(Chipset &chipset, uint16_t *ram, size_t word_size) :
chipset_(chipset), ram_(ram), ram_mask_(uint32_t(word_size - 1)) {}
void posit_interrupt(Amiga::InterruptFlag);
protected:
Chipset &chipset_;
uint16_t *const ram_ = nullptr;

33
Machines/Amiga/Flags.hpp Normal file
View File

@ -0,0 +1,33 @@
//
// Flags.hpp
// Clock Signal
//
// Created by Thomas Harte on 13/10/2021.
// Copyright © 2021 Thomas Harte. All rights reserved.
//
#ifndef Flags_hpp
#define Flags_hpp
namespace Amiga {
enum class InterruptFlag: uint16_t {
SerialPortTransmit = 1 << 0,
DiskBlock = 1 << 1,
Software = 1 << 2,
IOPortsAndTimers = 1 << 3, // i.e. CIA A.
Copper = 1 << 4,
VerticalBlank = 1 << 5,
Blitter = 1 << 6,
AudioChannel0 = 1 << 7,
AudioChannel1 = 1 << 8,
AudioChannel2 = 1 << 9,
AudioChannel3 = 1 << 10,
SerialPortReceive = 1 << 11,
DiskSyncMatch = 1 << 12,
External = 1 << 13, // i.e. CIA B.
};
};
#endif /* Flags_hpp */

View File

@ -2010,6 +2010,7 @@
4BD1552E270B14AC00410C6E /* MemoryMap.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = MemoryMap.hpp; sourceTree = "<group>"; };
4BD1552F2711E5FD00410C6E /* kickstart13 boot logo.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "kickstart13 boot logo.json"; path = "Kickstart 1.3 boot logo/kickstart13 boot logo.json"; sourceTree = "<group>"; };
4BD155312716362A00410C6E /* BitSpread.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = BitSpread.hpp; sourceTree = "<group>"; };
4BD1553227178E8000410C6E /* Flags.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Flags.hpp; sourceTree = "<group>"; };
4BD191D9219113B80042E144 /* OpenGL.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = OpenGL.hpp; sourceTree = "<group>"; };
4BD191F22191180E0042E144 /* ScanTarget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ScanTarget.cpp; sourceTree = "<group>"; };
4BD191F32191180E0042E144 /* ScanTarget.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ScanTarget.hpp; sourceTree = "<group>"; };
@ -4309,6 +4310,7 @@
4B9EC0E926B384080060A31F /* Keyboard.hpp */,
4BC6237026F94A5B00F83DFE /* Minterms.h */,
4BD1552E270B14AC00410C6E /* MemoryMap.hpp */,
4BD1553227178E8000410C6E /* Flags.hpp */,
);
path = Amiga;
sourceTree = "<group>";