Apple1-esp/io.h
2024-11-23 12:35:37 +00:00

33 lines
549 B
C++

#pragma once
class serial_kbd;
class disp;
class io: public Memory::Device {
public:
io(filer &files, serial_kbd &kbd, disp &dsp):
Memory::Device(Memory::page_size), files(files), _kbd(kbd), _dsp(dsp) {}
void reset();
bool start();
void operator=(uint8_t b) { _pia.write(_acc, b); }
operator uint8_t() { return _pia.read(_acc); }
void checkpoint(Stream &);
void restore(Stream &);
void poll();
void load();
filer &files;
private:
PIA _pia;
serial_kbd &_kbd;
disp &_dsp;
void enter(uint8_t);
bool _loading;
uint8_t _ch;
};