2020-12-29 14:12:33 +00:00
|
|
|
#ifndef __APPLEMOUSE_H
|
|
|
|
#define __APPLEMOUSE_H
|
|
|
|
|
|
|
|
#ifdef TEENSYDUINO
|
|
|
|
#include <Arduino.h>
|
|
|
|
#else
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "applemmu.h"
|
|
|
|
#include "slot.h"
|
|
|
|
|
|
|
|
class Mouse : public Slot {
|
|
|
|
public:
|
|
|
|
Mouse();
|
|
|
|
virtual ~Mouse();
|
|
|
|
|
|
|
|
virtual bool Serialize(int8_t fd);
|
|
|
|
virtual bool Deserialize(int8_t fd);
|
|
|
|
|
|
|
|
virtual void Reset(); // used by BIOS cold-boot
|
|
|
|
virtual uint8_t readSwitches(uint8_t s);
|
|
|
|
virtual void writeSwitches(uint8_t s, uint8_t v);
|
|
|
|
virtual void loadROM(uint8_t *toWhere);
|
|
|
|
|
|
|
|
virtual bool hasExtendedRom();
|
|
|
|
virtual void loadExtendedRom(uint8_t *toWhere, uint16_t byteOffset);
|
2021-01-10 20:04:52 +00:00
|
|
|
|
|
|
|
void maintainMouse(int64_t cycleCount);
|
2021-01-11 16:32:40 +00:00
|
|
|
|
|
|
|
bool isEnabled();
|
2021-01-10 20:04:52 +00:00
|
|
|
|
2021-01-14 03:03:30 +00:00
|
|
|
void performHack();
|
|
|
|
|
2021-01-10 20:04:52 +00:00
|
|
|
private:
|
|
|
|
uint8_t status;
|
|
|
|
uint8_t interruptsTriggered;
|
2021-01-11 04:52:58 +00:00
|
|
|
|
2021-01-11 16:32:40 +00:00
|
|
|
// Previous state vars used when we're asked "did this change since last time"
|
2021-01-11 04:52:58 +00:00
|
|
|
uint16_t lastX, lastY;
|
|
|
|
bool lastButton;
|
2021-01-11 16:32:40 +00:00
|
|
|
|
2021-01-11 04:52:58 +00:00
|
|
|
bool curButton;
|
2021-01-11 16:32:40 +00:00
|
|
|
|
|
|
|
// second set of previous state vars for use when checking if an interrupt
|
|
|
|
// needs to fire based on a change
|
|
|
|
uint16_t lastXForInt, lastYForInt;
|
|
|
|
bool lastButtonForInt;
|
2020-12-29 14:12:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|