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 > C64 Coding > Spindle spins out of control
2016-04-22 19:00
Trap

Registered: Jul 2010
Posts: 223
Spindle spins out of control

Hi,

I have a strange problem with Spindle 2.1. This time I have written a part that uses the memory area where Spindle is located (0c00-0dff), so I have to temporarily move it. I also save the ZP adresses $f0-$ff.
The problem I see is that the loader continues to access the disk - it actually looks like it starts to load in the middle of my part running. That really shouldn't be possible because the code isn't there. It makes me think that there could be some problems with other registers. I use DD02 extensively in this part, so I wonder if there could be a problem here? Anything else I might have missed?

Thanks.

Trap
2016-04-22 20:11
Krill

Registered: Apr 2002
Posts: 2980
Why don't you ask the inventor directly? I'm sure nobody else could answer your question. Lft is available via PM and IRCnet/#c-64.
2016-04-22 20:35
Trap

Registered: Jul 2010
Posts: 223
Will do :)
2016-04-22 21:19
Trap

Registered: Jul 2010
Posts: 223
So, #c-64 is invite only.
2016-04-23 06:15
Stryyker

Registered: Dec 2001
Posts: 468
Anyone should be able to join.
2016-04-23 06:29
Oswald

Registered: Apr 2002
Posts: 5094
you may send signals through dd02 that makes the drive think you want to load something, so it starts its job.

Wonder why gunnar did not mention this, since he invented a tech esp. for me to avoid the loader to answer to dummy raster code writes.
2016-04-23 10:05
Trap

Registered: Jul 2010
Posts: 223
I managed to get on to #c-64 ... the IRCnet host had some issues when I tried to connect.
So Krill was kind enough to discuss the problem with me and he found that Spindle was missing a bus lock.
So, by simply writing $c8 to $dd00 at the beginning of my code and then $48 at the end fixed the problem.

A huge 'thank you' to Krill for his help. Much appreciated.

br
Trap
2016-04-23 23:00
mankeli

Registered: Oct 2010
Posts: 146
What's a bus lock?
2016-04-24 05:38
Hoogo

Registered: Jun 2002
Posts: 105
Sometimes, when you are in quite a hurry to change the 16K of the VIC, you can't avoid to write to bits of the register that are used for the bus. But you can make sure that these writes do not have any effect on the bus, $dd00 (data) and $dd02 (direction) go hand in hand.

If you use $dd00 for VIC, then you will have some random output to the bus. Then you would use $dd02 before to set all lines for the bus to input, and the "output" can't reach the bus.

And if you use $dd02 for VIC, then you will randomly switch some lines between in- and output. This will have no effect on the bus if you set the correct data to $dd00 before.

This works when the drive is listening and the C64 is supposed to talk, so it's a matter of the protocol and the loader when and if this works.
2016-04-24 09:09
Krill

Registered: Apr 2002
Posts: 2980
What Hoogo said.

Some highly tight raster code doesn't have the time to properly mask the bits in $dd00 when setting the VIC bank. Think of badline-only effects which have barely 20 cycles per rasterline, then do things like "lda #value : sta $d018 : sta $dd00" along setting $d011 and $d016. Then it must be ensured that the random bits written to the 3 serial bus bits (DATA, CLK and ATN) won't affect the actual bus state, so the drive(s) won't get confused and start to do funny things.

Enter bus lock, which is just that. When the loader is idle, allow the user to write _any_ value to $dd00 (or $dd02, depending on how the loader is designed).
2016-04-24 19:20
lft

Registered: Jul 2007
Posts: 369
Hi!

Thanks for helping out when I wasn't around, Krill! Indeed, there's no official bus lock feature in Spindle, but you seem to have found a workaround.

What you are effectively doing, is you're making ATN active, and then you keep it active until the next loadercall. This should be safe. Although I reserve the right to change the serial protocol in future versions of Spindle.
2016-04-24 21:16
Krill

Registered: Apr 2002
Posts: 2980
Good that it works with ATN being set and then cleared again before loading anything, breaching the protocol a little. :)

Is there any reason not to keep all bus lines active when the loader is idle? I specifically designed my protocol like that, so that bus lock is no problem.
Another benefit is that resetting the C-64 will clear the lines and cause the drive to reset (as per protocol) - even with those C-64s that do not send a reset signal on the bus (or on a soft reset, for that matter).
2016-04-25 07:09
lft

Registered: Jul 2007
Posts: 369
Quoting Krill
Good that it works with ATN being set and then cleared again before loading anything, breaching the protocol a little. :)


It cannot be cleared again before loading. It has to remain set when making the next loadercall. This happens if you use the c8/48 magic numbers from Trap's post.

Quote:
Is there any reason not to keep all bus lines active when the loader is idle? I specifically designed my protocol like that, so that bus lock is no problem.
Another benefit is that resetting the C-64 will clear the lines and cause the drive to reset (as per protocol) - even with those C-64s that do not send a reset signal on the bus (or on a soft reset, for that matter).


Those are good ideas. I'll see if I can include something like that in the next upgrade, which is due soon anyway. Thanks for the suggestions!
2016-04-27 21:02
mankeli

Registered: Oct 2010
Posts: 146
Thanks for explanation!
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
csabanw
JackAsser/Booze Design
Jammer
Flex/Artline Designs
Guests online: 101
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Logo Graphicians
1 t0m3000  (10)
2 Sander  (9.8)
3 Mermaid  (9.5)
4 Facet  (9.4)
5 Shine  (9.4)

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