diff options
Diffstat (limited to 'asm.rb')
| -rwxr-xr-x | asm.rb | 2 |
1 files changed, 2 insertions, 0 deletions
| @@ -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()}" |
