Page 1 of 1

Aligned memory support driver for VS1010D dlx loader

Posted: Fri 2019-06-07 10:48
by Panu
Dear Signal Processing Enthusiasts,

Here is a small driver that implements aligned memory support for the VS1010D library loader. It's useful especially for signal processing applications.

To use the driver, place the ALIGN.DLX file to your SYS folder and add ALIGN to the beginning of your config.txt.


PS. For those interested, here's the source code. It shows the syntax for making a simple driver, which stays resident in memory after exit. It only works in VS1010D, does not work in VS1010C.

Code: Select all

#include <lowlevels.h>
u_int16 GetMemoryAlign(u_int16 page, u_int16 address, u_int16 sizeWords, u_int16 align) {
	if (align) {
		u_int16 alignMinus1 = align - 1;
		heap[page] = (heap[page] + alignMinus1) & ~alignMinus1;
	return GetMemory(page, address, sizeWords, align);
ioresult main (char *params) {
	u_int16 *thisLib = loadedLib[loadedLibs-1];
	thisLib[1] = 0xfffe; //Do not release memory at program exit
	SetJmpiHookFunction(GetMem, GetMemoryAlign);
	return S_OK;