64 Tape Control
I'm a beginning programmer; I'm getting a big headache trying to solve what originally seemed to be a simple problem. My program instructs the user of a Commodore 64 to press fast forward on the Datassette. When it senses that the button is down it prints OK. After a time interval I want the Datassette turned off automatically by the computer. I've tried every POKE possible and haven't got one that works. I thought that this one would work:
… but it doesn't.
How can I do this?
Jim Butterfield replies:
You're close. Two more things, and you'll have everything working.
First: the motor logic is inverted, so to turn the motor off, you must turn the control bit (value 32) on. To turn bits on, you need an OR function rather than an AND. So your code will be: POKE 1, PEEK(1) OR 32.
Second: the motor is also controlled by an interlock, address 192 on the VIC and Commodore 64. If this location contains a zero, you can try to turn the motor off … but it will be turned right back on again. You must set the interlock to any non-zero value after the motor has been turned on. Then, and only then, your POKE to address 1 will shut the motor off.
The interlock location, 192, will switch back to zero automatically when the user releases the Datassette key. If this key is still down, you can turn the cassette motor back on again very easily: just release the interlock with POKE 192,0.
So your procedure is as follows:
- Wait for the user to press the appropriate cassette key which will cause the motor to start. Then POKE 192,1.
- When the appropriate time has elapsed, POKE 1,PEEK(1) OR 32.