Skip to content

Instantly share code, notes, and snippets.

@aberranthacker
Created December 5, 2024 21:11
Show Gist options
  • Select an option

  • Save aberranthacker/f0d26b92fbf07617d4bd2764abd66c23 to your computer and use it in GitHub Desktop.

Select an option

Save aberranthacker/f0d26b92fbf07617d4bd2764abd66c23 to your computer and use it in GitHub Desktop.
@@ -54,12 +54,12 @@ int asm_option[ASM_OPT_NUM];
/* These chars start a comment anywhere in a source file (except inside
another comment. */
-const char comment_chars[] = "#/";
+const char comment_chars[] = ";";
/* These chars only start a comment at the beginning of a line. */
-const char line_comment_chars[] = "#/";
+const char line_comment_chars[] = ";";
-const char line_separator_chars[] = ";";
+const char line_separator_chars[] = "";
/* Chars that can be used to separate mant from exp in floating point nums. */
const char EXP_CHARS[] = "eE";
@@ -271,11 +271,15 @@ md_apply_fix (fixS *fixP,
case BFD_RELOC_PDP11_DISP_8_PCREL:
mask = 0x00ff;
shift = 1;
+ if ((int)val < -256 || (int)val > 254)
+ as_bad (_("Branch offset %i is out of range, opcode: %lo"), val >> 1, code);
break;
case BFD_RELOC_PDP11_DISP_6_PCREL:
mask = 0x003f;
shift = 1;
val = -val;
+ if ((int)val < -126)
+ as_bad (_("SOB offset %i is out of range, opcode: %lo"), val >> 1, code);
break;
default:
BAD_CASE (fixP->fx_r_type);
@aberranthacker
Copy link
Author

aberranthacker commented Dec 6, 2024

  • Replaces #/ as comment characters with ;, which allows to use # as prefix for immediate value, and to use / as division operator.
  • Displays an error when BR and SOB instructions offsets are out of range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment