Re: Got IEC code working

From: Jim Brain (
Date: 2004-05-27 09:31:26

>I see, you would prefer to have clean layers in the protocol.  Instead of
>escaping of 00 payload bytes, you would like to escape 00 bytes also in the
>parameters of commands.  I don't know what you would achieve with that.
>Of course, there must be a resynchronization mechanism, in case of
>intermittent communications failure.  I'm using the BREAK condition as a
>signal to reset the microcontroller to idle state.
If the system gets too far out of whack, command data could get 
misinterpreted as a command code (in your example, 00 LISTEN 00 00 00 00 
FF (32 bits) coudl get mangled into 00 LISTEN 00 00 00 00 CMD_FF 
(whatever this is).  At least with escaped command data, sync issues are 
less of an issue.  Minor nit.

>I didn't consider that, because I have the feeling that the serial bus is
>slower than the 38400 bps line.  Most executable programs for the
>Commodore 64 have been compressed, and there are no long sequences of zero
>bytes.  I picked zero as the escape byte, because testing against zero is
>easy on the AVR.  Testing against some other constant requires that the
>value is loaded to one of the registers 16..31.
True, but I tried FF, and I got into issues where the system might get 
off a byte (bad code), and then it gets worse.  FF FE or F2 02 or 
something worked much better.  I know 00 is easy, but 00 just shows up 
so much, In some files, it could double the size of the file.

>I would like to make it possible to upgrade existing C2N232 units, and to
>save trouble in circuit board design.  You're right, there's no need to
>stick to a smaller controller.  But I like challenges, and I'm not yet
>hitting the limits of the 2313 too hard.  (Are you familiar of Levente
>Hársfalvi's RS-232 to 1351 mouse adapter done with a PIC?  That's a real
Well, I think some standardization on protocol might be useful.

>10 years ago, I was dreaming of something similar: a programmable device
>for the serial bus.  Currently available microcontrollers are making the
>dream possible at an affordable cost.
As was I, but I dind;t have the tools or the expertise to do it.  Now, I 
have both.

>>I could try.  I was waiting a bit until I put the JDos routines in 
>>before I laid out the diagram in a package,  to make sure I actually 
>>capture all of the relevant states.
>It'd be good to draw one diagram without JDos and another including it.
That was the plan, but have them as overlays.

>What does ?ST say after such a failed LOAD attempt?
66 (with my code, not sure on base 64)

>I don't think that there is EOI handshake for bytes sent under ATN.
>I concluded this after reading the VIC-20 KERNAL routines.  Come to
>think of it, EOI handshaking for ATN would make things very complicated
>when you're talking to multiple devices.  And there is no EOI handshaking
>for the first ATN byte, is there?
I am getting the impression that EOI is never used when ATN low.

As stated in another email, I have server code running.  save 
"/home/brain/incoming/stuff",13 is working

Load needs a bit more thought.  It works now (I have a hardcoded app 
stored on the AVR for testing), but I need some commands to send to the 
AVR to tell it to wait for data, or not to bother, because file cannot 
be found.


Jim Brain, Brain Innovations                      
Dabbling in WWW, Embedded Systems, Old CBM computers, and Good Times!

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.