Added Turbo C for 16-bit DOS fix for 64k boundary crossing.
authorDavid Griffith <dave@661.org>
Sat, 1 Feb 2025 21:07:33 +0000 (13:07 -0800)
committerDavid Griffith <dave@661.org>
Sat, 1 Feb 2025 21:26:57 +0000 (13:26 -0800)
The LOW_WORD() macro for TurboC can't handle a zword passed as the
address because that macro assumes the first parameter is a 16-bit
value.  Maybe someday I'll find a clean way to rewrite that macro.

src/common/text.c

index 8814636a414ed2d8c3ce07588b8cbcf030934e57..477d1597ab576da5dd833a59586ee2e0a139d236 100644 (file)
@@ -437,7 +437,18 @@ static void decode_text(enum string_type st, zword z_addr)
 
                /* Fetch the next 16bit word */
                if (st == LOW_STRING || st == VOCABULARY) {
+
+               /* The LOW_WORD() macro for TurboC can't handle a zword
+                  passed as the address because that macro assumes the
+                  first parameter is a 16-bit value.  Maybe someday I'll
+                  find a clean way to rewrite that macro.  DG.
+               */
+#if defined __TURBOC__
+                       zword addr_clipped = (zword) addr;
+                       LOW_WORD(addr_clipped, code)
+#else
                        LOW_WORD(addr, code)
+#endif
                        addr += 2;
                } else if (st == HIGH_STRING || st == ABBREVIATION) {
                        HIGH_WORD(byte_addr, code)