1
Files
lecture-operating-system-de…/c_os/devices/BufferedCGA.h
2022-07-16 03:30:20 +02:00

38 lines
1.4 KiB
C++
Executable File

#ifndef __BUFFEREDCGA_INCLUDE_H_
#define __BUFFEREDCGA_INCLUDE_H_
#include "devices/CGA.h"
#include "devices/Keyboard.h"
#include "user/lib/Logger.h"
#include "user/ScrollbackBuffer.h"
#include <memory>
// NOTE: I added this file, I will probably replace this in the end by an application
class BufferedCGA : public CGA {
private:
std::unique_ptr<ScrollbackBuffer> scrollback_buffer; // Contains previous pages
std::unique_ptr<CGA::cga_page_t> screen_buffer; // Contains the current page separately from the scrollback.
bool initialized; // Don't do ScrollbackBuffer actions if not initialized
// TODO: Just check if pointers have value
BufferedCGA(const BufferedCGA&) = delete;
Logger log;
public:
BufferedCGA() : initialized(false), scrollback(0), log("BufferedCGA") {}
unsigned char scrollback; // The page that is displayed, public to enable page display
void init(unsigned int pages); // Scrollback needs to be initialized after memorymanagement
void display_scrollback(); // Write the current_page to CGA memory
void scroll_page_backward(); // Scroll up the page history
void scroll_page_forward(); // Scroll down the page history (to the current page)
void print(char* string, int n, unsigned char attrib = STD_ATTR) override;
void scrollup() override;
void clear() override;
};
#endif