Write introduction of the Article here.

Simple programming examples

Addition

Program:-Write an ALP to perform addition of two 8-bit numbers

ORG 00H
MOV A,#30H  ;Load immediate value into A
MOV R0,#40H ;Load immediate value into R0
ADD A,R0    ;A=A+R0
END

********Output***********
A=30H + 40H =70H

Video


Substraction

Program:-Write an ALP to perform Substraction of two 8-bit numbers

ORG 00H     ;Originate from initial memory location
MOV A,#40H  ;Load immediate value into A
MOV R0,#30H ;Load immediate value into R0
SUBB A,R0   ;A=A-R0
END

********Output***********
A=40H - 30H =10H

Video


Multiplication

Program:-Write an ALP to perform Multiplication of two 8-bit numbers

ORG 00H     ;Originate from 00H memory location
MOV A,#02H  ;Load immediate value into A
MOV B,#03H  ;Load immediate value into B
MUL AB      ;Perform multipication
END

********Output***********
02H * 03H =0006H
Higher 8-bits of result=B=00H
Lower 8-bits of result =A=06H

Video


Division

Program:-Write an ALP to perform Division of two 8-bit numbers

ORG 00H    ;Originate from 00H memory location
MOV A,#06H  ;Load immediate value into A as Divident
MOV B,#03H  ;Load immediate value into B as Divisor
DIV AB      ;Perform Division operation
END

********Output***********
A=06H
B=03H
After division
A=02H=Quotient
B=00H=Remainder

Video


References

  • Notes by Prof Sujit Wagh, SKNCOE, Pune
  • WikiNote Foundation
Tags:
Created by Sujit Wagh on 2017/08/19 15:12