summaryrefslogtreecommitdiff
path: root/asm.rb
diff options
context:
space:
mode:
authorJulian Blake Kongslie2021-04-05 13:24:32 -0700
committerJulian Blake Kongslie2021-04-05 13:24:32 -0700
commitb4b8685ca978dd24fc3683a9d296456c79016ed8 (patch)
treec95d97a7689810b20e710d9af7d81b3edb6aa80f /asm.rb
parentChange our simulator timing model to use continuous assignment guards. (diff)
downloadnoncpu-b4b8685ca978dd24fc3683a9d296456c79016ed8.tar.xz
Assembler errors for too-far jumps.
Diffstat (limited to '')
-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()}"