Skip to content

Runtime Speedcode generator for Retro Computing

An-S edited this page Apr 29, 2015 · 1 revision

Welcome to the SpeedcodeGenerator wiki!

You can use this c/asm library to generate highly repetive (but fast) code at runtime to avoid overhead by loop counters/checking stop conditions and index dependent expressionms.

You have four generation loops: z,y,x,part. The inner loop can assemble speedcode consisting of different parts, for example if you want to insert different speedcode at beginning and end of a row deviating from the one in the middle of a row. Each speedcode part definition contains a pointer to an assembler code template in which parameters are inserted (using selfmod) by a callback routine that is called for every z/y/x pair, the size of the assembler code template, the number of repeats and function pointers to the callback, setup and teardown functions.

Each speedcode definition consists of the number of repeats for z/y/x, a pointer to an array of part definitions, the loop counters, the amount of different parts and also setup and teartown function pointers.

Speedcode generation is started with spcode_Create which is passed a pointer to the speedcode definition struct and a pointer to the start address for the speedcode (maybe NULL to auto allocate mem for speedcode).

Clone this wiki locally