Forum Navigation
You need to log in to create posts and topics.

Re: Inline Assembly - assem. newbie Question

Posted by: tatewake <tatewake@...>

>Ok. I'm just getting in to Assembly, to do some OSA stuff. Basically,
>before this I haven't written a lick of Assembly, and so I need some
>answers. I have figured out how to call toolbox functions (eg: CALL SysBeep
>() in assem. would be _SysBeep, and CALL Debugger () would be _Debugger,
>right?). And this much I learned from the FB Ref. Manual. 🙂

Well, first; get the Universal Headers(Pascal) file, convert it with Andy's
Pascal converter, and see how it works; usually that's enough to get you
going. (But I'm not much of an asm buff myself.)

I believe things like _SysBeep, _Debugger, etc, have Hexadecimal
Equivalents, meaning that _SysBeep really isn't part of asm itself, it's
like a constant.

For instance, _ParamText is really 0xA98B; some(if not all) assemblers
should know these type of constants, at least for 68k/Mac compilers...

I may be totally off, though. It's just the way I think it works.

>Well, I figured that much out, but I don't see how to pass parameters with
>the toolbox calls. Such as, in the toolbox call DebuggStr, it takes one
>parameter, a string. How would I pass Debuggstr something like "FOOBAR"?
>Would I MOVE "FOOBAR" into the a6, or a7, or what?

You got me; as I said, play with the Universal Headers a bit; I'm sure
there's some useful info there.

I myself am interested in what goes into the Seg Loader info in CODE resources?
Or heck, the _format_ of CODE resources all together; how it all works to
make two bowling balls with eyes play volleyball on a three-d cube...

There's versions of ResEdit; i.e. Super Resedit, that can disassemble CODE
resources; and give you very nice asm output:

PlaySnd
+0000 000004 MOVEQ #$FF,D0 | 70FF
+0002 000006 MOVE.B D0,-$0212(A5) | 1B40 FDEE
+0006 00000A JMP End.SndMngr ; 00000C8A | 4EFA 0C7E
+000A 00000E JMP PlayNamedSnd ; 000000D2 | 4EFA 00C2
+000E 000012 MOVEA.L A7,A2 | 244F
+0010 000014 MOVE.L A6,-(A7) | 2F0E
+0012 000016 MOVE.L -$08AC(A5),-(A7) | 2F2D F754
+0016 00001A SUBA.W #$000C,A7 | 9EFC 000C
+001A 00001E MOVEA.L A7,A6 | 2C4F
+001C 000020 SUBA.L #$00000000,A7 | 9FFC
0000 0000
+0022 000026 MOVE.L A7,-$08AC(A5) | 2B4F F754
+0026 00002A MOVEQ #$00,D1 | 7200
+0028 00002C MOVE.W PlaySnd+$0018,D1 ; 0000001C | 323A FFEE
+002C 000030 ADD.L PlaySnd+$001E,D1 ; 00000022 | D2BA FFF0
+0030 000034 MOVEA.L A7,A1 | 224F
+0032 000036 SUBQ.L #$2,D1 | 5581
+0034 000038 BMI.S PlaySnd+$003A ; 0000003E | 6B04
+0036 00003A CLR.W (A1)+ | 4259
+0038 00003C BRA.S PlaySnd+$0032 ; 00000036 | 60F8
+003A 00003E MOVE.W D0,$0004(A6) | 3D40 0004
+003E 000042 MOVE.L (A2)+,D0 | 201A
+0040 000044 MOVE.L D0,$0000(A6) | 2D40 0000
+0044 000048 SUBQ.L #$4,A7 | 598F
+0046 00004A MOVE.L #$736E6420,-(A7) ; 'snd ' | 2F3C
736E 6420
+004C 000050 MOVE.W $0004(A6),-(A7) | 3F2E 0004
+0050 000054 _GetResource ; A9A0 | A9A0

Just do a search on it, I don't remember where I got it.

-- Terence Jordan (tatewake@usa.net)
Inspired Software. inspired.netstreet.net/
Macintosh, Dos, Windows, and BeOS software solutions.
Phone: 407-728-7563
............................................
. New: Renegade Space Ninja for Macintosh! .
. Visit our page for more info. .
............................................