From: Alan Cox Date: Sat, 6 Jun 2015 13:56:05 +0000 (+0100) Subject: Library: Add fixed ashlsi3 code to the C library X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=7166fa951e3ec2d70941e887eb535228ec575ea6;p=FUZIX.git Library: Add fixed ashlsi3 code to the C library --- diff --git a/Library/libs/Makefile.6809 b/Library/libs/Makefile.6809 index 7c96c22a..6f3ab527 100644 --- a/Library/libs/Makefile.6809 +++ b/Library/libs/Makefile.6809 @@ -4,12 +4,12 @@ AR = m6809-unknown-ar PLATFORM = 6809 export PLATFORM CC_OPT = -c -Os -I../include -I../include/6502 -# for stuff that gives sdcc nightmares +# for stuff that gives gcc nightmares CC_NOOPT = $(CC_OPT) ASM_OPT = -o SRC_CRT0 = crt0_$(PLATFORM).s OBJ_CRT0 = $(SRC_CRT0:.s=.o) -SRC_ASM = setjmp_6809.s +SRC_ASM = setjmp_6809.s ashlsi3_6809.s OBJ_ASM = $(SRC_ASM:.s=.o) SRC_C = __argv.c abort.c asctime.c assert.c atexit.c SRC_C += bcmp.c bcopy.c bsearch.c bzero.c calloc.c cfree.c clock.c closedir.c diff --git a/Library/libs/ashlsi3_6809.s b/Library/libs/ashlsi3_6809.s new file mode 100644 index 00000000..86dd0e09 --- /dev/null +++ b/Library/libs/ashlsi3_6809.s @@ -0,0 +1,47 @@ + .globl ___ashlsi3 + + .area .text + +___ashlsi3: + pshs u + + ; FIXME temporary hack until we fix gcc-6809 or our use of it + ; the argument passing doesn't match so we'll mangle it + ldu 4,s + stu ,x + ldu 6,s + stu 2,x + ldb 9,s + + cmpb #16 + blt try8 + subb #16 + ; Shift by 16 + ldu 2,x + stu ,x + ldu #0 + stu 2,x +try8: + cmpb #8 + blt try_rest + subb #8 + ; Shift by 8 + ldu 1,x + stu ,x + lda 3,x + sta 2,x + clr 3,x + +try_rest: + tstb + beq done +do_rest: + ; Shift by 1 + asl 3,x + rol 2,x + rol 1,x + rol ,x + decb + bne do_rest +done: + puls u,pc