Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user hardy_1974 ! (Registered 2018-03-16) You are not logged in 
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 12:36
Monte Carlos

Registered: Jun 2004
Posts: 254
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-19 00:03

Registered: Apr 2002
Posts: 933
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 12:59
Monte Carlos

Registered: Jun 2004
Posts: 254
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 22:07

Registered: Apr 2002
Posts: 933
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 09:31

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

Registered: Sep 2003
Posts: 1159
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 13:33

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

Registered: Apr 2002
Posts: 933
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
Jak T Rip/DMAgic
ULTIMAX 1379../INXS,..
Guests online: 57
Top Demos
1 C64 48Khz HiFi Digi ..  (9.8)
2 Uncensored  (9.7)
3 Edge of Disgrace  (9.7)
4 SSDPCM2 V3 - 16khz  (9.6)
5 Coma Light 13  (9.6)
6 The Shores of Reflec..  (9.6)
7 Comaland 100%  (9.6)
8 Lunatico  (9.6)
9 Incoherent Nightmare  (9.5)
10 Wonderland XII  (9.5)
Top onefile Demos
1 Pandemoniac Part 2 o..  (9.5)
2 Dawnfall V1.1  (9.5)
3 Synthesis  (9.5)
4 Treu Love [reu]  (9.5)
5 Daah, Those Acid Pil..  (9.5)
6 Dawnfall  (9.4)
7 Merry Xmas 2017  (9.4)
8 FMX Music Demo  (9.4)
9 Hardware Accelerated..  (9.3)
10 One-Der  (9.2)
Top Groups
1 Oxyron  (9.4)
2 Booze Design  (9.4)
3 Censor Design  (9.3)
4 Arsenic  (9.3)
5 Crest  (9.3)
Top Graphicians
1 Mirage  (9.8)
2 JonEgg  (9.7)
3 Archmage  (9.7)
4 Jok  (9.7)
5 Veto  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2018
Page generated in: 0.463 sec.