• Intel 8085 Multiplication

    From Mercyful Fate@46:1/140 to all on Tue Nov 28 19:38:36 2017
    Figured i'd post some school fun I'm having with 8085 ASM using j8085 micro-processor emulator. Of course there is also a second one i think using Booth's algo, i'll post that one later on ..


    ; Intel 8085 ASM Bit Multiplication
    ; Multiplies bits in B and C Registers (7 x 3) = 21
    ;
    mvi b, 07 ; Multiplicand (M)
    mvi c, 03 ; Multiplier (P)(Q)
    mvi d, 00 ; Acculiminator (A)
    mvi e, 08 ; Loop Counter

    L2:mov a, c ; Move Multiplier to A
    rar ; Right Shift
    jnc L1 ; Not carry, then L1
    mov a, d ; A = A + M
    add b ; Add (M)
    mov d, a ; Copy Result to (A)

    L1:mov a, d ; Move result down (A)
    rar ; Shift Right
    mov d, a ; Move Result Back
    mov a, c ; Move result down (Q)
    rar ; Shift Right
    mov c, a ; Move Result Back
    dcr e ; Decrement loop
    jnz L2 ; Counter not zero, continue.

    out 00 ; Displays 0001 0101 / 21
    hlt

    --- Enthral BBS 0.700.2 (4.9.60-1-ARCH armv7l GNU/Linux)
    * Origin: haunting The chapel >>--> htc.zapto.org <--<< (46:1/140)