	;8080 block compare routine
;
	org	100h
;
	lhld	size	;get length
	mov	c,l	;into BC
	mov	b,h
	lhld	blk2	;get block 2 start
	xchg		;in DE
	lhld	blk1	;get block 1 start
cmplp:	ldax	d	;get a block 2 byte
	cmp	m	;compare w/block 1 byte
	jnz	nomatch	;jump if different
	mov	a,c	;else done all bytes?
	ora	b
	jz	done	;all bytes done
	dcx	b	;else, decrement count
	inx	h	;increment blk1 ptr
	inx	d	;increment blk2 ptr
	jmp	cmplp	;and go again
;
nomatch:
	shld	blk1sv	;save blk1 ptr
	xchg
	shld	blk2sv	;save blk2 ptr
	mov	l,c
	mov	h,b
	shld	szsv	;save byte count
	lxi	d,diffmsg  ;msg ptr in DE
	jmp	done1
done:
	lxi	d,okmsg	;msg ptr in DE
done1:	mvi	c,9	;BDOS print string
	call	5
	rst	7	;back to debugger
;
diffmsg:
	db	'Blocks different.$'
okmsg:	db	'Blocks compare OK.$'
;
	if	($ mod 2)
	ds	2-$ mod 2
	endif
size	dw	980h	;length to compare
blk1	dw	180h	;start of 1st block
blk2	dw	1f80h	;start of 2nd block
;M
szsv	ds	2	;count of remaining bytes
blk1sv	ds	2	;addr of diff in blk1
blk2sv	ds	2	;addr of diff in blk2
;
	end
