PHYDIO question

Страница 1/2
| 2

By Eugeny_Brychkov

Paragon (1232)

Аватар пользователя Eugeny_Brychkov

19-11-2009, 23:09

I am analysing a code, and faced a problem: program tries to do the following

A=00
BC=01F9
DE=05C8
HL=some address
and goes with these parameters to phydio ($6052 in my machine's disk bios).

It is obvious for me that sector 5c8 does not exist on 2dd disks because 59f is the last one.

Any ideas? I think program expects something to read from this sector... If I try reading myself, it gives error A=08 "record not found" which is logical.

Для того, чтобы оставить комментарий, необходимо регистрация или !login

By flyguille

Prophet (3031)

Аватар пользователя flyguille

20-11-2009, 01:36

maybe is anti-pirate protection

on a special format procedure if the mechanical allows and don't hit the top & bounce back, you can to format one or two extra tracks, readable on most machines, as a normal disk will not to have those extra tracks, the anti-pirate protection will stop you

other method is to change the TAG number of a sector, so you can to create inside a normal track, the sector offset #55 by example.

other method is to swap a given sector, so reading that sector will return an sector not found error, and the anti-pirate protection will knows that is an original disk, (this methos is done most with the absolute sector #1), so reading it in BASIC with FILES will return disk y/o error, but as the disk has code on boot'sector, it boots into a game-menu.

and the list of anti-pirate protections go more far...

By Leo

Paragon (1236)

Аватар пользователя Leo

20-11-2009, 07:43

you can try to use disk manager from rumsx emulator to create custom size file.dsk , if you think you know the correct disk parameter.
yes i think also to anti-pirate or just a larger disk like formatted with more than 9 sector per track?
the media F9 shows clearly that it is suposed to be a 720kb disk

By NYYRIKKI

Enlighted (6016)

Аватар пользователя NYYRIKKI

20-11-2009, 08:08

@flyguille: This sector would be on track 83... a bit too far beyond last track... On worst case this kind of call can physically damage diskdrive...

Maybe you could tell us a bit more about the software? (Name or purpose for example)

By RetroTechie

Paragon (1563)

Аватар пользователя RetroTechie

20-11-2009, 18:05

A disk interface may not know how many tracks the connected drive has, and to support (possible) extra tracks, it may just assume valid input. Read: divide sector-number by sectors/track (depending on media descriptor), and not check for an upper bound.

For 80 tracks floppy drives, the use of 1 or 2 extra tracks is normally okay, more than that may or may not work depending on drive (and yes *may* cause physical damage although unlikely). Note that standard 3,5" DD floppies aren't formatted beyond 80 tracks, so if there's any magnetic info to be read on those extra tracks at all, chances are it's a specially prepared, non-standard floppy.

On track 0, the drive gives an electronic signal to the FDC (floppy disk controller) that says "head is on 1st (outer) track". On tracks >0, the FDC remembers on what track the head is, and only way to check is compare against magnetic markers on the floppy disk, that are written there during formatting. This happens implicitly when you read or write a sector on that track.

If the drive hits the last track, and you try eg. to move 3 tracks further, the read/write head will just 'click back' onto the last track, and the FDC will think that the read/write head has moved up. Result: the magnetic info on that track doesn't match the assumed track number, and should result in a disk error. What's more: this situation may remain (and keep resulting in errors), until the drive head is moved back to track 0 to re-calibrate its position.

So let me guess: you stumbled upon this while investigating a copy protection scheme? Wink Yes I know, knowledge of low-level disk I/O is *soooo* useful when cracking those LOL!LOL!

By RetroTechie

Paragon (1563)

Аватар пользователя RetroTechie

20-11-2009, 18:10

and the list of anti-pirate protections go more far...
True, and remember: the actual data read (or not) may also matter, apart from the errors returned.

By flyguille

Prophet (3031)

Аватар пользователя flyguille

20-11-2009, 20:07

A disk interface may not know how many tracks the connected drive has, and to support (possible) extra tracks, it may just assume valid input. Read: divide sector-number by sectors/track (depending on media descriptor), and not check for an upper bound.

For 80 tracks floppy drives, the use of 1 or 2 extra tracks is normally okay, more than that may or may not work depending on drive (and yes *may* cause physical damage although unlikely). Note that standard 3,5" DD floppies aren't formatted beyond 80 tracks, so if there's any magnetic info to be read on those extra tracks at all, chances are it's a specially prepared, non-standard floppy.

On track 0, the drive gives an electronic signal to the FDC (floppy disk controller) that says "head is on 1st (outer) track". On tracks >0, the FDC remembers on what track the head is, and only way to check is compare against magnetic markers on the floppy disk, that are written there during formatting. This happens implicitly when you read or write a sector on that track.

If the drive hits the last track, and you try eg. to move 3 tracks further, the read/write head will just 'click back' onto the last track, and the FDC will think that the read/write head has moved up. Result: the magnetic info on that track doesn't match the assumed track number, and should result in a disk error. What's more: this situation may remain (and keep resulting in errors), until the drive head is moved back to track 0 to re-calibrate its position.

So let me guess: you stumbled upon this while investigating a copy protection scheme? Wink Yes I know, knowledge of low-level disk I/O is *soooo* useful when cracking those LOL!LOL!

that's partialy true.

first, the controller has 3 commands, TRACK UP / DOWN / GO TO TRACK # in its command's list with many others,

first, diskbios is done in a way that, when is ordered to read/write a large ammount of sectors, like, dumping 40 sectors on a given RAM area, the code at disk-bios, will do FIRST, a GO TO TRACK #, then on the reading/writing procedure, when it finishes a given TRACK it DOES a TRACK UP, and in that way it transfers all the logical ammount of sectors.

What is happening, the controller, when is executed a GO TO TRACK #, it uses the TRACK NUMBER TAGs,

but in STEP UP / DOWN, it do not uses those track's tags, so it assumes that it is on the next or previous track.

and for one (two tracks because it is double sided REMEMBER), for one EXTRA track, every DRIVE is perfectly capable to access, but just one track (that is one per side). Now TWO (4 track, 2 per side), NO!, it is not capable because the DISK itself runs out of magnetic media.

That extra SPACE of magnetic media, that can host an extra track per side, is here as a way of a MARGIN on a PAPER, it is just here by IF there is imperfections on the disk. and all drives mechanicaly can read it because they has a litle MARGIN to POS if it necessary.

So, formatting 82 tracks (one more per side), will not damage any drive, and it is a perfect way to do anti-pirate protections. or extra space for programs, but remember, you are gambling here with the QUALITY of the disk because you are writing just TOO NEAR of the EDGE.

But, go far, imagine that you are a MAD very MAD programmer that is doing an MSX virus... and you do a code that says GO TO TRACK #100......

in 99% mechanism, that heads will click 20 times and stay on last track perfectly aligned, why?, because none motor is forced, the vibration for the heads is ok because when used the heads are moved all the time, so what?, the endless screw that displaces the heads and the way the heads are following the screw guide, allow to jump from the guide-line... so that is the reason that I says "jump-back" instead "click-back", because the cursor mechanically jumps back and you listen a click, there is not going to break nothing.

By Eugeny_Brychkov

Paragon (1232)

Аватар пользователя Eugeny_Brychkov

20-11-2009, 21:42

Well, program is being read from clusters 03a-041. After it is loaded and starts execution, I hear relatively long sound of moving heads. No jump/click sounds, just head move.

Yes, it is protection, along other numerous techniques applied like xoring code, code self-modification, jumping between memory pages etc.

By NYYRIKKI

Enlighted (6016)

Аватар пользователя NYYRIKKI

20-11-2009, 22:37

So, formatting 82 tracks (one more per side), will not damage any drive, and it is a perfect way to do anti-pirate protections.
If you insert 82-track disk to original disk drive of Sony HB-G900P you will hear very nasty cracks when you try to access the last tracks and it will not load correctly. I've had no problem on other MSX-computers that I've tested. Also all of the disk ROM's I've tested seem to understand perfectly fine 82-track formatted FAT12 disks without any custom code or tricks.

BTW if someone needs, I've made a program that can format this kind of disks on MSX tR. This might be usefull if you need to transfer 720KB .DSK files on disk as files. Eek!

By flyguille

Prophet (3031)

Аватар пользователя flyguille

20-11-2009, 22:54

Well, program is being read from clusters 03a-041. After it is loaded and starts execution, I hear relatively long sound of moving heads. No jump/click sounds, just head move.

Yes, it is protection, along other numerous techniques applied like xoring code, code self-modification, jumping between memory pages etc.

eh eh eh Wink

By flyguille

Prophet (3031)

Аватар пользователя flyguille

20-11-2009, 22:57

So, formatting 82 tracks (one more per side), will not damage any drive, and it is a perfect way to do anti-pirate protections.
If you insert 82-track disk to original disk drive of Sony HB-G900P you will hear very nasty cracks when you try to access the last tracks and it will not load correctly. I've had no problem on other MSX-computers that I've tested. Also all of the disk ROM's I've tested seem to understand perfectly fine 82-track formatted FAT12 disks without any custom code or tricks.

BTW if someone needs, I've made a program that can format this kind of disks on MSX tR. This might be usefull if you need to transfer 720KB .DSK files on disk as files. Eek!

well, 99% I said, that's just the esception to the rule!.

Also happens on 5 1/4 there is spare space for two tracks more per side. Big smile

Страница 1/2
| 2