2022-05-12 14:59:12 +00:00
|
|
|
import { useEffect } from 'preact/hooks';
|
|
|
|
import Apple2IO, { slot } from '../apple2io';
|
|
|
|
import RAMFactor from '../cards/ramfactor';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Slinky component properties
|
|
|
|
*/
|
|
|
|
export interface SlinkyProps {
|
|
|
|
io: Apple2IO | undefined;
|
|
|
|
slot: slot;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* RAMFactory (Slinky) memory card component. Adds
|
|
|
|
* 1MB of slinky compatible memory.
|
|
|
|
*
|
|
|
|
* @param io Apple2IO object
|
|
|
|
* @param slot Slot to register card in
|
|
|
|
* @returns Slinky component
|
|
|
|
*/
|
|
|
|
export const Slinky = ({ io, slot }: SlinkyProps) => {
|
|
|
|
useEffect(() => {
|
|
|
|
if (io) {
|
|
|
|
const slinky = new RAMFactor(1024 * 1024);
|
|
|
|
io.setSlot(slot, slinky);
|
|
|
|
}
|
2022-05-29 20:48:51 +00:00
|
|
|
}, [io, slot]);
|
2022-05-12 14:59:12 +00:00
|
|
|
|
|
|
|
return null;
|
|
|
|
};
|