Allow me to describe what I am playing with first, then I will describe the program I am using and then I will lay a billion questions on the 6502 Lords that dwell within the confines of said forum.
I have an Arduino Uno experimenter board that I am using to parse 300 baud data on one port to 9600 baud data on another port. This is all wrapped up nicely with the correct TTL voltages and such. The Arduino board is set up on both ends to communicate using 8,N,1, the only difference is one port is set to 300 and the other is set to 9600. The 9600 side is going into my laptop via a USB connection and for the most part is communicates flawlessly. The 300 side I am using one pin for TX and another for RX, both of which tie in with a common ground.
These pins go to the user port on the back of the VIC-20. The connector I have is a bit mislabeled so I will use the pin identifiers from the VIC-20 user Reference Guide. So I am using pin 1 and pin A for the common ground, Pin B (CB1) I am treating as the TX pin on Vic and Pin M (CB2) I am treating as the Rx pin on the Vic.
The program I am using is one I found in the book that comes with the VicModem. It is listed below.
Code: Select all
100 open 5,2,3,chr$(6)
110 dim f%(255),t%(255)
200 for j=32 to 64:t%(j)=j:next
210 t%(13)=13:t%(20)=8:rv=18:ct=0
220 for j=65 to 90:k=j+32:t%(j)=k:next
230 for j=91 to 95:t%(j)=j:next
240 for j=193 to 218:k=j-128:t%(j)=k:next
250 t%(146)=16:t%(133)=16
260 for j=0 to 255
270 k=t%(j)
280 if k<>0 then f%(k)=j:f%(k+128)=j
290 next
300 print" "chr$(147)
310 get #5,a$
320 if a$="" or st<>0 then 360
330 print" "chr$(157);chr$(f%(asc(a$)));
340 if f%(asc(a$))=34 then poke 212,0
350 goto 310
360 print chr$(rv)" "chr$(157);chr$(146);:get a$
370 if a$<>"" then print #5,chr$(t%(asc(a$)));
380 ct=ct+1
390 if ct=8 then ct=0: rv=164-rv
400 if(peek(37151)and 64)=1 then 400
410 goto 310
Here are the questions.
Hardware
1. I noticed in some circuits for building an RS232 port for the Vic involved using a transistor to trigger a pulse from Pin 2 to Pin N to get a signal on Pin M. Is there a reason for this? I am currently sending a signal directly from the Arduino.
2. Can I test the programs sending and receiving ability by creating a loop back by shorting Pin B (CB1) to Pin M (CB2)?
3. Not that anyone here might know this but I will toss it out there. Is it possible that I need some sort of buffer in the Arduino to gather the 9600 data and then serve that data up at 300 more slowly?
Software
1. First and most important does this program look correct for sending and receiving data using these pins on the user port?
2. In line 100 open 5,2,3,chr$(6). I understand argument 1,2, and 4 but what is argument 3? The programmers reference is a bit vague here. I can see the two byte string holding control and command registers, which I understand but argument three is also labeled command and has a value of "3" what does this represent?
3. Line 110 dim f%(255),t%(255). I am familiar with arrays and such but what does the symbol "%" do when in reference to a variable or array?
4. Lines 310-330. I have a rough understanding about what is going on with these lines however I am not sure the significance of the "ST" variable. I know this is a system type variable that shows a status but of what I don't know. Can someone comment on these lines of code?
5. Line 340, I see that this is resetting the quote mode but do not understand why?
6. Line if(peek(37151)and 64)=1 then 400. I am not sure I understand what this register is being checked for it appears to have something to do with Port A. Also the argument of "AND" in the statement is it addition, or multiplication?
I know this is a lot of questions but I figure that I will lay it all out and see what comes back.
Thanks
Oh yeah one more thing, I still haven't found the area on here where I can change my user name to get rid of "VIC" at the end.