Page 1 of 1

OSDK .tap takes a bit too long to load ..

Posted: Fri Jan 26, 2024 4:39 pm
by ibisum
.. for the code it contains.

As part of a workshop here at the museum, I wanted to show the OSDK and C environment, which works great. The only thing I'm wondering is why this code takes so long to load .. is there a way to make the .TAP file contain *only* the regions necessary, or is the OSDK simply a lot to load?

Code: Select all

//
// This program simply display a picture on the hires 
//  screen and then overwrites it with colourful bytes
//

#include <lib.h>
extern unsigned char LabelPicture[]; // derived from the OSDK picture example

#ifdef TEST_N
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#endif

#define MASK_RANGE(byte, start1, end1, start2, end2) \
    ((byte >= start1 && byte <= end1) || (byte >= start2 && byte <= end2) ? 0 : byte)

#define HIRES_BEGIN (0xA000)
#define HIRES_END (0xBF3F)

int main(int argc, char *argv[]) 
{
	unsigned int a = 0;
	unsigned char v = 0;
    // Seed for random number generation
    srand(rand());
	hires();
	memcpy((unsigned char*)HIRES_BEGIN,LabelPicture,8000);
	for(a=HIRES_BEGIN;a<=HIRES_END;a++) {
	// Mask off the blinky/futzy attributes ..
        v = MASK_RANGE(MASK_RANGE(rand() % 256, 24,27,152,155), 8,15,136,143);;
//		printf("a: %d v: %d ", a, v);
		poke(a,v);
	}

    return 0;
}


Re: OSDK .tap takes a bit too long to load ..

Posted: Fri Jan 26, 2024 8:50 pm
by Chema
If I recall correctly it is not related to unused areas, but to the important overhead needed by the C code (managing the stack frame, params, type handling..) plus the size of the libraries that the code uses... although I think a lot of effort was put to reduce them to the minimum.

Re: OSDK .tap takes a bit too long to load ..

Posted: Fri Jan 26, 2024 9:54 pm
by Dbug
The easiest way to see where the size goes is to run the osdk_showmap, so you get a detailed list of all the code and data sections.