| |
Krill
Registered: Apr 2002 Posts: 2980 |
1541 force immediate job code handling
The canonical way to issue jobs on 1541 is something like
lda #$80
sta $00
: lda $00
bmi :-; wait until job complete
if you don't want to do all the low-level disk access grunt work yourself. (I think 1571 allows for BRK to trigger the handler.)
Now, the problem is that the interrupt handler is triggered by a timer (see http://unusedino.de/ec64/technical/aay/c1541/ro41fe67.htm - the same timer which controls head stepping and movement speed), and that can take a few unnecessary bycles.
While looking for a solution to avoid that, this is what i came up with (realthing tests pending)
lda #$80
sei
sta $00
jsr $f2b0; force immediate job code processing
cli
: lda $00
bmi :-
Any objections to this approach or likely problems? :) (Looking funny at GRG and Magervalp.) |
|
| |
cadaver
Registered: Feb 2002 Posts: 1160 |
Neat! How guaranteed the handler location is in 1541 clones / derivatives? |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Dunno. The only ROM dump i ever came across with significant differences is from CX-500:
; Uncomment to compile the 1541 drivecode for Century Planning Corp. CX-500/Tecmate NPH-501C, which is not
; a clone, as the VIAs are located at $3800 and $5c00 due to simplified address decoding logics, and the ROM
; including the position of the GCR encoding and decoding tables (not used here) is entirely different as well.
;CX500 = 1
Needless to say, it's a-okay to ignore that weirdo drive. :) |
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
It's been years since I looked at that code, and I never quite got comfortable with the VIAs, but it seems like a reasonable approach. If you're using job codes though and not custom low level code, are you really that concerned about a few bycles being lost? Seems like the impact would be negligible. |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Quoting MagerValpI never quite got comfortable with the VIAs Yeah, they're pretty crappy devices. But they're all we've got. :D
Quoting MagerValpIf you're using job codes though and not custom low level code, are you really that concerned about a few bycles being lost? Seems like the impact would be negligible. Not really concerned, just something i came across again recently. And although the overall impact may not be so big (i wouldn't say negligible, though, it MAY shave off a revolution per track), if the solution is a few simple drop-in lines of code... why, why not? :) |
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
Cause it's five precious bytes :) |
| |
cadaver
Registered: Feb 2002 Posts: 1160 |
If the loader is uploaded only once, only increases the startup code size :) But yeah, it's great for cases where you'd just miss a revolution because of the delay. Could get a pretty reliable interleave 8 for Steel Ranger's mainpart (on-the-fly Exomizer), while the release version has 9. |
| |
6R6
Registered: Feb 2002 Posts: 245 |
Well, It's been a while.
But you can probably do something like this ?
lda #$80
sta $00
brk ;force job code
nop |
| |
tlr
Registered: Sep 2003 Posts: 1790 |
Quote: Well, It's been a while.
But you can probably do something like this ?
lda #$80
sta $00
brk ;force job code
nop
Interesting approach. Is it saaafe? |
| |
6R6
Registered: Feb 2002 Posts: 245 |
It works on 1581.
1541 probably - But have to check first. |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Quoting Krill(I think 1571 allows for BRK to trigger the handler.) So, no, BRK doesn't work on 1541. The appropriate condition "bit 6 of $1c0d set" isn't met, and the interrupt handler would just return. See http://unusedino.de/ec64/technical/aay/c1541/ro41fe67.htm (1541), which doesn't have this part the 1571 (default) interrupt handler has:
.8:9dce BD 04 01 LDA $0104,X
.8:9dd1 29 10 AND #$10
.8:9dd3 F0 03 BEQ $9DD8
.8:9dd5 20 B0 F2 JSR $F2B0 As for 1581, while BRK ls the canonical way to do it just like on 1571, there's also an entry in the jump table at $ff54 called STROBE_CONTROLLER, which wraps all that in a neat subroutine.
http://unusedino.de/ec64/technical/aay/c1581/ro819598.htm |