C68 Console
Posted: Mon May 06, 2019 11:12 pm
I've written a test program to open a console in C68, write some test and draw a block. The console is 512x256, but I've noticed that the text and graphics are shifted to the left. I left in the end message "press any key" that keeps the window open and it's text is where I would expect it. Am I not initialzing the console right?
Attached in a screenshot and the code.
Tim Swenson {can't seem to attach the code so I'll place it there]
/* gtest2_c
Graphics Test with C68 and QDOS calls
*/
#include <stdio.h>
#include <qdos_h>
char _prog_name[]="gtest";
/* char *_endmsg=NULL; */
int (*_cmdparams)()=NULL;
long (*_cmdchannels)()=NULL;
int (*_cmdwildcard)()=NULL;
long (*_stackchannels)()=NULL;
/* set up definition of CONsole window */
struct WINDOWDEF _condetails = {
2, /* border color */
1, /* border width */
0, /* Paper */
7, /* Ink */
512, /* Width */
256, /* Heigth */
0, /* X origin */
0 /* Y origin */
};
/* set up definition of BLOCK */
struct QLRECT block = {
20, /* Width */
20, /* Height */
0, /* X origin */
0 /* Y origin */
};
void main () {
int i,x;
FILE *fd;
chanid_t channel_id;
fd = fopen("CON_","wr");
channel_id = fgetchid(fd);
_initcon();
sd_clear(channel_id,-1);
fprintf(fd,"Test \n");
sd_fill(channel_id,(timeout_t) -1,(colour_t) 2,&block);
fprintf(fd,"test test \n");
for ( i = 1; i > 1000000000; i++) {
x = i * i;
}
fclose(fd);
}
Attached in a screenshot and the code.
Tim Swenson {can't seem to attach the code so I'll place it there]
/* gtest2_c
Graphics Test with C68 and QDOS calls
*/
#include <stdio.h>
#include <qdos_h>
char _prog_name[]="gtest";
/* char *_endmsg=NULL; */
int (*_cmdparams)()=NULL;
long (*_cmdchannels)()=NULL;
int (*_cmdwildcard)()=NULL;
long (*_stackchannels)()=NULL;
/* set up definition of CONsole window */
struct WINDOWDEF _condetails = {
2, /* border color */
1, /* border width */
0, /* Paper */
7, /* Ink */
512, /* Width */
256, /* Heigth */
0, /* X origin */
0 /* Y origin */
};
/* set up definition of BLOCK */
struct QLRECT block = {
20, /* Width */
20, /* Height */
0, /* X origin */
0 /* Y origin */
};
void main () {
int i,x;
FILE *fd;
chanid_t channel_id;
fd = fopen("CON_","wr");
channel_id = fgetchid(fd);
_initcon();
sd_clear(channel_id,-1);
fprintf(fd,"Test \n");
sd_fill(channel_id,(timeout_t) -1,(colour_t) 2,&block);
fprintf(fd,"test test \n");
for ( i = 1; i > 1000000000; i++) {
x = i * i;
}
fclose(fd);
}