|
All items on this page either work with or
are related to Fantasm. Users are invited to send in code snippets,
example projects, ideas, articles, discussions, algorithms, utilities
-- basically anything connected with programming, assembly language
or Fantasm.
Please send items
you want to see on this page along with corrections and updates
to the maintainer
of this area.
|
A carbonised LoMem.def file for Fantasm.
'This file is modified to include accessors with carbon support/non-support
designation. It assembled without error and the source was Apple
Development documentation. Hopefully, this will be useful.'
A small demo application for pre MacOS X systems only. Will
not run in Classic, OS 9 and earlier only.
A Fantasm 6 PPC project that shows the basics of building
an application for MacOS X.
This project shows how to use Carbon to do some simple things
like:
- Use the new Event Manager so that WaitNextEvent need never
be called
- Handle menu selections under Carbon (this took me a long
time to figure out as it is very poorly documented!)
- Handle window related events under Carbon
A Fantasm 6 project that shows many useful techniques with
regards to general Mac programming and PPC assm. Various runtime
controls are available; press APPLE H when running for details.
A Fantasm 6 project showing how to use editable text fields
from within a Fantasm program.
Rene writes...
I've converted the SIDLib 1.1 C reference to use with Fantasm
6 PPC.
SIDLib 1.1 is a small library that make it possible to play orginal
VIC-64 sounds. I've created the complete demo project for Fantasm
6 that shows how to use the SIDLib. Complete docs and SIDLib
1.1 are included.
Edited from the ReadMe...
The aim of this demo is to show, on a concrete example, how
Component Manager
and Scripting Components functions can be used to allow a Fantasm
application
to find and utilize various software objects (components) at
runtime, just as the
familiar Resource Manager provides access to data objects. A
component in this
program is a compiled AppleScript program of the type 'osa '
(Open Scripting
Architecture) and of the sub-type 'scpt'. Here, 'scpt' is a resource
file contained
in the resource fork of a compiled AppleScript application and
copied to the the
resource file of the Fantasm's project.
In this demo the following Applescript program ClearDesktop
is used
as a simple illustration:
tell application "Finder"
close every window
empty trash
return
end tell
Permission is granted for use of this code in any Fantasm
project.
Please send comments and suggestions to
Ranko Bojanic
bojanic@math.ohio-state.edu
Changes...
Several improvements were made in the mini_compiler unit.
An error that would incorrectly
parse x - (x-1)^2 as if it were x + (x-1)^2 , and similar expressions,
was corrected.
Space was added for 20 demo functions. A new rational approximation
for the cosine
function was added as the graf of the function
f(x) = cos(x) - (0.99996833 - 0.40528822*x^2)/(1+ 0.09426670*x^2
+ 0.00643034*x^4).
The graph shows that |f(x)| <= 0.00003168 for all x in
[-pi/2,pi/2].
For those interested in how a parsed function looks like,
a menu item Parsed Function
was added to the menu Options.
Extract from the Readme...
MiniPlotter is first of all a demo which shows how to
use MathLib function in
Fantasm projects MathLib contains a large number of mathematical
functions.
In this program we use the following MathLib functions:
acos, abs, atan, sqrt, exp, log, sin, cos,tan, pow,
gamma and erf
To these we have added also sgn,int and also the constant
= 3.1415926535897
It is easy to see that many other functions could be added to
this selection.
MathLib functions expect to find a real number x in
the floating point register f1
If we need then sin(x), for example, we call
SysCall sin
and the value of the function is returned in f1.
While this is very easy, it would be more complicated
to find the value of
sin(x+1) - cos(x^2) +0.2 * exp(-x), for example. To evaluate
this function
we would have to write actually a small program which would return
the value
of that function in f1.
In this project there is a unit called mini_compiler_unit_s.
This unit allows us
to just type the definition of a function into an edit field.
There are two
basic functions in that unit: parse_f and eval_f. The parse_f
procedure transforms
the algebraic string defining a function into an equivalent Reverse
Polish Notation
string which can be easily evaluated by the computer.The eval_f
function reads that
string and finds the value of the function for any value of x.
Fantasm 6 project with source and executable. README included.
131K Stuffit5 archive.
Atan and Sin comparison programs (rational approximation versus
MathLib) using Microseconds as the timer. Also included is two
simulation of Brownian motion -- the first allows you to set
various parameters, the second (ScreenSaver) runs continuously.
All projects are Fantasm 6 based. 566K Stuffit5 archive.
4 Apr 99
CodeWriter
3.10 - Cliff Harris - 435K.
See below
for details about CodeWriter.
19 Nov 98
Long time user Nathanael Hübbe wrote in (snail mail)
with some code he developed.
Nathanael writes...
"I developed two macros which can replace sub_in and sub_out.
The advantage is that these two macros are written to create
a custom stack frame easily which means no waste of time for
saving and restoring more registers than necessary and also the
possibility to allocate a certain amount of stack space for local
variables that cannot be stored in registers for some reason.
The free space allocated can be accessed by instructions like
lwz/la rx,56+offset(sp), where I use labels defined at the top
of the function via the set directive as the offset. Feel free
to do with these macros whatever you want, the only point is
that I would like to have a copy too if you improve them. I would
be especally happy if you would be able to reduce the last two
parameters in the calls with two or three parameters to one.
Or if you could make it possible to make the EndFr macro parameters
free.
I also used a modified version of the Xcall macro that imports
any symbol passed to it on the first usage, making import headers
obsolete and giving Fantasm only the data it needs."
See the code (GIF)
Download the code (Anvil 3 source file)
Nathanael can be contacted at:
Wählingsallee 79,
D22459 Hamburg,
Germany.
As a side note, we appreciate all contributions, but if
sending by snail mail please try to send on a floppy as it's
far less error prone (and saves Patch's paws - OK he's Dvorak
savvy, but it still takes time :)).
16th Oct 98
Life
- Alok Menghrajani - 15K
This is the classic computer version of Life.
Alok writes...
I wrote Life in 3 hours and in less then 40 builds. I wanted
to see if I could write a simple life simulation without exceeding
50 builds and 5 hours. I also challenged some friends to write
a faster life program, now let's see with what they turn ! My
algorithm can be quite improved, for more info go to http://www.scruznet.com/~crawford/Computers/life.html
Fantasm 5 PPC assm project.
16th Oct 98
ImageReader
- Alok Menghrajani - 80K
From the ReadMe...
ImageReader is a program (68k code) that displays a picture
stored in RAW format. I wrote this program for Benny's Challenge.
I bet nobody can display an image faster then this :)
You can now use my source in your game to have faster animations,
etc...
Fantasm 5 68K assm project.
4th Oct 98
Password
App - Paul McAllister - 12K
"PassWord App" displays a dialog box into which
the user types a password. The neat thing about this project
is it shows how to disable the force-quit (Cmd-Opt-Esc) key press
by patching an OS trap. Fantasm 5 PPC assm project.
19th Sept 98
URLtility
1.1 - Ajay Nath - 82K
This is an update to Ajay's URL utility; a complete and useful
application for managing URL's. Complete project includes all
source. Covers application framework, native callbacks, Navigation
Services, Apple events, window and dialog drivers/filters, application
launching, list handling etc. Highly recommended download for
all users, irrespective of experience. Fantasm5 PPC assm project.
6th Sept 98
Colour2Greyscale
- Paul McAllister - 12K
"Colour2Greyscale" displays a user selectable image
in the millions pixel depth, then converts it to greyscale after
a mouse click. Fantasm 5 PPC assm project.
6th Sept 98
Dancing
Girl - Paul McAllister - 40K
"Dancing Girl" is like an animated gif, but using
raw data instead of the gif format. 640*480, 246 colours. Fantasm
5 PPC assm project.
31 Aug 98
Trinket
- Paul McAllister - 10K.
Paul writes....
Here's a PPC snippet someone might have a use for (or more likely,have
a laugh at ;) It just flashes the keyboard lights (on an extended
keyboard) until a mouseclick occurs,and is appropriately called
"Trinket" :)
11 July 98
CodeWriter
- Cliff Harris - 380K.
This is a full featured application that will be extremely
useful to Macintosh assembly language programmers. It allows
you to select an item, say GetNewCWindow, then CodeWriter gives
you template code you can copy and paste into your source file.
Data files supplied include:
128K trap macros, 256k+ trap macros, A-Trap list, Code fragments(68K),
Constants, OS Globals by address, OS Globals by name, Pascal
calls, PowerPC mnemonics, PowerPC routines (Fantasm Xcall format),
Record definitions, Result Codes, RMaker templates.
Cliff writes...
What it is
The CodeWriter application, with its associated data files, is
a programmers data base. I wrote it to help me write assembly
language code, so the emphasis is on that language. Assembly
language code segments are defined for about 575 68K trap calls
and 25 RMaker templates. The number of PowerPC routines is small
but growing. There are also a bunch of record definitions, a
list of constants, global variables and the Pascal calls from
the older volumes of Inside Macintosh. The latest addition is
the list of PowerPC mnemonics.
CodeWriter and its associated data files is free. All Cliff
asks is that if you use it, send him
some fan mail. Cliff has also updated his PPC Mnemonics document
and his ROM Sucker project to fix a bug in the Apple Events handler
-- see side bar.
Ajay writes...
When it is put in the "BBEdit Extensions" folder it
is run when BBEdit is launched. The tool causes a floating window
titled "Anvil Tool" to be created that has 4 rows as
follows:
- Build & Run
- Build
- Run
- Start Anvil
Clicking on the mouse makes BBEdit do what is expected if
Anvil is already running. If Anvil is not running then BBEdit
asks the Finder to launch it.
Curiously, when BBEdit asks the Finder to launch Anvil &
then the user brings Anvil to the foreground, Anvil does not
respond to command keys. I do not know why this is so.
Anyone who wants the C source to the tool can email me at
ajaynath@compuserve.com.
I'd welcome any suggestions as to improving the tool.
22nd Apr 98
PPCMnemonics - see link above right.
Cliff Harris has made available his PPC Mnemonics reference
card. We have formatted it as either a PDF or self reading eDoc
for your convenience.
Cliff Harris has released RoutineIndex. Here's the readme:
Routine Index 1.0
March 30, 1998
Install the Routine Index application in
an appropriate place. You'll probably want to put it into the
Apple Menu Items folder. I put a space in front of mine so that
it appears at the top of the Apple menu list. Double-click on
the application icon or select it from the Apple menu. If all
goes well, a window will open with some info in it. At this time
you can type any letter and the index entries for that letter
will appear in the window. Typing another letter will display
the entries for the new letter. If you have an extended keyboard,
try hitting the "help" key for more info (the home,
end, page up, page down, up arrow and down arrow keys do what
I think they ought to, also).
Routine Index contains an index to the
routines in the new volumes of Inside Macintosh, oriented toward
programming with Lightsoft's Fantasm assembler. See the information
on the opening screen for details. You can select "About
Routine Index" to return to this screen at any time.
The application has a Find command. Type Cmd-F
and a dialog box will appear. Type in the text that you wish
to find and hit <return> or <enter> or click on the
Find button. The database will be searched until the string is
found, in which case it will be highlighted. You can continue
the search by pressing <return>, etc. again. After the
entire database has been searched, the application will beep
when it returns to the starting place. Dismiss the Find dialog
box by clicking Cancel or typing <esc> or Cmd-period. It
will also go away if you press <return> or click Find when
there is no text in the dialog. The most efficient way to use
the Find command is to hit the key corresponding to the first
letter in the routine you're looking for and then Cmd-F and type
in the routine name.
One irritation I've experienced in using this application
is that I will do a Find on a routine and then click in my source
to go back to editing. Since I'm using ModalDialog for Find,
I get a beep. This is really starting to bug me, so I will probably
change this behavior in the future.
This is a fat application and was written in 680x0
assembly language using the CDS assembler from Consulair and
in PowerPC assembly language using the Fantasm assembler from
Lightsoft.
This application is FREE, but I would like to
hear from anyone who finds it useful. Thanks.
Cliff Harris
PO Box 4343
Anaheim, CA 92803
AOL: CliffH5
CompuServe: 72157,2033
Internet: cliffh5@aol.com
Paul McAllister has released "ByteSwitcher" - here's
what he has to say:
ByteSwitcher is a simple program that does resource<->data
conversion.It was written in PPC assembler (Fantasm,of course!)
and weighs in at just over 9Kb :)
The PPC source code to ByteSwitcher is provided free for everyone
to look at/learn from,etc with the sole premise that you don't
just re-assemble it with your name on it and claim it as your
own.
Any questions, suggestions or the like should be directed
to the below eMail address.
Thanks,
Paul <mrwhippy@pac.com.au>
|