Would like to development a new THINK Pascal App for 68K

LelandLong

Active member
I'm fairly new here and have spent a few days reading a variety of posts here on this site.
I have just finished composing a little introduction to my early Macintosh history over in my User Profile/About.

The last time I spent any amount of time working/playing/collecting old Macintosh hardware was around 1999, and at that time there was little help from likeminded Mac users that I could find. I did find a local user group and had a little bit of time hanging with some people that were Apple fans like myself, but no where near the volume of information like what I have found here!

I sold and gave away all of my old hardware when I moved from the West Coast to the west Coast in 2007, but I kept all my software.
Just this last weekend, while scrolling thru FaceBook I saw a Marketplace posting for a Mac SE, and I made the quick decision to obtain it, which I did. An hour later I had myself an old yet familiar toy. Spent the next several hours trying to find my box of floppies. And even more hours trying a few of them out.

So now that the dust has settled a bit, and I have THINK Pascal v2 installed, many of my old projects and source files transferred onto the HD, I am ready for my next project: develope a new App for my new toy.

For various reasons I won't bore you with, I recently recreated PacMan using JavaScript. Not a port. No copy/paste of somebodies code somewhere, but a complete start-from-scratch coding of the entire game all by myself. It was a wonderful time. Lots of challenges that matched my skill level. I would consider myself to be an intermediate-level JavaScript developer, nothing more. To add some clarity (and confusion most likely), this game was actually written and contained inside a FileMaker Pro database, using JavaScript for the game engine and native UI being handled by FileMaker. I am assuming that most readers of this post will find this bemusing, baffling, confusing, and possibly outright ludicrous, but so be it. If you are at all curious about this, you can see a bit of an explanation and demo here:

So, I am thinking it would be fun to do this same thing all over again, but here in 68K land, on this SE of mine, using THINK Pascal.
If you have read my little bio over on my profile, you will have noticed already that I wrote a PacMan game for my final project in the Pascal high school class.
I did, I tried, it mostly worked, but the major hangup was that I had never yet been introduced to the Mac Toolbox and had not yet gotten my hands on the Inside Macintosh volumes. I did years later, and loved them.
But this poor PacMan attempt was the best I could do and it was impressive from a teacher of Pascal's point of view.

So following other examples I have seen in this site, I propose starting up this project and posting my progress and questions to this thread, so that anyone can follow along, providing answers, feedback, and suggestions along the way.

Any initial thoughts, considerations, ponderings, concerns, or advice at this early stage?
Are you with me?
Are you hitting "ignore" and wish you had never heard of me?
I don't know any of you very well yet but hope to get some conversations going with y'all.
 

LelandLong

Active member
Did I forget to put on any deodorant ?
Did I say a bad word?
Is my avatar offensive?
Do you all hate THINK Pascal?
Do you despise the thought of anything PacMan related?
Is the 2024 eclipse stealing your attention away from this website?
It says 129 of you viewed this post, yet not a single comment?
No "Hello, welcome to the site"?
Just crickets........
 

phlogios

Active member
Welcome to the site, I am also new here, and also a game developer. Just saw this thread now. I look forward to trying your pacman game! Compile it for PPC too if you can.
 

Callan

Well-known member
Welcome to the site! I was one of those 129 so I apologize. I actually started watching your Javascript script stream and forgot to come back to say howdy. I too haven't programmed in Pascal since high school, so I probably won't be any help. My pacman chops were lacking (great port btw!), but I loved crazy climber! I do a lot of arcade related stuff and am more a hardware guy, but am looking forward to your posts. Who knows... I might be motivated to pick up Pascal again myself! Have fun!!!
 

LelandLong

Active member
Welcome to the site, I am also new here, and also a game developer. Just saw this thread now. I look forward to trying your pacman game! Compile it for PPC too if you can.
I have made some games, usually re-creating something I enjoy, like a board game or simple arcade game such as PacMan.
I am a published author on a Game Development book.
BUT, even after those little accolades I will still state loudly that I am a novice game maker.
Why do I do it? For the fun and challenge of doing it.
Certainly not for the money.
What is your game developer experience?
I have no experience at all with compiling for a PPC. I will need your help in attempting that task, but will certainly give it a try for your sake and for other's that might show up here asking for the same.

I'll be following this, it might finally get me interested in coding again, haven't done any since High School.
Like you I have not done any Pascal or early Mac development since high school and first 2 years of Community College.
What would make you interested in coding again? Just watching our discussion of it here? A particular project or app?
Do you have hardware/software to code something, anything?
As for me, I just purchased a Mac SE, grabbed all my old floppies, and have tried to get as much old Pascal projects transferred onto it, and just last night, got THINK Pascal v4.5 onto it and running with several of my old projects. Had many frustrating road-blocks to this but managed after hours of small successes to make it happen. Felt good at the end of it all.

Welcome to the site! I was one of those 129 so I apologize. I actually started watching your Javascript script stream and forgot to come back to say howdy. I too haven't programmed in Pascal since high school, so I probably won't be any help. My pacman chops were lacking (great port btw!), but I loved crazy climber! I do a lot of arcade related stuff and am more a hardware guy, but am looking forward to your posts. Who knows... I might be motivated to pick up Pascal again myself! Have fun!!!
Wowser's, you got distracted by the JavaScript video - how cool is that. Was it fun? Entertaining? Useful? Educating at all or just an interesting distraction for you?
Have experience with FileMaker Pro or JavaScript?
I enjoyed making those video's (there are a dozen or so) and have been eagerly invited back to make more, but wow, they take time to prepare for and I struggle with coming up with content to share.
What is your high school Pascal programming experience? Just learning and a little homework? Did you make anything outside of class(es)?
Your PacMan chops were lacking? Ha, myself I love to make the games. I am usually terrible at playing them!! My brother was the gamer. I enjoy watching good players play the games because I certainly can't.
I don't recall Crazy Climber....
I loved Lode Runner!
Yes, pick up the Pascal again! Just do it!
Especially since you can get all the software nowadays for free!

- - -

Y'all are bringing a little tear to my eye reading these replies. You're awesome. Thank you.
 

Phipli

Well-known member
I have no experience at all with compiling for a PPC. I will need your help in attempting that task, but will certainly give it a try for your sake and for other's that might show up here asking for the same.
Generally you don't really need to consider this. As long as you're not targeting very late model 68k macs, all PowerPC macs are fast enough to run any game you write for 68k under their normal integrated emulator. It will just run seamlessly.

If your game runs on a IIci OK, it will run on a 6100/60, the lowest spec PPC :)

I'd only specifically try targeting PPC if I was doing stuff that needed more performance, in which case I probably wouldn't also be targeting 68k!
 

LelandLong

Active member
Time for a progress report I think...

1) this Mac I purchased says "Macintosh SE" Model M5011 on the back, yet the Finder About says "SE/30" and has 4Mb RAM. Did someone upgrade it to an SE/30 or is that just a fluke or misleading notion?

2) with the desire to get files on/off my new Mac SE, I recently got my RaspberryPi off the shelf, got it up and running with "MapIPpi" on it (makes it an AppleShare server I guess), and could see the shared drive on my MacBook. I ordered up some hardware for the SE and all of it is in. So I plugged a PhoneNet adapter into the SE, found a 4-wire phone cable to use, plugged the 2nd PhoneNet into the AsanteTalk box, plugged that into my network switch with ethernet cable, powered it up, and groaned when the SE Chooser AppleShare selection gave me nothing in the list. Tried a cable swap, unplug and replug things, found the Network and FileSharing Control Panels in the System Folder and turned FileSharing on, shared the entire HD, saw all the folder tabs change to dark corners (visually showing the user that File Sharing was turned on and those folders were shared), went back to the Chooser AppleShare tab, and viola!! MacIPpi showed up in the list. The adrenaline rushed and life was good! I started moving folders from my SE's HD to the shared folder and suddenly I was happily creating a backup of everything. I have no idea out of everything I tried, what finally made the shared drive suddenly show up in the Chooser or what was missing that made it blank initially. Anyone here know the secret(s)?

3) I had several folders all copied over to the shared drive, and was in the middle of another copy when suddenly things ground to a halt! The mouse was NOT stuck so the Mac wasn't frozen. But it was in the middle of reading a file, and the status refused to change. I left it for a bit 5-10 minutes but no change and no HD read/write noises. <groan> So I finally killed power. Turned it back on, and no relaunch! No flashing question mark/floppy icon. The mouse was there and moving fine, but grey screen with white menubar area. Went to my stash of floppies and for 30 minutes tried every possible floppy-with-system I could find. A Google search revealed that cmd-option-shift-delete upon power on would bypass HD system startup. Found a few floppies that obviously had Systems on them. Some immediately ejected back out, but some provided Welcome Dialog messages, but even those got to a point where the Welcome message wouldn't go away and the drive noises would just stop. Sometimes waiting 5-10 minutes would result in no change, BUT sometimes it would resume, acting like it was testing memory or something that took way too long to perform, but was not stuck or hung at all, just reallllllly slowly doing something! So frustrating! I resisted the urge to toss the entire mess out the 2nd floor window. <sigh> Eventually I re-tried yet again a floppy that was supposed to be a 7.0.1. Disk Tools I that was not successful earlier, but upon trying again, it LOADED. <whew> Aaaaaand then once opened up to the Finder, there was no HD. And Disk First Aid didn't see no HD neither. Wellllll damn it all anyways. So I gave up and ShutDown again. And powered back up with no floppy, and WHAT .... the HD started up just fine, came to the Finder as if nothing was amiss. Well I'll be a darned biscuit eater! WTHeckyness is going on anyways?! So then I try to reconnect to AppleShare shared folder, and I get it up on the Finder screen, and start to do some copying again, and now it sits there, no status changes again. After waiting 10-15 minutes I gave up and power cycled again. So for the next several hours this was my experience. Sometimes working fine, sometimes crawling so slow it was appearing to be frozen only later to resume, and a few times where waiting patiently resulted in no change, even after an hour. Later in the late evening, it appeared to be working just fine - for 1-2 hours, where I managed to get THINK Pascal v4 transferred from the shared drive onto the SE, and it was running just fine, opening all my old Projects and humming away nicely as if nothing was wrong at all. I dunno what is up or how long this will last.

4) while trying to Build and Run one of my old projects, the compiler stopped with an error on a line that looked fine to me:
FillRect ( 10, 10, 200, 200, white ) ;
Look fine to you? It does me. This compiled just fine in THINK Pascal v2. But not in v4.
I got past the error by replacing that with:
var tempRect: Rect; SetRect ( tempRect, 10, 10, 200, 200 ) ; FillRect ( tempRect, white ) ;
I ran into several more projects with this same issue and solution. Can anyone explain why this is occurring and maybe even where in the docs I can find info on this?

5) while trying to Build and Run another of my old projects, the compiler stopped with an error on a line that also looked fine to me:
SFGetFile ( where, 'Prefs file', nil, 1, typeList[0], nil, reply );
with these vars defined earlier:
var where: Point; typeList: SFTypeList; reply: SFReply; typeList[0] := 'PREF'; SetPtr ( where, 50, 50 );
So I tried replacing it with:
StandardGetFile()
No luck, same type mismatch error. Couldn't get past this error so I moved on. Anyone got ideas or reasons?

- - -

That was my adventurous night. Frustrating. Rewarding eventually. But wow, so far I have high hopes that even though I have no luck finding answers to my questions with Google for this old equipment and programming issues, that this website and all you awesome people are going to potentially make this sort of challenge bearable and hopefully resolve things.
And evidently, according to your posts thus far, this just might encourage some of you to dust things off and give it a try yourself! Fun fun.
 

Phipli

Well-known member
this Mac I purchased says "Macintosh SE" Model M5011 on the back, yet the Finder About says "SE/30" and has 4Mb RAM. Did someone upgrade it to an SE/30 or is that just a fluke or misleading notion?
If it says SE/30, it is pretty likely to be one. It is possible to spoof it, but there isn't really any reason to. Can you move software to it (seems so based on your question 2)? If so, load in "TattleTech" from here :


It gives lots of technical details including whether you have an SE or an SE/30 CPU.

If you have an SE/30, that is amazing good luck, except you have to get it recapped. Seriously, they are all leaking and causing damage due to the parts apple chose, and it is actually surprising that yours is still working.

If you're happy to do it yourself, that's great, otherwise, you might want to get a quote from https://amigaofrochester.com/recap-services/macintosh-se-analog-boards/

I realise a lot of new people to the hobby think we're being over dramatic, but genuinely, it is much easier (read cheaper) to recap a machine than to repair traces after damage has occured. It's actually quite likely to already perhaps have some issues. Sound is common - is it quiet at full volume? Does it chime at all?

Ah, just read :
3) I had several folders all copied over to the shared drive, and was in the middle of another copy when suddenly things ground to a halt! The mouse was NOT stuck so the Mac wasn't frozen. But it was in the middle of reading a file, and the status refused to change. I left it for a bit 5-10 minutes but no change and no HD read/write noises. <groan> So I finally killed power. Turned it back on, and no relaunch! No flashing question mark/floppy icon.
Yeah. Sounds like it is on its way out. Sadly this might be cap damage, which is accelerated by use (the gunk on the board and electricity flowing causes electrolysis to occur and accelerates deterioration, or conducts a bit of electricity to places it shouldn't be and confuses things). Sorry. Otherwise, your hard disk might be playing up. But also, your floppy drive needs cleaning is likely part of the booting issue.

Another thing it might be is the power supply. Do you have a multimeter? We can check that the main 5v voltage is good from an external port.

The floppy drive is something you can do fairly easily if you're comfortable taking things apart. The logic board is more tricky but doable if you're looking for a challenging project. Otherwise, sending it off is an option. The company I linked isn't actually that expensive considering the time involved from start to finish of the work.
 

joevt

Well-known member
4) while trying to Build and Run one of my old projects, the compiler stopped with an error on a line that looked fine to me:
FillRect ( 10, 10, 200, 200, white ) ;
Look fine to you? It does me. This compiled just fine in THINK Pascal v2. But not in v4.
I got past the error by replacing that with:
var tempRect: Rect; SetRect ( tempRect, 10, 10, 200, 200 ) ; FillRect ( tempRect, white ) ;
I ran into several more projects with this same issue and solution. Can anyone explain why this is occurring and maybe even where in the docs I can find info on this?
The Think Pascal manual at https://archive.org/stream/THINKPascalUserManual1991/THINK Pascal User Manual 1991_djvu.txt says "THINK Pascal lets you use an alternate parameter list for the QuickDraw graphics operations on Rects, RoundRects, Ovals and Arcs". Is this changed in different versions of Think Pascal?

A problem with Think Pascal is that it doesn't include interfaces for everything. If you look at QuickDraw.p, it says "Its declarations are built into the THINK Pascal 4.0 compiler."

So you'll want a reference of some kind. "Think Ref"? or MPW Interfaces&Libraries? UniversalInterfaces (versions 3.0 to 3.4.2) are probably too new.

5) while trying to Build and Run another of my old projects, the compiler stopped with an error on a line that also looked fine to me:
SFGetFile ( where, 'Prefs file', nil, 1, typeList[0], nil, reply );
with these vars defined earlier:
var where: Point; typeList: SFTypeList; reply: SFReply; typeList[0] := 'PREF'; SetPtr ( where, 50, 50 );
So I tried replacing it with:
StandardGetFile()
No luck, same type mismatch error. Couldn't get past this error so I moved on. Anyone got ideas or reasons?
Does the compiler not say which argument has the mismatching type?

MPW Interfaces&Libraries says:
Code:
PROCEDURE SFGetFile(where: Point;
                    prompt: Str255;
                    fileFilter: FileFilterProcPtr;
                    numTypes: INTEGER;
                    typeList: SFTypeList;
                    dlgHook: DlgHookProcPtr;
                    VAR reply: SFReply);
    INLINE $3F3C,$0002,$A9EA;

I think you need to pass typeList instead of typeList[0]?

Universal Interfaces 3.4.2 says:
Code:
{
 *  SFGetFile()
 *  
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        not available
 *    Mac OS X:         not available
 }
PROCEDURE SFGetFile(where: Point; prompt: Str255; fileFilter: FileFilterUPP; numTypes: INTEGER; typeList: ConstSFTypeListPtr; dlgHook: DlgHookUPP; VAR reply: SFReply);
	{$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
	INLINE $3F3C, $0002, $A9EA;
	{$ENDC}

In this case, I think you need to pass @typeList?
 

LelandLong

Active member
Okay, the Project has begun.
I have the first Build up and running.
How do we share this?
I have uploaded the source to my GitHub - which doesn't seem to understand Pascal at all lol.
https://github.com/LelandLong/PacMan_v2
Do I attach compiled app here?
Do I attach zipped source files here?
How do y'all want to follow along?
 

LelandLong

Active member
The Think Pascal manual at https://archive.org/stream/THINKPascalUserManual1991/THINK Pascal User Manual 1991_djvu.txt says "THINK Pascal lets you use an alternate parameter list for the QuickDraw graphics operations on Rects, RoundRects, Ovals and Arcs". Is this changed in different versions of Think Pascal?

A problem with Think Pascal is that it doesn't include interfaces for everything. If you look at QuickDraw.p, it says "Its declarations are built into the THINK Pascal 4.0 compiler."

So you'll want a reference of some kind. "Think Ref"? or MPW Interfaces&Libraries? UniversalInterfaces (versions 3.0 to 3.4.2) are probably too new.


Does the compiler not say which argument has the mismatching type?

MPW Interfaces&Libraries says:
Code:
PROCEDURE SFGetFile(where: Point;
                    prompt: Str255;
                    fileFilter: FileFilterProcPtr;
                    numTypes: INTEGER;
                    typeList: SFTypeList;
                    dlgHook: DlgHookProcPtr;
                    VAR reply: SFReply);
    INLINE $3F3C,$0002,$A9EA;

I think you need to pass typeList instead of typeList[0]?

Universal Interfaces 3.4.2 says:
Code:
{
 *  SFGetFile()
 * 
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        not available
 *    Mac OS X:         not available
 }
PROCEDURE SFGetFile(where: Point; prompt: Str255; fileFilter: FileFilterUPP; numTypes: INTEGER; typeList: ConstSFTypeListPtr; dlgHook: DlgHookUPP; VAR reply: SFReply);
    {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
    INLINE $3F3C, $0002, $A9EA;
    {$ENDC}

In this case, I think you need to pass @typeList?
Thanx for the links. I have bookmarked the ones I didn't already have.
I have physical copies of Inside Macintosh I - VI, and AppleTalk & ResEdit reference books.
Also just started using Think Reference App.
I think I type-o'd the parameter as typeList[0] when I was composing my code snippets, so you are certainly correct, I have to pass the typeList variable and not a single element. Not sure if this fixes it, but I will look into it.

I agree with you, that the documentation states: "THINK Pascal lets you use an alternate parameter list for the QuickDraw graphics operations on Rects, RoundRects, Ovals and Arcs".
So I'm really confused why it is not liking it.
Very strange indeed, but at least a solution is easy enough.

Thanks for your help and advice!
 

hauke

Active member
Okay, the Project has begun.
I have the first Build up and running.
How do we share this?
I have uploaded the source to my GitHub - which doesn't seem to understand Pascal at all lol.
https://github.com/LelandLong/PacMan_v2
Do I attach compiled app here?
Do I attach zipped source files here?
How do y'all want to follow along?
You will need to binhex/macbinary/applesingle any files with a resource fork, since modern (>= CVS) VCSes have no support for Macintosh forks.

Alternatively, run the resource file through SaDeRez (ISTR it ships with Think Pascal) before committing, then SaRez after checking out, and add the resulting file to .gitignore.
 

cheesestraws

Well-known member
which doesn't seem to understand Pascal at all lol.

it does but only for files with .pas extension I think.

Also if you want the code to be remotely useful on github you'll need to give it unix linefeed endings.

Also, yeah, what @hauke said about resource forks. SaDeRez certainly came with the version of THINK Pascal I use/used (4).
 

robin-fo

Well-known member
Alternatively, run the resource file through SaDeRez (ISTR it ships with Think Pascal) before committing, then SaRez after checking out, and add the resulting file to .gitignore.
DeRez‘ing a resource file is probably the way to go. It‘s probably also the easiest way to allow diffs of your commits/source files.
Btw. Rez and DeRez are still part of modern macOS 😉
 

LelandLong

Active member
it does but only for files with .pas extension I think.

Also if you want the code to be remotely useful on github you'll need to give it unix linefeed endings.

Also, yeah, what @hauke said about resource forks. SaDeRez certainly came with the version of THINK Pascal I use/used (4).
Any advice on how to implement your proposed unix linefeed endings?
 

LelandLong

Active member
DeRez‘ing a resource file is probably the way to go. It‘s probably also the easiest way to allow diffs of your commits/source files.
Btw. Rez and DeRez are still part of modern macOS 😉
Never used it before.
I just found it inside THINK Pascal v3 (folder named THINK Pascal 4 - as in disk 4) and moved it into BasiliskII and ran it.
Seems straight forward.
Looks like it converted the resource fork items into hex data?
I updated my GitHub with this file. Shows up fine in Raw format.
I can only presume that for someone to download it and to convert it back into a proper Resource file you have to use "SARez"?
 

LelandLong

Active member
Very good question. I was sure I had it working on a couple of repos but I can't find the bloody config now. You might want to start here:


or ignore my suggestion entirely :)
I sure love your idea and help in this.
I tried but am not having much luck.
Look at my new .gitattributes file in GitHub and see if you suggest a different setup.
I would love to have this source code formatted correctly in GitHub.
I have it looking great in Visual Studio.
 

LelandLong

Active member
Looks like I managed to have 2 GitHub repo's.
So I deleted the first one.
I renamed the second to the same name as the deleted one.
This might make the link still work but will have deleted anyone following or watching it, sorry for my blunder.
 
Top