1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-05 10:28:58 +00:00

Reduces line drawing to two accesses per slot.

Still a fiction, but a better one.
This commit is contained in:
Thomas Harte 2022-08-07 19:15:03 -04:00
parent 7f423e39ed
commit 867769f6e7
2 changed files with 66 additions and 61 deletions

View File

@ -292,9 +292,11 @@ bool Blitter<record_bus>::advance_dma() {
// at https://github.com/niklasekstrom/blitter-subpixel-line/blob/master/Drawing%20lines%20using%20the%20Amiga%20blitter.pdf
//
int error = int16_t(pointer_[0] << 1) >> 1; // TODO: what happens if line_sign_ doesn't agree with this?
bool draw_ = true;
while(height_--) {
if(!busy_) {
error_ = int16_t(pointer_[0] << 1) >> 1; // TODO: what happens if line_sign_ doesn't agree with this?
draw_ = true;
busy_ = true;
}
if(draw_) {
// TODO: patterned lines. Unclear what to do with the bit that comes out of b.
@ -322,15 +324,15 @@ bool Blitter<record_bus>::advance_dma() {
((line_direction_ & 1) ? LEFT : RIGHT) :
((line_direction_ & 1) ? UP : DOWN);
if(error < 0) {
error += modulos_[1];
if(error_ < 0) {
error_ += modulos_[1];
} else {
step |=
(line_direction_ & 4) ?
((line_direction_ & 2) ? UP : DOWN) :
((line_direction_ & 2) ? LEFT : RIGHT);
error += modulos_[0];
error_ += modulos_[0];
}
if(step & LEFT) {
@ -353,9 +355,12 @@ bool Blitter<record_bus>::advance_dma() {
pointer_[3] += modulos_[2];
draw_ = true;
}
}
--height_;
if(!height_) {
busy_ = false;
posit_interrupt(InterruptFlag::Blitter);
}
} else {
// Copy mode.
if(!busy_) {
@ -518,9 +523,6 @@ bool Blitter<record_bus>::advance_dma() {
}
}
posit_interrupt(InterruptFlag::Blitter);
height_ = 0;
return true;
}

View File

@ -261,6 +261,9 @@ template <bool record_bus = false> class Blitter: public DMADevice<4, 4> {
bool busy_ = false;
int loop_index_ = -1;
int error_ = 0;
bool draw_ = false;
void add_modulos();
std::vector<Transaction> transactions_;
};