Flash 9 Assembler
June 27th, 2008 by heardtheword
In my spare time I’ve been playing around with the idea of writing an assembler for Flash 9. There is a project for version 8 called FLASM, which works well, but nothing targeting the newest version of Flash. I’ve also played with HxAsm which will compile low level Flash byte code but the syntax is counter-productive and swf files have to be generated dynamically.
So what I plan to do is write an assembler similar to HLA. The syntax will mask some of the commands, like setting up classes, but will remain low level enough to get the speed increase. I’ll post more as I work out the details.
Here is what I think the syntax may look like.
;============================== ; Fibonnaci Sequence ;============================== #include "stdlib.fas" ; Flash helpers $version 9 $width 320 ; 6400 twips $height 240 ; 4800 twips $start App ; -=-=-= App Class =-=-=- %class App welcome string "Hello World!" cnt byte 1 %function fib (1) pop r1 ; pull argument into r1 push 1 ; small integer jgt over ; jump if (1 > r1) push 1 ret over: dec r1 push this push r1 callp "fib", 1 dec r1 push this push r1 callp "fib", 1 add ret end ; fib %function main (0) push 2 ; push a function argument callp "fib" ; call fib(2) ret end ; main .function asmTest (2) xor ; xor both arguments pop r1 ; pop the result push welcome push nan pop r5 end ; asmTest end ; App
Posted in Development, Flash