Skip to content

Commit

Permalink
Merge pull request #2 from markdryan/markdryan/v3
Browse files Browse the repository at this point in the history
Version 3
  • Loading branch information
markdryan authored Jun 17, 2022
2 parents 2dff3a9 + 5841029 commit 446393a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/salink.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,8 @@ static void prv_complete_absolutes_e(void)
align = 1 << label->id;
mask = align - 1;
adjust = (real_off + label->off) & mask;
real_off += align - adjust;
if (adjust > 0)
real_off += align - adjust;
continue;
}
if (label->off > 0xffff - real_off) {
Expand Down
4 changes: 2 additions & 2 deletions src/state_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#ifndef SPECASM_STATE_READ_H
#define SPECASM_STATE_READ_H

#define SPECASM_VERSION 2
#define SPECASM_VERSION_STR "v2"
#define SPECASM_VERSION 3
#define SPECASM_VERSION_STR "v3"

#include <stdint.h>

Expand Down
9 changes: 9 additions & 0 deletions tests/test_align_aligned/align_aligned.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.Main
align 8
ld hl, l1
.l1
nop
ld hl, l2
align 8
.l2
ret
21 changes: 21 additions & 0 deletions tests/test_align_aligned/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -e
rm align_aligned 2>/dev/null 1>&2 || true
rm *.x 2>/dev/null 1>&2 || true

../../saimport *.s
../../salink 2>/dev/null 1>&2
offset=`od -An -j1 -t x1 -N2 align_aligned | xargs`
if [ "$offset" != "03 80" ]; then
exit 1
fi

offset=`od -An -j5 -t x1 -N2 align_aligned | xargs`
if [ "$offset" != "08 80" ]; then
exit 1
fi

rm align_aligned
rm *.x

0 comments on commit 446393a

Please sign in to comment.