home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / dos_ency / 4 / fig4_4.asm < prev    next >
Encoding:
Assembly Source File  |  1988-08-11  |  1.3 KB  |  35 lines

  1. TEXT    SEGMENT PARA PUBLIC 'CODE'
  2.  
  3.         ASSUME  CS:TEXT,DS:NOTHING,ES:NOTHING,SS:NOTHING
  4.  
  5. ENTRY_PROC      PROC    FAR     ;make proc FAR so RET will be FAR
  6.  
  7. ;Push pointer to termination vector in PSP
  8.         PUSH    DS              ;push PSP's segment address
  9.         XOR     AX,AX           ;ax = 0 = offset of Warm Boot vector in PSP
  10.         PUSH    AX              ;push Warm Boot vector offset
  11.  
  12. ;***** Place main task here *****
  13.  
  14. ;Determine which MS-DOS version is active, take jump if 2.0 or later
  15.  
  16.         MOV     AH,30h          ;load Get MS-DOS Version Number function code
  17.         INT     21h             ;call MS-DOS to get version number
  18.         OR      AL,AL           ;see if pre-2.0 MS-DOS
  19.         JNZ     TERM_0200       ;jump if 2.0 or later
  20.  
  21. ;Terminate under pre-2.0 MS-DOS (this is a FAR proc, so RET will be FAR)
  22.         RET                     ;pop PSP:00H into CS:IP to terminate
  23.  
  24. ;Terminate under MS-DOS 2.0 or later
  25. TERM_0200:
  26.         MOV     AX,4C00h        ;AH = MS-DOS Terminate Process with Return Code
  27.                                 ;function code, AL = return code of 00H
  28.         INT     21h             ;call MS-DOS to terminate 
  29.  
  30. ENTRY_PROC      ENDP
  31.  
  32. TEXT    ENDS
  33.  
  34.         END     ENTRY_PROC      ;declare the program's entry point
  35.