[Copyright 1999,2002 Frank Durda IV, All Rights Reserved. Mirroring of any material on this page in any form is expressly prohibited. The official web site for this material is: http://nemesis.lonestar.org Contact this address for use clearances: clearance at nemesis.lonestar.org Comments and queries to this address: web_software at nemesis.lonestar.org]
MISOSYS EDAS-4.3 04/11/99 02:14:23 REMOVE - LS-DOS 6.2 Page 00001
00001 ;LBREMOVE/ASM - REMOVE command
00003 ;
0000 00004 *GET BUILDVER:3
00005 ;
00006 ; Buildver/asm is a bit of a kludge since not all utilities can load
00007 ; equates from LDOS60 and still compile. LOWCORE and everybody else
00008 ; relies on this setting, and it eventually ends up in LDOS60/EQU
00009 ; for programs that can use that.
00010 ;
FFFF 00011 @BLD631 EQU -1 ;<631>Build 631 distribution (LEVEL 1B)
00012 ; These switches activate patches made since the 1B release.
00013 ; It is important that all earlier patches be enabled when a higher
00014 ; patch is enabled.
00015 ; Patches C thru F were published in TMQ IV.iv, page 32 (NOTE: the
00016 ; patch addresses listed for SPOOL in SPOOL1/FIX are 19H high.)
FFFF 00017 @BLD631C EQU -1 ;<631>Apply 1C patches (SETKI)
FFFF 00018 @BLD631D EQU -1 ;<631>Apply 1D patches (DIR)
FFFF 00019 @BLD631E EQU -1 ;<631>Apply 1E patches (DIR & MEMDISK/DCT)
FFFF 00020 @BLD631F EQU -1 ;<631>Apply 1F patches (SPOOL)
00021 ; Patches G and H were published in TMQ V.i, pages 10 and 18/19.
FFFF 00022 @BLD631G EQU -1 ;<631>Apply 1G patches (//KEYIN,DIR,DO *)
FFFF 00023 @BLD631H EQU -1 ;<631>Apply 1H patches (MEMORY)
00024 ;
00025 ;End of BUILDVER/ASM
0000 00026 *GET SVCMAC:3 ;SVC Macro equivalents
00027 ;SVCMAC/ASM - LS-DOS Version VI
00028 *LIST OFF
00420 *LIST ON
0000 00422 *GET VALUES:3 ;Misc. equates
00423 ;VALUES/ASM - Version 6
00424 *LIST OFF
00451 *LIST ON
00452 ;
2400 00453 ORG 2400H
00454 ;
00455 REMOVE
00456 IF @BLD631
2400 ED731024 00457 LD (SAVESP+1),SP ;<631>Save Stack
00458 ENDIF
2404 00459 @@CKBRKC ;Break key down?
2404+3E6A 00460 LD A,106
2406+EF 00461 RST 40
00462 IF @BLD631
2407 200D 00463 JR NZ,BRKABT ;<631>else abort
00464 ELSE
00465 JR Z,BEGINA ;Ok if not
00466 LD HL,-1 ; else abort
00467 RET
00468 ENDIF
00469 ;
00470 BEGINA
00471 IF @BLD631
00472 ELSE
00473 LD (SAVESP+1),SP ;Save Stack
00474 ENDIF
2409 CD2E24 00475 CALL REMOV ;Do the removing
00476 IF @BLD631
00477 ELSE
00478 JR EXIT
00479 ;
00480 ; Exit Routine - Clear any & return
00481 ;
00482 BRKABT
00483 LD HL,-1
00484 JR SAVESP ;Abort with error
00485 ENDIF
00486 ;
240C 210000 00487 EXIT LD HL,0 ;Set retcod if exiting
240F 310000 00488 SAVESP LD SP,$-$ ;P/u stack
2412 00489 @@CKBRKC ;Clear if entered
2412+3E6A 00490 LD A,106
2414+EF 00491 RST 40
2415 C9 00492 RET ; and Return
00493 IF @BLD631
00494 ;
00495 ; Exit Routine - Clear any & return
00496 ;
00497 BRKABT ;<631>
2416 21FFFF 00498 LD HL,-1 ;<631>
2419 18F4 00499 JR SAVESP ;<631>Abort with error
00500 ENDIF
00501 ;
00502 ; Special Message Exit
00503 ;
241B 212325 00504 SPCREQ LD HL,SPCREQ$
241E 00505 @@LOGOT
00506 IFEQ 00H,1
00507 LD HL,
00508 ENDIF
241E+3E0C 00509 LD A,12
2420+EF 00510 RST 40
00511 IF @BLD631
2421 18F3 00512 ERREXIT JR BRKABT ;<631>Get stack & RET
00513 ELSE
00514 ERREXIT LD HL,-1
00515 JR SAVESP ;Get stack & RET
00516 ENDIF
00517 ;
00518 ; I/O Error Exit
00519 ;
2423 6F 00520 IOERR LD L,A ;Error # to HL
2424 2600 00521 LD H,0
2426 F6C0 00522 OR 0C0H ;Abbrev, return
2428 4F 00523 LD C,A ;Error code to reg C
2429 00524 @@ERROR
2429+3E1A 00525 LD A,26
242B+EF 00526 RST 40
242C 18E1 00527 JR SAVESP ;P/u stack & return
00528 ;
00529 ; REMOV - Remove file(s) or device(s)
00530 ;
242E E5 00531 REMOV PUSH HL ;Save INBUF$ pointer
242F AF 00532 REMOV0 XOR A ;Set Z-flag for loop
2430 E1 00533 REMOV1 POP HL
2431 C22324 00534 JP NZ,IOERR
00535 ;
00536 ; Skip leading spaces - exit on terminator
00537 ;
2434 00538 @@CKBRKC ;Check for break
2434+3E6A 00539 LD A,106
2436+EF 00540 RST 40
2437 20DD 00541 JR NZ,BRKABT ; abort if so
00542 ;
2439 2B 00543 DEC HL
243A 23 00544 REMOV2 INC HL ;Skip past spaces
243B 7E 00545 LD A,(HL)
243C FE20 00546 CP ' '
243E 28FA 00547 JR Z,REMOV2
2440 D8 00548 RET C ;Return on terminator
00549 ;
00550 ; Hit a non-space char - is this a filespec ?
00551 ;
2441 115225 00552 REMOV3 LD DE,FCB ;Fetch the filespec
2444 00553 @@FSPEC
2444+3E4E 00554 LD A,78
2446+EF 00555 RST 40
2447 C21B24 00556 JP NZ,SPCREQ ;Jump on spec error
244A E5 00557 PUSH HL ;Save INBUF$ pointer
00558 ;
00559 ; Transfer Filespec to buff without password
00560 ;
244B D5 00561 PUSH DE ;Save FCB ptr
244C EB 00562 EX DE,HL ;Pt HL => FCB
244D 114325 00563 LD DE,FILESPC ;DE => Filespec
2450 CD0225 00564 CALL MOVSPC ;Move filespec
2453 3E0D 00565 LD A,CR ;End spec with C/R
2455 12 00566 LD (DE),A
2456 D1 00567 POP DE ;Recover FCB
00568 ;
00569 ; Are we Removing a Device ?
00570 ;
2457 1A 00571 LD A,(DE) ;Is it a device?
2458 FE2A 00572 CP '*'
245A 2843 00573 JR Z,RMVDVC
00574 ;
00575 ; Removing a File - Does it exist ?
00576 ;
245C 00577 @@OPEN ;Open the file
245C+3E3B 00578 LD A,59
245E+EF 00579 RST 40
245F 2804 00580 JR Z,GOODOPN ;Z - it does exist
2461 FE2A 00581 CP 42 ;LRL Open Fault ?
2463 20CB 00582 JR NZ,REMOV1 ;No - abort
00583 ;
00584 ; Successful Open - Can we Remove the file ?
00585 ;
2465 3A5325 00586 GOODOPN LD A,(FCB+1) ;P/u access level
2468 E607 00587 AND 7
246A FE02 00588 CP 2 ;REMOVE access ?
246C 3E25 00589 LD A,37 ;No - "Illegal access
246E D22324 00590 JP NC,IOERR ; attempted to ..."
00591 ;
00592 ; Is there a drivespec in the filespec ?
00593 ;
2471 214325 00594 LD HL,FILESPC ;HL => Filespec
2474 7E 00595 FLOOP LD A,(HL) ;P/u char
2475 FE0E 00596 CP CR+1 ;End of Filespec ?
2477 300E 00597 JR NC,CHKDSPC
00598 ;
00599 ; Drivespec wasn't specified - put it on
00600 ;
2479 363A 00601 LD (HL),':' ;Append drivespec onto
247B 23 00602 INC HL ; end of filespec
247C 3A5825 00603 LD A,(FCB+6) ;Xfer drive # to A
247F C630 00604 ADD A,'0' ;Convert to ASCII
2481 77 00605 LD (HL),A
2482 23 00606 INC HL ;Bump
2483 360D 00607 LD (HL),CR ;End of filespec
2485 1805 00608 JR SHOWFIL ;Dsply name & remove it
00609 ;
00610 ; Stop when ":" hit or terminator
00611 ;
2487 FE3A 00612 CHKDSPC CP ':' ;Already have one ?
2489 23 00613 INC HL
248A 20E8 00614 JR NZ,FLOOP
00615 ;
00616 ; Display "Removing Filespec" & remove it
00617 ;
248C CD9424 00618 SHOWFIL CALL SHOWIT ;"Removing:"
248F 00619 @@REMOV ;Remove the file
248F+3E39 00620 LD A,57
2491+EF 00621 RST 40
2492 189C 00622 JR REMOV1 ;Loop for more
00623 ;
00624 ; Display Filespec or Devspec
00625 ;
2494 213925 00626 SHOWIT LD HL,SHOW$ ;Show what we are
2497 D5 00627 PUSH DE ;Save FCB ptr
2498 00628 @@DSPLY ; removing
00629 IFEQ 00H,1
00630 LD HL,
00631 ENDIF
2498+3E0A 00632 LD A,10
249A+EF 00633 RST 40
249B D1 00634 POP DE
249C 2092 00635 JR NZ,REMOV1 ;NZ - abort
249E C9 00636 RET ; else RETurn Z
00637 ;
00638 ; Routine to Remove a device
00639 ;
249F D5 00640 RMVDVC PUSH DE ;Xfer FCB ptr to IX
24A0 DDE1 00641 POP IX
24A2 DD5E01 00642 LD E,(IX+1) ;P/u device name
24A5 DD5602 00643 LD D,(IX+2)
00644 ;
00645 ; Routine to find a device in the device tables
00646 ;
24A8 00647 @@GTDCB ;Find this DCB
24A8+3E52 00648 LD A,82
24AA+EF 00649 RST 40
24AB 2083 00650 JR NZ,REMOV1 ;Abort if not found
00651 ;
00652 ; Found device in tables, is it killable?
00653 ;
24AD ED533725 00654 DEV4 LD (RENDEV+1),DE ;Try to rename it
24B1 E5 00655 PUSH HL ;Save address pointer
24B2 213625 00656 LD HL,RENDEV ;New & old names same
24B5 5D 00657 LD E,L
24B6 54 00658 LD D,H
24B7 00659 @@RENAM
24B7+3E38 00660 LD A,56
24B9+EF 00661 RST 40
24BA E1 00662 POP HL ;Rcvr address pointer
24BB FE13 00663 CP 19 ;If not "illegal name"
24BD C23024 00664 JP NZ,REMOV1 ; error, is protected
00665 ;
00666 ; Device not system device - is it in use?
00667 ;
24C0 CB5E 00668 CKNILL BIT 3,(HL) ;Test NIL device
24C2 2006 00669 JR NZ,REMOVIT ;OK if NIL (not in use)
24C4 3E27 00670 LD A,27H ; else "device in use"
24C6 B7 00671 OR A
24C7 C33024 00672 JP REMOV1 ; and return error
00673 ;
00674 ; Remove the device
00675 ;
24CA CDFA24 00676 REMOVIT CALL SCND4 ;Zero 8-byte DCB area
00677 ;
00678 ; Any other device routes to the removed one?
00679 ;
24CD 114B49 00680 SCNDCB LD DE,'IK' ;Point to begin of area
24D0 00681 @@GTDCB
24D0+3E52 00682 LD A,82
24D2+EF 00683 RST 40
24D3 CB66 00684 SCND1 BIT 4,(HL) ;Routed device?
24D5 2811 00685 JR Z,SCND2 ;Jump if not
24D7 E5 00686 PUSH HL ;Save DCB pointer
24D8 2C 00687 INC L ;Bypass TYPE code
24D9 7E 00688 LD A,(HL) ;P/u route vector
24DA 2C 00689 INC L ; lo-order
24DB 66 00690 LD H,(HL) ;P/u vector hi-order
24DC 6F 00691 LD L,A
24DD 7E 00692 LD A,(HL) ;P/u TYPE code of nest
24DE E1 00693 POP HL ;Rcvr DCB pointer
24DF B7 00694 OR A ;If TYPE=0, we killed
24E0 2006 00695 JR NZ,SCND2 ; the routed device
24E2 3E08 00696 LD A,8
24E4 B6 00697 OR (HL) ;Convert to NIL if so
24E5 77 00698 LD (HL),A
24E6 18E5 00699 JR SCNDCB
00700 ;
00701 ; Point to next device
00702 ;
24E8 7D 00703 SCND2 LD A,L ;Advance to next DCB area
24E9 C608 00704 ADD A,8 ;Loop through all
24EB 6F 00705 LD L,A ; devices while checking
24EC 20E5 00706 JR NZ,SCND1 ;Loop until table end
00707 ;
00708 ; Device table cleared, now zero the DCB/FCB
00709 ;
24EE DDE5 00710 PUSH IX ;Xfer vector to HL
24F0 E1 00711 POP HL
24F1 CDFA24 00712 CALL SCND4
24F4 CD9424 00713 CALL SHOWIT ;Show "Removing:"
24F7 C32F24 00714 JP REMOV0 ;Next ...
00715 ;
24FA 0608 00716 SCND4 LD B,8 ;Clear 8 bytes
24FC AF 00717 XOR A
24FD 77 00718 SCND5 LD (HL),A ;Go for it
24FE 23 00719 INC HL
24FF 10FC 00720 DJNZ SCND5
2501 C9 00721 RET
00722 ;
00723 ; Transfer a filespec from HL to DE
00724 ;
2502 7E 00725 MOVSPC LD A,(HL) ;P/u a spec character
2503 FE2F 00726 CP '/' ;Extension ?
2505 2008 00727 JR NZ,CKSPACE ;No - check if space
2507 23 00728 INC HL ;Is the next character
2508 7E 00729 LD A,(HL) ; valid ?
2509 FE41 00730 CP 'A'
250B 3802 00731 JR C,CKSPACE ;No - don't output it
250D 2B 00732 DEC HL ;Back one
250E 7E 00733 LD A,(HL) ;P/u slash
250F FE20 00734 CKSPACE CP ' '
2511 D8 00735 RET C ;Stop on space or less
2512 FE2E 00736 CP '.' ;Password ?
2514 2009 00737 JR NZ,MOVSPC1
2516 23 00738 SKIPPW INC HL
2517 7E 00739 LD A,(HL)
2518 FE20 00740 CP ' '
251A D8 00741 RET C ;Back on terminator
251B FE3A 00742 CP ':'
251D 20F7 00743 JR NZ,SKIPPW
251F EDA0 00744 MOVSPC1 LDI ;Move the char
2521 18DF 00745 JR MOVSPC
00746 ;
2523 46 00747 SPCREQ$ DB 'File spec required',CR
69 6C 65 20 73 70 65 63
20 72 65 71 75 69 72 65
64 0D
00748 IF @BLD631
2536 2A 00749 RENDEV DB '*RS' ;<631>
52 53
00750 ELSE
00751 RENDEV DB '*LS'
00752 ENDIF
2539 52 00753 SHOW$ DB 'Removing: '
65 6D 6F 76 69 6E 67 3A
20
2543 00754 FILESPC DS 15
2552 00 00755 FCB DB 0
2553 00756 DS 31
00757 ;
2400 00758 END REMOVE
2400 is the transfer address
00000 Total errors
[Copyright 1999,2002 Frank Durda IV, All Rights Reserved. Mirroring of any material on this page in any form is expressly prohibited. The official web site for this material is: http://nemesis.lonestar.org Contact this address for use clearances: clearance at nemesis.lonestar.org Comments and queries to this address: web_software at nemesis.lonestar.org]