With a little more research today, a little more hacking, and a lot of debugging help from my roommate ("wait, is that a void pointer?"), I now have two animated smiley faces bouncing across the screen. Here's the relevant Parrot assembler:
new P0, .SDLAnim new P1, .SDLAnim set I0, 0 set P0["filename"], "smile.bmp" set P0["blankfile"], "blank.bmp" set P1["filename"], "smile.bmp" set P1["blankfile"], "blank.bmp" set I1, 320 LOOP: eq I0, 320, LAST inc I0 dec I1 set P0["x"], I0 set P0["y"], I0 set P1["x"], I0 set P1["y"], I1 branch LOOP LAST: end
I have several enhancements to make before I release the code. First, I need to separate the window creation from the actual image objects. That's easy -- just create another PMC and make a way to associate the images with the screen. I have a pointer reserved just for that purpose. Second, I'd like to figure out how to add a new function to the PMC. Currently, the PMC redraws the image on each coordinate assignment. That's not so good for speed. I think this has something to do with the 'invoke' opcode, but I'm not sure.
Finally, I'd like to figure out how to make my new PMCs work without having to be core PMCs. Yep, I'm running a hacked version of Parrot. If I can figure out how to load a PMC dynamically, I'm good to go.
This has been a good learning experience (and I'm very glad to have gdb at my disposal). It's also been a little frustrating, as my C is rusty when it's not ignorant. Besides that, I have a feeling I'm at the very fringe of Parrot development here.
It's nice to do something no one else has ever done, though, and to get it to work.