From b1f772e9be1526e5696b9f9e0801c273bb027780 Mon Sep 17 00:00:00 2001 From: uz Date: Sat, 15 Aug 2009 20:58:35 +0000 Subject: [PATCH] Added additional entry points that clear the high word of the right operand. git-svn-id: svn://svn.cc65.org/cc65/trunk@4023 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/runtime/ladd.s | 7 ++++++- libsrc/runtime/ldiv.s | 11 ++++++++--- libsrc/runtime/lmod.s | 9 +++++++-- libsrc/runtime/lmul.s | 8 +++++++- libsrc/runtime/lsub.s | 11 ++++++++--- libsrc/runtime/lumod.s | 7 ++++++- 6 files changed, 42 insertions(+), 11 deletions(-) diff --git a/libsrc/runtime/ladd.s b/libsrc/runtime/ladd.s index a68583e76..4e864c797 100644 --- a/libsrc/runtime/ladd.s +++ b/libsrc/runtime/ladd.s @@ -4,7 +4,7 @@ ; CC65 runtime: long add ; - .export tosaddeax + .export tosadd0ax, tosaddeax .import addysp1 .importzp sp, sreg, tmp1 @@ -12,6 +12,11 @@ ; EAX = TOS + EAX +tosadd0ax: + ldy #$00 + sty sreg + sty sreg+1 + tosaddeax: clc .if (.cpu .bitand CPU_ISET_65SC02) diff --git a/libsrc/runtime/ldiv.s b/libsrc/runtime/ldiv.s index cbbf78aa7..3d8dda0d5 100644 --- a/libsrc/runtime/ldiv.s +++ b/libsrc/runtime/ldiv.s @@ -7,9 +7,14 @@ ; When negating values, we will ignore the possibility here, that one of the ; values if $80000000, in which case the negate will fail. - .export tosdiveax - .import poplsargs, udiv32, negeax - .importzp ptr1, tmp1, tmp2 + .export tosdiv0ax, tosdiveax + .import poplsargs, udiv32, negeax + .importzp sreg, ptr1, tmp1, tmp2 + +tosdiv0ax: + ldy #$00 + sty sreg + sty sreg+1 tosdiveax: jsr poplsargs ; Get arguments from stack, adjust sign diff --git a/libsrc/runtime/lmod.s b/libsrc/runtime/lmod.s index ab3d8c0b7..89826ba84 100644 --- a/libsrc/runtime/lmod.s +++ b/libsrc/runtime/lmod.s @@ -7,11 +7,16 @@ ; When negating values, we will ignore the possibility here, that one of the ; values if $8000, in which case the negate will fail. - .export tosmodeax + .export tosmod0ax, tosmodeax .import poplsargs, udiv32, negeax .importzp sreg, ptr1, ptr2, tmp1, tmp3, tmp4 -tosmodeax: +tosmod0ax: + ldy #$00 + sty sreg + sty sreg+1 + +tosmodeax: jsr poplsargs ; Get arguments from stack, adjust sign jsr udiv32 ; Do the division, remainder is in (ptr2:tmp3:tmp4) diff --git a/libsrc/runtime/lmul.s b/libsrc/runtime/lmul.s index 1a909a3d6..44a46b5aa 100644 --- a/libsrc/runtime/lmul.s +++ b/libsrc/runtime/lmul.s @@ -4,10 +4,16 @@ ; CC65 runtime: multiplication for long (unsigned) ints ; - .export tosumuleax, tosmuleax + .export tosumul0ax, tosumuleax, tosmul0ax, tosmuleax .import addysp1 .importzp sp, sreg, tmp1, tmp2, tmp3, tmp4, ptr1, ptr3, ptr4 +tosmul0ax: +tosumul0ax: + ldy #$00 + sty sreg + sty sreg+1 + tosmuleax: tosumuleax: mul32: sta ptr1 diff --git a/libsrc/runtime/lsub.s b/libsrc/runtime/lsub.s index 2ade75e2e..30ae49da1 100644 --- a/libsrc/runtime/lsub.s +++ b/libsrc/runtime/lsub.s @@ -7,12 +7,17 @@ ; ; EAX = TOS - EAX ; - .export tossubeax - .import addysp1 - .importzp sp, sreg + .export tossub0ax, tossubeax + .import addysp1 + .importzp sp, sreg .macpack cpu +tossub0ax: + ldy #$00 + sty sreg + sty sreg+1 + tossubeax: sec eor #$FF diff --git a/libsrc/runtime/lumod.s b/libsrc/runtime/lumod.s index 00f5e7353..3128bc078 100644 --- a/libsrc/runtime/lumod.s +++ b/libsrc/runtime/lumod.s @@ -4,10 +4,15 @@ ; CC65 runtime: modulo operation for long unsigned ints ; - .export tosumodeax + .export tosumod0ax, tosumodeax .import getlop, udiv32 .importzp sreg, tmp3, tmp4, ptr2 +tosumod0ax: + ldy #$00 + sty sreg + sty sreg+1 + tosumodeax: jsr getlop ; Get the paramameters jsr udiv32 ; Do the division -- 2.39.5