Terminal programs and 80-column cards (DATA-20)

Modding and Technical Issues

Moderator: Moderators

User avatar
ral-clan
plays wooden flutes
Posts: 3702
Joined: Thu Jan 26, 2006 2:01 pm
Location: Canada

Terminal programs and 80-column cards (DATA-20)

Post by ral-clan »

Hi, I have a Data-20 (which is the same as a Protecto-80 column board) for my VIC-20.

I would love to get terminal software working on this so I could use the display with my wimodem wireless user port modem.
However, I'm not sure how to do it.

According to the manual for this device, there is terminal software built in which is accessible by pressing the F8 key. Here is a paragraph from the manual:
TERMINAL MODE

The Protecto 80 software has provisions to emulate a terminal. You can use the terminal mode in either 80 or 40 columns to access many remote data bases such as the Source and Compuserve in conjunction with the VIC Modem.

To use the terminal mode, all you have to do is first open the RS-232 port using the open statement (see the programmer's reference guide for the particulars) and then hit the F8 key. It is not necessary to load the VICTERM program from tape. The exact form of OPEN statement will vary from service to service, but there are only a few things to look for: speed of transmission, parity, work length, and duplex mode. A form that should work with most of them is: OPEN127,2,0,CHR$(6). To exit terminal mode, just hit the F8 key again.
So I've tried turning on my VIC with the 80 column board, typing the OPEN command as listed in the manual, then pressing F8. Whenever I type something, it's garbled, so I'm guessing the terminal software in the DATA-20 cartridge is not communicating with the Wimodem properly (perhaps mis-matched baud rate). But after there I'm stuck.

I don't really know what to do. Can anyone help? Thanks.
Image Music I've made with 1980s electronics, synths and other retro-instruments: http://theovoids.bandcamp.com
User avatar
Mike
Herr VC
Posts: 4830
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Terminal programs and 80-column cards (DATA-20)

Post by Mike »

Please refer to page 253 of the Programmer's Reference Guide (RS232 baud rate, etc.) and the WiModem manual.

The WiModem manual states the pre-configured baud rate is 2400 baud. If you haven't changed this (by earlier operation with a C64, or the like), you should thus use OPEN127,2,0,CHR$(10) instead of the OPEN command as given in the Data-20 manual.

HTH,

Michael
User avatar
ral-clan
plays wooden flutes
Posts: 3702
Joined: Thu Jan 26, 2006 2:01 pm
Location: Canada

Re: Terminal programs and 80-column cards (DATA-20)

Post by ral-clan »

Hi Mike,

Thanks for the help. I had already looked at page 253, but I didn't really understand from that explanation how to implement the baud changes shown in binary in the chart into an OPEN statement. I'll have to re-read it several times until it sinks in.

I did change the default baud rate of the WiModem, first to 1200, and then 300. Both instances offered no improvement to the garbled text I was receiving echoed back from the modem. So I'll try to understand the info on page 253 and implement that to match the WiModem parameters better.
Image Music I've made with 1980s electronics, synths and other retro-instruments: http://theovoids.bandcamp.com
User avatar
ral-clan
plays wooden flutes
Posts: 3702
Joined: Thu Jan 26, 2006 2:01 pm
Location: Canada

Re: Terminal programs and 80-column cards (DATA-20)

Post by ral-clan »

Well, I'm closer to a solution.

With the 80-column card plugged in, I enter:

OPEN 1,2,0,CHR$(6)

Which should open a 300 baud connection to the RS-232 port.

I then enter terminal mode on the 80-column cartridge and type the modem command:

ATI

This normally asks the wireless modem to return a status report (about 7 lines of text) and it works in my terminal programs on a 22-column VIC. With the 80-column card I get a garbled series of lines (although I can read the word "PORT" among the garbage text).

However, most importantly, the garbled text is NOT random. Each time I issue the ATI command, the garbage returned by the modem is consistent and the same. This leads me to believe that there is just a protocol mismatch I haven't been able to figure out yet. The WiModem is set for 300 baud (I have confirmed that).

If anyone has any ideas I would appreciate suggestions.

A second question, but related:

In my research into using the RS-232 user port, I have read many program examples. The one on the VIC Reference manual uses the line:

100 OPEN2,2,3,CHR$(6+32)+CHR$(32+128): REM OPEN THE CHANNEL

What does the "+32" do? And what does the whole second part "+CHR$(32+128)" do? I'm having trouble understanding this. The reference manual does not explain it.
Image Music I've made with 1980s electronics, synths and other retro-instruments: http://theovoids.bandcamp.com
User avatar
ral-clan
plays wooden flutes
Posts: 3702
Joined: Thu Jan 26, 2006 2:01 pm
Location: Canada

Re: Terminal programs and 80-column cards (DATA-20)

Post by ral-clan »

ADDITIONAL....

More experimentation has revealed some interesting results that I don't know how to interpret.

Even though I am getting a garbled (but consistently garbled) text back from the WiModem, it seems to be receiving my commands just fine.
I trying ATDT (dialing) into a BBS and it seemed to work. The modem's own OLED screen told me it was dialing in and even showed the correct address. The text that I received back from the BBS was garbled, but consistent (i.e. I could tell it was receiving my commands and responding to them properly, just that the text I was seeing on my display was garbled).

Then I tried removing the WiModem and installing a stock 1270 Commodore 1200 baud modem in the user port.
This was interesting. Everything seemed to work properly between the 80-column card's terminal and this modem. I could ATDT a phone number, heard the number dial on the modem's speaker and got ungarbled responses from the modem (saying "NO CARRIER") on my screen. I didn't have a telephone line hooked up to the modem, so it couldn't actually connect with anything.

What was even more puzzling was that with the Commodore 1200 baud user port modem, I didn't even have to open a channel to the RS-232 port [OPEN 1,2,0,CHR$(6)] to start communication with the modem from the 80-column cartridge's terminal. It just worked right away. With the WiModem, I get absolutely no response from the terminal until I issue the OPEN statement.

So I don't understand what is going on, but it's very interesting.
Image Music I've made with 1980s electronics, synths and other retro-instruments: http://theovoids.bandcamp.com
User avatar
Mike
Herr VC
Posts: 4830
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Terminal programs and 80-column cards (DATA-20)

Post by Mike »

Please note, I own neither a Data-20 nor the WiModem, so any advice I can give most probably requires you to check against the manuals. Also, you'll need to acquire at least some basic knowledge about how bytes are physically transmitted with RS232. The PRG doesn't give this information, because in those days, the necessary information mostly was fixed and always conveyed by either the modem manufactorer or the BBS.

RS232 allows for different number of bits per bytes. Can be any of 5 to 8. 7-bit ASCII would only need 7 bits, if you need to transmit full 8 bits, you'll need to setup the transmission with 8 bits (d'uh), etc.

The simple 3-wire protocol needs only one line for signal ground (GND), and 2 signal lines in each direction. The receivers end of these lines is labeled RxD, the transmitters end TxD. That means, RxD and TxD are crossed along the cable.

While a signal line is idle, the sender puts a 0 signal (also dubbed "space") on it. To signify the beginning of a byte transmission, the sender puts 1 or 2 start-bits (a 1 signal, also dubbed "mark") on the line. That is already relevant for a correct transmission! If the sender uses 2 start bits, but the receiver only expects 1, it will mistake the 2nd start bit for a mark in the data. That means, both sender and receiver must agree upon the number of start bits.

Then follows the data. The bit order is not specified, but usually is lowest bit first.

If parity is specified, the data is possibly extended with another bit, the parity. If present, it is either chosen to make the number of all set bits, in data and parity combined, odd or even. That's what's meant with parity odd or even. The parity bit can also be chosen as always set, always clear, or not present at all. Parity, if used, checks for transmission errors on the bit level.

The combination of bits per byte, parity, and number of start bits is usually abbreviated in a short 3 letter combination like "8N1", which means 8 bits/byte, No parity, 1 start bit. That info is evidently missing from the WiModem manual!

The protocol also allows to specity the number of stop-bits. That is the minimal number of blanks a receiver can expect before the next byte is going to be sent - however, as you probably could guess, this is of minor importance for a correct transmission.

With the 3-wire protocol, special characters are employed between Modem and Computer to control the data flow. That means, the computer can tell the Modem (and thus, ultimately the BBS) to temporarily cease sending because it has to process the data. At a later time, it can ask for more data. The X-wire protocol implements this in hardware, with extra signal lines.

So much for the basics of RS232.
ral-clan wrote:[...]it works in my terminal programs on a 22-column VIC. With the 80-column card I get a garbled series of lines[...]
That's good news: at least something works, and we can exclude a hardware failure in the VIC-20 (of the VIA). Also, the WiModem seems to have quite relaxed demands upon the receiving end, otherwise it wouldn't be able to recognise your commands.

You'll need to replicate the exact settings of that 22-column terminal program with the OPEN127,2,... command for the Data-20 to stand any chance for a correct transmission in both directions. And then it still needs to be confirmed, that the terminal program of the Data-20 does a correct translation for ASCII (Edit: seems to work with your 1270 modem, so that is also confirmed).


Edit: you tell different logical channels for the OPEN command. What is given in the Data-20 manual, OPEN1,2,... or OPEN127,2,...? You can't just change the first number as you like, because the terminal internally uses exactly that number to set up the KERNAL I/O functions for input and output!
User avatar
ral-clan
plays wooden flutes
Posts: 3702
Joined: Thu Jan 26, 2006 2:01 pm
Location: Canada

Re: Terminal programs and 80-column cards (DATA-20)

Post by ral-clan »

Hi Mike,

You solved it. I simply had to change the first number so that my open statement read:

OPEN 127,2,0,CHR$(8)

[note this is for a 1200 baud connection to the WiMODEM - hence CHR$(8)]

Now the terminal works fine and I can use my Data-20 with the WiModem.

I had no idea (nor would I have ever figured it out) that the first number NEEDED to be 127. In all my reading in the VIC Programmer's Reference and elsewhere, it seemed to say that this first number could be any arbitrary number between 1 and 255. Why must it be a certain number?

In fact, my source book "The Commodore 64/VIC-20 BASIC Handbook" by Doublas Hergert (published by Sybex) said the following (misleading) information which caused me to believe the first number (which it calls the file number but you call "Logical Channel" for some reason) is arbitrary:
You can choose any number from 1 to 127 to act as the file number for each file you open....
I'm also not sure why it says 1 to 127 when the VIC's manual says the first number can be 0-255. That is why I was finding things so confusing. None of the explanations of the OPEN statement I was finding were explained completely or consistently between each other.

Thanks very much.
Image Music I've made with 1980s electronics, synths and other retro-instruments: http://theovoids.bandcamp.com
User avatar
srowe
Vic 20 Scientist
Posts: 1338
Joined: Mon Jun 16, 2014 3:19 pm

Re: Terminal programs and 80-column cards (DATA-20)

Post by srowe »

ral-clan wrote: I had no idea (nor would I have ever figured it out) that the first number NEEDED to be 127. In all my reading in the VIC Programmer's Reference and elsewhere, it seemed to say that this first number could be any arbitrary number between 1 and 255. Why must it be a certain number?
The logical file number (LFN) is the handle used for all later KERNAL operations, the application must use 127 so that's what you need to open. If you write your own program you can use any value.

Setting the top bit of the LFN causes a line feed to be sent after every carriage return (but only from BASIC PRINT statements).
User avatar
Mike
Herr VC
Posts: 4830
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Terminal programs and 80-column cards (DATA-20)

Post by Mike »

I'm glad to read you got it to work! :D
ral-clan wrote:I had no idea (nor would I have ever figured it out) that the first number NEEDED to be 127. In all my reading in the VIC Programmer's Reference and elsewhere, it seemed to say that this first number could be any arbitrary number between 1 and 255. Why must it be a certain number?
When you write an own program, of course you can choose the logical file number (the first argument of OPEN) as you please. Then you just have to make sure, that the PRINT#, INPUT# and GET# statements use exactly this number you associated with the file or device. This way, several open channels are distinguished from each other.

Now, the terminal program of the Data-20 internally uses the machine code equivalents of PRINT#127, INPUT#127 and GET#127, with 127 fixed, without any corresponding OPEN statement. That has to be entered by the user before start with F8. An OPEN1,... opens channel #1 - PRINT#127, INPUT#127 and GET#127 have no access to channel #1.

The allowed range for the logical file number is 1..255. OPEN 0 is illegal and prompts an error. Logical file numbers of 128 and above have a special treatment of carriage return on output - they send an extra line feed afterwards. Unless you'd really need that, just remain in the range 1..127.

A maximum of 10 channels are allowed to be open concurrently at any one time on the computer. For devices, it may be considerably less - this is more exactly stated in the drive manuals.
User avatar
ral-clan
plays wooden flutes
Posts: 3702
Joined: Thu Jan 26, 2006 2:01 pm
Location: Canada

Re: Terminal programs and 80-column cards (DATA-20)

Post by ral-clan »

One of the problems I was also having, which was making it difficult to solve this problem, is that if you enter the terminal mode of the DATA-20 cartridge before setting the OPEN statement and then try and set it later, or if you try to change the baud rate later via another OPEN statement, things get messed up and you get the garbled text from then on. This garbled text stays even when you reset the WiMODEM and CLOSE and re-OPEN the channel to user port.

I'm not sure why this happens, but I didn't realize it at the beginning.

It seems the only way to reset things is to do a total cold reboot of all equipment. It also seems like you have to leave the VIC-20 and all peripherals off for a while. Maybe the WiMODEM retains a residual charge in its capacitors for a while --- I'm not sure, but a quick on-and-off of the equipment doesn't cure the garbled text. It takes a prolonged shut down and restart to reset everything.
Image Music I've made with 1980s electronics, synths and other retro-instruments: http://theovoids.bandcamp.com
Bobbi
Vic 20 Afficionado
Posts: 355
Joined: Thu Oct 13, 2016 11:35 am
Location: Toronto
Occupation: Programmer

Re: Terminal programs and 80-column cards (DATA-20)

Post by Bobbi »

I don't think the WiModem itself has much in the way of capacitors on the board (although I don't usually do really fast power cycles to reset because I have some vague idea that it is not too good for the VIC-20 and also I have a memory expansion with a reset button.)

One gripe I have is that once I start a big transfer (HTTP GET) using the WiModem I can't interrupt it with the "+++" escape sequence. Resetting the VIC-20 with the reset button doesn't reset the WiModem. In that case I either have to wait for the data to be finish streaming or do a power cycle to reset the modem.
User avatar
ral-clan
plays wooden flutes
Posts: 3702
Joined: Thu Jan 26, 2006 2:01 pm
Location: Canada

Re: Terminal programs and 80-column cards (DATA-20)

Post by ral-clan »

Bobbi,

I'm not sure if you use the WiModem with the VIC-20 or a C64. I was unable to get the WiModem to work in 2400 baud mode with the VIC-20. I could blindly send commands to the WiModem which were understood correctly, but any text returned to the VIC-20 was garbled, with any terminal program.

The problem is that the WiModem comes set at 2400 baud by default. Thankfully, I was able to blindly send commands to the WiModem in the first place, because that allowed me to set the baud rate lower. 300 baud to 1200 baud all work fine with the VIC-20. If I hadn't been able to do this then I might not have been able to use the WiModem.
Image Music I've made with 1980s electronics, synths and other retro-instruments: http://theovoids.bandcamp.com
Bobbi
Vic 20 Afficionado
Posts: 355
Joined: Thu Oct 13, 2016 11:35 am
Location: Toronto
Occupation: Programmer

Re: Terminal programs and 80-column cards (DATA-20)

Post by Bobbi »

I use the WiModem with VIC-20 only - don't own a C64 at the moment.

I haven't tried any speed faster than 1200 baud and had the same experience where I had to do a blind AT*B1200 command to set it to 1200 baud. I am not sure why but short commands from the VIC-20 to the WiModem work even when the baud rate is incorrect. I have been trying to work out how that can work, but fortunately it does! I use MightyTerm for playing with the modem (and my own C code, compiled using cc65.)
User avatar
ral-clan
plays wooden flutes
Posts: 3702
Joined: Thu Jan 26, 2006 2:01 pm
Location: Canada

Re: Terminal programs and 80-column cards (DATA-20)

Post by ral-clan »

My experience has the same (WiModem responding to commands even when baud rate is wrong).

I have been corresponding with Jim Drew, and he agrees with the idea of setting the future WiModems he sells to a default baud rate of 1200, so that VIC-20 users don't have problems with the modem out-of-the-box.

I did get the Data-20 (40/80 column hardware display card) working with the WiModem, and it's great, although there is one problem with the built-in terminal program....all text typed by the operator defaults to UPPER CASE and you have to press SHIFT to get lower case letters. This makes it very hard to type messages on BBS's, etc. Oh....and no, using SHIFT LOCK doesn't rememedy this as you cannot use the INST/DEL or SPACE keys with the terminal when SHIPT LOCK is on, nor get any punctuation (i.e. period, comma) until SHIFT LOCK is released.

That's really too bad....I'm not sure why they made it that way. All incoming text from the BBS is displayed just fine.
I guess I'll have to learn how to program my own terminal program for it.....I've tried every VIC-20 terminal program I could find with the DATA-20, but all seem to want to output their text to the 22-column screen.
Image Music I've made with 1980s electronics, synths and other retro-instruments: http://theovoids.bandcamp.com
User avatar
Mike
Herr VC
Posts: 4830
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Terminal programs and 80-column cards (DATA-20)

Post by Mike »

I did get the Data-20 (40/80 column hardware display card) working with the WiModem, and it's great, although there is one problem with the built-in terminal program....all text typed by the operator defaults to UPPER CASE and you have to press SHIFT to get lower case letters. This makes it very hard to type messages on BBS's, etc.
I think I can do something about that. :)

Can you tell me how many bytes free you get with the Data-20 active?
Post Reply