mirror of
https://github.com/notwa/lips
synced 2024-05-17 07:53:22 -07:00
use 2**n alignment instead of 2*n
This commit is contained in:
parent
f8805e6deb
commit
7c4becf0b6
|
@ -113,13 +113,13 @@ be wary of potential alignment issues.
|
||||||
writes a series of 32-bit numbers until end-of-line.
|
writes a series of 32-bit numbers until end-of-line.
|
||||||
|
|
||||||
* `.align [n] [fill]`
|
* `.align [n] [fill]`
|
||||||
aligns the next datum to a `n*2` boundary using `fill` for spacing.
|
aligns the next datum to a `2**n` boundary using `fill` for spacing.
|
||||||
if `n` is not given, 2 is implied.
|
if `n` is omitted, 2 is implied.
|
||||||
if `fill` is not given, 0 is implied.
|
if `fill` is omitted, 0 is implied.
|
||||||
|
|
||||||
* `.skip {n} [fill]`
|
* `.skip {n} [fill]`
|
||||||
skips the next `n` bytes using `fill` for spacing.
|
skips the next `n` bytes using `fill` for spacing.
|
||||||
if `fill` is not given, no bytes are overwritten,
|
if `fill` is omitted, no bytes are overwritten,
|
||||||
and only the position is changed.
|
and only the position is changed.
|
||||||
|
|
||||||
* `.org {address}`
|
* `.org {address}`
|
||||||
|
|
|
@ -93,11 +93,13 @@ function Dumper:add_directive(line, name, a, b)
|
||||||
self:advance(0)
|
self:advance(0)
|
||||||
elseif name == 'ALIGN' then
|
elseif name == 'ALIGN' then
|
||||||
t.kind = 'ahead'
|
t.kind = 'ahead'
|
||||||
local align = a*2
|
local align
|
||||||
if align == 0 then
|
if a == 0 then
|
||||||
align = 4
|
align = 4
|
||||||
elseif align < 0 then
|
elseif a < 0 then
|
||||||
self:error('negative alignment')
|
self:error('negative alignment')
|
||||||
|
else
|
||||||
|
align = 2^a
|
||||||
end
|
end
|
||||||
local temp = self.pos + align - 1
|
local temp = self.pos + align - 1
|
||||||
t.skip = temp - (temp % align) - self.pos
|
t.skip = temp - (temp % align) - self.pos
|
||||||
|
|
Loading…
Reference in New Issue
Block a user