Flash / flasm debugger

Debugger for flasm developer

Igor Kogan and Dave Hayden from Opaque Industries have created a product for the "real" Flash coders. The product is called flasm, and it lets you program the Flash ActionScript in the lowest level possible, namely, bytecodes. Using syntax like ol' good assembler one can optimize complex code-intensive parts of his Flash application.

Playing with flasm I quickly found out that its very easy to get lost when your scripts reach beyond twenty lines or so. Without having any way to check the stack and registers in the middle of script development gets really challenging. To address this issue I have made a simple tool, a debugger window where the values from stack and registers can be sent in the middle of flasm script for inspection.


Usage

All the code is in the Debugger movieclip. Just put it in your movie and whenever you need to update it's contents, call these instructions:

 "push '[label]', '[trace]', 2, 'updateDebug'"; "callFunction"; "pop"

'Label' is the name of debugger pane where the data should be updated, 'trace' is a value to be sent to trace window of debugger. Leave 'label' empty string to update default pane. If there are no more clear panes available, the data in oldest one will be overwritten. Write UNDEF instead of trace value to leave trace window contents unchanged:

"push '', UNDEF, 2, 'updateDebug'"; "callFunction"; "pop"

Note that 'updateDebug' function is attached to the Movieclip prototype, so it is available from anywhere in the movie.
Another important note: if stack is empty, it is not possible to know it, since "pop" wil not return eny error. For flasm debugger to know that it has reached the beginning of the stack you have to push value '$EndOfStack$' when you load your movie. This code is inserted in the first frame of debugger window.

I really would like to get some feedback on this thing. Please mail me and tell your suggestions or bug reports.

Downloads

flasm_debug.zip