;
; *** Listing 9-14 ***
;
; An illustration of the use of CBW to convert an
; array of unsigned byte values between 0 and 7Fh to an 
; array of unsigned words. Note that this would not work
; if Array1 contained values greater than 7Fh.
;
	jmp	Skip
;
ARRAY_LENGTH	equ	1000
;
Array1	label	byte
ARRAY_VALUE=0
	rept	ARRAY_LENGTH
	db	ARRAY_VALUE
ARRAY_VALUE=(ARRAY_VALUE+1) and 07fh
				;cycle source array byte
				; values from 0-7Fh
	endm
;
Array2	dw	ARRAY_LENGTH dup (?)
;
Skip:
	mov	si,offset Array1 ;set up array pointers
	mov	di,offset Array2
	mov	ax,ds
	mov	es,ax		;copy to & from same segment
	cld			;make string instructions
				; increment pointers
	mov	cx,ARRAY_LENGTH
	call	ZTimerOn
ProcessingLoop:
	lodsb			;get the next element
	cbw			;make it a word
	stosw			;save the word value
	loop	ProcessingLoop	;do the next element
	call	ZTimerOff
