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
        .STACK    10h
        	msg	DB 'Current directory:',0h
		msg_l	equ	$-msg
        	buff		db  64 dup('$')
		;f_handle	dw  1 dup(?)
        	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.

Edited by Alex_: n/a

7 Years
Discussion Span
Last Post by NotNull

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:

  mov ah, 0x6
  mov dx, 0xff
  int 0x21
  jz waitkey ; if no char recieved ZF=1

Edited by NotNull: n/a

Votes + Comments
This solved the thread
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.