Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

How to compile this program for DOS? (Developers)

posted by rosegondon, C:\DOS, 19.09.2021, 01:28

Hi sezeroz & tkchia,

@sezeroz, thank you for your patch, after I applied it, program compiled regardless of patching errors.

@tkchia, your patch triggers whitespace errors too, I will try to
manually apply your modifications in source code. Probably something happens with text when copying&pasting from this forum to patch file.

Thank you for you help, now I will make code changes and tests on my DOS machine and I hope to come back with results soon.

> Hello rosegondon,
>
> My proposed modified patch (for now) is as follows:
>
> --- otp.c.orig    2021-09-18 18:49:22.723186562 +0000
> +++ otp.c  2021-09-18 19:27:31.893487497 +0000
> @@ -57,4 +57,10 @@
> #endif
>
> +#ifdef __DJGPP
> +#define __far
> +#define _intdos intdos
> +#define _REGS REGS
> +#endif
> +
> #ifdef unix
> #include <sys/time.h>
> @@ -311,8 +317,8 @@
> ri.h.dl = 0;               /* Default drive */
> if (_intdos(&ri, &ro) != 0xFFFF) {
> -          trash[1] = (((int32_t) ro.x.ax) << 16) | ro.x.bx;
> -      trash[2] = (((int32_t) ro.x.cx) << 16) | ro.x.dx;
> +     trash[5] = (((int32_t) ro.x.ax) << 16) | ro.x.bx;
> +      trash[6] = (((int32_t) ro.x.cx) << 16) | ro.x.dx;
> }
> -      trash[4] = (int32_t) (char __far *) trash;
> +  trash[7] = (int32_t) (char __far *) trash;
> #define OS_KNOWN 1
> #endif
> @@ -353,5 +359,7 @@
> trash[4] = getpid();
> trash[11] = getppid();
> +#ifndef __DJGPP
> trash[38] = gethostid();
> +#endif
> /* If the system implements /dev/random, obtain 16 bytes
> of entropy thence. */

>
> Further improvements are probably possible.
>
> Thank you!

---
echo g=ffff:0|debug>nul

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 218 users online (0 registered, 218 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum