Package smsqmulator
Class QL50HzInterrupt
java.lang.Object
smsqmulator.QL50HzInterrupt
- All Implemented Interfaces:
ExternalInterruptHandler
This simulates a 50 Hz external frame interrupt, and generates screen redraws.
Two independent threads are created:
- The first one sleeps for 20 milliseconds and then signals an interrupt to the cpu = 50 Hz interrupt.
- The second thread is responsible for (re)drawing the screen.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Handles the interrupt, no instruction is being executed whilst this goes on.void
This stops the interrupt handler, and removes any reference to the cpu.void
setCpu
(MC68000Cpu ncpu) Sets a (new) cpu object.void
Sets a (new) screen object.void
setScreenUpdateInterval
(int tim) Sets the interval between screen updates.void
Starts the interrupt handler and screen redraw threads.void
Stops the interrupt handler and screen redraw threads.
-
Constructor Details
-
QL50HzInterrupt
Creates the object.- Parameters:
cpu
- the cpu to which this interrupt is attached.
-
-
Method Details
-
handleExternalInterrupt
Handles the interrupt, no instruction is being executed whilst this goes on. This should be called from the CPU execute thread. However, since there is only one interrupt, this isn't called at all, the CPU handles the interrupt directly. was: Port $18021 on the emulated machine is set to 8, to signal the external interrupt. An exception is raised, which changes the CPU's PC.- Specified by:
handleExternalInterrupt
in interfaceExternalInterruptHandler
- Parameters:
cpu
- the CPU for which an interrupt was generated.- See Also:
-
startInterrupts
public void startInterrupts()Starts the interrupt handler and screen redraw threads. -
stopInterrupts
public void stopInterrupts()Stops the interrupt handler and screen redraw threads. -
removeHandler
public void removeHandler()This stops the interrupt handler, and removes any reference to the cpu.- Specified by:
removeHandler
in interfaceExternalInterruptHandler
-
setScreen
Sets a (new) screen object.- Parameters:
screen
- the Screen to set.
-
setCpu
Sets a (new) cpu object. This stops the interrupt threads- Parameters:
ncpu
- the new Cpu to set.
-
setScreenUpdateInterval
public void setScreenUpdateInterval(int tim) Sets the interval between screen updates.- Parameters:
tim
- the interval between screen updates in milliseconds
-