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

Added some notes to self on line mode.

This commit is contained in:
Thomas Harte 2021-09-20 23:08:26 -04:00
parent fa800bb809
commit 7092429f7c
2 changed files with 61 additions and 1 deletions

View File

@ -15,6 +15,12 @@
using namespace Amiga;
void Blitter::set_control(int index, uint16_t value) {
if(index) {
line_mode_ = !(value & 1);
} else {
}
shifts_[index] = value >> 12;
LOG("Set control " << index << " to " << PADHEX(4) << value);
}
@ -61,7 +67,58 @@ uint16_t Blitter::get_status() {
bool Blitter::advance() {
if(!height_) return false;
printf("!!! %08x\n", pointer_[3]);
if(line_mode_) {
//
// Line mode.
//
// Bluffer's guide to line mode:
//
// In Bresenham terms, the following registers have been set up:
//
// [A modulo] = 4 * (dy - dx)
// [B modulo] = 4 * dy
// [A pointer] = 4 * dy - 2 * dx, with the sign flag in BLTCON1 indicating sign.
//
// [A data] = 0x8000
// [Both masks] = 0xffff
// [A shift] = x1 & 15
//
// [B data] = texture
// [B shift] = bit at which to start the line texture (0 = LSB)
//
// [C and D pointers] = word containing the first pixel of the line
// [C and D modulo] = width of the bitplane in bytes
//
// height = number of pixels
//
// If ONEDOT of BLTCON1 is set, plot only a single bit per horizontal row.
//
// BLTCON1 quadrants are (bits 24):
//
// 110 -> step in x, x positive, y negative
// 111 -> step in x, x negative, y negative
// 101 -> step in x, x negative, y positive
// 100 -> step in x, x positive, y positive
//
// 001 -> step in y, x positive, y negative
// 011 -> step in y, x negative, y negative
// 010 -> step in y, x negative, y positive
// 000 -> step in y, x positive, y positive
//
// So that's:
//
// * bit 4 = x or y major;
// * bit 3 = 1 => major variable negative; otherwise positive;
// * bit 2 = 1 => minor variable negative; otherwise positive.
printf("!!! Line %08x\n", pointer_[3]);
// ram_[pointer_[3] & ram_mask_] = 0x0001 << shifts_[0];
} else {
// Copy mode.
printf("!!! Copy %08x\n", pointer_[3]);
}
ram_[pointer_[3] & ram_mask_] = 0xffff;
height_ = 0;

View File

@ -43,6 +43,9 @@ class Blitter: public DMADevice<4> {
private:
uint8_t minterms_;
int width_ = 0, height_ = 0;
int shifts_[2];
bool line_mode_ = false;
};
}