More MASM compatibility and bug fixes
authorRobert Pengelly <robertapengelly@hotmail.com>
Sat, 11 Oct 2025 16:28:44 +0000 (17:28 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Sat, 11 Oct 2025 16:28:44 +0000 (17:28 +0100)
intel.c
kwd.c
process.c

diff --git a/intel.c b/intel.c
index 12fa84c9c164dc1b8d00eab00bb7e69e936a3c26..abfdb9da06766c31eb28de5d33b9676570fe8b95 100644 (file)
--- a/intel.c
+++ b/intel.c
@@ -2185,14 +2185,13 @@ static struct pseudo_op_entry pseudo_op_table[] = {
 
 void machine_dependent_init (void) {
 
+    struct template *template = template_table;
     struct hashtab_name *key;
     
     struct reg_entry *reg_entry;
     struct templates *templates;
     
-    struct template *template = template_table;
     struct model_entry *model_entry;
-    
     int ch;
     
     templates = xmalloc (sizeof (*templates));
@@ -2421,7 +2420,19 @@ void machine_dependent_handle_segment (char *start, char **pp, char *name) {
             break;
         }
         
-        if (xstrcasecmp (arg, "use16") == 0) {
+        if (xstrcasecmp (arg, "byte") == 0) {
+        
+            /* TODO: Figure out what needs to be done. */
+        
+        } else if (xstrcasecmp (arg, "word") == 0) {
+        
+            /* TODO: Figure out what needs to be done. */
+        
+        } else if (xstrcasecmp (arg, "public") == 0) {
+        
+            /* TODO: Figure out what needs to be done. */
+        
+        } else if (xstrcasecmp (arg, "use16") == 0) {
         
             machine_dependent_set_march ("i8086+8087");
             bits = 16;
@@ -2431,11 +2442,11 @@ void machine_dependent_handle_segment (char *start, char **pp, char *name) {
             machine_dependent_set_march ("i386+387");
             bits = 32;
         
-        } else if (xstrcasecmp (arg, "code")) {
+        } else if (xstrcasecmp (arg, "code") == 0) {
             section_set_by_name (".text");
-        } else if (xstrcasecmp (arg, "data")) {
+        } else if (xstrcasecmp (arg, "data") == 0) {
             section_set_by_name (".data");
-        } else if (xstrcasecmp (arg, "bss")) {
+        } else if (xstrcasecmp (arg, "bss") == 0) {
             section_set_by_name (".bss");
         } else {
         
diff --git a/kwd.c b/kwd.c
index 125a15830cf11eaf0fe22a16436bf725d7a3921a..55fd3666968dacd4f58a19ec888a48dea635afe6 100644 (file)
--- a/kwd.c
+++ b/kwd.c
@@ -2,6 +2,7 @@
  * @file            kwd.c
  *****************************************************************************/
 #include    <ctype.h>
+#include    <limits.h>
 #include    <stdlib.h>
 #include    <string.h>
 
@@ -198,7 +199,7 @@ static void align_bytes (char *start, char **pp, int first_arg_is_bytes) {
 
 void machine_dependent_number_to_chars (unsigned char *p, uint64_t number, unsigned int size);
 
-unsigned long array_to_integer (unsigned char *arr, int size) {
+static unsigned long array_to_integer (unsigned char *arr, int size) {
 
     unsigned long value = 0;
     int i;
index bb1f4a57a218d781506afa4cee0c32be80d618a7..0303a6a531a3d5304003450c6aa810706e4060ee 100644 (file)
--- a/process.c
+++ b/process.c
@@ -141,6 +141,13 @@ static char *preprocess_line (char *src, int in_macro) {
             
             }
             
+            if (xstrcasecmp (sname, "DGROUP") == 0 && *caret == ':') {
+            
+                caret++;
+                continue;
+            
+            }
+            
             cstr_cat (&cstr, start, caret - start);
             continue;
         
@@ -922,6 +929,7 @@ static void handle_org (char *start, char **pp) {
 }
 
 extern void machine_dependent_assemble_line (char *start, char *line);
+extern void machine_dependent_handle_label (char *start, char **line);
 
 extern void machine_dependent_handle_proc (char *start, char **pp, char *name);
 extern void machine_dependent_handle_endp (char *start, char *name);
@@ -1111,6 +1119,18 @@ static void process_line (char *line, char *line_end) {
                     
                     }
                     
+                    if (xstrcasecmp (directive, "label") == 0) {
+                    
+                        symbol = symbol_label (start, caret, arg);
+                        symbol->scope = SYMBOL_SCOPE_LOCAL;
+                        
+                        free (directive);
+                        
+                        ignore_rest_of_line (&line);
+                        goto check;
+                    
+                    }
+                    
                     if (xstrcasecmp (directive, "proc") == 0) {
                     
                         machine_dependent_handle_proc (start, &line, arg);