Adapted div & mod for popptr1.

This commit is contained in:
IrgendwerA8
2018-05-24 03:55:40 +02:00
parent 746e3d1454
commit dd411efd1c
9 changed files with 92 additions and 122 deletions

View File

@@ -0,0 +1,22 @@
;
; Christian Krueger, 23-May-2018
;
; CC65 runtime: helper call for mod/div with signed ints
;
; When negating values, we will ignore the possibility here, that one of the
; values is $8000, in which case the negate will fail.
.export absvaludiv
.import _abs, popax, udiv16
.importzp ptr1, ptr4
absvaludiv:
jsr _abs
sta ptr4
stx ptr4+1 ; Save right absolute operand
jsr popax
jsr _abs
sta ptr1
stx ptr1+1 ; Save left absolute operand
jmp udiv16