Skip to content

Commit

Permalink
asm6809: Add package
Browse files Browse the repository at this point in the history
  • Loading branch information
stahta01 committed Apr 30, 2023
1 parent 3958447 commit 95c7613
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
39 changes: 39 additions & 0 deletions mingw-w64-asm6809/101-Add-printf-debug-lines.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 2f45d2f810ec641daada9f0c69d6783e0d9d34d2 Mon Sep 17 00:00:00 2001
From: Tim Stahlhut <[email protected]>
Date: Sat, 29 Apr 2023 17:37:47 -0400
Subject: Add printf debug lines

---
src/assemble.c | 1 +
src/instr.c | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/assemble.c b/src/assemble.c
index c40b5d0..6569cd5 100644
--- a/src/assemble.c
+++ b/src/assemble.c
@@ -782,6 +782,7 @@ static void pseudo_fcc(struct prog_line *line) {
struct node **arga = node_array_of(line->args);
for (int i = 0; i < nargs; i++) {
emit_formatted("FCC", i, arga[i], 0);
+ fprintf(stderr, "%s node_type_of=%d\n", "inside assemble.c near line 786", node_type_of(arga[i]));
}
}

diff --git a/src/instr.c b/src/instr.c
index 27f8433..c645f44 100644
--- a/src/instr.c
+++ b/src/instr.c
@@ -104,8 +104,10 @@ void instr_rel(struct opcode const *op, struct node const *args) {
int rel8 = to_rel16(arga[0]->data.as_int - (cur_section->pc + 1));
_Bool rel8v = (rel8 < -128 || rel8 > 127);
if ((op->type & OPCODE_EXT_TYPE) == OPCODE_REL8) {
- if (rel8v)
+ if (rel8v) {
+ fprintf(stderr, "%s rel8=%d pc=%X op=%s data.as_int%x\n", "inside instr.c near line 108", rel8, cur_section->pc, op->op, arga[0]->data.as_int);
error(error_type_out_of_range, "8-bit relative value out of range");
+ }
section_emit_uint8(rel8);
} else {
if (!rel8v && node_attr_of(arga[0]) != node_attr_16bit)
--
25 changes: 25 additions & 0 deletions mingw-w64-asm6809/102-Edit-symbol-output-in-program.c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 96ad7c7e56398fc545ffa472c3b20055f23567aa Mon Sep 17 00:00:00 2001
From: Tim Stahlhut <[email protected]>
Date: Sat, 29 Apr 2023 19:08:59 -0400
Subject: Edit symbol output in program.c

---
src/program.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/src/program.c b/src/program.c
index 6e064d0..b54ab7a 100644
--- a/src/program.c
+++ b/src/program.c
@@ -249,6 +249,8 @@ static void print_symbol(const char *key, FILE *f) {
if (delim) fputc(delim, f);
node_print(f, n);
if (delim) fputc(delim, f);
+ if (node_type_of(n) == node_type_int)
+ fprintf(f, "; %X", n->data.as_int);
fprintf(f, "\n");
n = node_set_attr(n, old_attr);
node_free(n);
--
2.40.1.windows.1

50 changes: 50 additions & 0 deletions mingw-w64-asm6809/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Maintainer: Tim S <[email protected]>

_realname=asm6809

pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.12
pkgrel=1
pkgdesc="Cross Assembler for the Motorola 6809 and Hitachi 6309 microprocessors (mingw-w64)"
arch=('any')
url="https://www.6809.org.uk/asm6809/"
license=('GPL3')
groups=("${MINGW_PACKAGE_PREFIX}-${_target}-toolchain")
source=("https://www.6809.org.uk/asm6809/dl/${_realname}-${pkgver}.tar.gz"
'102-Edit-symbol-output-in-program.c.patch')
sha256sums=('32044f0087ac8fa94ff5f3e54279d91c3df2c21b5c2098b48bbc2754678b22a2'
'ce9cfd69272c0dad1e3177c48e268b086a2330353b1d1ddd3f9f71260fb599b2')
prepare() {
cd ${_realname}-$pkgver

#patch --forward -p1 -i "$srcdir"/102-Edit-symbol-output-in-program.c.patch
}

build() {
if [[ -d "build-${_realname}-${MSYSTEM}" ]]; then
rm -rf build-${_realname}-${MSYSTEM}
fi
mkdir build-${_realname}-${MSYSTEM}
cd build-${_realname}-${MSYSTEM}

CPPFLAGS=""
CXXFLAGS="-O2 -Wno-error=format-security"
CFLAGS="-O2 -Wno-error=format-security"
../${_realname}-$pkgver/configure \
--prefix=${MINGW_PREFIX} \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST}

make -j1
}

package() {
cd build-${_realname}-${MSYSTEM}

CPPFLAGS=""
CFLAGS="-O2"
make -j1 DESTDIR="$pkgdir/" install
}

# vim:set ts=2 sw=2 et:

0 comments on commit 95c7613

Please sign in to comment.