Skip to content

Instantly share code, notes, and snippets.

@lpproj
Created September 30, 2021 13:05
Show Gist options
  • Save lpproj/42af0ab0ba2a70dd9eb4ae7717bec0b9 to your computer and use it in GitHub Desktop.
Save lpproj/42af0ab0ba2a70dd9eb4ae7717bec0b9 to your computer and use it in GitHub Desktop.
NASM 0.98.39 (guess last version for 16bit DOS)
quick fix option "-I path", and option "-f aout" on 16bit compiler.
to build with (Open)Watcom:
wmake -h -u -f Mkfiles\Makefile.wcd
(note option -u is important for Watcom wmake)
diff -urw nasm-0.98.39-org/output/outaout.c nasm-0.98.39/output/outaout.c
--- nasm-0.98.39-org/output/outaout.c 2005-01-16 07:16:08.000000000 +0900
+++ nasm-0.98.39/output/outaout.c 2021-09-30 21:37:27.452276300 +0900
@@ -834,7 +834,7 @@
word2 = r->symbol;
else
word2 = -r->symbol;
- word2 |= r->reltype << 24;
+ word2 |= (unsigned long)(r->reltype) << 24;
word2 |= (r->bytes == 1 ? 0 :
r->bytes == 2 ? 0x2000000L : 0x4000000L);
fwritelong(word2, aoutfp);
diff -urw nasm-0.98.39-org/preproc.c nasm-0.98.39/preproc.c
--- nasm-0.98.39-org/preproc.c 2005-01-16 07:15:51.000000000 +0900
+++ nasm-0.98.39/preproc.c 2021-09-30 21:38:46.418627500 +0900
@@ -3987,7 +3987,25 @@
IncPath *i;
/* by alexfru: order of path inclusion fixed (was reverse order) */
i = nasm_malloc(sizeof(IncPath));
- i->path = nasm_strdup(path);
+ if (path) {
+ size_t lenp = strlen(path);
+ i->path = nasm_malloc(lenp + 2);
+ if (lenp > 0) {
+ char c = path[lenp - 1];
+ memcpy(i->path, path, lenp);
+#if defined(MSDOS) || defined(__DOS__) || defined(DOS) || defined(_WIN32) || defined(WIN32) || defined(__OS2__)
+ if (c != '\\' && c != '/')
+ i->path[lenp++] = '\\';
+#else
+ if (c != '/')
+ i->path[lenp++] = '/';
+#endif
+ }
+ i->path[lenp] = '\0';
+ }
+ else {
+ i->path = NULL;
+ }
i->next = NULL;
if (ipath != NULL) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment