2) Strings to be handled by the DOS interrupts all had to be terminated by the $ character).

Only for function 9 "print string". All other strings are ASCIIZ (zero-terminated).
Posted on 2007-06-14 21:16:01 by sinsi
If you're doing a standalone .com file in a Winbox don't forget to finish off with

mov ax,4C00
int 21

kinda thing.
Or it crashes.
Posted on 2007-06-16 05:31:26 by eek
As far as I remember, you didn't need to issue the DOS trap for COM files and I believe the above source is for a COM file. RET will do  8)

I remember having written a rename-file function in my OASML library like this:

; ------------------------------
FileRename PROC
  COMMENT *
    Description : Renames a file given its full null-terminated path to another given path
                  which should be null-terminated too. See note(s).

    Calling Convention : Push from left to right.

    Parameter(s) :
      WORD Param1 = Existing file path
      WORD Param2 = New file path

    Stack Usage: 8 Bytes.

    Note : 1) The FileRename procedure can be used to move files from one location to
              another as long as both files exist in the same disk.
          2) The AX register will be set to 0000h (Zero) if the procedure is through successfully
              or to one of the below values if an error occurrs:
                AX = 0002h (File not found)
                AX = 0005h (Access denied)
                AX = 0011h (Not the same device)
          3) Both Param1 and Param2 are assumed to have had been declared in the DS (Data segment).

    Example : Rename the file 'C:\Command.bak' to 'C:\Com.bak'

    .DATA
      FileName              DB              'C:\Command.bak', 0
      NewName              DB              'C:\Com.bak', 0
    .CODE
      PUSH    OFFSET FileName ; Existing file
      PUSH    OFFSET NewName  ; New file path
      CALL    FileRename      ; Rename the file
      ADD    SP , 0004h      ; Remove both of the parameters off of the stack
      TEST    AX , AX        ; See if AX == 0 (Success)
      JNE    @@Failed        ; Jump to ... if not
        ; Success
      @@Failed:
        ; Failure
  *
  PUSH    DX                              ; Push the data register onto the stack
  PUSH    DI                              ; Push the destination index onto the stack
  PUSH    BP                              ; Push the base pointer onto the stack
  PUSH    ES                              ; Preserve the extra segment
  MOV    AX , DS                        ; Move the data segment to the AX register
  MOV    ES , AX                        ; Move the AX register to the extra segment
  MOV    BP , SP                        ; Move the stack pointer to the base pointer
  MOV    AH , 56h                        ; Request Rename File operation
  MOV    DI , WORD PTR           ; DI = New file path
  MOV    DX , WORD PTR           ; DX = Existing file path
  DW      21CDh                          ; Issue the DOS interrupt
  JC      @@__FileRenameEP                ; Jump to ... if an error has occurred
  XOR    AX , AX                        ; AX = 0000h (Success)
  @@__FileRenameEP:                      ; End of the procedure routine
    POP    ES                            ; Restore the extra segment
    POP    BP                            ; Restore the base pointer
    POP    DI                            ; Restore the destination index
    POP    DX                            ; Restore the data register
  RET                                    ; Return to the calling procedure
FileRename ENDP
; ------------------------------


I hate DOS now. I'm glad I am not coding anything for it anymore.
Posted on 2007-06-16 08:21:19 by XCHG


I hate DOS now. I'm glad I am not coding anything for it anymore.


What did you progress onto?
Posted on 2007-06-16 10:04:31 by eek
Kind of off topic but I am coding my own OS. I've got PIC, PIT, HDD Driver, Physical Memory Management, Scheduling and multitasking working up to this point. The next step is creating my own File System and also extending the HDD Driver to use UDMA for faster transfers. That way I will be able to get virtual memory working for my user processes too.
Posted on 2007-06-16 13:09:45 by XCHG