943,945 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Marked Solved
  • Views: 1177
  • Assembly RSS
Oct 22nd, 2009
0

Changing current directory. Help.

Expand Post »
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
asm Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 10
Solved Threads: 3
Junior Poster
Alex_ is offline Offline
175 posts
since Jun 2008
Oct 22nd, 2009
1
Re: Changing current directory. Help.
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:
Assembly Syntax (Toggle Plain Text)
  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.
Reputation Points: 36
Solved Threads: 19
Junior Poster
NotNull is offline Offline
198 posts
since Oct 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: add
Next Thread in Assembly Forum Timeline: Question regarding output





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC