Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums

Forums > CSDb Discussions > Reversibly mute serial devices by a tight loop drive code which disable interrupts and set ATNA according to ATN IN in a loop
2017-11-18 11:36
Monte Carlos

Registered: Jun 2004
Posts: 351
Reversibly mute serial devices by a tight loop drive code which disable interrupts and set ATNA according to ATN IN in a loop

I raised a discussion about this topic by asking a question about C128D(metal) and 1541U usage
Krill came up with the idea of setting up the tight loop and provided me with a short program. It turned out to successfully mute the internal 1571 in contrast to my own more innocent approaches.
There has already been some discussion between Krill and Lft how to reverse the effect of the tight loop after loading has finished.
What do other loader enthusiasts think about this?
Other ideas of how to terminate the tight loop?
I'm really unexperienced with IEC bus, but i like the idea (which would not only help C128D users) and therefore i would like to encourage some more discussion about this topic.
2017-11-18 23:03

Registered: Apr 2002
Posts: 2856
This seems to be really important to you, opening another thread and asking everybody and their dog for help and all. ;)

Anyhow, i seem to have found a rather simple solution in the meanwhile, at least for my loader and its protocol. (Works in VICE, realthing tests still pending.)

Unlike KERNAL protocol, the custom loader protocol has ATN asserted most of the time, which is basically always except for every other bitpair when the drive sends data to the computer, and the idea is this:

On a falling ATN edge, start a timer, and on a rising ATN edge, disable that timer.
Once the timer expires after a falling ATN edge (64K cycles later), we can be pretty certain that the computer side is not following the loader's protocol any more (the active drive's watchdog IRQ has triggered as well), and so the timer interrupt goes off and resets the drive.

Thanks to lft! I guess that insight about the existing watchdog timer invariants was what nudged me in the right direction.

This is the relevant code snippet from the current source code (ca65):
atnlo:      .byte "m-w", .lobyte($0400), .hibyte($0400), atnhi - * - 1; read forward
            jmp ($1800)
            .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
            stx $1800
            sta $1c05; timer 1 hi 
            jmp $0400
atnhi:      .byte "m-w", .lobyte($0480), .hibyte($0480), atnhiend - * - 1; read forward
            sty $1800
            jmp ($1800)
            .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
            jmp ($1800)
This solution will go into my next loader release, but it does not magically work for any 2bit+ATN protocol, of course, so your C128D with built-in 1571 must still rely on a manual reset after running a demo.
2017-11-19 11:59
Monte Carlos

Registered: Jun 2004
Posts: 351
Of course i have a special interest in this topic with my 128D and the 1541U. However it hasn't been my intention to set-up the whole scene on my private problems, i just thought it would also be interesting for other 128D users or people who commonly uses more than one drive with the commodore. Another reason to open this thread was, that the follow up discussion on my original question was targeting loader concepts in a more common sense and deserved a more dedicated room.
Besides that it seemed to bug you very much because you came up with the very clever idea of that tight loop setting ATNA.
I meanwhile tried other demos with 1541 U on my 128D and they all worked without any loader trouble. This is a great success, it think.
Thank you very much for that. I'm looking forward to return in favor something which i can do with my knowledge... ;-)
2017-11-19 21:07

Registered: Apr 2002
Posts: 2856
A bit of beta-testing the next release candidate would do. :)

I was just wondering why you seemed so keen on a solution to the wake-up problem. The main problem has been solved with the tight loop setting ATNA in response to ATN, and gracefully leaving this is just a nice-to-have, basically. After all, people use to leave demos with a reset or power cycle.

But the nice-to-have is a have now, so all's good. :)
2017-11-20 08:31

Registered: Oct 2014
Posts: 480
If only you could use the SEQ line to do a burst line toggle to restore the drive.
2017-11-20 09:04

Registered: Sep 2003
Posts: 1730
Quote: If only you could use the SEQ line to do a burst line toggle to restore the drive.

You mean SRQ, is that even connected on a 1541? Reacting to ATN is what you do normally unless you hog it for other things.
2017-11-20 12:33

Registered: Oct 2014
Posts: 480
yeah SRQ sorry. On the 1541 no, but I thought they were talking about muting a 1571 on a 128.
2017-11-20 13:12

Registered: Apr 2002
Posts: 2856
Well, it works now, no SRQ required. And for all kinds of setup, C-64 or C-128 with or without internal drives. So, not a pity at all.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Users Online
Proton/Finnish Gold
Guests online: 56
Top Demos
1 Next Level  (9.7)
2 Mojo  (9.7)
3 13:37  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.7)
6 Aliens in Wonderland  (9.6)
7 Comaland 100%  (9.6)
8 Uncensored  (9.6)
9 No Bounds  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 Rainbow Connection  (9.5)
6 It's More Fun to Com..  (9.5)
7 Dawnfall V1.1  (9.5)
8 Daah, Those Acid Pil..  (9.5)
9 Birth of a Flower  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Nostalgia  (9.4)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 SHAPE  (9.3)
Top Fullscreen Graphicians
1 Joe  (9.7)
2 Veto  (9.6)
3 Facet  (9.6)
4 The Sarge  (9.6)
5 Carrion  (9.5)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.047 sec.