; division routine
; 1. calculate flag if result is negate and convert operands to positiv ; 2. second "divide" with unsigned suczessive Approximation ; 3. fix the sign of result

        .MACRO INTdivide
         LDR R2,%2
         LDR R3,%3 
         MOV R0,#0
         CMP R2,#0
          RSBLT R2,R2,#0
          SUBLT R0,R0,#1
         CMP R3,#0
          RSBLT R3,R3,#0
          MVNLT R0,R0
         STR R0,minusflag
         MOV  R0,#32.
         MOV  R1,#0
\loop ADDS R2,R2,R2
         ADCS R1,R1,R1
         CMP  R1,R3
         SUBGE  R1,R1,R3
         ADDGE  R2,R2,#1         
         SUB  R0,R0,#1
         CMP  R0,#0
         BNE  \loop        
    
         LDR R0,minusflag
         CMP R0,#0
         RSBNE R2,R2,#0 
         STR R2,%1
        .ENDM