Hello everybody. I'm trying to get the current directory, save it, changing the current dir, then coming back to the previous one.

My code so far

TITLE ep1_7
	.MODEL    SMALL
        .STACK    10h
        .DATA
        	msg	DB 'Current directory:',0h
		msg_l	equ	$-msg
        	buff		db  64 dup('$')
		;f_handle	dw  1 dup(?)
	.CODE
        	begin:   mov	ax,@DATA
                mov	ds,ax
		;Getting current directory
		mov	ah,47h
		mov	dl,0
		mov	ds,buff
		;showing the returned pathname
		mov  dx,OFFSET buff
		mov  ah,09h
		int  21h
		;bail out
		mov	ax,4c00h	
	        int	21h	
                END	begin

My problem is that i have an error at line 15. I don't know how to put the buffer's adress into ds. Can some one help me?

Btw , please tell me what is the function that waits for a key to be pressed and/or the one that waits a certain given time to pass.

mov ds, seg buff ; works in MASM
mov si, offset buff

All you need is the segment address on which the buff string
lies, this is because your generating an .EXE.

Here's one way to wait for a key press:

waitkey:
  mov ah, 0x6
  mov dx, 0xff
  int 0x21
  jz waitkey ; if no char recieved ZF=1
commented: This solved the thread +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.