Changing current directory. Help.

Thread Solved

Join Date: Jun 2008
Posts: 97
Reputation: Alex_ is an unknown quantity at this point 
Solved Threads: 2
Alex_'s Avatar
Alex_ Alex_ is offline Offline
Junior Poster in Training

Changing current directory. Help.

 
0
  #1
Oct 22nd, 2009
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
  1. TITLE ep1_7
  2. .MODEL SMALL
  3. .STACK 10h
  4. .DATA
  5. msg DB 'Current directory:',0h
  6. msg_l equ $-msg
  7. buff db 64 dup('$')
  8. ;f_handle dw 1 dup(?)
  9. .CODE
  10. begin: mov ax,@DATA
  11. mov ds,ax
  12. ;Getting current directory
  13. mov ah,47h
  14. mov dl,0
  15. mov ds,buff
  16. ;showing the returned pathname
  17. mov dx,OFFSET buff
  18. mov ah,09h
  19. int 21h
  20. ;bail out
  21. mov ax,4c00h
  22. int 21h
  23. 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.
Last edited by Alex_; Oct 22nd, 2009 at 2:10 pm.
Fundamental law of life:
do{ ThingsToDo+=me.CompleteTask(ThingsToDo); }while(ThingsToDo); Die(me);
Law of the Spirit:
do{ Rebuke(me); }while(!me.Repented); LiveEternal(me);
PM me to know more why i wrote this or what it means.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 133
Reputation: NotNull is an unknown quantity at this point 
Solved Threads: 13
NotNull's Avatar
NotNull NotNull is offline Offline
Junior Poster
 
1
  #2
Oct 22nd, 2009
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:
  1. waitkey:
  2. mov ah, 0x6
  3. mov dx, 0xff
  4. int 0x21
  5. jz waitkey ; if no char recieved ZF=1
Last edited by NotNull; Oct 22nd, 2009 at 6:34 pm.
----------------------------------------------------------
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
Reply With Quote Quick reply to this message  
Reply

Tags
adress, buffer, directory

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Assembly Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC