home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / DIR / PUSH.ZIP / PUSH.ASM next >
Encoding:
Assembly Source File  |  1991-12-12  |  14.3 KB  |  560 lines

  1. PAGE    58,132
  2. TITLE    PUSH    10-8-90    [12-12-91]
  3.  
  4. ;Disassembled via good old ASMGEN.
  5. ;Commented, no changes (per copyright requirements).
  6. ;However, if you were to happen to "/dTOADTWEAK" when you
  7. ;assembled this sucker ...
  8. ;
  9. ;Warning:  I couldn't test the original PUSH.COM (renamed to
  10. ;PUSH0.COM) or this disassembly because I only have DOS 3.1.
  11. ;The original PUSH.COM requires DOS 3.3 minimum.
  12. ;
  13. ;Since all seems to work just fine with PC-DOS 3.1
  14. ;(and presumably earlier versions as well),
  15. ;TOADTWEAK will extend legal versions down to DOS 2.0
  16. ;(below which we lose handles).
  17. ;We also patch "@echo off" to be a simple " echo off"
  18. ;since earlier DOS versions don't seem to like that '@' character.
  19. ;
  20. ;David Kirschbaum
  21. ;Toad Hall
  22. ;kirsch@usasoc.soc.mil
  23.  
  24. LF    EQU    0AH
  25. CR    EQU    0DH
  26.  
  27. CSEG    SEGMENT
  28.     ASSUME DS:CSEG, SS:CSEG ,CS:CSEG ,ES:CSEG
  29.  
  30.     ORG    100H
  31.  
  32. _Push    proc    near
  33.     MOV    SP,OFFSET stacktop_84A    ;stack top
  34.     MOV    DX,OFFSET msg62E    ;'PUSH (c) ...'
  35.     MOV    AH,9
  36.     INT    21H
  37.  
  38.     MOV    AH,30H            ;get DOS version
  39.     INT    21H
  40.     XCHG    AH,AL
  41.     CMP    AX,031EH        ;version 3.30?
  42.     JNB    Skp11F            ;yep, or higher
  43.  
  44. IFDEF    TOADTWEAK
  45. ;Everything works fine with PC-DOS 3.1
  46. ;except for a problem with that "@echo off" command
  47. ;written to the batch file.
  48. ;Let's just say if <DOS3.3, we delete that "@" character, eh?
  49. ;And let's choke&die if <DOS2.0.
  50.  
  51.     mov    byte ptr txt47F,' '    ;blank out that feelthy '@'    
  52.     cmp    ax,0200H        ;< DOS 2.0?
  53.     jnb    Skp11F            ;nope, drive on
  54.     
  55. ENDIF
  56.     MOV    DX,OFFSET msg6F7    ;'Requires DOS 3.3 or later'
  57.                     ;(or maybe 'DOS 2.0 or later')
  58.     MOV    CX,LEN6F7    ;25H    ;msg length
  59.     JMP    MsgTerm_3BD        ;display msg, terminate ERROR 1
  60.  
  61. Skp11F:
  62.     MOV    AH,19H            ;report current drive
  63.     INT    21H
  64.     ADD    AL,'A'            ;Asciify it
  65.     MOV    currdriv_5E0,AL        ;save in string
  66.     MOV    AH,47H            ;get current directory
  67. IFNDEF    TOADTWEAK
  68.     MOV    DL,0            ;0 = current drive
  69. ELSE            ;v1.1
  70.     xor    dl,dl            ;0 = current drive        v1.1
  71. ENDIF
  72.     MOV    SI,OFFSET currdir_5E8    ;directory string buffer
  73.     INT    21H
  74.     PUSH    ES
  75.     MOV    ES,DS:2CH        ;environment segment
  76.     MOV    CS:envseg_3DD,ES    ;save it
  77.     ASSUME    ES:NOTHING        ;actually environment segment
  78.  
  79. ;Scan environment
  80. IFNDEF    TOADTWEAK
  81.     MOV    DI,0FFFFH
  82. ELSE                ;v1.1
  83.     mov    cx,0FFFFH        ;handy constant        v1.1
  84.     mov    di,cx            ;initialize pointer    v1.1
  85. ENDIF
  86.     XOR    AX,AX            ;scan for environ string end
  87.  
  88. EnvLup_140:
  89.     INC    DI
  90.     CMP    ES:[DI],AX        ;hit msg end?
  91.     JNZ    EnvLup_140        ;not yet
  92.     ADD    DI,4            ;bump to next string
  93.     MOV    envptr_3DB,DI        ;save env string pointer
  94.     CMP    WORD PTR ES:[DI+1],'\:'    ;need drive in PATH
  95.     JZ    PathOk_15F
  96.      MOV    DX,OFFSET msg71C    ;'Bad PATH - must include drive.'
  97.      MOV    CX,LEN71C    ;20H    ;msg length
  98.      JMP    NotPushed_3B3        ;'not pushed', terminate
  99.  
  100. PathOk_15F:
  101.     CLD                ;insure fwd scan
  102. IFNDEF    TOADTWEAK
  103.     MOV    CX,0FFFFH        ;max scan
  104.     MOV    AL,0            ;dumb, AX is still 0
  105. ELSE                ;v1.1
  106. ;AL is still 0.
  107. ;CX is still initialized to 0FFFFH for max scan.
  108. ENDIF
  109.     REPNZ    SCASB            ;to find PATH string end
  110.     NEG    CX            ;adjust
  111.     STD                ;now scan backwards
  112.     MOV    AL,'\'            ;scan for directory separator
  113.     REPNZ    SCASB
  114.     INC    CX            ;adjust
  115.     MOV    ofs_3DF,CX        ;save offset to PATH '\'
  116.     CLD                ;insure fwd again
  117.     POP    ES
  118.     ASSUME    ES:CSEG
  119.  
  120.     MOV    DI,OFFSET path3E1    ;path buffer
  121.     CALL    CopyPath_399        ;copy PATH from environment to buffer
  122.     MOV    SI,OFFSET batname_3C6    ;'POP.BAT',0,CR,LF,'$'
  123.     MOV    CX,LEN3C6    ;0BH    ;chars to copy
  124.     REPZ    MOVSB            ;add to PATH
  125.     SUB    DI,OFFSET path3E1    ;minus start
  126.     MOV    pathlen42D,DI        ;save length of POP.BAT path
  127.  
  128.     MOV    DI,OFFSET path42F    ;another PATH buffer
  129.     CALL    CopyPath_399        ;copy PATH from environment to buffer
  130.     MOV    SI,OFFSET batname_3C6    ;'POP.BAT',0,CR,LF,'$'
  131.     MOV    CX,4            ;just move the 'POP.'
  132.     REPZ    MOVSB
  133.     MOV    WORD PTR [DI],'1'    ;now add a "1" and 0 to the path
  134.     MOV    dot1ptr_479,DI        ;save pointer to POP.1
  135.  
  136. RenameLup_1A2:
  137.     MOV    AH,56H            ;Rename file
  138.     MOV    DX,OFFSET path3E1    ;from POP.BAT
  139.     MOV    DI,OFFSET path42F    ;to POP.1
  140.     INT    21H
  141.     JNB    RenamedOk_1EC        ;renamed ok
  142.  
  143.     CMP    AL,2            ;file not found?
  144.     JZ    Skp204            ;yep
  145.     CMP    AL,5            ;access denied?
  146.     JZ    Skp1C3            ;yep
  147.      MOV    DX,OFFSET msg73C    ;'Error renaming '
  148.      MOV    CX,LEN73C    ;0FH    ;msg length
  149.      CALL    PrMsg_Fname_386        ;display err msg, filename
  150.      JMP    NotPushed_3B6        ;'Env not pushed', die
  151.  
  152. Skp1C3:    MOV    SI,dot1ptr_479        ;pointer to POP.1 end
  153. ;Bump a bunch of digit characters to the next higher digit
  154.     INC    BYTE PTR [SI]        ;bump to next digit
  155.     INC    BYTE PTR nr_51C        ;'1' of 'POP.1 goto :rename'
  156.     INC    BYTE PTR nr_54E        ;another POP.1
  157.     INC    BYTE PTR nr_5AB        ;'1 pop.bat'
  158.     INC    BYTE PTR nr_5C3        ;'1 POP(s) remaining.',CR,LF
  159.     INC    BYTE PTR nr_6A0        ;'Level 1'
  160.     CMP    BYTE PTR [SI],'9'    ;maxed out yet?
  161.     JBE    RenameLup_1A2        ;not yet, try for one higher
  162.  
  163.     MOV    DX,OFFSET msg74B    ;'PUSHes may only be nested 10 levels deep.'
  164.     MOV    CX,LEN74B    ;2BH    ;msg length
  165.     JMP    NotPushed_3B3        ;'not pushed', terminate
  166.  
  167. RenamedOk_1EC:
  168.     MOV    BYTE PTR bflag_47B,1    ;pass 2
  169.     MOV    SI,OFFSET nr_6A0    ;'1' of Level 1
  170.     INC    BYTE PTR [SI]        ;bump to '2' or whatever
  171.     CMP    BYTE PTR [SI],'9'+1    ;go beyond '9'?
  172.     JNZ    Skp204            ;not yet
  173.      MOV    WORD PTR [SI],'01'    ;actually '10'
  174.      MOV    BYTE PTR [SI+2],'.'
  175.  
  176. Skp204:    MOV    AH,5BH            ;Create new file
  177.     MOV    DX,OFFSET path3E1    ;use the new PATH\POP.xx
  178. IFNDEF    TOADTWEAK
  179.     MOV    CX,0            ;normal attributes
  180. ELSE                ;v1.1
  181.     xor    cx,cx            ;normal attributes        v1.1
  182. ENDIF
  183.     INT    21H
  184.     MOV    fhandle_47C,AX        ;save file handle
  185.     JNB    CreateOk_220        ;created ok
  186.      MOV    DX,OFFSET msg776    ;'Error creating '
  187.      MOV    CX,LEN776    ;0FH    ;msg length
  188.      CALL    PrMsg_Fname_386        ;display err msg, filename
  189.      JMP    Recover_35D        ;attempt to recover old POP.BAT
  190.                     ;Terminate in any case
  191.  
  192. CreateOk_220:
  193.     MOV    DX,OFFSET txt47F    ;'@echo off'
  194.     MOV    CX,LEN47F    ;9    ;length
  195.     CALL    WriteFile_334        ;write to POP.x file
  196.     CMP    BYTE PTR bflag_47B,0    ;pass 1?
  197.     JZ    Pass1_268        ;yep
  198.  
  199. ;Only do this on pass 2
  200.     MOV    DX,OFFSET txt488    ;'pass_2' text
  201.     MOV    CX,LEN488    ;27H    ;length
  202.     CALL    WriteFile_334
  203.     MOV    AX,7            ;PATH + 7 chars (POP.BAT?)
  204.     CALL    WritePath_3A6        ;write to POP.x file
  205.     MOV    DX,OFFSET txt3DA    ;' '
  206.     MOV    CX,1            ;1 char
  207.     CALL    WriteFile_334
  208.     XOR    AX,AX            ;just PATH\
  209.     CALL    WritePath_3A6
  210.     MOV    DX,OFFSET txt3D1    ;'pop_2.bat'
  211.     MOV    CX,LEN3D1    ;9    ;length
  212.     CALL    WriteFile_334
  213.     MOV    DX,OFFSET txt4AF    ;'>nul', more
  214.     MOV    CX,LEN4AF    ;25H    ;length
  215.     CALL    WriteFile_334
  216.     MOV    AX,7            ;PATH\7 chars
  217.     CALL    WritePath_3A6
  218.  
  219. Pass1_268:
  220.     PUSH    ES
  221.     MOV    ES,envseg_3DD
  222.     ASSUME    ES:NOTHING        ;actually environment seg
  223. IFDEF    TOADTWEAK
  224.     xor    di,di            ;base                v1.1
  225. ELSE
  226.     MOV    DI,0            ;base
  227. ENDIF
  228.  
  229. SetLup_270:
  230.     MOV    DX,OFFSET txt4D4    ;CR/LF,'set '
  231.     MOV    CX,LEN4D4    ;6    ;length
  232.     CALL    WriteFile_334
  233.     PUSH    DS
  234.     PUSH    ES
  235.     POP    DS
  236.     ASSUME    DS:NOTHING,ES:NOTHING    ;actually environment seg
  237.  
  238.     MOV    DX,DI            ;write from here
  239. IFDEF    TOADTWEAK
  240.     xor    al,al            ;scan for string end        v1.1
  241. ELSE
  242.     MOV    AL,0            ;scan for string end
  243. ENDIF
  244.     MOV    CX,0FFFFH        ;max scan
  245.     REPNZ    SCASB
  246.     NOT    CX            ;flip
  247.     DEC    CX            ;adjust, CX = length
  248.     PUSH    DI            ;save pointer
  249.     CALL    WriteFile_334        ;write to POP.x file
  250.     POP    DI            ;restore pointer
  251.     CMP    BYTE PTR [DI],0        ;end of environment?
  252.     POP    DS
  253.     ASSUME    DS:CSEG
  254.  
  255.     JNZ    SetLup_270        ;nope, repeat
  256.  
  257.     POP    ES
  258.     ASSUME    DS:CSEG,ES:CSEG
  259.  
  260.     MOV    DX,OFFSET txt4DA    ;'echo Environment popped'
  261.     MOV    CX,LEN4DA    ;32H    ;length
  262.     CMP    BYTE PTR bflag_47B,0    ;pass 1?
  263.     JNZ    Skp2A4            ;nope
  264.      DEC    CX            ;yep, write 1 less char
  265. Skp2A4:    CALL    WriteFile_334
  266.     MOV    DX,OFFSET txt50C
  267.     MOV    CX,LEN50C    ;7    ;length
  268.     CALL    WriteFile_334
  269.     CMP    BYTE PTR bflag_47B,0    ;pass 1?
  270.     JZ    Pass1_2E2        ;yep
  271.  
  272. ;Write this to POP.x file on pass 2
  273.     MOV    DX,OFFSET txt513    ;'if exist %1'
  274.     MOV    CX,LEN513    ;9    ;length
  275.     CALL    WriteFile_334
  276.     MOV    AX,4
  277.     CALL    WritePath_3A6
  278.     MOV    DX,OFFSET nr_51C    ;'1 goto :rename',CR,LF
  279.     MOV    CX,LEN51C    ;8FH    ;text length
  280.     CALL    WriteFile_334
  281.     MOV    AX,4            ;PATH\ + 4 chars
  282.     CALL    WritePath_3A6
  283.     MOV    DX,OFFSET nr_5AB    ;'1 pop.bat',CR,LF
  284.     MOV    CX,LEN5AB    ;35H    ;text length
  285.     CALL    WriteFile_334
  286.  
  287. Pass1_2E2:
  288.     MOV    DX,OFFSET currdriv_5E0    ;x: cd \' etc etc
  289.     MOV    CX,LEN5E0    ;4EH    ;length
  290.     CALL    WriteFile_334
  291.     XOR    AX,AX            ;PATH\, no additional chars
  292.     CALL    WritePath_3A6
  293.     MOV    DX,OFFSET batname_3C6    ;'POP.BAT',0,CR,LF,'$'
  294.     MOV    CX,7            ;move the 'POP.BAT'
  295.     CMP    BYTE PTR bflag_47B,0    ;pass 1?
  296.     JZ    Pass1_304
  297.      MOV    DX,OFFSET txt3D1    ;'pop_2.bat'
  298.      MOV    CX,LEN3D1    ;9    ;length
  299. Pass1_304:
  300.     CALL    WriteFile_334
  301.     MOV    DX,OFFSET txt47E    ;^Z
  302.     MOV    CX,1            ;1 char
  303.     CALL    WriteFile_334
  304.     MOV    AH,3EH            ;close file handle
  305.     MOV    BX,fhandle_47C        ;POP.x file handle
  306.     INT    21H
  307.     JB    Delete_340        ;close failed, delete, cleanup, die
  308.  
  309.     MOV    DX,OFFSET msg67D    ;'current environment pushed'
  310.     MOV    AH,9            ;display msg
  311.     INT    21H
  312.     MOV    DX,OFFSET path3E1    ;POP.BAT path
  313.     MOV    AH,9
  314.     INT    21H
  315.     MOV    DX,OFFSET msg6B6    ;'POP <any parameter> will display '
  316.                     ;'popped environment variables.'
  317.     MOV    AH,9
  318.     INT    21H
  319.     MOV    AX,4C00H        ;terminate, ERRORLEVEL 0
  320.     INT    21H
  321. _Push    endp
  322.  
  323.  
  324. ;Write text at DX (length in CX) to POP.x file.
  325. ;Choke&die if write failure
  326. WriteFile_334    proc    near
  327.     MOV    AH,40H            ;write to file/device
  328.     MOV    BX,CS:fhandle_47C    ;POP.x file handle
  329.     INT    21H
  330.     JB    Delete_340        ;write failed
  331.      RET    ;_NEAR
  332. WriteFile_334    endp
  333.  
  334.  
  335. ;Something went wrong in POP create, write, whatever.
  336. ;Delete it, clean up, terminate.
  337. Delete_340    proc    near
  338.  
  339. IFDEF    TOADTWEAK        ;v1.1
  340.     mov    ax,CS
  341.     mov    DS,ax
  342.     mov    ES,ax
  343. ELSE
  344.     PUSH    CS
  345.     PUSH    CS
  346.     POP    DS
  347.     POP    ES
  348. ENDIF
  349.     ASSUME    DS:CSEG,ES:CSEG
  350.  
  351.     MOV    DX,OFFSET msg785    ;'Error writing to '
  352.     MOV    CX,LEN785    ;11H    ;length
  353.     CALL    PrMsg_Fname_386        ;display err msg, filename
  354.     MOV    AH,3EH            ;Close file handle
  355.     MOV    BX,fhandle_47C        ;POP.x file handle
  356.     INT    21H
  357.     MOV    AH,41H            ;Delete file
  358.     MOV    DX,OFFSET path3E1    ;POP.BAT
  359.     INT    21H
  360.  
  361. Recover_35D:
  362.     CMP    BYTE PTR bflag_47B,0    ;pass 1?
  363.     JZ    NotPushed_3B6        ;yep, 'Env not pushed', die
  364.  
  365.     MOV    AH,56H            ;Rename file
  366.     MOV    DX,OFFSET path42F    ;from POP.n
  367.     MOV    DI,OFFSET path3E1    ;to POP.BAT
  368.     INT    21H
  369.     MOV    DX,OFFSET msg796    ;'Previous POP.BAT recovered.'
  370.     MOV    CX,LEN796    ;1DH    ;msg length
  371.     JNB    NotPushed_3B3        ;rename failed. 'not pushed', terminate
  372.      MOV    DX,OFFSET msg7CC    ;'Can't recover previous POP.BAT',
  373.      MOV    CX,LEN7CC    ;3EH    ;msg length
  374.      CALL    PrMsg_391        ;display
  375.      MOV    AX,4C02H        ;terminate, ERRORLEVEL 2
  376.      INT    21H
  377. Delete_340    endp
  378.  
  379.  
  380. PrMsg_Fname_386    proc    near
  381.     CALL    PrMsg_391        ;display msg in DX/CX
  382.     MOV    DX,OFFSET path3E1    ;'POP.BAT'
  383.     MOV    CX,pathlen42D        ;msg length
  384.     DEC    CX            ;adjust
  385. PrMsg_391:
  386.     MOV    AH,40H            ;Write to file/device
  387.     MOV    BX,2            ;StdErr
  388.     INT    21H
  389.     RET    ;_NEAR
  390. PrMsg_Fname_386    endp
  391.  
  392.  
  393. CopyPath_399    proc    near
  394.     PUSH    DS
  395.     MOV    CX,ofs_3DF        ;offset to PATH '\'
  396.     LDS    SI,DWORD PTR envptr_3DB    ;pointer to PATH in environment
  397.     REPZ    MOVSB            ;move into ES:DI buffer
  398.     POP    DS
  399.     RET    ;_NEAR
  400. CopyPath_399    endp
  401.  
  402.  
  403. ;Write PATH plus AX characters to PATH.x file
  404. WritePath_3A6    proc    near
  405.     MOV    DX,OFFSET path3E1
  406.     MOV    CX,ofs_3DF        ;offset to PATH '\'
  407.     ADD    CX,AX            ;plus length of added string
  408.     CALL    WriteFile_334
  409.     RET    ;_NEAR
  410. WritePath_3A6    endp
  411.  
  412.  
  413. ;Fatal error.  Display error msg, more, terminate.
  414. NotPushed_3B3    proc    near
  415.     CALL    PrMsg_391        ;display msg in DX/CX
  416. NotPushed_3B6:
  417.     MOV    DX,OFFSET msg7B3    ;'Environment not PUSHed.'
  418.     MOV    CX,LEN7B3    ;19H    ;msg length
  419.  
  420. MsgTerm_3BD:
  421.     CALL    PrMsg_391        ;display msg in DX/CX
  422.     MOV    AX,4C01H        ;Terminate, ERRORLEVEL 1
  423.     INT    21H
  424. NotPushed_3B3    endp
  425.  
  426.  
  427. ;    DB    0
  428. batname_3C6    DB    'POP.BAT',0,CR,LF,'$'
  429. LEN3C6        EQU    $-batname_3C6
  430. txt3D1        DB    'pop_2.bat'
  431. LEN3D1        EQU    $-txt3D1
  432. txt3DA        DB    ' '
  433. envptr_3DB    dw    0        ;saved environment string ptr
  434. envseg_3DD    dw    0        ;saved environment segment
  435. ofs_3DF        dw    0        ;offset in PATH str to '\'
  436.  
  437. IFNDEF TOADTWEAK
  438. path3E1        DB    4CH DUP(0)    ;PATH\POP.BAT buffer
  439. ELSE            ;v1.1
  440. ;v1.1 Moved to dynamic buffers outside program space.
  441. ENDIF
  442.  
  443. pathlen42D    dw    0        ;length of POP.BAT path
  444.  
  445. IFNDEF TOADTWEAK
  446. path42F        DB    4AH DUP(0)    ;PATH\POP.1 buffer
  447. ELSE            ;v1.1
  448. ;v1.1 Moved to dynamic buffers outside program space.
  449. ENDIF
  450.  
  451. dot1ptr_479    dw    0        ;pointer to POP.1 string
  452. bflag_47B    DB    0        ;flag pass 1 (0) or pass 2 (1)
  453. fhandle_47C    dw    0        ;file handle
  454. txt47E        DB    1AH
  455.  
  456. txt47F    DB    '@echo off'
  457. LEN47F    EQU    $-txt47F
  458. txt488    DB    CR,LF
  459.     DB    "if '%2'=='pass_2' goto :pass_2",CR,LF
  460.     DB    'copy '
  461. LEN488    EQU    $-txt488
  462. txt4AF    DB    ' >nul',CR,LF
  463.     DB    '%0_2 _%1 pass_2',CR,LF
  464.     DB    ':pass_2',CR,LF
  465.     DB    'del '
  466. LEN4AF    EQU    $-txt4AF
  467. txt4D4    DB    CR,LF
  468.     DB    'set '
  469. LEN4D4    EQU    $-txt4D4
  470. txt4DA    DB    CR,LF
  471.     DB    'echo Environment popped.',CR,LF
  472.     DB    'echo.',CR,LF
  473.     DB    "if not '%1'=='_"
  474. LEN4DA    EQU    $-txt4DA
  475. txt50C    DB    "' set",CR,LF
  476. LEN50C    EQU    $-txt50C
  477. txt513    DB    'if exist '
  478. LEN513    EQU    $-txt513
  479. nr_51C    DB    '1 goto :rename',CR,LF
  480.     DB    'echo WARNING:  Could not find POP.'
  481. nr_54E    DB    '1',CR,LF
  482.     DB    'echo           Previous environment(s) lost!',7,CR,LF
  483.     DB    'set pop_error=1',CR,LF
  484.     DB    'goto :drive',CR,LF
  485.     DB    ':rename',CR,LF
  486.     DB    'ren '
  487. LEN51C    EQU    $-nr_51C
  488.  
  489. nr_5AB    DB    '1 pop.bat',CR,LF
  490.     DB    'echo ',0FFH
  491.     DB    CR,LF
  492.     DB    'echo '
  493. LEN5AB    EQU    $-nr_5AB
  494.  
  495. nr_5C3    DB    '1 POP(s) remaining.',CR,LF
  496.     DB    ':drive',CR,LF
  497. currdriv_5E0    DB    ' :',CR,LF
  498.     DB    'cd \'
  499. currdir_5E8    DB    40H DUP(0)    ;current directory
  500.     DB    CR,LF
  501.     DB    'del '
  502. LEN5E0    EQU    $-currdriv_5E0
  503.  
  504. IFNDEF    TOADTWEAK
  505. msg62E    DB    'PUSH  (c) Mitch Ames 1990.  May be copied freely, '
  506.     DB    'but not modified or sold.',CR,LF,LF,'$'
  507. ELSE        ;v1.1
  508. msg62E    db    'PUSH v1.1 (c) Mitch Ames 1990.',CR,LF,'$'
  509.     db    'May be copied freely, but not modified or sold.',0
  510.     db    'Toad Hall Tweak',0
  511. ENDIF
  512.  
  513. msg67D    DB    'Current environment pushed:  Level '
  514. nr_6A0    DB    '1. ',CR,LF
  515.     DB    'To restore, run $'
  516. msg6B6    DB    'POP <any parameter> will display popped environment '
  517.     db    'variables.',CR,LF,'$'
  518.  
  519. IFNDEF    TOADTWEAK
  520. msg6F7    DB    'Requires DOS version 3.30 or later.',CR,LF
  521. ELSE            ;v1.1
  522. msg6F7    db    'Requires DOS 2.0 or later.',CR,LF        ;v1.1
  523. ENDIF
  524. LEN6F7    EQU    $-msg6F7
  525.  
  526. msg71C    DB    'Bad PATH - must include drive.',CR,LF
  527. LEN71C    EQU    $-msg71C
  528. msg73C    DB    'Error renaming '
  529. LEN73C    EQU    $-msg73C
  530. msg74B    DB    'PUSHes may only be nested 10 levels deep.',CR,LF
  531. LEN74B    EQU    $-msg74B
  532. msg776    DB    'Error creating '
  533. LEN776    EQU    $-msg776
  534. msg785    DB    'Error writing to '
  535. LEN785    EQU    $-msg785
  536. msg796    DB    'Previous POP.BAT recovered.',CR,LF
  537. LEN796    EQU    $-msg796
  538. msg7B3    DB    'Environment not PUSHed.',CR,LF
  539. LEN7B3    EQU    $-msg7B3
  540. msg7CC    DB    "Can't recover previous POP.BAT",CR,LF
  541.     DB    'Previous environments lost!',7,CR,LF
  542. LEN7CC    EQU    $-msg7CC
  543. IFNDEF TOADTWEAK
  544.     DB    'stack   stack   stack   stack   '
  545.     db    'stack   stack   stack   stack   '
  546. stacktop_84A    EQU    $-0H
  547. ELSE            ;v1.1
  548.  
  549. ;Use dynamic variables outside program space.
  550. ;This reduces compiled program's size.
  551.  
  552. PROGEND    EQU    $
  553. stacktop_84A    EQU    PROGEND+(8*8)
  554. path3E1        EQU    stacktop_84A+2    ;DB 4CH DUP(0)    ;PATH\POP.BAT buffer
  555. path42F        EQU    path3E1+4CH    ;DB 4AH DUP(0)    ;PATH\POP.1 buffer
  556. ENDIF
  557.  
  558. CSEG    ENDS
  559.     END    _Push
  560.