Someone hooked up the data lines between the systems backwards, so we
get to swizzle the bits in software.
Signed-off-by: Keith Packard <keithp@keithp.com>
ao_lisp.h \
ao_lisp_const.h \
ao_lisp_os.h \
+ ao_flip_bits.h \
Makefile
-
#PROFILE=ao_profile.c
#PROFILE_DEF=-DAO_PROFILE=1
clean::
rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
- rm -f ao_product.h
+ rm -f ao_product.h ao_flip_bits.h
+
+ao_flip_bits.h: ao_flip_bits.5c
+ nickle ao_flip_bits.5c > $@
include ../lisp/Makefile-lisp
--- /dev/null
+#!/usr/bin/nickle
+
+int flip_bits(int a)
+{
+ int result = 0;
+ for (int pos = 0; pos < 8; pos++)
+ if ((a & (1 << pos)) != 0)
+ result |= (1 << (7 - pos));
+ return result;
+}
+
+printf ("static uint8_t ao_flip_bits[256] = {\n");
+
+for (int i = 0; i < 256; i++) {
+ printf (" 0x%02x,", flip_bits(i));
+ if ((i & 0xf) == 0xf)
+ printf("\n");
+}
+printf("};\n");