summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xasm.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/asm.rb b/asm.rb
index 4883edb..686f9c1 100755
--- a/asm.rb
+++ b/asm.rb
@@ -57,7 +57,9 @@ $code.each_with_index() do | line, i |
57 op |= $labels[$1] 57 op |= $labels[$1]
58 elsif $labels.key?(ref) 58 elsif $labels.key?(ref)
59 target = $labels[ref] - (i + 1) 59 target = $labels[ref] - (i + 1)
60 throw "Jump too far forward" if target > 0x7f
60 target += 0x80 if target < 0 61 target += 0x80 if target < 0
62 throw "Jump too far backward" if target < 0
61 op |= target 63 op |= target
62 else 64 else
63 throw "I don't understand #{ref.inspect()}" 65 throw "I don't understand #{ref.inspect()}"