bigbeebrian
Programmer
the following code snippet copies from one place to another but doesn't want to decrement cx . An infinite loop has been created. can anyone tell me why and how I can fix it.
thanks
.MODEL SMALL
.386
.STACK 1024
.DATA
Message DB 'Press Any Key$'
videoSeg = 0B800h
scrnStorage = (25*80*2)
buffer DB scrnStorage dup(?)
.CODE
main PROC
mov si,videoSeg ;set DS to video segment
mov ds,si
mov si, 0 ; use as index
mov di,seg buffer ;set ES to buffer
mov es,di
mov di,offset buffer ; use as index
mov cx,scrnStorage ;counter
mov dl,[si] ;move video contents into buffer
mov es:[di],dl
inc si ;move thru video memory
inc di ;move thru buffer memory
dec cx ;decrement counter
cmp cx,0
jz spot
spot:
thanks
.MODEL SMALL
.386
.STACK 1024
.DATA
Message DB 'Press Any Key$'
videoSeg = 0B800h
scrnStorage = (25*80*2)
buffer DB scrnStorage dup(?)
.CODE
main PROC
mov si,videoSeg ;set DS to video segment
mov ds,si
mov si, 0 ; use as index
mov di,seg buffer ;set ES to buffer
mov es,di
mov di,offset buffer ; use as index
mov cx,scrnStorage ;counter
mov dl,[si] ;move video contents into buffer
mov es:[di],dl
inc si ;move thru video memory
inc di ;move thru buffer memory
dec cx ;decrement counter
cmp cx,0
jz spot
spot: