ThinkC [Study Group 0] Getting your Development Environment Setup & Hello, World!

Relating to ThinkC Development

pfuentes69

Active Tinkerer
Oct 27, 2021
380
293
63
Switzerland
Pascal could have been a good choice for the “retro” reasons, as it was the language used initially and the Toolkit actually was made in Pascal.
I learnt Pascal after Basic and before C, but I still think C is the right choice… well, I prefer C++ actually, but starting this exercise with C is fine to me.
 

jenna32bit

New Tinkerer
Aug 19, 2022
13
7
3
United States
New to this forum! Jupo talked me in to participating in this. My system 7.1 setup needs some love anyway. Still debating between the built in editor or BBEdit.
 

Attachments

  • helloworld.jpg
    helloworld.jpg
    872.5 KB · Views: 95
  • Like
Reactions: Patrick and eric

Crutch

Tinkerer
Jul 10, 2022
293
228
43
Chicago
Pascal could have been a good choice for the “retro” reasons, as it was the language used initially and the Toolkit actually was made in Pascal.
I learnt Pascal after Basic and before C, but I still think C is the right choice… well, I prefer C++ actually, but starting this exercise with C is fine to me.
Most of the core parts of the Toolbox were actually written in 68k assembly. But you are right that the standard high-level language with which developers were expected to implement Mac applications in 1984 was indeed Pascal … but it would have been Lisa Workshop Pascal running on a Lisa, because there was actually now Mac Pascal compiler at that time.
 
  • Like
Reactions: pfuentes69

pfuentes69

Active Tinkerer
Oct 27, 2021
380
293
63
Switzerland
Most of the core parts of the Toolbox were actually written in 68k assembly. But you are right that the standard high-level language with which developers were expected to implement Mac applications in 1984 was indeed Pascal … but it would have been Lisa Workshop Pascal running on a Lisa, because there was actually now Mac Pascal compiler at that time.
ok ok, it was then a mis-informed guessing, as I saw in the headers declarations all as "EXTERN PASCAL" and pascal-like type declarations. I guess they formatted the toolkit libraries to be accessed from Pascal.
 

Patrick

Tinkerer
Oct 26, 2021
435
1
224
43
so this might be interesting. in the first issue of MacDeveloper (link opens to the page) newsletter. there is a review of Aztec c for the mac. it came out in May 1985 .

So very early on in the mac life there was discussions about which programing lang to use! we are carrying on that tradition and its great.

considering one could program in C in 1985. (which would be 128k or 512k) i think learning C to be a very retro thing to learn. IMHO

i like this clip
Aztec C will run on a minimum configuration Macintosh: a 128K machine with no external disk drive. For serious development, however, I recommend a 512K Mac with the external drive and an ImageWriter printer
 

Patrick

Tinkerer
Oct 26, 2021
435
1
224
43
yeah. I wasn't trying to make a case that it was the FIRST c compiler. only that it was a thing at least in 1985.
That is, if one wanted to pretend its 1985 and program for this brand new Mac. you could program in C if you wanted.
 

jenna32bit

New Tinkerer
Aug 19, 2022
13
7
3
United States
It's interesting too in the second chapter we're reading. There's a lot of referencing to the Toolbox functions and those are, apparently, Pascal style. I bet this is going to trip me up more than once. Anyone else have to read through that part a few times?
 

Patrick

Tinkerer
Oct 26, 2021
435
1
224
43
yeah. thats what @Crutch was talking about. the Toolbox is setup with pascal in mind.

...

its gonna be fun. learning to program retro computer is ... gonna be ... more interesting than learning on a modern computer.
 

Mu0n

Active Tinkerer
Oct 29, 2021
610
560
93
Quebec
www.youtube.com
I REBELLED right on week 0 and made a Mac Toolbox variant of 'Hello World' to show how challenging the learning curve already is when you step away from the comfort zone of ANSI C.

For those not used to programming in C, it'll look very awkward and inefficient and you'll wonder why it's so complicated to show a piece of text-as-graphics, forcing you to consider relative window coordinates, toolbox managers, pascal-type string, handles (pointers to pointers), locking and unlocking of handles, etc. Quickdraw is the main graphical toolbox the mac has and you can think of it as if you were programatically and precisely coding MacPaint commands with C. All your commands must be precise and deliberate.

For those used in C, you'll right away be faced with Mac style memory management, where pointers can be used, but pointers to pointers (handles) are prefered for most big blocks of allocated memory because the Mac likes to defrag that space often, without telling you. You big chunk of sound data might change its RAM address midway into using a Mac toolbox function and crash your app. To prevent this, you have to lock the handle while you perform sensitive calls to toolbox functions, then unlock it when you know that data won't be used.

1660965505946.png


1660965412854.png


and in mini-vMac with a boot disk that has the Venice font installed:

1660965829769.png



If you want to check out my code, I attached the .sit file to this message containing my project file and the .c file. Just add MacTraps and you can run or build it.
 

Attachments

  • Mu0nHelloWorld.sit
    21.7 KB · Views: 124
Last edited:

Mu0n

Active Tinkerer
Oct 29, 2021
610
560
93
Quebec
www.youtube.com
I think the pre-made image has Symantec C++ 6, not ThinkC 6. Is this OK to follow the book?

Both are practically the same for our purposes. In essence, Symantec C++ 6 is much like THINK C 6 but with (pseudo) C++ added as a bonus if you want it (I don't use it). The regular C portion is pretty much the same.

There's no fear of missing out by using one or the other for this study group!
 
  • Like
Reactions: eric and Patrick

pfuentes69

Active Tinkerer
Oct 27, 2021
380
293
63
Switzerland
Both are practically the same for our purposes. In essence, Symantec C++ 6 is much like THINK C 6 but with (pseudo) C++ added as a bonus if you want it (I don't use it). The regular C portion is pretty much the same.

There's no fear of missing out by using one or the other for this study group!
Good to know!
Txs.
 

Patrick

Tinkerer
Oct 26, 2021
435
1
224
43
completed!

So when first building with ANSI it locked up during loading ANSI. But after restarting it worked. I am using the beta version of mini vMac that has the apple silcon version. So that might be a little unstable...
Hello world.png



I would like to eventually use real hardware to do it. but sharing screenshots are easier on a modern OS ..... 🤔
 

Patrick

Tinkerer
Oct 26, 2021
435
1
224
43
i assume its a weekly thing. So we will get a new thread every wednesday ?

i've moved on a little bit where you drop ANSI and draw into a window. Has anybody started to mess with changing fonts ? i tried symbol and that was fun.

1661196653278.png
 
  • Like
Reactions: eric

eric

Administrator
Staff member
Sep 2, 2021
964
1,570
93
MN
scsi.blue
Ok what is on deck for Session 2?

May I suggest we watch this video and do a small GUI App?
I watched some of @jcs's videos last year before I understood anything, so yes, a great idea to go back and watch them to pick up some pointers.

So we will get a new thread every wednesday
It'll be weekly'ish - I plan to post the next one Monday just due to my time.
 
  • Like
Reactions: Patrick