Overlooked a few target tests that take the address of main().

This commit is contained in:
Kugel Fuhr 2024-09-02 16:55:58 +02:00
parent cd4357057f
commit 79606c4d20
3 changed files with 9 additions and 3 deletions

View File

@ -21,6 +21,8 @@ unsigned int *MEMTOP = (unsigned int *)741;
unsigned int *MEMLO = (unsigned int *)743; unsigned int *MEMLO = (unsigned int *)743;
void *allocmem; void *allocmem;
void code(void) { }
int main(void) int main(void)
{ {
allocmem = malloc(257); allocmem = malloc(257);
@ -35,7 +37,7 @@ int main(void)
printf(" MEMLO = $%04X (%u)\n", *MEMLO, *MEMLO); printf(" MEMLO = $%04X (%u)\n", *MEMLO, *MEMLO);
printf(" ----------------------\n"); printf(" ----------------------\n");
printf(" main: $%04X (code)\n", &main); printf(" code: $%04X (code)\n", &code);
printf(" data: $%04X (data)\n", &data); printf(" data: $%04X (data)\n", &data);
printf(" _dos_type: $%04X (bss)\n", &_dos_type); printf(" _dos_type: $%04X (bss)\n", &_dos_type);
printf(" allocmem: $%04X (dyn. data)\n", allocmem); printf(" allocmem: $%04X (dyn. data)\n", allocmem);

View File

@ -11,6 +11,8 @@ static char hex[16] = { "0123456789abcdef" };
static char charbuf[0x20]; static char charbuf[0x20];
static char colbuf[0x20]; static char colbuf[0x20];
void func(void) { }
void main(void) void main(void)
{ {
int stackvar = 42; int stackvar = 42;
@ -65,7 +67,7 @@ void main(void)
p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15] p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15]
); );
} }
memcpy(p, main, i = 0); /* test that a zero length doesn't copy 64K */ memcpy(p, func, i = 0); /* test that a zero length doesn't copy 64K */
gotoxy(0,ysize - 1); gotoxy(0,ysize - 1);
for (i = 0; i < xsize; ++i) { for (i = 0; i < xsize; ++i) {

View File

@ -159,12 +159,14 @@ static void Pause(void) {
#endif #endif
} }
static void Nil() { }
int main(void) { int main(void) {
long n0; long n0;
unsigned t; unsigned t;
int c, n1 = 12345, n2, n3; int c, n1 = 12345, n2, n3;
char s1[80], s2[80]; char s1[80], s2[80];
void *p1 = main, *p2 = main, *p3 = main, *p4 = main; void *p1 = Nil, *p2 = Nil, *p3 = Nil, *p4 = Nil;
#ifndef USE_STDIO #ifndef USE_STDIO
clrscr(); clrscr();