It's possible to use a C64 remotely with minimum modification thanks to RS232:
We know that we are able to direct the screen output to the other devices or files in the BASIC and direct mode with the help of the CMD command. For example, OPEN1,2,0,CHR$(10):CMD1:LIST command line opens the RS232 channel, directs the output to this channel, and the output of the LIST command is sent to the device (modem, terminal, etc.) connected via RS232. However, we can not direct the input in the direct mode (due to lack of initialization by using get# in direct mode I think).
Yet, it is easy to convert any BASIC program to be used over RS232, despite the lack of direct mode. That is to say, we can get the input from modem and send the output to modem in BASIC.
First, we insert the RS232 configuration at the start of the program (before the variables), and read a byte for initialization:
1 OPEN 129,2,0,CHR$(10)+CHR$(0):GET#129,A$
Then, we direct the input/output to the RS232 device instead of keyboard and screen:
2 POKE 153,2:POKE 154,2
that's all.
And, for ending the program
32767 POKE 153,0:POKE 154,3:CLOSE 129:END
turns back the input/output default values.
The details on the use of OPEN command for RS232 are discussed in C64 Programmer's Reference Guide, that's where I've looked at. In short, the configuration:
In OPEN,
129= logical file no (If it's greater than 127 it sends CRLF instead of CR).
2= RS232 device.
CHR$(10) is for 2048bps. Use 6 for 300bps, and 8 for 1200bps. Unfortunately, the highest speed is 2400bps in C64.
An example program:
50 REM SIMPLE INPUT OUTPUT EXAMPLE PROGRAM 100 GOSUB 1000:REM CLEAR SCREEN 110 PRINT "==== MENU ====" 120 PRINT "1) OPTION 1" 130 PRINT "2) OPTION 2" 140 PRINT "0) EXIT" 200 GET A$:IF A$="" GOTO 200 210 A=1+ASC(A$)AND7 220 ON A GOTO 500,300,400 290 GOTO 200 300 GOSUB 1000 310 PRINT "=== MENU 1 ===" 320 PRINT "..." 330 REM 390 GOTO 110 400 GOSUB 1000 410 PRINT "=== MENU 2 ===" 420 PRINT "..." 430 REM 490 GOTO 110 500 END 1000 FORI=1TO25:PRINT:NEXT:RETURN 1010 REM CLEARS SCREEN BY TAKING THE DUMB TERMINALS INTO ACCOUNT 1020 REM
Now, we perform the following changes in order to use a simple BASIC program like this over RS232 remotely:
0 OPEN 129,2,0,CHR$(10)+CHR$(0):GET#129,A$:POKE 153,2:POKE 154,2 500 POKE 153,0:POKE 154,3:CLOSE 129:END
Then the program becomes:
0 OPEN 129,2,0,CHR$(10)+CHR$(0):GET#129,A$:POKE 153,2:POKE 154,2 50 REM SIMPLE INPUT OUTPUT EXAMPLE PROGRAM 100 GOSUB 1000:REM CLEAR SCREEN 110 PRINT "==== MENU ====" 120 PRINT "1) OPTION 1" 130 PRINT "2) OPTION 2" 140 PRINT "0) EXIT" 200 GET A$:IF A$="" GOTO 200 210 A=1+ASC(A$)AND7 220 ON A GOTO 500,300,400 290 GOTO 200 300 GOSUB 1000 310 PRINT "=== MENU 1 ===" 320 PRINT "..." 330 REM 390 GOTO 110 400 GOSUB 1000 410 PRINT "=== MENU 2 ===" 420 PRINT "..." 430 REM 490 GOTO 110 500 POKE 153,0:POKE 154,3:CLOSE 129:END 1000 FORI=1TO25:PRINT:NEXT:RETURN 1010 REM CLEARS SCREEN BY TAKING THE DUMB TERMINALS INTO ACCOUNT 1020 REM 20000 REM =============== 21000 REM ILKER FICICILAR 22000 REM 2014.07.17 23000 REM ===============
So, where can we use this method?
For example, you connect your C64 at home to a modem and phone line. Configure your modem for automatic answering. And, at home call your home phone through your laptop's modem and connect your favorite program on the C64!
Or, if you don't want monitor clutter over your desk, you can connect your Commodore to your other computer through a NULL-MODEM cable and use it that way.
By the way, a PETSCII terminal emulator software is necessary for an efficient use of this method.
And, the goal of the method is to make present BASIC programs usable over RS232 remotely with just two additional lines of code.
İlker Fıçıcılar
20.07.2014
Keywords: Commodore, RS232, remote desktop