Implementing Trap # 3 SO.POINT

Anything QL Software or Programming Related.
Post Reply
ohcan_ognara
ROM Dongle
Posts: 3
Joined: Thu Nov 03, 2016 4:10 pm

Implementing Trap # 3 SO.POINT

Post by ohcan_ognara »

Hello all.

just for nostalgic reasons I'm using Metacomco QL C to implement a plot routine using Trap # 3, SO.POINT as per the code below. I think i'm following all the parameters described in the QL Technical guide.

However, when running the program, no matter what the coordinates I use for x and y, I only get a point at x=0, y=10.

Any hints are really appreciated!

#include <flp1_stdio_h>
#include <flp1_qdos_h>

main()
{
int i, j;
char *a1;

float f_x, f_y;
unsigned char *c_x = (unsigned char *)&f_x;
unsigned char *c_y = (unsigned char *)&f_y;

a1 = (char *)malloc(240);

if (a1==NULL) {
printf("Cannot allocate 240 bytes\n");
}
else{
f_x = 10;
f_y = 10;

for (i=0; i<4; i++) a1=c_y;

a1[4]=0;
a1[5]=0;

for (i=6; i<10; i++) a1=c_x[i-6];

a1[10]=0;
a1[11]=0;


if(sd_point(fgetchid(stdout), -1, a1)!=0)
printf("Trap Failed\n");

}

}
}

sd_point(chan_id, time_out, a1)

char *chan_id, *a1;
int time_out;

{

struct REGS in, out;
int ret;

in.D0 = 48;
in.D3 = time_out;
in.A0 = chan_id;
in.A1 = a1;

ret = QDOS3(&in, &out);
return(ret);
}


Post Reply