6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Wed Sep 25, 2024 8:36 am

All times are UTC




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Sun Nov 28, 2010 4:53 am 
Offline

Joined: Fri Nov 26, 2010 6:03 pm
Posts: 46
Location: NSW, Australia
I hope to share with everyone something that allows a 6502-based system to use a bi-directional parallel port connection to a GNU/Linux system for terminal and file I/O, and several other features.

It was primarily written for the Synertek SYM-1 belonging to the 'local hackers club', to allow fast (~8kB/sec) program transfers during development, and to also provide a pseudo-terminal channel replacement for the none-too-reliable bitbanging 6522 serial port interface. (No dropped chracters at ~1400chars/sec. :)

To explain the protocol used, lets say I wanted to sync the Dallas DS1230Y Time-keeping nonvolatile RAM used on the 6502 system here with the system clock on the GNU/Linux box. The client might send through the handshaked parallel port, via calls to the PP Put_Char and Get_Char routines:

Code:
    "*t"


..and the server would reply with:

Code:
    "101128142833"


The client's code might look like:

Code:
  Sync_Time:
     lda #42
     jsr Put_Char
     lda #'t'
     jsr Put_Char
     jsr Delay        ;required during any change in transfer direction
     lda #80          ;enable updating the DS1230
     sta $7FF8
     jsr GetBCD
     sta $7FFF        ;year
     jsr GetBCD
     sta $7FFE        ;month
     jsr GetBCD
     sta $7FFD        ;day
     jsr GetBCD
     sta $7FFB        ;hour
     jsr GetBCD
     sta $7FFA        ;mins
     jsr GetBCD
     sta $7FF9        ;sec
     lda #0           ;online the DS1230 clock
     sta $7FF8
     rts

  Get_BCD:
     jsr Get_Char
     pha
     jsr Get_Char
     pha
     jmp Magic_BCD_Converter


(This is just something I made up on-the-fly while writing this post.. I haven't checked anything to see if it correct...)

Rather than conjure up code for the server's Time command handler, here's what's used for the '*T'ext command:

Code:
    void do_talk (void)
    {
      char s[MAXFNLEN];

      get_string (s);
      printf ("* TEXT\n%s\n* EOT\n\n",s);
    }


The current release supports PP commands for downloading files, uploading files, directory listings on the server, sending talk/ debugging strings, blockmode "sector" read and writing(*), and reading and writing to a pseudo-terminal channel.

(*: a friend wrote an operating system for my 6522IDE interface that used a real harddrive; it was straight-forward to patch its I/O vectors to use PP-- the advantage being no need for a seperate power supply for the drive, and all data is stored and more accessible on the server this way.)

The server software runs on GNU/Linux systems(*), using IOCTLs for parallel-port access, so I assume it is portable across hardware platforms (maybe even USB-parallel adapters?) No bloated frameworks or obfuscation was employed-- there's just the one plainly-written C program.

(*: I had attempted to include the *BSDs, I have NetBSD on my primary workstation, but their schedulers got in the way..)

The server also provides a multiplexed 'telnet' manager for the pseudo-terminal feature: any number of users can telnet to port 2001 on the server to access the console [of the SYM-1], with all shared character I/O being converted to PPtty commands. The SYM-1 implementation includes a replacement
INTCHAR/OUTC with circular queues, so most 'well behaved' programs will now appear in the telnet sessions. I've tested it with MicroChess. :)

Hopefully you can see how this can be useful... This release includes the client software for the SYM-1 and Commodore 64/128. In future (after the around-Australia motorcycle holiday) I'm planning on a port for a recycled Z180 printer-buffer system with two parallel ports that has issues with its
serial (10MHz xtal..)

Source tarball download: http://tinyurl.com/26frgv2 (via http://kildall.apana.org.au/~cjb/sym1/index.php ) Code licenced as per the GPLv3.


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 29, 2010 10:42 am 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 1041
Location: near Heidelberg, Germany
This looks interesting. Could it possibly be used as protocol between multiple PETs, using the user port?

André


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 29, 2010 5:11 pm 
Offline

Joined: Fri Nov 26, 2010 6:03 pm
Posts: 46
Location: NSW, Australia
fachat wrote:
This looks interesting. Could it possibly be used as protocol between multiple PETs, using the user port?

No, it's a point-to-point connection scheme, unless you're suggesting that one PET operate as a server for another PET client. The great-grandfather of this code was used to transfer software between a CBM64 and a diskless PET4032 back in the 1980s...

I would think MJ Mahon's NadaNet could be the basis for a 'multicasting' system... If the PC parallel port sense pins could tri-state (can they?), it might be a project to do some bus arbitration for multiple clients..


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Nov 30, 2010 2:48 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
All modern networking links are point-to-point, which works quite well as long as you can fashion a switch. An ATmega or PIC chip (with enough pins!) should work fine for serving as a 2- or 3-port switch for this system.

Of course, you'll need to adjust your protocol to include node addresses then.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Nov 30, 2010 4:38 am 
Offline

Joined: Fri Nov 26, 2010 6:03 pm
Posts: 46
Location: NSW, Australia
kc5tja wrote:
An ATmega or PIC chip (with enough pins!) should work fine for serving as a 2- or 3-port switch for this system.

Again, NadaNet should be cited as an example of a link layer (albeit serial) that provides multiple-client communication with just two wires and no excessive hardware requirements. For the parallel-port, there's at least two more unused sense pins available.
But this is not a thread about what I don't have any intention of doing with PP...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Dec 01, 2010 7:59 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
OK, you don't have to be snooty about it. Maybe you aren't interested in doing this. But, maybe Fachat is, since he asked the question about linking multiple PETs?

"Again," please consider my contribution to the thread. If it doesn't interest you, fine. Maybe it'll interest someone else.

Unsubscribing from this thread. I'm obviously unwanted here.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Dec 01, 2010 11:24 am 
Offline

Joined: Fri Nov 26, 2010 6:03 pm
Posts: 46
Location: NSW, Australia
Get over yourself. Thread derailment in development forums is not a contribution.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Dec 01, 2010 4:51 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
I did not derail the thread. I offered a single observation, saying, "Hey, if you do X, you get Y." As I said above, if this is of no interest to you, fine. But it might be an opportunity to explore for others.


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 01, 2010 10:05 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8395
Location: Midwestern USA
cjb wrote:
But this is not a thread about what I don't have any intention of doing with PP...

I think I'll interject here.

This is a forum about and for the 65xx family of microprocessors, which, as you surely must know, are used in a multitude of applications, the Synertek SYM-1 being but one example. Many of us here are into scratch-developed hardware and are always looking at various ways to transfer data between our creations and other systems. If that can be accomplished by adapting a method developed for a narrow application such as the SYM-1, excellent. If not, well, we have some fertile minds around here that can concoct a suitable interface, André Fachat being one of them. Hence André's question was completely on topic, as were kc5tja's comments.

Your accusation of "thread derailment" is out of line. If 'PP' is adaptable to something other than its original target, how is discussion to that end off-topic? This is a site about use of the 65xx MPU family, and is not system-specific. So there's no reason for others to not discuss how to adapt something to a different application than originally intended. If that sort of activity had been discouraged in the past, the 65xx would have been dead meat many years ago.

What I see here is you signed up at 6502.org on Sat Nov 26 and immediately posted about your project. Following that, you got short with other denizens of this site who expressed possible interest in adapting 'PP' to other uses. Both of these members have been here far longer than have you. How about if you extend a little courtesy toward them when they ask about your I/O system? If you can't do that, we may request that a moderator delete this topic, as (at least in my opinion) 'PP' is too narrowly defined to be of significant value to the rest of the 6502.org community.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Dec 01, 2010 10:32 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8517
Location: Southern California
It is indeed an uncomfortable situation to have to watch a topic and wonder if it's time to do something about it. We can all learn when there's some freedom to let the topic migrate or explore its way in different directions, into more applications than the OP had in mind. Even the OP benefits. I imagine that if we didn't allow this, it would be pretty dead around here, as no two members have the same set of applications. If it looks like the topic is getting totally highjacked, we start another one with a link telling where it came from so as not to have to lay the groundwork again, and add a link in the old thread telling where the new one is to discuss the new subject that came up. Such total highjacking has not happened on this topic so far, so we're ok as long as everyone can accommodate others' personalities. Some of the most active members here are extremely knowledgeable professionals whom we can all benefit from.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Dec 01, 2010 11:20 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8395
Location: Midwestern USA
GARTHWILSON wrote:
We can all learn when there's some freedom to let the topic migrate or explore its way in different directions, into more applications than the OP had in mind.

You can double that in brass. In my POC topic (which has exceeded 21,000 views to date), discussion wandered around a bit and while occasionally off-topic, gave me some ideas that ended up in the "finished product" (of course, something like this is never truly finished). I'd like to think that others who have read all the posts came away with something useful or were perhaps inspired to try their hand at a scratch-built 65xx whosamawhatchit. After all, if a big dumb dinosaur can do it...

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Dec 01, 2010 11:33 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
BigDumbDinosaur wrote:
... try their hand at a scratch-built 65xx whosamawhatchit...


You talkin' to me?! I take insult to you calling my project a "whosamawhatchit"! I'll show you BDD!

In all seriousness though, 6502 fans are the common denominator!
There's always going to be drama.

IMHO, noone was out of hand here...

Gonna grill some brats and drink biers!

Never underestimate!

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Dec 02, 2010 1:33 am 
Offline

Joined: Sun Nov 28, 2010 6:35 am
Posts: 48
Location: Newcastle Australia
You're all welcomed to wander about and suggest anything in my Symbiosys operating system thread, I definitely want more ideas posted.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Dec 02, 2010 3:25 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8395
Location: Midwestern USA
ElEctric_EyE wrote:
BigDumbDinosaur wrote:
... try their hand at a scratch-built 65xx whosamawhatchit...


You talkin' to me?! I take insult to you calling my project a "whosamawhatchit"! I'll show you BDD!

Well, I could call it a "contraption." :)

Quote:
Gonna grill some brats and drink biers!

Just exactly what do little kids that have been cooked over charcoal taste like? Is it anything like chicken? Do you use BBQ sauce on 'em? :twisted:

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 03, 2010 5:26 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Hi cjb, and welcome

cjb wrote:
...users can telnet to port 2001 on the server to access the console [of the SYM-1]

This is a very convenient approach - I've been using ser2net on linux to talk to a BBC micro over the serial port. The machine can do I/O redirection, and we made a small EEPROM so it booted into a redirected state.

Am I right in thinking this is a 10-wire protocol? 8 data plus 2 handshake, run in half-duplex? I didn't manage to find a description of that, although I did find this picture: Image

Anyhow, it looks good to me, and I like the mentions of paper tape too.

Cheers
Ed


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: