]> git.sur5r.net Git - cc65/blobdiff - libsrc/runtime/ludiv.s
no TGI_ERR_NO_MEM or TGI_ERR_NO_IOCB anymore: replaced by TGI_ERR_NO_RES
[cc65] / libsrc / runtime / ludiv.s
index 1d8dc730ae51808e773ffc49daad1d7fbe17cfcb..aa40a962063dc3660d6681a0f5b97ab1eee96261 100644 (file)
@@ -4,11 +4,16 @@
 ; CC65 runtime: division for long unsigned ints
 ;
 
-               .export         tosudiveax, getlop, udiv32
+               .export         tosudiv0ax, tosudiveax, getlop, udiv32
        .import         addysp1
        .importzp       sp, sreg, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4
 
-tosudiveax:
+tosudiv0ax:
+        ldy     #$00
+        sty     sreg
+        sty     sreg+1
+
+tosudiveax:                         
        jsr     getlop          ; Get the paramameters
        jsr     udiv32          ; Do the division
        lda     ptr1            ; Result is in ptr1:sreg
@@ -72,7 +77,7 @@ L0:   asl     ptr1
 
 ; Overflow, do the subtraction again, this time store the result
 
-       sta     ptr4+1          ; We have the high byte already
+        sta            tmp4            ; We have the high byte already
        pla
        sbc     ptr3            ; byte 0
        pha