Disected! - A disk sector editor in BASIC
DIsk SECTor EDitor
I wrote about Atari DOSes in this week’s Monday paid post and I continue that topic with a program I wrote back in 1985 called Disected!
It is a DIsk SECTor EDitor and I have to say, I’m kind of proud of that name. It is entirely based around a single machine language routine
that is built into the OS to read a sector of data from a disk. With this single routine you could build your own DOS if you wanted to, although certainly not in BASIC.As I typed the program in, a couple things jumped out at me. First is the FOR loop on line 160 that does not have a corresponding NEXT. Looking at the code, I don’t even think the FOR loop is even necessary since the string is cleared using the subsequent code.
I also incorrectly used “then” instead of “than” (line 700). I hate that.
Also, when reading a sector in the Atari CR is changed to an asterisk for display purposes. When writing the sector back out, the asterisk is changed to a CR. So if the sector actually had a valid asterisk in it, it would get changed to a CR, corrupting what was there.
If you like these posts, you may want to consider becoming a paid subscriber. You’ll get extra posts on Mondays plus perks. Even better, you can currently save 10% with the Anniversary Sale, ending next week.
Although this is less than 100 lines of code, there is a lot of jumping around and repeated code. Of course, Atari BASIC doesn’t make it easy to reuse code and it all line-based BASICs make it hard to refactor code once it’s written.
I seem to also have an even more advanced version of this, called 1050 Disk Ed (not as good a name). I have not yet typed this one in as it is much longer, but if memory serves it uses the joystick in some way.
Related Articles:
I believe that the ML routine was from an issue of ANALOG computing.