From b4b8685ca978dd24fc3683a9d296456c79016ed8 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Mon, 5 Apr 2021 13:24:32 -0700 Subject: Assembler errors for too-far jumps. --- asm.rb | 2 ++ 1 file changed, 2 insertions(+) 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 | op |= $labels[$1] elsif $labels.key?(ref) target = $labels[ref] - (i + 1) + throw "Jump too far forward" if target > 0x7f target += 0x80 if target < 0 + throw "Jump too far backward" if target < 0 op |= target else throw "I don't understand #{ref.inspect()}" -- cgit v1.2.3