Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user Harvey ! (Registered 2024-11-25) 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: 358
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
http://csdb.dk/forums/?roomid=7&topicid=126539&firstpostd=12673...
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
Krill

Registered: Apr 2002
Posts: 2969
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
            cli
            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
            sei
            jmp ($1800)
atnhiend:
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: 358
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
Krill

Registered: Apr 2002
Posts: 2969
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
oziphantom

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

Registered: Sep 2003
Posts: 1787
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
oziphantom

Registered: Oct 2014
Posts: 490
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
Krill

Registered: Apr 2002
Posts: 2969
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
Advanced
Users Online
Pushead/Hokuto Force
Brataccas/HF
DeeKay/Crest
Matt
Guests online: 83
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Mojo  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Wonderland XIV  (9.6)
10 Comaland 100%  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Party Elk 2  (9.6)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.6)
5 Libertongo  (9.5)
6 Rainbow Connection  (9.5)
7 Onscreen 5k  (9.5)
8 Morph  (9.5)
9 Dawnfall V1.1  (9.5)
10 It's More Fun to Com..  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Nostalgia  (9.3)
5 Triad  (9.2)
Top Crackers
1 Mr. Z  (9.9)
2 Antitrack  (9.8)
3 OTD  (9.8)
4 Fungus  (9.8)
5 S!R  (9.8)

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