mirror of
https://github.com/TomHarte/CLK.git
synced 2024-10-05 23:56:33 +00:00
Reduces line drawing to two accesses per slot.
Still a fiction, but a better one.
This commit is contained in:
parent
7f423e39ed
commit
867769f6e7
@ -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
|
// 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?
|
if(!busy_) {
|
||||||
bool draw_ = true;
|
error_ = int16_t(pointer_[0] << 1) >> 1; // TODO: what happens if line_sign_ doesn't agree with this?
|
||||||
while(height_--) {
|
draw_ = true;
|
||||||
|
busy_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(draw_) {
|
if(draw_) {
|
||||||
// TODO: patterned lines. Unclear what to do with the bit that comes out of b.
|
// 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) ? LEFT : RIGHT) :
|
||||||
((line_direction_ & 1) ? UP : DOWN);
|
((line_direction_ & 1) ? UP : DOWN);
|
||||||
|
|
||||||
if(error < 0) {
|
if(error_ < 0) {
|
||||||
error += modulos_[1];
|
error_ += modulos_[1];
|
||||||
} else {
|
} else {
|
||||||
step |=
|
step |=
|
||||||
(line_direction_ & 4) ?
|
(line_direction_ & 4) ?
|
||||||
((line_direction_ & 2) ? UP : DOWN) :
|
((line_direction_ & 2) ? UP : DOWN) :
|
||||||
((line_direction_ & 2) ? LEFT : RIGHT);
|
((line_direction_ & 2) ? LEFT : RIGHT);
|
||||||
|
|
||||||
error += modulos_[0];
|
error_ += modulos_[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(step & LEFT) {
|
if(step & LEFT) {
|
||||||
@ -353,9 +355,12 @@ bool Blitter<record_bus>::advance_dma() {
|
|||||||
pointer_[3] += modulos_[2];
|
pointer_[3] += modulos_[2];
|
||||||
draw_ = true;
|
draw_ = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
--height_;
|
||||||
|
if(!height_) {
|
||||||
busy_ = false;
|
busy_ = false;
|
||||||
|
posit_interrupt(InterruptFlag::Blitter);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Copy mode.
|
// Copy mode.
|
||||||
if(!busy_) {
|
if(!busy_) {
|
||||||
@ -518,9 +523,6 @@ bool Blitter<record_bus>::advance_dma() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
posit_interrupt(InterruptFlag::Blitter);
|
|
||||||
height_ = 0;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,6 +261,9 @@ template <bool record_bus = false> class Blitter: public DMADevice<4, 4> {
|
|||||||
bool busy_ = false;
|
bool busy_ = false;
|
||||||
int loop_index_ = -1;
|
int loop_index_ = -1;
|
||||||
|
|
||||||
|
int error_ = 0;
|
||||||
|
bool draw_ = false;
|
||||||
|
|
||||||
void add_modulos();
|
void add_modulos();
|
||||||
std::vector<Transaction> transactions_;
|
std::vector<Transaction> transactions_;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user