<commit_before>;; cpHLDE [Maths]
;;  Compares HL to DE.
;; Output:
;;  Same as z80 CP instruction.
cpHLDE:
    or a
    sbc hl, de
    add hl,de
    ret
;; cpHLBC [Maths]
;;  Compares HL to BC.
;; Output:
;;  Same as z80 CP instruction.
cpHLBC:
    or a
    sbc hl, bc
    add hl,bc
    ret
;; cpBCDE [Maths]
;;  Compares DE to BC.
;; Output:
;;  Same as z80 CP instruction.
cpBCDE:
    push hl
    ld h, b
    ld l, c
    or a
    sbc hl, de
    pop hl
    ret
    
;; DEMulBC [Maths]
;;  Performs `HL = DE * BC`
DEMulBC:
    push af
        ld hl, 0
        ld a, 16
.loop:
        add hl, hl
        sla c
        rl b
        jr nc, $ + 3
        add hl, de
        dec a
        jr nz, .loop
    pop af
    ret
    
;; DEMulA [Maths]
;;  Performs `HL = DE * A`
DEMulA:
    push bc
        ld hl, 0
        ld b, 8
.loop:
        add hl, hl
        rla
        jr nc, $ + 3
        add hl, de
        djnz .loop
    pop bc
    ret
    
;; sDEMulA [Maths]
;; Performs `HL = DE * A`. The operation is signed.
sDEMulA:
    push bc
        ld hl, 0
        ld bc, 0x0800
        or a
        jp p, .loop
        sbc hl, de
.loop:
        add hl, hl
        rla
        jr nc, $ + 4
        add hl, de
        adc a, c
        djnz .loop
    pop bc
    ret


;; mul16To32 [Maths]
;;  Performs an unsigned multiplication of DE and BC.
;; Inputs:
;;  DE: Factor 1
;;  BC: Factor 2
;; Outputs:
;;  DEHL: Result of DE * BC
mul16To32:
    xor hl, hl

    sla e
    rl d
    jr nc, $ + 4
    ld h, b
    ld l, c

.macro mul16To32Iter
    add hl, hl
    rl e
    rl d
    jr nc, $ + 6
    add hl, bc
    jr nc, $ + 3
    inc de<commit_msg>I dun goofed<commit_after>;; cpHLDE [Maths]
;;  Compares HL to DE.
;; Output:
;;  Same as z80 CP instruction.
cpHLDE:
    or a
    sbc hl, de
    add hl,de
    ret
;; cpHLBC [Maths]
;;  Compares HL to BC.
;; Output:
;;  Same as z80 CP instruction.
cpHLBC:
    or a
    sbc hl, bc
    add hl,bc
    ret
;; cpBCDE [Maths]
;;  Compares DE to BC.
;; Output:
;;  Same as z80 CP instruction.
cpBCDE:
    push hl
    ld h, b
    ld l, c
    or a
    sbc hl, de
    pop hl
    ret
    
;; DEMulBC [Maths]
;;  Performs `HL = DE * BC`
DEMulBC:
    push af
        ld hl, 0
        ld a, 16
.loop:
        add hl, hl
        sla c
        rl b
        jr nc, $ + 3
        add hl, de
        dec a
        jr nz, .loop
    pop af
    ret
    
;; DEMulA [Maths]
;;  Performs `HL = DE * A`
DEMulA:
    push bc
        ld hl, 0
        ld b, 8
.loop:
        add hl, hl
        rla
        jr nc, $ + 3
        add hl, de
        djnz .loop
    pop bc
    ret
    
;; sDEMulA [Maths]
;; Performs `HL = DE * A`. The operation is signed.
sDEMulA:
    push bc
        ld hl, 0
        ld bc, 0x0800
        or a
        jp p, .loop
        sbc hl, de
.loop:
        add hl, hl
        rla
        jr nc, $ + 4
        add hl, de
        adc a, c
        djnz .loop
    pop bc
    ret


;; mul16To32 [Maths]
;;  Performs an unsigned multiplication of DE and BC.
;; Inputs:
;;  DE: Factor 1
;;  BC: Factor 2
;; Outputs:
;;  DEHL: Result of DE * BC
mul16To32:
    ld hl, 0

    sla e
    rl d
    jr nc, $ + 4
    ld h, b
    ld l, c

.macro mul16To32Iter
    add hl, hl
    rl e
    rl d
    jr nc, $ + 6
    add hl, bc
    jr nc, $ + 3
    inc de
{'fraction_non_alphanumeric': 0.09880331389996931, 'fraction_numerical': 0.023013194231359314, 'mean_word_length': 1.323592302209551, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3898182', 'n_tokens_mistral': 1479, 'n_tokens_neox': 1373, 'n_words': 493}