Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

ORG 0000h ; Start of program memory

; Equate directive
RB0 EQU 00h
RB1 EQU 01h
RB2 EQU 02h
RB3 EQU 03h
B EQU 08h
PSW EQU 0D0h

; Write 00h to register bank 0


MOV R0, #00h
MOV R1, R0
MOV R2, R0
MOV R3, R0

; Write 00h to register bank 1


MOV R0, #00h
MOV R4, R0
MOV R5, R0
MOV R6, R0
MOV R7, R0

; Write 00h to register bank 2


MOV R0, #00h
MOV R8, R0
MOV R9, R0
MOV R10, R0
MOV R11, R0

; Write 00h to register bank 3


MOV R0, #00h
MOV R12, R0
MOV R13, R0
MOV R14, R0
MOV R15, R0

; Write #1h to memory location 0h


MOV 00h, #01h

; Write #1h to memory location 9h


MOV 09h, #01h

; Write #1h to memory location 10h


MOV 10h, #01h

; Write 12h to RB0, R1, R2, and R4


MOV R0, #12h
MOV R1, R0
MOV R2, R0
MOV R4, R0

; Write 12h to RB2 and R6


MOV R2, #12h
MOV R6, R2

; Write #9h to memory location 5h


MOV 05h, #09h
; Write #9h to memory location 7h
MOV 07h, #09h

; Write #9h to memory location 0Bh


MOV 0Bh, #09h

; Write #9h to memory location 19h


MOV 19h, #09h

; Add the value in RB0, R0, and R2


ADD R6, R0
ADD R6, R2

; Multiply 2h and 10h


MOV R0, #2h
MOV R2, #10h
MUL AB

; Store the result in 8h and 0Ah


MOV 08h, R0
MOV 0Ah, R1

; Write 15h to RB1 and R4


MOV R4, #15h
MOV R1, #15h

; Write 15h to RB3 and R4


MOV R4, #15h
MOV R3, #15h

; Subtract #1h from the value in RB1, R4


MOV R5, R4
SUBB A, #1h
MOV R4, A

; Add #10h to the value in RB1, R3


MOV A, R3
ADD A, #10h
MOV R3, A
MOV R6, A
MOV R4, A
MOV 1Dh, A

; Store #5h in memory location 12h


MOV 12h, #5h

; Store #5h in memory location 15h


MOV 15h, #5h

; Store #5h in memory location 1Eh


MOV 1Eh, #5h

; Add #2h and #16h


MOV A, #2h
ADD A, #16h

; Write the sum to RB2 and R1


MOV R1, A
MOV R2, A

; Add the values in memory locations 10h and 12h


MOV A, 10h
ADD A, 12h

; Store the result in memory location 17h


MOV 17h, A

; Copy the value in RB0 to memory location 1Ah


MOV 1Ah, R0

; Write the value 13h into RB3 and R2


MOV R2, #13h
MOV R3, #13h

; Add #3h to the value in RB3, R2


MOV A, R2
ADD A, #3h
MOV R2, A
MOV R3, A

; Store the value 4h in the last register bank (RB3)


MOV R7, #4h

You might also like