mirror of
https://github.com/jscrane/r65emu.git
synced 2025-02-10 19:31:57 +00:00
remove Line class
This commit is contained in:
parent
e4cc6249ff
commit
3bccf38c7d
@ -127,8 +127,10 @@ void Display::setFont(const void *font) {
|
||||
_cx = utft.getFontXsize();
|
||||
_cy = utft.getFontYsize();
|
||||
#elif defined(USE_ESPI)
|
||||
#if defined(LOAD_GFXFF)
|
||||
const GFXfont *f = (const GFXfont *)font;
|
||||
espi.setFreeFont(f);
|
||||
#endif
|
||||
_cy = espi.fontHeight();
|
||||
_cx = espi.textWidth("M");
|
||||
#elif defined(USE_DVI)
|
||||
|
17
src/line.h
17
src/line.h
@ -1,17 +0,0 @@
|
||||
#ifndef _LINE_H
|
||||
#define _LINE_H
|
||||
|
||||
class Line {
|
||||
public:
|
||||
Line(): _state(false) {}
|
||||
|
||||
operator bool() { return _state; }
|
||||
void set(bool state) { _state = state; }
|
||||
void clear() { set(false); }
|
||||
void set() { set(true); }
|
||||
|
||||
private:
|
||||
volatile bool _state;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,6 +1,5 @@
|
||||
#include <Arduino.h>
|
||||
#include <memory.h>
|
||||
#include <line.h>
|
||||
#include <via.h>
|
||||
|
||||
#define VPORTB 0x00
|
||||
@ -117,7 +116,7 @@ void VIA::write_sr(uint8_t b) {
|
||||
|
||||
void VIA::write_pcr(uint8_t b) {
|
||||
_pcr = b;
|
||||
CA2.set(b & 0x02);
|
||||
_ca2_handler(b & 0x02);
|
||||
}
|
||||
|
||||
void VIA::write_acr(uint8_t b) {
|
||||
|
15
src/via.h
15
src/via.h
@ -3,7 +3,7 @@
|
||||
|
||||
class VIA {
|
||||
public:
|
||||
VIA(): _irq(0), _timer1(false), _timer2(false), _t1(0), _t2(0), _t1_latch(0),
|
||||
VIA(): _timer1(false), _timer2(false), _t1(0), _t2(0), _t1_latch(0),
|
||||
_sr(0), _acr(0), _pcr(0), _ier(0), _ifr(0), _ddra(0), _ddrb(0), _porta(0), _portb(0) {}
|
||||
|
||||
virtual void reset() {
|
||||
@ -20,9 +20,13 @@ public:
|
||||
|
||||
void tick();
|
||||
|
||||
Line CA2;
|
||||
void register_irq_handler(std::function<void(bool)> fn) {
|
||||
_irq_handler = fn;
|
||||
}
|
||||
|
||||
void register_irq(Line &irq) { _irq = &irq; }
|
||||
void register_ca2_handler(std::function<void(bool)> fn) {
|
||||
_ca2_handler = fn;
|
||||
}
|
||||
|
||||
// acr
|
||||
static const uint8_t ACR_SHIFT_MASK = 0x1c;
|
||||
@ -76,10 +80,11 @@ protected:
|
||||
virtual uint8_t read_ier() { return _ier | 0x80; }
|
||||
virtual uint8_t read_vporta_nh();
|
||||
|
||||
void set_interrupt() { if (_irq) _irq->set(); }
|
||||
void set_interrupt() { if (_irq_handler) _irq_handler(true); }
|
||||
|
||||
private:
|
||||
Line *_irq;
|
||||
std::function<void(bool)> _irq_handler;
|
||||
std::function<void(bool)> _ca2_handler;
|
||||
|
||||
void set_int(uint8_t);
|
||||
void clear_int(uint8_t);
|
||||
|
Loading…
x
Reference in New Issue
Block a user