The MASM Forum
Miscellaneous => 16 bit DOS Programming => Topic started by: hellfix on June 14, 2012, 04:18:50 AM
-
Im trying to add another buffer to a program but it only prints one character im
trying to make a monster prorgam full of all sorts of code but im starting with using
strings and arrays for my own rube goldberg program a bunch of simple task but
the program only prints once character i want to know why.
.386
.model flat,c
.stack 100h
includelib msvcrt
.data
printf proto arg:ptr byte
string byte "Abby","Fred","john","kent","Mary",0
buffer byte 20 dup(?),0
buffer2 byte 4 dup(?),0
.code
public main
main proc
mov ecx,5
lea esi,string
lea edi,buffer
cld ;set the direction flag to decrement
;ecx instead increment
while1: cmp ecx,0
je endloop
push ecx
mov ecx,4
rep movsb
mov ecx,0
while2: cmp ecx,4
je endloop2
mov ebx, offset buffer
mov edx, offset buffer2
mov al,[ebx]
mov [edx],al
inc ebx
inc edx
endloop2:nop
invoke printf,addr buffer2
pop ecx
dec ecx
jmp while1
endloop:invoke printf,addr buffer
ret
main endp
end main
i want to copy what has already been stored in one of the buffers to another buffer how can i do this in the simplest way
-
im trying to nest loops can it be done
-
hellfix,
Yes you can have nested loops, but I'm not sure that you can do it with the HLL constructs.
Dave.