| |
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? |
|
... 2 posts hidden. Click here to view all posts.... |
| |
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 :)) |
| |
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. |
| |
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? |
| |
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. |
| |
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? |
| |
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. |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
The badline condition is that the lowmost 3 bits of $d011 (YSCROLL) and $d012 match. But simply doingwaitbl: 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. |
| |
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 ;) |
| |
tlr
Registered: Sep 2003 Posts: 1790 |
Quote: 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 ;)
That's quite common.
Example (from the Superkit filecopier):
.C:3663 A2 07 LDX #$07
.C:3665 38 SEC
.C:3666 AD 12 D0 LDA $D012
.C:3669 E9 32 SBC #$32
.C:366b 90 04 BCC $3671
.C:366d 29 07 AND #$07
.C:366f F0 F5 BEQ $3666
.C:3671 8E 00 DD STX $DD00
.C:3674 48 PHA
.C:3675 68 PLA
.C:3676 24 EA BIT $EA
.C:3678 AD 00 DD LDA $DD00
.C:367b 4A LSR A
.C:367c 4A LSR A
.C:367d 4D 00 DD EOR $DD00
.C:3680 4A LSR A
.C:3681 4A LSR A
.C:3682 4D 00 DD EOR $DD00
.C:3685 4A LSR A
.C:3686 4A LSR A
.C:3687 A2 27 LDX #$27
.C:3689 4D 00 DD EOR $DD00
.C:368c 8E 00 DD STX $DD00 |
| |
DJ Gruby
Registered: Aug 2002 Posts: 30 |
Krill, you are the God! Thanks so much, now with your change the code seems to work and it doesn't load any garbage anymore, just an original file data: charin ldx #$03
charin1 sec
lda $d012
sbc #$03
and #$07
cmp #$07
bcs *-9
lda #$0b
sta $dd00
bit $dd00
bpl charin1 Thanks, you rock! |
Previous - 1 | 2 - Next |