Discussion:
48K Pascal runtime -> ProDOS 8?
(too old to reply)
Steve Nickolas
2015-08-14 01:43:29 UTC
Permalink
I just got a weird idea: would it be difficult to either port the 48K
Pascal runtime to use the ProDOS API and filesystem, or rewrite it to run
under ProDOS?

-uso.
Don Bruder
2015-08-14 03:25:53 UTC
Permalink
Post by Steve Nickolas
I just got a weird idea: would it be difficult to either port the 48K
Pascal runtime to use the ProDOS API and filesystem, or rewrite it to run
under ProDOS?
-uso.
Without doing a boatload of "under the hood" digging to refresh 20+ year
old brain-cells, I'd bet that it wouldn't be difficult at all - It'd be
a full-blown visit to hell!

The only similarity between the Pascal and ProDOS disk access is that
they both use a "two disk sectors make a logical block" scheme. Worse,
to make "Pascal block 1", it might be "cram Track 1, Sector 3 and Track
1, Sector 5 together", while "ProDOS block 1" is "cram Track 1, Sector 7
and Track 1, sector 8 together" (Note that I'm certain I'm wrong on the
exact sector pairs - Just pulling them out of thin air for illustration)

In other words, the Pascal system and ProDOS are basically about as
compatible as water and motor oil - without a major dose of "soap", they
don't mix worth a damn.

Years ago, I wrote some special-purpose ProDOS assembly code to import a
handful of sectors of data from a Pascal disk to ProDOS - It was a
disaster. Took weeks of research, followed by days of coding, and when
it was done, it would only cope with turning that specific group of
sectors into a ProDOS binary file. Even then, I had to massage it before
I could use it. Trying to go the other direction was COMPLETELY outside
my ability at the time - I could write to a Pascal disk from ProDOS, but
it was an even money bet as to whether the disk would read under Pascal
afterwards.
--
Security provided by Mssrs Smith and/or Wesson. Brought to you by the letter Q
Steve Nickolas
2015-08-14 03:31:49 UTC
Permalink
Post by Don Bruder
Post by Steve Nickolas
I just got a weird idea: would it be difficult to either port the 48K
Pascal runtime to use the ProDOS API and filesystem, or rewrite it to run
under ProDOS?
-uso.
Without doing a boatload of "under the hood" digging to refresh 20+ year
old brain-cells, I'd bet that it wouldn't be difficult at all - It'd be
a full-blown visit to hell!
The only similarity between the Pascal and ProDOS disk access is that
they both use a "two disk sectors make a logical block" scheme. Worse,
to make "Pascal block 1", it might be "cram Track 1, Sector 3 and Track
1, Sector 5 together", while "ProDOS block 1" is "cram Track 1, Sector 7
and Track 1, sector 8 together" (Note that I'm certain I'm wrong on the
exact sector pairs - Just pulling them out of thin air for illustration)
In other words, the Pascal system and ProDOS are basically about as
compatible as water and motor oil - without a major dose of "soap", they
don't mix worth a damn.
Years ago, I wrote some special-purpose ProDOS assembly code to import a
handful of sectors of data from a Pascal disk to ProDOS - It was a
disaster. Took weeks of research, followed by days of coding, and when
it was done, it would only cope with turning that specific group of
sectors into a ProDOS binary file. Even then, I had to massage it before
I could use it. Trying to go the other direction was COMPLETELY outside
my ability at the time - I could write to a Pascal disk from ProDOS, but
it was an even money bet as to whether the disk would read under Pascal
afterwards.
Well, I would need to gut out all the file access stuff, and translate
that to ProDOS stuff. That would absolutely be difficult to pull off.

I don't think I'd have to worry about ProDOS being less permissive than
Pascal though. And I think all the Pascal filetypes have ProDOS
equivalents?

-uso.
fadden
2015-08-14 04:32:12 UTC
Permalink
Looking at the Language Reference Manual (https://archive.org/details/Apple_Pascal_Language_Reference_Manual_with_Addendum), I think you'd have some trouble with UNITREAD and UNITWRITE. It's possible these are only used by the Filer, which requires intimate knowledge of the filesystem (for things like Krunch).

I think everything else would just be doing file I/O once the system is booted.
Don Bruder
2015-08-14 04:43:34 UTC
Permalink
Post by Steve Nickolas
Post by Don Bruder
Post by Steve Nickolas
I just got a weird idea: would it be difficult to either port the 48K
Pascal runtime to use the ProDOS API and filesystem, or rewrite it to run
under ProDOS?
-uso.
Without doing a boatload of "under the hood" digging to refresh 20+ year
old brain-cells, I'd bet that it wouldn't be difficult at all - It'd be
a full-blown visit to hell!
The only similarity between the Pascal and ProDOS disk access is that
they both use a "two disk sectors make a logical block" scheme. Worse,
to make "Pascal block 1", it might be "cram Track 1, Sector 3 and Track
1, Sector 5 together", while "ProDOS block 1" is "cram Track 1, Sector 7
and Track 1, sector 8 together" (Note that I'm certain I'm wrong on the
exact sector pairs - Just pulling them out of thin air for illustration)
In other words, the Pascal system and ProDOS are basically about as
compatible as water and motor oil - without a major dose of "soap", they
don't mix worth a damn.
Years ago, I wrote some special-purpose ProDOS assembly code to import a
handful of sectors of data from a Pascal disk to ProDOS - It was a
disaster. Took weeks of research, followed by days of coding, and when
it was done, it would only cope with turning that specific group of
sectors into a ProDOS binary file. Even then, I had to massage it before
I could use it. Trying to go the other direction was COMPLETELY outside
my ability at the time - I could write to a Pascal disk from ProDOS, but
it was an even money bet as to whether the disk would read under Pascal
afterwards.
Well, I would need to gut out all the file access stuff, and translate
that to ProDOS stuff. That would absolutely be difficult to pull off.
I don't think I'd have to worry about ProDOS being less permissive than
Pascal though. And I think all the Pascal filetypes have ProDOS
equivalents?
-uso.
I may be mistaken, but now that your question got me thinking about it,
I seem to recall reading somewhere that the UCSD Pascal system (which,
whether it explicitly says so or not, means "Apple Pascal") source code
had been (was going to be?) released under a variant of GPL. Seems to me
that was about 4-5 years ago, however, and at this point, I have no idea
where I saw it. (Or, to be honest, if I'm even remembering reading it,
or just wishing I'd read it...)

If it has been released, that'd make the task one helluva lot easier.
(Duh... as if doing *ANYTHING* when you've got source code available
isn't easier than trying to patch binaries...)
--
Security provided by Mssrs Smith and/or Wesson. Brought to you by the letter Q
Steve Nickolas
2015-08-14 05:13:55 UTC
Permalink
Post by Don Bruder
I may be mistaken, but now that your question got me thinking about it,
I seem to recall reading somewhere that the UCSD Pascal system (which,
whether it explicitly says so or not, means "Apple Pascal") source code
had been (was going to be?) released under a variant of GPL. Seems to me
that was about 4-5 years ago, however, and at this point, I have no idea
where I saw it. (Or, to be honest, if I'm even remembering reading it,
or just wishing I'd read it...)
If it has been released, that'd make the task one helluva lot easier.
(Duh... as if doing *ANYTHING* when you've got source code available
isn't easier than trying to patch binaries...)
Apple Pascal is based on UCSD Pascal II.1. There was a source release,
but it was I.5. It was released under a non-commercial use only license
or CC-BY-NC-SA disjoint, with wording similar to the BSD license (both
codebases are owned by the Regents of the University of California).

-uso.
awanderin
2015-08-14 06:18:19 UTC
Permalink
Post by Steve Nickolas
Post by Don Bruder
Post by Steve Nickolas
I just got a weird idea: would it be difficult to either port the 48K
Pascal runtime to use the ProDOS API and filesystem, or rewrite it to run
under ProDOS?
-uso.
Without doing a boatload of "under the hood" digging to refresh 20+ year
old brain-cells, I'd bet that it wouldn't be difficult at all - It'd be
a full-blown visit to hell!
The only similarity between the Pascal and ProDOS disk access is that
they both use a "two disk sectors make a logical block" scheme. Worse,
to make "Pascal block 1", it might be "cram Track 1, Sector 3 and Track
1, Sector 5 together", while "ProDOS block 1" is "cram Track 1, Sector 7
and Track 1, sector 8 together" (Note that I'm certain I'm wrong on the
exact sector pairs - Just pulling them out of thin air for illustration)
In other words, the Pascal system and ProDOS are basically about as
compatible as water and motor oil - without a major dose of "soap", they
don't mix worth a damn.
Years ago, I wrote some special-purpose ProDOS assembly code to import a
handful of sectors of data from a Pascal disk to ProDOS - It was a
disaster. Took weeks of research, followed by days of coding, and when
it was done, it would only cope with turning that specific group of
sectors into a ProDOS binary file. Even then, I had to massage it before
I could use it. Trying to go the other direction was COMPLETELY outside
my ability at the time - I could write to a Pascal disk from ProDOS, but
it was an even money bet as to whether the disk would read under Pascal
afterwards.
Well, I would need to gut out all the file access stuff, and translate
that to ProDOS stuff. That would absolutely be difficult to pull off.
I don't think I'd have to worry about ProDOS being less permissive
than Pascal though. And I think all the Pascal filetypes have ProDOS
equivalents?
-uso.
What about the Pascal AREA file type in ProDOS? ProDOS Tech note #25:

http://www.1000bit.it/support/manuali/apple/technotes/pdos/tn.pdos.25.html

I haven't studied it in detail, but perhaps it could be utilized to
provide a virtual Pascal volume on a ProDOS device, and that would make
monkeying with the Pascal internals a lot easier. (Which might still be
hard.)

--
Jerry awanderin at gmail dot com

Loading...