;LOGIC_RULE--G5_11
;**********************************************************
datarea segment			;define data segment
  x		dw	20,20,20,20,20,20,20,20,20,20
  y		dw	10,10,10,10,10,10,10,10,10,10
  z		dw	10 dup(0)
  logic_rule	dw	00dch
datarea ends
;**********************************************************
prognam segment			;defint code segment
;----------------------------------------------------------
main	proc	far		;main part of program

	assume cs:prognam,ds:datarea

start:				;starting execution address

;set up stack for return
	push	ds		;save old data segment
	sub	ax,ax		;put zero in AX	
	push	ax		;save it on stack

;set DS register to current data segment
	mov	ax,datarea	;datarea segment addr
	mov	ds,ax	  	;  into DS register
  
;MAIN PART OF PROGRAM GOES HERE
	mov	bx,0
	mov	cx,10
	mov	dx,logic_rule
next:	mov	ax,x[bx]
	shr	dx,1
	jc	subtract
	add	ax,y[bx]
	jmp	short result
subtract:
	sub	ax,y[bx]
result:	mov	z[bx],ax
	add	bx,2
	loop	next
	ret			;return to DOS
main	endp			;end of main part of program
;----------------------------------------------------------
prognam ends			;end of code segment
;**********************************************************

	end	start		;end assembly
