Buffered CGA refactor finish
This commit is contained in:
@ -7,15 +7,12 @@
|
||||
|
||||
// NOTE: I added this file
|
||||
|
||||
// The buffer dimensions must match with the destination dimensions
|
||||
class ScrollbackBuffer {
|
||||
private:
|
||||
CGA::cga_page_t* buffer; // Circular buffer to store lines that left the screen
|
||||
CGA::cga_page_t* pagebuffer; // Contains the current page separately from the scrollback.
|
||||
// I thought this was easier since it also captures the little output
|
||||
// generated before the scrollback buffer is initialized by accident
|
||||
// (but only if it's less than a page)
|
||||
unsigned int pos;
|
||||
CGA::cga_page_t* buffer; // Circular buffer to store lines that left the screen
|
||||
unsigned int pos; // Buffer write position
|
||||
|
||||
ScrollbackBuffer(const ScrollbackBuffer&) = delete;
|
||||
|
||||
public:
|
||||
const unsigned int pages; // Number of pages in buffer
|
||||
@ -23,19 +20,15 @@ public:
|
||||
|
||||
ScrollbackBuffer(unsigned char rows, unsigned char pages)
|
||||
: pos(0), pages(pages), rows(rows * pages) {
|
||||
this->buffer = new CGA::cga_page_t[pages]; // Allocate with new because it's quite large,
|
||||
this->pagebuffer = new CGA::cga_page_t; // also I wanted to use the new memory manager.
|
||||
this->clear(); // Null out the buffer so no crap gets displayed.
|
||||
this->buffer = new CGA::cga_page_t[pages]; // Allocate with new because it's quite large
|
||||
this->clear(); // Null out the buffer so no crap gets displayed
|
||||
}
|
||||
~ScrollbackBuffer() {
|
||||
delete[] this->buffer;
|
||||
delete this->pagebuffer;
|
||||
}
|
||||
|
||||
void put(CGA::cga_line_t* line);
|
||||
void get(CGA::cga_line_t* destination, unsigned char page) const;
|
||||
void save_screen(CGA::cga_page_t* destination) const; // Do not lose video memory when scrolling
|
||||
void restore_screen(CGA::cga_page_t* source);
|
||||
void clear();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user