• Hello MLAers! We've re-enabled auto-approval for accounts. If you are still waiting on account approval, please check this thread for more information.

asm blocks in THINK C

Mu0n

6502
Trying to learn some simple assembly in order to gear up for my long term project - 

I have this book "The Complete Macinotsh Assembly Language Programming" by Dan Weston, and the examples assume you have the 2-disk early version of Macintosh Development System for Mac 128k and 512k, which I was able to secure. However, even the simplest program can't find the MacTraps.D from my include instruction.

So, I tried to make it work in an asm {} block in THINK C, and that works.

Moving on to the next program, I encounter some difficulties with THINK C:

-labels don't work as is, ie MainLoop: they have to be preceded with the @ symbol

-hex numbers have to be changed from #0000FFFF to #0x0000FFFF

-it can't deal with declaring and defining constants using EQU, so I have to declare those outside the asm{} block

-same goes for nonrelocatable data such as WindowStorage DS.B whateverSize, these lines are simply not understood, so I guess it's globals again, outside the block

-relative addressing doesn't work like this line:

    PEA WindowStorage(A5)

I tried defining WindowStorage as a long *int (32-bit address), as a Ptr - both don't seem to work.

 
Do you have a copy of the THINK C user manual?  (The original white one with a red stripe, not the later Symantec C++ yellow manual.)  There is a (brief but useful) section on p. 251 called “Using the Inline Assembler” that explains some of the vagaries of inline asm blocks.  I found the PDF online somewhere but can’t find the link immediately (I just have it saved in iBooks) - happy to shoot you the PDF if you want, PM me your email.

68KMDS doesn’t support HFS as I recall, so unless you’re running from 2 floppies as designed (or maybe copy all the files to the root directory of your HD? haven’t tried that), it will not be able to find your includes.

 
Last edited by a moderator:
the examples assume you have the 2-disk early version of Macintosh Development System for Mac 128k and 512k, which I was able to secure. However, even the simplest program can't find the MacTraps.D from my include instruction.


68KMDS doesn’t support HFS as I recall, so unless [...] copy all the files to the root directory of your HD [...], it will not be able to find your includes.


Correct. You need to put the includes in your root directory when using HFS.

 
Even if I booted mini-vMac using MDS disk 1, which uses an olden System? Isn't the MFS used then?

 
Even if I booted mini-vMac using MDS disk 1, which uses an olden System? Isn't the MFS used then?
Yes, the MFS distribution disks are both MFS. there's no problem if you use an MFS disk, because as I'm sure you know, MFS doesn't have directories.

If you still want to use HFS, here is a patch by Andy Hertzfeld called HFS Open. It improves compatibility of older applications by patching the _Open OS call to scan all subdirectories on an HFS volume. Using this, you should be able to store your MFS includes and equates in any subdirectory and still have it work. But I haven't tested it.

 
Back
Top