Page 1 of 1

SmartPort calls - FORMAT

PostPosted: Sat May 12, 2007 3:44 pm
by david__schmidt
If the firmware for the SmartPort format command is essentially a NOP, how does the ProDOS utility program format it successfully?

RE: Post subject: SmartPort calls - FORMAT

PostPosted: Tue May 15, 2007 11:29 am
by rich
I have always assumed that the SmartPort format command (that is basically a NOP) is there to support low-level formatting of attached devices. This kind of low-level formatting is not needed on IDE and CF devices. The only formatting that is needed is to write out the file system data and bootlloader at the beginning of the partition. For prodos that means writing < 20 blocks of data to the drive.

Keep in mind that a CF card handles all of the messy FLASH wear-leveling and error detection and correction details internally. To the user it appears as a linear array of 512 byte blocks. When a block goes bad, it is automatically replaced, and the data is copied to the new block from a pool of reserved blocks, if possible. It is typically possible, because it is usually write that fails and read still works fine.

IDE drives also appear as a linear array of blocks, but I don't believe they can auto detect and replace bad blocks like a CF card can. That is why modern OS still scan the entire drive looking for bad blocks when you do a format. Unless you do a Quick format, then that step is skipped.

PostPosted: Tue May 15, 2007 7:33 pm
by david__schmidt
Ok, I'll take another look. I sent a format command and got back a $27 error code (drive door open or some such). So obviously I did something wrong.

SmartPort calls - FORMAT

PostPosted: Thu May 17, 2007 11:30 pm
by rich
Dave,

So I guess i was trying to say, that indeed the format command in the smartport firmware on the CFFA card is a NOP. There isn't any format support built-in because there isn't any needed. You just need a ProDOS utility that has format support, like Copy II+ or Apple System Utilities or Davex.

If I am not understanding something in your thread, let me know.

SmartPort calls - FORMAT

PostPosted: Thu May 17, 2007 11:33 pm
by rich
Also...

If you are getting that error from a standard prodos utility like I mentioned, then the most likely cause of that is you put the CF card into the socket in the CFFA __after__ your Apple II was already turned on. This will not work. Actually with some cards you can just hit reset, and they will start working, but in general you always want to have the CF card installed before power is switched on.

If that is not the problem, then drop me an email and I can try to help you debug this further.

Re: SmartPort calls - FORMAT

PostPosted: Sun May 20, 2007 3:21 pm
by david__schmidt
[quote="rich"]If that is not the problem, then drop me an email and I can try to help you debug this further.[/quote]

Thanks. Turns out that wasn't the problem. I'm running into the CFFA ROM's SpValidateUnitNumber code, and it's returning a #BAD_UNIT_NUMBER ($11) which I erroneously interpreted as a ProDOS return code (drive door open).

I sent you an email with some more particulars and a pointer to the format code (http://adtpro.cvs.sourceforge.net/adtpr ... iew=markup, SmartForm: routine).

- David