[net.micro.pc] Need help with MS MASM 4.0

siewert@puff.UUCP (Dean Siewert) (04/26/86)

I'd like to thank anyone that might take the time to respond tothis.

I'm just starting in 8086 assembly langage and trying to get a program to
work that would copy the graphics screen from segment B800H to an unused
section of memory.  the idea is that once several images are out in memory,
I could do very fast loads of these images into the video buffer.

Unfortunately, things are not working when the program terminates.  The machine
hangs.  Using SYMDEB, it looks that when the program hits the RET command, it
jumps off into never-never land.

Following is the code I've been working with:


TITLE	Memory Mover
;----------------------Code Area Begins -----------------------------+
;
code	segment 	 public 'CODE'
	assume cs:code,es:code,ds:code,ss:code
;
;----------------------Main Program Begins --------------------------+
;
; Program to pull a image from DEF SEG 3840 to the graphics display page
;
main	proc	far
;
	push 	bp
	push	bx
	push	ax
	mov	ax,	0b800H
	mov	ds,	ax
	mov	ax,	04000H
	mov 	es,	ax
	mov	bx,	2
label1:
;  decrement counter
	dec 	bx
;  if ax less than zero then goto label2
	cmp 	bx,	0
	jl	label2
;  Move the value from &H4000,
;    to &b800,
	mov	 ax,	es:[bx]
	mov	ds:[bx],ax
;  goto label
	jmp 	label1

label2:
	;  end program
        nop
	pop 	ax
	nop	
	pop	bx
	nop
	pop	bp
	nop	
	ret
	main    endp
	code 	ends
	end	main

  I have checked that the registers are left as they are when the 
  program is first entered and the stack is empty.  Can someone give me
  an idea of what I am doing wrong?

  Also, I have learned that it doesn't work to define the data and extra
  segment registers as pointing to some absolute addess by using:

			DATA1  segment at B800H 

  in the data definition segemt.  Is there some other way of doing this
  than how I did it, (move the desired value into the ES and DS registers
  manually?

  Well, if anyone can give me some pointers, thanks.

				Dean Siewert
				siewert@puff.wisc.edu

				University of Wisconsin-Madison