From: ian Date: Sat, 23 Apr 2005 13:36:11 +0000 (+0000) Subject: instruction set aliases and summary X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=bb9cc1356fd47160ae2b66ea6e104933c3e63ead;p=trains.git instruction set aliases and summary --- diff --git a/iwjpictest/.cvsignore b/iwjpictest/.cvsignore index b9fbbeb..9ddea0c 100644 --- a/iwjpictest/.cvsignore +++ b/iwjpictest/.cvsignore @@ -1,3 +1,7 @@ *.hex *.cod *.lst +insn-*.ps +insn-*.txt +insn-aliases.inc +*.tmp diff --git a/iwjpictest/Makefile b/iwjpictest/Makefile index 9737068..fab06cd 100644 --- a/iwjpictest/Makefile +++ b/iwjpictest/Makefile @@ -1,9 +1,26 @@ -TARGETS= config.hex +TARGETS= config.hex $(INSN_TARGETS) + +INSN_TARGETS= insn-aliases.inc insn-1.ps insn-2.ps PROGRAMS= flasher copybits serialloop +include ../common.make include ../pic.make clean: pic-clean + rm -f $(INSN_TARGETS) + +insn-aliases.inc: insn-aliases.inc-gen + ./$< --macros $o + +insn-%.txt: insn-aliases.inc-gen Makefile + sed -e '1,/^#--1--/d; /^#--2--/,$$d' <$< >$@.1.tmp + ./$< --descs >$@.2.tmp + sort -t % -k 1.$(subst 2,28,$*) <$@.2.tmp >>$@.1.tmp + sed -e '1,/^#--2--/d; /^#--3--/,$$d' <$< >>$@.1.tmp + mv -f $@.1.tmp $@ + +insn-%.ps: insn-%.txt + atp -T A4 -B -f Courier8.2 <$< $o copybits.o serialloop.o: onecopybit.inc diff --git a/iwjpictest/insn-aliases.inc-gen b/iwjpictest/insn-aliases.inc-gen new file mode 100755 index 0000000..8b499ce --- /dev/null +++ b/iwjpictest/insn-aliases.inc-gen @@ -0,0 +1,177 @@ +#!/bin/sh +set -e + +badusage () { echo >&2 'bad usage'; exit 1; } + +comment=';' +macros=false + +case "$1" in +--macros) macros=true ;; +--descs) comment='' ;; +*) badusage ;; +esac +test $# = 1 || badusage + +w=0xfe8 + +desc () { + local use=$1 new=$2 formargs=$3 notes=$4 + local fan="$(printf "%-6s %s" "$formargs" "$notes")" + if $descs; then + printf "$comment %-13s %-11s %-39s %s\n" \ + "$new" "$fan" "$ds" "$use" + fi +} +alias_r () { + local use=$1 new=$2 actargs=$3 formargs=$4 + if $macros; then + cat <_a (always uses access bank) and _b + (always uses BSR). (_[ab]_if for conditionals.) + digits Gives number of bits of address or offset. +#--3--