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 > Opinions on safe minimum $1c07 value?
2003-03-09 16:06
cadaver

Registered: Feb 2002
Posts: 1160
Opinions on safe minimum $1c07 value?

Any opinions on safe values of $1c07 (disk drive interrupt/head stepper motor frequency on 1541-ish drives)?

I know $3a is the default, and $10 is something one should *never* go below. I quickly checked Remember's recent Gemini Wing release and there $20 was used. So I guess the minimum safe value, considering different disk drive clones etc. would be somewhere between $10-$20?
2003-03-09 19:09
Graham
Account closed

Registered: Dec 2002
Posts: 990
the minimum safe value is about $20 - $28. the problem is that different drive mechanics have different stepper motor values. you can reach higher speeds safely though by accelerating the head instead of trying to go highest speed from the first step on. but it's not worth the effort because the head moves just one track in most cases.
2003-03-10 08:07
Vulgar
Account closed

Registered: Feb 2003
Posts: 2
$18 should work on all drives unless their stepper is REALLY worn out
2003-03-10 12:24
cadaver

Registered: Feb 2002
Posts: 1160
Thanks for answers, I'm now using $28, that seems to ensure sufficient data-rate with the interleave I'm using (it's mainly the more quicker response to jobcodes I'm after, as I'm too lame to write my own routines from ground up :))
2003-03-11 12:03
Graham
Account closed

Registered: Dec 2002
Posts: 990
Quote: $18 should work on all drives unless their stepper is REALLY worn out

i used $18 in deus ex machina... but then short before the competition at mekka symposium anonym/padua came to me and said it didn't work on the compo machine. i changed it to $28 and it worked. guys, you don't save much time anyway if you put your files into loading order.
2015-05-16 19:22
DJ Gruby

Registered: Aug 2002
Posts: 30
I know this a super old thread, but it had been referred in the article I wanted to ask about. Perhaps someone can enlighten me, why this fast loader routine from Codebase
64 wiki
requires blank screen? Majority of popular loaders do not require blank screen, but this one breaks if I remove...
lda #$00
sta $d011
...from the code (basically loading a couple of bytes of garbage from each sector). Any ideas?
2015-05-16 22:18
Krill

Registered: Apr 2002
Posts: 2980
This simply depends on the transfer protocol used. With badlines enabled, the CPU is stalled once in a while. If the protocol isn't made to handle this (lacking suitable handshaking to achieve higher throughput by synchronous access), it breaks - the drive would keep on sending data while the CPU cannot receive it, so that data is missed. Same problem emerges with other kinds of DMA caused by sprites and yes, REU DMA.
Without having looked at your specific instance, it's often possible to check for a badline before doing the handshake for a byte and wait until it has passed.
2015-05-17 08:34
DJ Gruby

Registered: Aug 2002
Posts: 30
Thanks for a hint, Krill! I have tried out waiting for a bad line in several different places, but it does not seem to solve the problem. For example if I replace...
charin   ldx #$03
         lda #$0b
         sta $dd00
charin0  bit $dd00
         bpl charin
...with...
charin  ldx #$03

charin0 lda $d012
        and #$07
        beq charin0

        lda #$0b
        sta $dd00
        bit $dd00
        bpl charin0
...it still fetches garbage. Any other ideas?
2015-05-17 09:19
Burglar

Registered: Dec 2004
Posts: 1101
gruby, the loader you chose from codebase is *not* an irq loader at all and it doesn't contain the source of the drivecode.

check the code at charin:
;---------------------------------------
;-remove this if no irq is used        -
;---------------------------------------
charin1 ; lda $d012
        ; cmp #$31   ;number of free rasterlines the higher the number, the slower the loader
        ; bcs charin1

so it wants you to uncomment that rasterline check if u want to use it under irq. it relies on nothing being active on some rasterlines so that the loader can transfer 4*2 bits (1 byte) without a handshake for each 2 bits. If anything happens (badline, irq, sprite, etc) during the transfer of a byte, it will fuck up.
It only does a handshake at the start of a full byte.

my advice, delete that loader and use a proper one.
2015-05-17 09:25
Krill

Registered: Apr 2002
Posts: 2980
The badline condition is that the lowmost 3 bits of $d011 (YSCROLL) and $d012 match. But simply doing
waitbl: lda $d011
        eor $d012
        and #$07
        beq waitbl
does not work, as once you detect a badline this way, it's pretty much over after this loop. You'd miss the case when the badline happens a bit later, while you do the actual byte transfer. So what you do this detect if a badline is about to happen, which means that the lowmost 3 bits in $d012 PLUS 1 match the YSCROLL bits:
        sec
waitbl: lda $d012
        sbc $d011
        and #$07
        cmp #$07
        bcs waitbl
Depending on the rest of the code and its timing, having 2 lines of tolerance might be required, i.e. cmp #$06 instead. Just play around with that.

As a sidenode, while this approach was quite common back in the days, i think it's a bit wasteful. The experimental resend method (detecting interrupts and DMA after the fact and resending the byte if so) i've added to my loader a while ago seems more promising, but it hasn't been used and tested much.
2015-05-17 10:45
Oswald

Registered: Apr 2002
Posts: 5094
how about checking if we're on the top/bottom border, and change transfer method for that part ? :) ofcourse sprited would be not allowed in there ;)
 
... 2 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 - Next
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
Alakran_64
MWR/Visdom
E$G/HF ⭐ 7
The MeatBall
/Panor..
Guests online: 94
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 Musicians
1 Rob Hubbard  (9.7)
2 Mutetus  (9.7)
3 Jeroen Tel  (9.7)
4 Linus  (9.6)
5 Stinsen  (9.6)

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