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 tkchia Homepage, 18.09.2021, 21:31

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!

---
https://gitlab.com/tkchia · https://codeberg.org/tkchia · 😴 "MOV AX,0D500H+CMOS_REG_D+NMI"

 

Complete thread:

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