Hello,
I have a Commodore smart modem that attaches to the USER port and has auto answer. It seems to work fine with the standard built in kernal RS232 stuff. I was wondering if anyone ever made a program that redirects the console (basic's input and output) to the USER port? Ive figured out how to do it on other systems (tandy coco, Apple2) but can't really find any info about people doing it on Commodore machines. The best i was able to come up with was some one doing it on the C64 with FORTH ( https://c64retr.blogspot.com/2012/10/su ... nsole.html )
Thanks
Redirecting console (basic's I/O) to user port?
Moderator: Moderators
- Junkman
- Vic 20 Newbie
- Posts: 6
- Joined: Sun Jan 13, 2019 7:38 pm
- Website: http://sl0w.org/
- Location: ct,usa
- Mike
- Herr VC
- Posts: 4842
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: Redirecting console (basic's I/O) to user port?
Redirecting the output is usually done with the CMD command. The incantation "OPEN4,4:CMD4:LIST" for example (written in a single line) lists the BASIC program currently in RAM on the line printer. With "PRINT#4:CLOSE4" (also in a single line, with no space between PRINT and "#"!) the output is properly restored to screen.
For redirecting the keyboard input, there is no dedicated BASIC command. Though, the combination of POKE781,X (where X is the channel number of an opened file or device) with SYS65478 (KERNAL call CHKIN) pretty much achieves this effect. Two main issues: BASIC and KERNAL repeatedly call CLRCHN at several places to reset any I/O redirections, and redirections are only possible in half-duplex mode (as per out-of-the-box).
It is possible, for example, to redirect keyboard input to "type in" a BASIC program from a SEQ file. For this, the KERNAL routine CLALL has to be temporarily disabled by pointing it to an RTS instruction (it is vectored over 812/813):
The last line of the SEQ file then re-enables CLALL and restores input back to keyboard as follows:
For redirecting the keyboard input, there is no dedicated BASIC command. Though, the combination of POKE781,X (where X is the channel number of an opened file or device) with SYS65478 (KERNAL call CHKIN) pretty much achieves this effect. Two main issues: BASIC and KERNAL repeatedly call CLRCHN at several places to reset any I/O redirections, and redirections are only possible in half-duplex mode (as per out-of-the-box).
It is possible, for example, to redirect keyboard input to "type in" a BASIC program from a SEQ file. For this, the KERNAL routine CLALL has to be temporarily disabled by pointing it to an RTS instruction (it is vectored over 812/813):
Code: Select all
POKE812,238:OPEN2,8,2,"file,S,R":POKE781,2:SYS65478
Code: Select all
[... payload of SEQ file ...]
POKE812,239:SYS65484:CLOSE2
- Schema
- factor
- Posts: 1430
- Joined: Tue Mar 23, 2004 7:07 am
- Website: http://www.jammingsignal.com
- Location: Toronto, Ontario
Re: Redirecting console (basic's I/O) to user port?
There was a program for the 64 published in Transactor that did exactly this - lets you remote control your C64 through the user port through console I/O. Would be cool to see a VIC version.
ftp://ftp.zimmers.net/pub/cbm/magazines ... 2/p042.jpg
ftp://ftp.zimmers.net/pub/cbm/magazines ... 2/p043.jpg
ftp://ftp.zimmers.net/pub/cbm/magazines ... 2/p044.jpg
The disk can be found here: http://csbruce.com/cbm/transactor/disks/
ftp://ftp.zimmers.net/pub/cbm/magazines ... 2/p042.jpg
ftp://ftp.zimmers.net/pub/cbm/magazines ... 2/p043.jpg
ftp://ftp.zimmers.net/pub/cbm/magazines ... 2/p044.jpg
The disk can be found here: http://csbruce.com/cbm/transactor/disks/
- Mike
- Herr VC
- Posts: 4842
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: Redirecting console (basic's I/O) to user port?
Nice! This comes quite handy for a WIP of mine.
I took a quick peek at the source, no obvious obstacles for a port. Will take a stab at it this evening.Schema wrote:Would be cool to see a VIC version.
Last edited by Mike on Mon Feb 04, 2019 1:28 pm, edited 1 time in total.
Reason: PM sent
Reason: PM sent
- Junkman
- Vic 20 Newbie
- Posts: 6
- Joined: Sun Jan 13, 2019 7:38 pm
- Website: http://sl0w.org/
- Location: ct,usa
Re: Redirecting console (basic's I/O) to user port?
Schema, wow that program would be great to have on the VIC. Simple remote access would be neat and being able to do text stuff with an 80col dumb terminal connected would also be usefull.
Mike thanks for the tips on CLRCHN. I hope you have luck with a REMOTE port!
I am sure im not the only one who could think up some fun uses for a remote controlled VIC
Mike thanks for the tips on CLRCHN. I hope you have luck with a REMOTE port!
I am sure im not the only one who could think up some fun uses for a remote controlled VIC