Loader под DOS

Тема в разделе "WASM.BEGINNERS", создана пользователем alexey_k, 7 дек 2007.

  1. alexey_k

    alexey_k New Member

    Публикаций:
    0
    Регистрация:
    28 сен 2006
    Сообщения:
    24
    Привет всем!
    Подскажите, пожалуйста. Мне нужно написать прогу под DOS, которая будет устанавливать нужную мне дату, как текущую, затем запускать другую программу, восстанавливать дату и закрываться, своеобразный FreezeTrial, но вот как это реализовать под DOS?

    Зарание спасибо!
     
  2. SII

    SII Воин против дзена

    Публикаций:
    0
    Регистрация:
    31 окт 2007
    Сообщения:
    1.483
    Адрес:
    Подмосковье
    alexey_k

    Устанавливаешь дату, просишь ДОС запустить следующую программу (через какую-то из функций INT 21h, у меня нет их списка под рукой), а после её завершения восстанавливаешь.
     
  3. alexey_k

    alexey_k New Member

    Публикаций:
    0
    Регистрация:
    28 сен 2006
    Сообщения:
    24
    установка даты делается тоже чере 21-е прерывание?
     
  4. Vov4ick

    Vov4ick Владимир

    Публикаций:
    0
    Регистрация:
    8 окт 2006
    Сообщения:
    581
    Адрес:
    МО
    Вот отрывок из Ральфа Брауна
    Код (Text):
    1. INT 21 - DOS 1+ - GET SYSTEM DATE
    2.         AH = 2Ah
    3. Return: CX = year (1980-2099)
    4.         DH = month
    5.         DL = day
    6. ---DOS 1.10+---
    7.         AL = day of week (00h=Sunday)
    8. --------D-212B-------------------------------
    9. INT 21 - DOS 1+ - SET SYSTEM DATE
    10.         AH = 2Bh
    11.         CX = year (1980-2099)
    12.         DH = month (1-12)
    13.         DL = day (1-31)
    14. Return: AL = status
    15.             00h successful
    16.             FFh invalid date, system date unchanged
    17. Note:   DOS 3.3+ also sets CMOS clock; due to the limitations of the CLOCK$
    18.           driver interface, the CMOS time is also updated to the current
    19.           DOS time (which is the BIOS time-of-day clock with the default
    20.           CLOCK$ driver)
    21. --------D-214B-------------------------------
    22. INT 21 - DOS 2+ - "EXEC" - LOAD AND/OR EXECUTE PROGRAM
    23.         AH = 4Bh
    24.         AL = type of load
    25.             00h load and execute
    26.             01h load but do not execute
    27.             03h load overlay (see #01591)
    28.             04h load and execute in background (European MS-DOS 4.0 only)
    29.                 "Exec & Go" (see also AH=80h)
    30.         DS:DX -> ASCIZ program name (must include extension)
    31.         ES:BX -> parameter block (see #01590,#01591,#01592)
    32.         CX = mode (subfunction 04h only)
    33.                 0000h child placed in zombie mode after termination
    34.                 0001h child's return code discarded on termination
    35. Return: CF clear if successful
    36.             BX,DX destroyed
    37.             if subfunction 01h, process ID set to new program's PSP; get with
    38.                 INT 21/AH=62h
    39.         CF set on error
    40.             AX = error code (01h,02h,05h,08h,0Ah,0Bh) (see #01680 at AH=59h)
    41. Notes:  DOS 2.x destroys all registers, including SS:SP
    42.         under ROM-based DOS, if no disk path characters (colons or slashes)
    43.           are included in the program name, the name is searched for in the
    44.           ROM module headers (see #01595) before searching on disk
    45.         for functions 00h and 01h, the calling process must ensure that there
    46.           is enough unallocated memory available; if necessary, by releasing
    47.           memory with AH=49h or AH=4Ah
    48.         for function 01h, the AX value to be passed to the child program is put
    49.           on top of the child's stack
    50.         for function 03h, DOS assumes that the overlay is being loaded into
    51.           memory allocated by the caller
    52.         function 01h was undocumented prior to the release of DOS 5.0
    53.         some versions (such as DR DOS 6.0) check the parameters and parameter
    54.           block and return an error if an invalid value (such as an offset of
    55.           FFFFh) is found
    56.         background programs under European MS-DOS 4.0 must use the new
    57.           executable format
    58.         this function ignores the filename extension, instead checking the
    59.           first two bytes of the file to determine whether there is a valid
    60.           .EXE header (see #01594); if not, the file is assumed to be in .COM
    61.           format.  If present, the file may be in any of several formats which
    62.           are extensions of the original .EXE format (see #01593)
    63.         .COM-format executables begin running with the following register
    64.           values:
    65.                 AL = 00h if first FCB has valid drive letter, FFh if not
    66.                 AH = 00h if second FCB has valid drive letter, FFh if not
    67.                 CS,DS,ES,SS = PSP segment
    68.                 SP = offset of last word available in first 64K segment
    69.                 (note: AX is always 0000h under DESQview)
    70.         old-format executables begin running with the following register
    71.           values:
    72.                 AL = 00h if first FCB has valid drive letter, FFh if not
    73.                 AH = 00h if second FCB has valid drive letter, FFh if not
    74.                 DS,ES = PSP segment
    75.                 SS:SP as defined in .EXE header
    76.                 (note: AX is always 0000h under DESQview)
    77.         new executables begin running with the following register values
    78.                 AX = environment segment
    79.                 BX = offset of command tail in environment segment
    80.                 CX = size of automatic data segment (0000h = 64K)
    81.                 ES,BP = 0000h
    82.                 DS = automatic data segment
    83.                 SS:SP = initial stack
    84.           the command tail corresponds to an old executable's PSP:0081h and
    85.           following, except that the 0Dh is turned into a NUL (00h); new
    86.           format executables have no PSP
    87.         under the FlashTek X-32 DOS extender, only function 00h is supported
    88.           and the pointers are passed in DS:EDX and ES:EBX
    89.         DR DOS 6 always loads .EXE-format programs with no fixups and
    90.           .COM-format programs starting with 9Ch 55h (PUSHF/PUSH BP) above the
    91.           64K mark to avoid the EXEPACK bug, by extending the memory block
    92.           containing the program's environment; this code is disabled if the
    93.           name of the parent program as stored in the MCB is 'WIN'.
    94.         DR DOS 3.41 and 5.0 check for a valid filename before testing the
    95.           subfunction number, so the otherwise invalid subfunction 02h will
    96.           only return error code 01h if the given filename actually exists;
    97.           otherwise, errors 02h, 03h, or 05h are returned
    98. BUGS:   DOS 2.00 assumes that DS points at the current program's PSP
    99.         Load Overlay (subfunction 03h) loads up to 512 bytes too many if the
    100.           file contains additional data after the actual overlay
    101.         Load but Do Not Execute (subfunction 01h) is reported to corrupt the
    102.           top word of the caller's stack if the loaded module terminates with
    103.           INT 21/AH=4Ch in some versions of MS-DOS, including v5.00.
    104. SeeAlso: AX=4B05h,AH=4Ch,AH=4Dh,AH=64h/BX=0025h,AH=8Ah,INT 2E,INT 60/DI=0604h
    105.  
    106. Format of EXEC parameter block for AL=00h,01h,04h:
    107. Offset  Size    Description     (Table 01590)
    108.  00h    WORD    segment of environment to copy for child process (copy caller's
    109.                   environment if 0000h)
    110.  02h    DWORD   pointer to command tail to be copied into child's PSP
    111.  06h    DWORD   pointer to first FCB to be copied into child's PSP
    112.  0Ah    DWORD   pointer to second FCB to be copied into child's PSP
    113.  0Eh    DWORD   (AL=01h) will hold subprogram's initial SS:SP on return
    114.  12h    DWORD   (AL=01h) will hold entry point (CS:IP) on return
    115. SeeAlso: #01591,#01592
     
  5. alexey_k

    alexey_k New Member

    Публикаций:
    0
    Регистрация:
    28 сен 2006
    Сообщения:
    24
    Огромное пасиб!