Finished the rename program 
Author Message
 Finished the rename program

; today.asm  Tasm  Andrew Kennedy  Jan 2003 Help from Stealth
;
; Store date, use to rename bookmarks.html -> 011303.html(current date format)
; Win 98 +  Future improvements: add command line options on what file to
rename and error checking

model small
stack 200h

data

    day           db '00'
    month         db '00'
    year          db '00'
    file_name     db   'bookmarks.html',0
    new_name      db   128 dup(?)

code
 begin:

                 mov ds,ax
                 mov es,ax

                 mov ah,4      ; get time
                 int 1ah

                 mov al,cl       ; store time
                 xor ah,ah       ;   |
                 mov bl,10h      ;
                 div bl
                 add ax,3030h
                 mov [year],al
                 mov [year+1],ah

                 mov al,dh
                 xor ah,ah
                 div bl
                 add ax,3030h
                 mov [month],al
                 mov [month+1],ah

                 mov al,dl
                 xor ah,ah
                 div bl
                 add ax,3030h
                 mov [day],al
                 mov [day+1],ah

        mov     al, [month]       ; build time based new filename
        mov     byte ptr new_name, al

        mov     al, [month + 1]
        mov     byte ptr new_name + 1, al

        mov     al, [day]
        mov     byte ptr new_name + 2, al

        mov     al, [day + 1]
        mov     byte ptr new_name + 3, al

        mov     al, [year]
        mov     byte ptr new_name + 4, al

        mov     al, [year + 1]
        mov     byte ptr new_name + 5, al

        mov     al, '.'
        mov     byte ptr new_name + 6, al

        mov     al,'h'    
        mov     byte ptr new_name + 7,  al

        mov     al,'t'
        mov     byte ptr new_name + 8, al

        mov     al,'m'
        mov     byte ptr new_name + 9, al

        mov     al,'l'
        mov     byte ptr new_name + 10, al

        mov     al,00                  ; make it null terminated
        mov     byte ptr new_name + 11, al

;  ds:dx = segment:offset of ascii file name
;  es:di = segment:offset of new ascii pathname for file

          xor       ax,ax
          xor       dx,dx
          mov       ax,7156h        ; rename file  Win 98 +
          lea       dx, file_name   ; old name
          lea       di, new_name    ; sets the new name
          int       21h

exit:
                  mov ax,4c00h
                  int 21h

end begin



Sat, 02 Jul 2005 06:08:05 GMT  
 Finished the rename program


Hello Andrew,

Quote:
> ; today.asm  Tasm  Andrew Kennedy  Jan 2003 Help from Stealth
> ;
> ; Store date, use to rename bookmarks.html -> 011303.html(current date
format)
> ; Win 98 +  Future improvements: add command line options on what file to
> rename and error checking

[Snip]

Well done !

(just remove those superfluous "xor ax,ax" and "xor dx,dx" commands, just
before the actual renaming-call)

Regards,
  Rudy Wieser



Sat, 02 Jul 2005 07:06:12 GMT  
 Finished the rename program

Quote:
>(just remove those superfluous "xor ax,ax" and "xor dx,dx" commands, just
>before the actual renaming-call)

Your right, sometimes I forget to look up what registers get destroyed or
which don't. Another thing is so many programs are written in com form, which
really isn't much faster with just 420 bytes less. Converting them to exe
form takes awhile, but it's easier not having to use the segment overrides,
etc. And then there's the non-standard non-Tasm code out there to have to
fix it right. I feel sorry for those folks who have to deal with WinMe, 2000,
and XP. Like buying a Lexus and discovering there isn't any interior lights,
ash tray, or glove box anymore. :-)


Sat, 02 Jul 2005 22:04:29 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Wait until program finish on CW5ee

2. RUN used in program, but not waiting for process to finish

3. How do you finish off a LabView Program

4. Finished program

5. stupid question: how can I finish a program?

6. HELP!! I need to finish this program

7. finishing program

8. calling a program without waiting for it to finish

9. Program very slow to finish

10. HELP: Program to rename a dir

11. Free renaming program

12. F77: Rename/Moving a file inside a program

 

 
Powered by phpBB® Forum Software