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 > Job codes - again
2003-10-14 20:53
Cybernator

Registered: Jun 2002
Posts: 154
Job codes - again

I'm having some strange problems:

1. Execute ($E0) doesn't seem to be positioning the head as mentioned in some docs.
2. Seek ($B0) works the first time I call it, but later it returns an error: "SYNC not found".

Upon closer investigation, I realized that the head is not in read-mode. Seek is supposed to activate the motor, and the head on its own. I've tried disabling ATN IRQ, just in case it causes some trouble. But nope... Does anyone have any clue of what could be wrong? Any tips?
 
... 5 posts hidden. Click here to view all posts....
 
2003-10-17 10:11
Puterman
Account closed

Registered: Jan 2002
Posts: 188
My boss always says that if there's something you don't know, call someone and ask. Cybernator seems to have the same policy.
2003-10-17 10:33
Cybernator

Registered: Jun 2002
Posts: 154
I've, of course, checked various docs, eg. 'Inside C= DOS', and noticed something like 'working buffer' at $0200. I wasn't sure what exactly this meant. Then I remembered that I wasn't able to place my code at $0200 using memory-write, so the problem was immediately clear.

The reason I've asked is because I couldn't find solution for a while.
2003-10-17 14:37
Graham
Account closed

Registered: Dec 2002
Posts: 990
$0200+ contains a lot of system variables just like the zeropage. as "working buffer" i would describe $01BA-$01FF and $0300-$03FF since all block encoding/decoding is done there.
2003-10-17 23:41
6R6

Registered: Feb 2002
Posts: 244
Hello Cybernator

Here's something to load a file.


* = $0400
nextsec lda #3 ;Use buffer 0 ($0300-$0400)
sta $31

jsr $f50a (to find the data block)
<gcr reader/decoder>
<handshaking>

lda $0301
sta 9 ;next sector
lda $0300
beq lastsec
cmp 8
beq nextsec
.byte $2c
lastsec lda #0
sta 8
jmp $f418 ;Exit to disk controller, all ok

lda track
ldx sector
sta 8 ;t+s for buffer $0400
stx 9
more
lda #$e0
sta 1 ;Execute at $0400
lda 1
bmi *-2
lda 9
bne more
jmp $c194 ;Exit control to drive with no errors.
;Incase you invoked this with a
;user command. (U3,4,5,6 etc..)

If I am not mistaking you have to exit to disk controller
when the track link (0300) in the data block changes,
else there be errors...

<< GRG / SHAPE >>
2003-10-17 23:47
6R6

Registered: Feb 2002
Posts: 244
lda 8
bne more
jmp $c194 ;Exit control to drive with no errors.

<a quick bug patch >
2003-10-19 00:11
6R6

Registered: Feb 2002
Posts: 244
Just one other thing..

V-max uses memory $0100-$0800 for the drive routine.
Krills atn loaders uses about the same amount of memory.
But you cant do job codes when using memory $0200-$0300
afik.

2003-10-19 09:03
Cybernator

Registered: Jun 2002
Posts: 154
Hi GRG!

So you are not just an awesome musician. ;)

> jmp $f418 ;Exit to disk controller, all ok

I need to return to my code, not the FDC. JMP $f505 works fine.

> lda #3 ;Use buffer 0 ($0300-$0400)
> sta $31

Is this for the $f50a routine?
My code is at buffer 0, and I don't write anything to $31. It works a-ok. :)

I've been thinking about the side-detector. If I use the 2 ID chars, it may lead to problems, right? Because the IDs are in the header, and this is only touched when formatting. Nibblers won't copy this! I'm using the BAM (track 18, sector 0). Before the disk has been turned, I xor 321 GCR bytes of the BAM. After it has been turned, I do the same, and I check the values. If they are the same, the disk is obviously not turned. (*)
This doesn't give the possibility to be sure if it's the correct disk. I mean, I can insert another disk, and it'll have different BAM. Can't think of a better method, though. A possibility is to read a specific file or something...

When disabling the motor, the FDC makes a little delay before the motor is really turned off. Is there any way to avoid this? I'm doing it directly using $1C00, disabling IRQ first, and I activate it on my own before I enable IRQ and call execute. So the DOS thinks that the motor is always turned on.
--
(*) In fact, it's slightly different. At first, I xor starting from 0. Then I keep this value, and when the disk has been turned (which is detected by the write-protect sensor), I xor the bytes starting from this value. If it's the same disk/side, the result will be 0.
Btw, I use the write-protect sensor because I don't want the motor to be turned on while I'm taking the disk in/out. :)
2003-10-19 14:57
raven
Account closed

Registered: Jan 2002
Posts: 137
why go through so much trouble just to detect disk-side?
You can simply use the disk-ID at track 18 sector 0 for that,
or any other mark you leave in a certain sector.
Then, simply read that sector & check for your ID :)
2003-10-19 18:07
6R6

Registered: Feb 2002
Posts: 244
Hi Cybernator,

Yes I know assembly :)

<1>
F418 and F505 does the same thing, putting a 1 into the
command code. (and some stack and disk controller things)

lda #$e0
sta $00 ;command code for buffer 0 (0300)
cli ;(**)
lda $00
bmi *-2

(**) try with SEI and it will crash.


<2>
The F50A routine needs you to point out what buffer to
use. lda #3, sta $31... points to buffer 0 again ($0300).

<3>
Raven's method sounds easy enough.. :)



2003-10-22 10:32
Cybernator

Registered: Jun 2002
Posts: 154
I was against using the ID at track 18, sector 0 since the beginning. This is used for decoration. :) The other thing is, while my head is used as wallbreaker (because of some nasty effect :)), I can't bother with marks on my workdisks.
Or if someone else uses the loader (yeah right :)) he'd have to check what data I use, and if that doesn't fit his needs, he'd have to make additional changes. What I like about the method above is that it'll always be able to see if I've changed the disk. Something in the BAM will probably be different. And if not, there's some empty space, so one could write something there to make it different than the other side.
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
CA$H/TRiAD
Mason/Unicess
Røly/Mayday!
Slaxx/Q/HF
Krill/Plush
trident
JackAsser/Booze Design
St0rmfr0nt/Quantum
Guests online: 221
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.9)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.8)
4 Acidchild  (9.7)
5 Starlight  (9.6)

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