mirror of
https://github.com/jscrane/Apple1.git
synced 2024-12-21 12:29:51 +00:00
blink cursor (#9)
This commit is contained in:
parent
48529fae16
commit
f2abbe9dfd
@ -34,7 +34,7 @@ void reset() {
|
||||
io.status("Reset failed");
|
||||
return;
|
||||
}
|
||||
io.files.start();
|
||||
io.start();
|
||||
#if defined(KRUSADER)
|
||||
io.status("Krusader: F000R / Basic: E000R");
|
||||
#else
|
||||
|
25
io.cpp
25
io.cpp
@ -1,5 +1,4 @@
|
||||
#include <Stream.h>
|
||||
#include <stdint.h>
|
||||
#include <Arduino.h>
|
||||
#include <memory.h>
|
||||
#include <display.h>
|
||||
#include <serialio.h>
|
||||
@ -26,6 +25,28 @@ void io::reset() {
|
||||
PIA::reset();
|
||||
}
|
||||
|
||||
static io *i;
|
||||
|
||||
const int TICK_FREQ = 2;
|
||||
|
||||
bool io::start() {
|
||||
|
||||
i = this;
|
||||
timer_create(TICK_FREQ, io::on_tick);
|
||||
return files.start();
|
||||
}
|
||||
|
||||
void IRAM_ATTR io::on_tick() {
|
||||
|
||||
static int tick = 0;
|
||||
tick = ++tick % 3;
|
||||
i->cursor(tick < 2);
|
||||
}
|
||||
|
||||
void io::cursor(bool on) {
|
||||
draw(on? '_': ' ', c, r);
|
||||
}
|
||||
|
||||
void io::load() {
|
||||
if (files.more()) {
|
||||
_loading = true;
|
||||
|
23
io.h
23
io.h
@ -5,18 +5,22 @@ class io: public Memory::Device, public Display, Keyboard, public PIA {
|
||||
public:
|
||||
io(filer &files): Memory::Device(Memory::page_size), files(files) {}
|
||||
|
||||
virtual void reset();
|
||||
virtual void down(uint8_t);
|
||||
virtual void up(uint8_t);
|
||||
void reset();
|
||||
bool start();
|
||||
|
||||
virtual void operator=(uint8_t b) { PIA::write(_acc, b); }
|
||||
virtual operator uint8_t() { return PIA::read(_acc); }
|
||||
static void on_tick();
|
||||
|
||||
virtual void checkpoint(Stream &);
|
||||
virtual void restore(Stream &);
|
||||
void down(uint8_t);
|
||||
void up(uint8_t);
|
||||
|
||||
virtual void write_portb(uint8_t);
|
||||
virtual uint8_t read_cra();
|
||||
void operator=(uint8_t b) { PIA::write(_acc, b); }
|
||||
operator uint8_t() { return PIA::read(_acc); }
|
||||
|
||||
void checkpoint(Stream &);
|
||||
void restore(Stream &);
|
||||
|
||||
void write_portb(uint8_t);
|
||||
uint8_t read_cra();
|
||||
|
||||
void load();
|
||||
filer &files;
|
||||
@ -25,6 +29,7 @@ public:
|
||||
static const uint8_t COLS = 40;
|
||||
|
||||
private:
|
||||
void cursor(bool on);
|
||||
void display(uint8_t);
|
||||
void draw(char, int, int);
|
||||
void enter(uint8_t);
|
||||
|
Loading…
Reference in New Issue
Block a user