LIB2 / FILE VIEW

sub_u32_u32.inc

DOWNLOAD ORIGINAL ↓

; CLARITAS TIP u32/1 - sub_u32_u32.inc
; Public: USUB32

;
; ROM-independent exact transplant of OM-52C C-ROM routine E990.
;
; Contract:
;   input:
;       $15-$18  unsigned 32-bit minuend, low word first
;       $5-$8    unsigned 32-bit subtrahend, low word first
;
;   output:
;       $15-$18  ($15-$18 - $5-$8) mod 2^32
;
;   arithmetic:
;       unsigned wraparound modulo 2^32
;
; Historical donor:
;   OM-52C E990..E99A
;   length 11 bytes
;   SHA-256:
;   991f03968a7059a0ec3848fa6017e2091eaa260ad0abcb388ca69a99f4fb03b0
;
; The donor propagates low-word borrow by subtracting the word value 1 via $SY.
; No underflow/status result is returned.

#LIST

USUB32:
        SBW     $15,$5
        JR      NC,_USUB_HI
        SBW     $17,$SY
_USUB_HI:
        SBW     $17,$7
        RTN