You are on page 1of 2

;****************************************************************************

; ADDITION-2
;****************************************************************************
.global _c_int00
.data
aguend .word 0002h ; .word directive is used to initialize a label .The label
;has value 400h. (memory location 400h)

addend .word 0009h

.bss sum, 1 ;The .bss directive reserves 1 word space


;for variable (sum) in the .bss section

.mmregs
.text

_c_int00:

STM #aguend,AR1
STM #addend,AR2
STM #sum,AR3

LD *AR1,A
ADD *AR2,A
STL A,*AR3

hlt: B hlt

.end
;****************************************************************************
; ARRAY ADDITION
;****************************************************************************
.global _c_int00
.data

N .set 3 ;Symbol N=3

array .word 0003h, 0002h, 0002h, 0001h ; .word directive is used to initialize
; several words, A label would point to the
; first word. Here label (array) start from
; the value 400h.

.bss sum, 1 ; The .bss directive reserves 1 word space


;for variable (sum) in the .bss section
.mmregs

.text

_c_int00:
STM #array, AR1
STM #sum, AR2
STM #N-1, AR3

LD *AR1+, A

Loop: ADD *AR1+, A


BANZ Loop, *AR3 - ;If the value in auxiliary register AR3 is
;non zero , then branch to the label
Loop .
; Otherwise drop through to the next line of
; the programme .In either case decrement AR3

STL A, *AR2

hlt: B hlt

.end

You might also like