Skip to main content

8085 ALP: multiplication table of a number

Short answer

Load the number from 8230H into A and B. Add B repeatedly to generate successive multiples. Store ten entries (n×1 to n×10) starting at 8231H; for n=05H the table is 05H, 0AH, 0FH, ..., 32H.

Write a program for 8085 to generate multiplication table of a number stored at 8230H and store the generated table starting at 8231H. For example, if location 8230H has number 05H then store 05H at 8231H, 0AH at 8232H and so on.

Assumptions: the table has 10 entries (n x 1 to n x 10), and each entry fits in one byte (n up to 19H = 25). For n = 05H the table is 05, 0A, 0F, 14, ... 32H.

Method: no multiplication instruction is needed: start with A = n and add n repeatedly to get the next multiple.

        LDA 8230H       ; A = number n
        MOV B,A         ; B = n
        LXI H,8231H     ; HL -> first table location
        MVI C,0AH       ; 10 entries (n x 1 ... n x 10)
LOOP:   MOV M,A         ; store current multiple
        INX H
        ADD B           ; next multiple = previous + n
        DCR C
        JNZ LOOP
        HLT

Result for n = 05H: 8231H = 05H, 8232H = 0AH, 8233H = 0FH, ... 823AH = 32H.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Microprocessor chapter 2 questions →