Fantasm 5 · Frequently Asked Questions

 

Contents

Important information about this FAQ

Projects

Anvil

Linkers

Memory and speed

Music

Fantasm/Assembly language

Misc.

 

©Lightsoft 1999. All rights reserved.

 

Fantasm 5 · Frequently Asked Questions

Information

 

This FAQ was taken from the Lightsoft Document: LSA0003 - FAQ, Revision 1. This document, along with many others, is supplied on the Fantasm 5 distribution. Contact Lightsoft for pricing and availability.

 

©Lightsoft 1999. All rights reserved. Reproduction of this information is prohibited, except for personal viewing purposes.

 

Lightsoft can be contacted by:-

Postal Mail: Lightsoft.55 Sidney Street,Grantham,Lincs,NG31 8AZ U.K.

Email: <sales@lightsoft.co.uk>

 

Information about Lightsoft and their products can be found at:

Web: <http://www.lightsoft.co.uk/>


Note - The information contained in this document may be out of date by the time you read it. Contact Lightsoft directly (either via Email or Post) to clarify specfic information.

 

Anvil, DynaRAM, Fantasm, L.I.D.E., Eddie, E.C.L., F-RAD, PowerFantasm, Fantasy and Fanta_C are trademarks of Lightsoft 1992 - 1997.

Macintosh, System 7, MacOS, Macsbug, Resedit, PCexchange® are trademarks of Apple Computer 1984-99 - all rights acknowledged.

All other trademarks and copyrights acknowledged.

 

Top of Page

©Lightsoft 1999. All rights reserved.

 

 

Fantasm 5 · Frequently Asked Questions

Projects

 

 

Q: How do I add shared libraries to my PowerPC project?

A: Use the "Add shared library(s)" menu command from the Project menu. Many shared libraries live in the "extensions" folder, although in MacOS 8 they have all been rolled into the System file.

Anvil will open a file selector, with which you select the file you think is holding the shared Libraries you want to add. Anvil will hunt around in the file looking for all possible PowerPC shared libraries and list them in a window. Now all you have to do is single click on them to add them to your project.

 

Q: I'm an assembly language programmer. When I click on a file in my Globincs area, Anvil reports there are no dependencies for this file? I'm confused.

A: Anvil is correct. The report you get is one way only. The file you have clicked on is not dependent on any other files. All the other source files in your project are dependent on it however (it's a globinc). If you "get info" on one of them, you'll see this globinc listed.

 

Q: I'm an assembly language programmer. What is a SrcIncs area?

A: In Fantasm, you have two types of include directives you can use, viz:

includeh - get a file from the "Anvil Low Level Defs" folder.

include - get a file from the _SrcIncs area.

Files you want to "include" should be added to the project in the _SrcIncs area.

They will be found extremely quickly. If you do not, they will still be found, but much more slowly as Anvil may have to search many, many folders. It effectively starts at the highest level source area of your project, finds a file, works out its folder and looks in there. If not found it moves onto the next file. Slow, but reliable, just in case you forget to add an include file.

includeh will not do this. If a file you want to "includeh" isn't found in the Anvil Low Level Defs. folder, then you'll get an error.

 

You may want to move some of your globincs into the _srcincs area if the file in the globincs area really isn't necessary for every source file in your project. This will speed up Build times.

 

Q: When I create a new project, I get just the project file. When I check later, there's a folder next to project file called something like "Anvil Project Binaries". Where did this come from? And when?

A: Build needs somewhere to store intermediate files. This folder contains all the binary files generated by your project. If whoever needs it can't find it, a new one is created. Normally it is Build that will create this folder, however, there are occasions when Anvil may need to look inside (for project management functions) and if not found, Anvil will create it.

The only time you may be interested in the files in this folder is if you need to set the link order of your binary files. In this case you add all the files in this folder to your project, then drag them about. See the "Anvil Linkers " documentation (LSA0005) for complete details of this procedure or alternatively, see the next question.

 

NOTE: Do not have two projects in the same folder at the same level - your binary files will become mixed up which may lead to problems.

 

Q: Can files in a project come from anywhere? Can I put my libraries on another drive? Can I put my project headers on a networked Mac?

A: Yes, but watch out for removable media. Example: You have one floppy drive. You add a file from a floppy. You remove the floppy, insert another and add a file from that floppy. You can see that building such a project would keep you extremely fit?

 

Do NOT move the folders named "Anvil Low Level defs" or "Lightsoft Documentation".

 

Q: What happens if I delete a file that's part of my project?

A: Well, first Anvil will search the connected universe looking for it. By this we mean it will search all local and networked drives. If not found, you'll be presented with a file selector, and asked if you want to look for it. You may now select an alternative file, or cancel.

 

If you cancel Anvil will ask you if you want to remove the file from the project, or not open the project whilst you go search some back up media.

 

Q: How do a rename file that is part of a project.

A: Use the Finder then reopen the project.

 

Q: How do I rename my target?

A: Either edit the file name via the Edit Project dialog, or simply change the name in the Finder.

 

Q: Why can't I nest user folder?

A: It's due in a future version. Internally, Anvil can handle nested user folders, but the Project Metaphor Translator can't.

 

Q: How do I add a project to a project?

A: Just add it. Anvil will place it in the highest level language area, so that's either VHL, HL or SRC depending on your project.

 

Q: To remove a project from a project, I just drag it over the trash icon?

A: Yup.

 

Q: So, how about setting the order sub-projects are built?

A: Just drag them about - they'll be processed in the order you put them. From the top of the project window downwards.

Q: What happens if my project file goes corrupt?

A: Use a backup. You did make one didn't you? If not, you have no option but to make a new project. In our experience, a corrupt project file is rare (since rev. 3 of the project file we have not had a single corruption. The current revision is 4), but nonetheless we do strongly urge you to make backups regularly.

 

Q: Just how, exactly do I quickly add all the files in a folder to my project?

A: Click the "add file" icon in the project window. Find a file in the folder you want to add all the files from. Select the file. Click the "add all user files" checkbox. Now click the "Add this file" button. All files in the folder will be checked and added if possible.

 

Q: When I move a source file, Anvil tells me a binary related to the file is included in the project and do I want to delete it. Huh?

A: Binary files, or object files, are derived from the source file. When you move or remove a source file Anvil will check whether you want to remove the object file.

 

Q: When I drag a file over the trash icon in the project window, it flashes - why?

A: It does that, just as a warning.

 

Top of Page

©Lightsoft 1999. All rights reserved.

 

 

 

Fantasm 5 · Frequently Asked Questions

Anvil

 

Q: I have an original 68000 based Mac. Will Anvil run on it?

A: No. Anvil needs at least an 020 processor.

 

Q: What happens if I close the "log" window?

It'll be opened again when needed.

 

Q: Can I copy text out of the log window?

A: Yes.

 

Q: When I get an error pop up in the error window it'd be nice to be able to edit it before the build finishes. Can I do this?

A: Switch off "Build Hogs CPU" in the general preferences dialog. Anvil can now work whilst building rather than just freezing but of course Build will take longer.

 

Q: Can I use another editor with Anvil?

A: Yes, as long as you remember to save all changed files before building.

 

Q: When I print my tabs are not aligned correctly? What can I do?

A: Print with the chroma coder on (general prefs). The tabs should then line up OK.

 

Q: I had a nasty crash after a long period of work. When I "rebooted" Anvil there seemed to be quite a long delay before it came up. What happened?

Q: After a long period of work, Anvil seems to take a while to shutdown. Why?

A: Anvil creates temporary files for it's internal use (undo buffers/context info etc.). When Anvil shuts down, it deletes these files. If, when Anvil is booting it finds these files, again it deletes them. This was the cause of your delay. There shouldn't be much delay if you have an Async SCSI manager as the calls are made asynchronously.

 

Q: What do the numbers in the Undo menu item mean?

A: This is the current undo stage. When it gets down to "1" that's the last undo operation possible on the file.

 

Q: After I've been using Anvil for a while, I notice the available space on my drive is decreasing! Why?

A: Anvil saves temporary files in the Lightsoft folder whilst working. These are all deleted when Anvil quits (or starts up, just in case a crash means you have to restart your machine and Anvil doesn't get to tidy up before quitting), so you do need free space on your System drive.

 

Q: I tried to UNDO and got an error - why?

A: Either Anvil could not save undo information (see the question above) and hence couldn't get it back or there was not enough free memory to perform the undo.

 

Q: I'm typing away in Anvil when all of a sudden I get a dialog saying "Anvil Filing System error". Why?

A: Anvil tried to write to disk and failed. This can happen when typing under two circumstances:

1. Autosave - check your disk with Disk First Aid or a third party disk testing package.

2. Undo.

In the case of Undo, if you have booted your Mac off of a CD, you will get a lot of errors, as Anvil keeps trying to write to the Lightsoft folder in the Preferences folder.

 

Q: Is Anvil happy on multiple monitors?

A: Yes. If you switch your monitors around, Anvil will move windows to fit when Anvil is rebooted.

 

Q: Is Anvil compatible with Sony's CDRFS filing system?

A: Yes.

 

Top of Page

©Lightsoft 1999. All rights reserved.

 

 

 

Fantasm 5 · Frequently Asked Questions

Linkers

Q: How do I set the Link order of my project?

A: Build the project. You will get link errors stating that offsets are too big.

Now, add all the binary files to the project: Go to the Anvil Project Binaries folder and select a file. Check the "Add all user files" checkbox and then on "Add this file". All the binaries will be added to the binaries area of your project window. Now drag them about to set the link order. You do not necessarily need to add all the object files. Just the ones you need to specify the order for. See LSA0005.

 

Q: How do I make a library?

A: Use the supplied project set up. See LSA0008 for details.

 

Top of Page

©Lightsoft 1999. All rights reserved.

 

 

 

Fantasm 5 · Frequently Asked Questions

Memory and speed

 

Q: Memory is too tight to mention. What's the absolute minimum I can get away with?

A: Officially 3 megabytes. How do we arrive at that figure? Well, we test build a large project whilst gradually reducing Anvil's partition size. When Build gives up, we take that partition size, and then like all good designers, double it.

So, unofficially, the bare minimum is 1.5 megabytes. The figures are available in LSA0005 - Link PPC memory requirements and performance.

You need to give Anvil 6 megabytes to use AnvMOD and maintain comfortable Build speed, which is reduced at low memory extremes. Without AnvMOD, 4 megs should be fine for general usage.

Q: Half way through Building my project, there's a five second delay and my hard drive gets really agitated. What gives?

A: Turn off virtual memory.

Q: I read in the programmers docs I can set my tools to boot up with Anvil, rather than as needed. This would give a faster first Build. How?

A: Read the programmers docs, specifically LSA0010. Use a resource editor to toggle the boot flag in the TLcl resource of the tool you wish to load as Anvil is loading.

 

Q: Does Virtual Memory (V.M.) affect Anvil to any great extent?

A: Not in our experience (this means "your mileage may vary"). The way Anvil has been designed, and in particular the various "phases" of project building ensure two things.

 

1. Cache locality is optimized, specially if you have a 2nd level cache. During Build, generally the tool that is working, Build, the C.C.P. and the file being translated can all fit in the 2nd level cache.

2. Page faults are reduced due to the locality of the important mechanisms and data at any given time. So although a page fault may be generated when switching from say phase 3 to 4, during phase 4, no more swapping should occur. A file caching tool is planned for Anvil, again this is written with these concepts in mind for maximum speed. If you don't have this plug (it may not be available yet, the class is "FAFCxx") we suggest making the Macintosh disk cache as big as you can.

 

Just for your information, this is one of the reasons why you won't find an incremental linker available from Lightsoft. We feel the whole idea of incremental linking is flawed within a cached architecture. Much better to make the tools as small as possible and try not to blow the cache too much.

 

Having said that, VM on a PowerMac is much faster than VM on a 680x0 machine.

Q: As I was building my project I was watching the "Free Mem:" display in the tool bar and saw that each time it went to compile a file the free memory went from 4MB to 230K. I thought that was a lot to be using if it is a big project...

A: Some Anvil tools grab a block of memory based on a percentage of available memory. Fantasm for example does this. This way if a tool can't translate a file or do it's work because of lack of memory, all you have to do is increase Anvil's partition and the tool will then get more memory. So even if you give Anvil 100 Megabytes, you'll still see the free memory drop pretty low at some points. See LSA0005 - Anvil Linkers for some info on how LinkPPC uses memory

Q: I shared one of my disks over a network, and now Builds are taking ages! Why?

A: File sharing is a very processor intensive task. We found that one of our 040 based PowerBooks took 65 seconds to Build a project whilst it was sharing one of it's local disks, compared to only 2.5 seconds when it wasn't!

Mapping to a shared disk on the network doesn't seem to affect speed quite as much. When we had somebody elses shared disk on the PowerBook's desktop the same project took about 5 seconds to build.

Q: Fantasm gave me an "Out of global (System) memory error" - is this a bug?

A: No, it means that Fantasm tried to get some temporary memory from the System heap and the call failed. You can either reduce Anvil's partition to give the System more memory, get more real RAM or switch on VM.

 

Top of Page

©Lightsoft 1999. All rights reserved.

 

 

 

Fantasm 5 · Frequently Asked Questions

Music

 

 

Q: When does AnvMOD change the type and creator of a file?

A: When you open it manually with AnvMOD's file selector if the file has no type or creator info.

 

Q: AnvMOD beeped at me. What does this mean?

A: AnvMOD doesn't have enough memory to load a file.

 

Q: AnvMOD beeped at me twice!

A: AnvMOD tried to load a file it has no import filter for.

 

Q: How do I play MP3 files?

A: Use AnvAMP available from Cache-Computing. It can be found in your "Third party" folder.

 

Q: Anvil's CD controller seems to be updating too often. It's slowing my Mac down / causing audio interference because my drive cables are close to my audio cables / driving me nuts. How do I slow it down?

A: Select "Set task priorities" from the edit menu, and increase the value for "CD Display". This will reduce the rate the CD display is updated.

 

Q: Can you recommend a decent set of speakers at a realistic price?

A: Yes, Missions. Forget anything else and get these. The 76x series are priced at under 200 ukp and beat anything in the sub 500ukp bracket.

 

Q: Cool working music?

A: Anything by Bjorn Lynne. http://www.digitarx.com/lynne

 

Q: I have two CD players connected to my Mac, but I can only control one with Anvil!

A: Correct, Anvil's CD controller will only control one CD player (normally the one with the highest scuzzy address) and currently can't select a SCSI address to control.

 

Top of Page

©Lightsoft 1999. All rights reserved.

 

 

 

Fantasm 5 · Frequently Asked Questions

Fantasm/Assembly language

Q: In 68k assembly language, how do I find out the size of my data?

A: Officially, you can't. However, if you have all your data in separate files which are included into the required source files, you would normally have these files in the "SrcIncs" area. However, if you move them into the _Src area, they will still be included fine, but will also be sent to the assembler! Now assuming they will assemble fine, you will then find the data size reported in the project window. You will of course have an object file that is completely unused, but you will know the exact data size. This can be very handy.

 

Q: I'm coding in PPC assembly language. When in my low level debugger (Macsbug for example) it would be nice to see some labels. Can I do this?

A: Yes, go to LinkPPC's preferences and select "Export all global code labels". These labels will now be displayed when debugging as PPC C.F.M. labels.

 

Q: When I do this, and then use MacsBug's "D" command, I don't see a list of my labels. I either see junk or nothing?

A: Switch off V.M. With V.M. on, nearly all of the code can be spooled out to disk when in Macsbug and hence it may not be able scan your Table of Contents.

 

Q: Can I export code labels that are not global?

A: No.

 

Q: I'm building a PPC shared library. How do I export labels?

A: You can export global code labels by creating a file called "project_exports" and adding it to your project. The code labels you specify in this file will be exported. See "LSA0005" for full details. You can't export data labels.

Note that a shared library should have it's stack size set to zero and the cfrg ID must also be zero - same as for an Application.

 

Q: My shared library simply isn't being recognized! Help!

A: See "Creating a PPC shared library - hints and tips" in the chapter "Advanced Anvil" in LSA0100.

 

Q: "What books would you recommend for 680x0 programming?"

Motorola Programmers Reference Manual - available from Motorola, part number M68000PM/AD.

 

Programming the 68000 by Steve Williams and published by Sybex. ISBN0-89588-133-0.

 

Inside Mac for the relevant data structures, however you can always contact us if you have problems with a Mac trap, or any related data structures.

 

Any ST or Amiga machine code books, of which there are plenty.

 

Q: And PowerPC?

Pop into any computer book shop and take your pick. Fantasm's reference is "The PowerPC architecture" by I.B.M. along with the Motorola 60x user and programmers guides (available for free from Motorola).

 

Q: Is Fantasm compatible with other assemblers?

Fantasm is not specifically modeled on any one previous assembler, but it is compatible with source code from Devpac or Genam by Hisoft, which are assemblers for the ST and Amiga respectively. Other than that, it attempts to understand most other assembler syntaxes, and has a few unique directive names of it's own - i.e. Globoff (what were we thinking of?).

 

Q: You've used the RS directive to define BSS offsets. Does this mean I can't define my own RS blocks in PPC?

Not at all. Of course you can use RS as normal. See the RS directive for PPC section of LSA0040 for more details.

 

Q: Data definitions...

Data section labels are defined thus:

Follow the label by a data definition directive such as dc.w

label: data definition directive - e.g. dc.b, ds.w,cstring etc

OR

follow the label with an explicit "data" directive:

label: data

dc.x

ds.x etc

This is the neatest way.

 

If you make a mistake the code will assemble fine, but your data reference will be rubbish (as it will be a code section label) and you will probably crash.

For more information, see the PowerPC specific chapter in LSA0040.

2. How to use the BSS section in Fantasm.

a). Create a new file and call it my_bss.def or whatever you want.

b). Add the file the _globincs area of your project.

This file will now be included in every file that is assembled.

c). In the my_bss.def file, define your global variables with rs directives - e.g.

my_scratch1: rs.w 1

my_x: rs.b 1

my_y: rs.b 1

etc

d). In your source code you can now refer to these variables off of the BSS pointer. The start_up macro defines r30 as being the bss pointer. So, in your code you can use global variables thus:

lwz r11,my_x(r30)

etc.

It's best to requ r30 to BSS so the code reads:

lwz r11,my_x(`bss)

 

3. DO NOT put anything but RS directives in your BSS definition file, else you'll get all sorts of weird double defined errors.

Again, see the PowerPC specific chapter in LSA0040.

 

Top of Page

©Lightsoft 1999. All rights reserved.

 

 

 

Fantasm 5 · Frequently Asked Questions

Misc.

 

 

Q: Could you recommend a good coffee?

A: Yes, "Roberts" from Ireland.

Q: How's Fluffy?

She's fine, although we do wish she'd stop pulling socks out of the drawers.

 

 

Top of Page

©Lightsoft 1999. All rights reserved.