2 ; Ullrich von Bassewitz, 13.08.1998
4 ; CC65 runtime: helper stuff for mod/div/mul with long signed ints
7 ; When negating values, we will ignore the possibility here, that one of the
8 ; values if $80000000, in which case the negate will fail.
12 .importzp sreg, tmp1, tmp2, ptr1, ptr3, ptr4
15 jsr getlop ; Get the operands
17 ; Remember the signs of the operands (that is, the high bytes) in tmp1 and
18 ; tmp2. Make both operands positive.
20 lda sreg+1 ; Is the left operand negative?
21 sta tmp1 ; Remember the sign for later
24 clc ; Make it positive
42 L1: lda ptr4+1 ; Is the right operand nagative?
43 sta tmp2 ; Remember the sign for later
46 clc ; Make it positive