;Ben Weir
;CIS 35
;Program 1
;This program has two 10-byte strings for input. It outputs a 20-byte
;string that takes a byte from the first string, then the second, then
;the first, and so on until it's finished.
;---------------------------------------------------------------------
.model small
.stack 100h
.data
string1 db '1234567890'
string2 db 'ABCDEFGHIJ'
string3 dw 0ah dup (?) ;0Ah(10d) words (20d bytes) to hold result
db '$' ;for string printing function
.code
mov ax, @data
mov ds, ax
mov es, ax ;initialize data and extra segments
lea si, string1
lea bx, string2
lea di, string3
mov cx, 0ah ;10 bytes in each source string
again:
mov al, [si] ;get part of first string
mov ah, [bx] ;get part of second string
mov word ptr [di], ax ;put it in source
inc si
inc bx
inc di
inc di ;increment pointers
loop again
mov ah, 09h ;display string3
lea dx, string3
int 21h
mov ax, 4c00h ;terminate program
int 21h
end
               (
geocities.com/siliconvalley/park)                   (
geocities.com/siliconvalley)