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 .global ___sdivhi3 18 19___sdivhi3: 20 lda <r4 21 ldx <r5 22 23 ldy #0 !flag positive result 24 rol a 25 ror a 26 bpl L10 27 28 iny !flag negative result 29 eor #0xFFFF 30 inc a 31 32L10: pha 33 txa 34 bpl L20 35 36 dey !flag negative/positive result 37 eor #0xFFFF 38 inc a 39 tax 40 41L20: pla 42 phy 43 jsr >udv 44 ply 45 beq Lend !if positive result 46 47 eor #0xFFFF !negate result 48 inc a 49 50Lend: sta <r0 51 rtl 52