1/* 2Copyright (c) 1990 The Regents of the University of California. 3All rights reserved. 4 5Redistribution and use in source and binary forms are permitted 6provided that the above copyright notice and this paragraph are 7duplicated in all such forms and that any documentation, 8and/or other materials related to such 9distribution and use acknowledge that the software was developed 10by the University of California, Berkeley. The name of the 11University may not be used to endorse or promote products derived 12from this software without specific prior written permission. 13THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16 */ 17#include <picolibc.h> 18 19 .global ___sdivhi3 20 21___sdivhi3: 22 lda <r4 23 ldx <r5 24 25 ldy #0 !flag positive result 26 rol a 27 ror a 28 bpl L10 29 30 iny !flag negative result 31 eor #0xFFFF 32 inc a 33 34L10: pha 35 txa 36 bpl L20 37 38 dey !flag negative/positive result 39 eor #0xFFFF 40 inc a 41 tax 42 43L20: pla 44 phy 45 jsr >udv 46 ply 47 beq Lend !if positive result 48 49 eor #0xFFFF !negate result 50 inc a 51 52Lend: sta <r0 53 rtl 54