In the 8085, the LDA instruction loads the accumulator from memory, while the STA instruction stores the accumulator to memory. LDA is a read, while STA is a write. LDA is opcode 3AH, while STA is opcode 32H.
Chat with our AI personalities
Lda 3000mov c,acpi 02hjz 2025cpi 01hjz 202dcpi 01hjz 202dmvi b,02hsub bjz 202djnc 2015inr bmov a,ccmp bjz 2025jnz 2015mvi a,01sta 27f6jmp 2032mvi a,0esta 27f6call 06fahlt
Lxi b, 0000h lhld 8000h xchg lhld 8002h dcx d l006: lda 8002h add l mov l, a lda 8003h adc h mov h, a jnc l013 l013: inx b dcx d mov a, d ora e jnz l006 shld 8006h mov l, c mov h, b shld 8004h hlt
Lda 8500 mov c,a cpi 02h jz l1 cpi 01h jz l1 mvi e,01h mvi h,00 mvi b,02h l4: mvi d,00 mov a,c l2: sub b inr d cmp b jnc l2 cmp e jz l3 jnc l3 inr h l3:inr b dcr d jnz l4 mov a,h cmp e jz l5 jnc l5 mov a,01 sta 8501 hlt l5: mov a,0e sta 8501 hlt
LXI SP, 27FFH ; Initialize stack pointer LDA 2200H ; Get the number CPI 02H ; Check if number is greater than 1 JC LAST MVI D, 00H ; Load number as a result MOV E, A DCR A MOV C,A ; Load counter one less than number CALL FACTO ; Call subroutine FACTO XCHG ; Get the result in HL SHLD 2201H ; Store result in the memory JMP END LAST: LXI H, 000lH ; Store result = 01 END: SHLD 2201H HLT Subroutine Program: FACTO:LXI H, 0000H MOV B, C ; Load counter BACK: DAD D DCR B JNZ BACK ; Multiply by successive addition XCHG ; Store result in DE DCR C ; Decrement counter CNZ FACTO ; Call subroutine FACTO RET ; Return to main program