X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=device%2Flib%2Fhc08%2F_mulint.c;h=57c19b8101732588d3b62bcc29bb3417e25a3255;hb=3ce766b71ad2b6d9f192e0e6c5d3a5f129804812;hp=9ac3a720a67bd6e829c57d128c8f9424af8fbbc0;hpb=400a10f587fa3d37986233200e77ce1f3e21fd74;p=fw%2Fsdcc diff --git a/device/lib/hc08/_mulint.c b/device/lib/hc08/_mulint.c index 9ac3a720..57c19b81 100644 --- a/device/lib/hc08/_mulint.c +++ b/device/lib/hc08/_mulint.c @@ -26,13 +26,79 @@ has the same precision as the input. Assembler-functions are provided for: - ds390 - mcs51 small - mcs51 small stack-auto - mcs51 large + hc08 + hc08 stack-auto */ +#if !defined(_SDCC_NO_ASM_LIB_FUNCS) + +#pragma save +#pragma less_pedantic +int +_mulint (int a, int b) +{ + a,b; /* reference to make compiler happy */ + +#if !defined(SDCC_STACK_AUTO) + _asm + ais #-2 + psha + pshx + + ldx __mulint_PARM_2+1 + mul + sta 4,s + stx 3,s + + lda 1,s + ldx __mulint_PARM_2+1 + mul + add 3,s + sta 3,s + + lda 2,s + ldx __mulint_PARM_2 + mul + add 3,s + sta 3,s + + ais #2 + pulx + pula + _endasm; +#else + _asm + ais #-2 + psha + pshx + + ldx 8,s + mul + sta 4,s + stx 3,s + + lda 1,s + ldx 8,s + mul + add 3,s + sta 3,s + + lda 2,s + ldx 7,s + mul + add 3,s + sta 3,s + + ais #2 + pulx + pula +#endif +} +#pragma restore + +#else + union uu { struct { unsigned char hi,lo ;} s; unsigned int t; @@ -60,6 +126,7 @@ _mulint (int a, int b) return t.t; } +#endif #undef _MULINT_ASM