about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--subx/034compute_segment_address.cc2
-rw-r--r--subx/035labels.cc5
2 files changed, 7 insertions, 0 deletions
diff --git a/subx/034compute_segment_address.cc b/subx/034compute_segment_address.cc
index cf5b789d..b6c191e4 100644
--- a/subx/034compute_segment_address.cc
+++ b/subx/034compute_segment_address.cc
@@ -119,6 +119,8 @@ uint32_t num_bytes(const line& inst) {
 int size_of(const word& w) {
   if (has_operand_metadata(w, "disp32") || has_operand_metadata(w, "imm32"))
     return 4;
+  else if (has_operand_metadata(w, "disp16"))
+    return 2;
   // End size_of(word w) Special-cases
   else
     return 1;
diff --git a/subx/035labels.cc b/subx/035labels.cc
index e07cede8..cbe83802 100644
--- a/subx/035labels.cc
+++ b/subx/035labels.cc
@@ -105,6 +105,11 @@ void compute_byte_indices_for_labels(const segment& code, map<string, int32_t>&
           raise << "'" << to_string(inst) << "': don't use ':' when jumping to labels\n" << end();
         current_byte += 4;
       }
+      else if (has_operand_metadata(curr, "imm16")) {
+        if (*curr.data.rbegin() == ':')
+          raise << "'" << to_string(inst) << "': don't use ':' when jumping to labels\n" << end();
+        current_byte += 2;
+      }
       // automatically handle /disp8 and /imm8 here
       else if (*curr.data.rbegin() != ':') {
         ++current_byte;