| |
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 |
|
... 3 posts hidden. Click here to view all posts.... |
| |
Stryyker
Registered: Dec 2001 Posts: 468 |
Anyone should be able to join. |
| |
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. |
| |
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 |
| |
mankeli
Registered: Oct 2010 Posts: 146 |
What's a bus lock? |
| |
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. |
| |
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). |
| |
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. |
| |
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). |
| |
lft
Registered: Jul 2007 Posts: 369 |
Quoting KrillGood 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! |
| |
mankeli
Registered: Oct 2010 Posts: 146 |
Thanks for explanation! |
Previous - 1 | 2 - Next |