[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CP/M disk format question
In article <aabf134e-e443-44b2-8c58-2b2cb4552c7d@s50g2000hsb.googlegroups.com>,
jonnosan <jonnosan@gmail.com> wrote:
>On Jul 12, 3:59=A0am, Andy McFadden <fad...@fadden.com> wrote:
>>
>> I've been sent an apparently valid disk image that uses block numbers abo=
>ve
>> 128. =A0It appears that such values wrap around, storing data in track 0-=
>2.
>>
>
>Andy,
>
>By coincidence, I've recently been hacking cp/m handling into my
>dsktool.rb library - is there any chance I could get a copy of the
>problematic image (or any other particularly interesting specimens)?
>
>BTW as part of that cp/m work, I put together code to parse
>(unprotected) MBASIC / GBASIC tokenised files, it's pretty simple -
>the format is exactly the same as the x86 BASICA/GWBASIC format
>described at http://www.chebucto.ns.ca/~af380/GW-BASIC-tokens.html -
>the only difference seems to be the mapping of bytes to keywords - I
>can supply those values if you're interested in adding this to
>CiderPress.
Another difference is the line number after a GOTO/GOSUB which could
be stored in two different formats. The first format was simply the
line number - that format was used before the GOTO/GOSUB statement
had been executed for the first time. After the first execution,
the line number was replaced with the direct address of the target
line, which meant the line needed not be searched for after that.
If the program was modified, all line addresses was replaced by
line numbers - this was necessary since modifying the program could
potentially make the line address invalid.
The GW-BASIC-tokens.html web page stated that GW-BASIC never stored
the line addresses, only the line numbers, when a GW-BASIC program
was SAVE'd in tokenized format. Here MBASIC behaved differently:
if the program in memory had line addresses instead of line numbers,
the SAVE'd program would also contain line addresses, if it was saved
in tokenized format. Back when I still wrote some programs in
MBASIC, I therefore used to execute the program first, thoroughly enough
to make sure all GOTO's/GOSUB's had been executed, before I SAVE'd
the program in tokenized format - then it would execute slightly faster
the next time I LOAD'ed and RUN'ned it. If the program was to be saved in
ASCII format, this didn't matter of course.
--
----------------------------------------------------------------
Paul Schlyter, Grev Turegatan 40, SE-114 38 Stockholm, SWEDEN
e-mail: pausch at stjarnhimlen dot se
WWW: http://stjarnhimlen.se/