[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_2011 at nemesis.lonestar.org]
MISOSYS EDAS-4.3 04/11/99 02:16:21 RESET - LS-DOS 6.2 Page 00001
00001 ;LBRESET/ASM - RESET Command
00003 ;
000D 00004 CR EQU 13
0000 00005 *GET BUILDVER:3
00006 ;
00007 ; Buildver/asm is a bit of a kludge since not all utilities can load
00008 ; equates from LDOS60 and still compile. LOWCORE and everybody else
00009 ; relies on this setting, and it eventually ends up in LDOS60/EQU
00010 ; for programs that can use that.
00011 ;
FFFF 00012 @BLD631 EQU -1 ;<631>Build 631 distribution (LEVEL 1B)
00013 ; These switches activate patches made since the 1B release.
00014 ; It is important that all earlier patches be enabled when a higher
00015 ; patch is enabled.
00016 ; Patches C thru F were published in TMQ IV.iv, page 32 (NOTE: the
00017 ; patch addresses listed for SPOOL in SPOOL1/FIX are 19H high.)
FFFF 00018 @BLD631C EQU -1 ;<631>Apply 1C patches (SETKI)
FFFF 00019 @BLD631D EQU -1 ;<631>Apply 1D patches (DIR)
FFFF 00020 @BLD631E EQU -1 ;<631>Apply 1E patches (DIR & MEMDISK/DCT)
FFFF 00021 @BLD631F EQU -1 ;<631>Apply 1F patches (SPOOL)
00022 ; Patches G and H were published in TMQ V.i, pages 10 and 18/19.
FFFF 00023 @BLD631G EQU -1 ;<631>Apply 1G patches (//KEYIN,DIR,DO *)
FFFF 00024 @BLD631H EQU -1 ;<631>Apply 1H patches (MEMORY)
00025 ;
00026 ;End of BUILDVER/ASM
0000 00027 *GET SVCMAC:3 ;SVC Macro equivalents
00028 ;SVCMAC/ASM - LS-DOS Version VI
00029 *LIST OFF
00421 *LIST ON
00423 ;
2400 00424 ORG 2400H
00425 ;
00426 ; Save stack & call reset code
00427 ;
2400 ED732624 00428 RESET LD (SAVESP+1),SP ;Save Stack ptr
00429 IF @BLD631
2404 00430 @@CKBRKC ;<631>
2404+3E6A 00431 LD A,106
2406+EF 00432 RST 40
2407 2019 00433 JR NZ,ABORT
00434 ENDIF
2409 CD2C24 00435 CALL RESET1 ;Call Reset routine
240C 210000 00436 LD HL,0 ;Init successful
240F 2814 00437 JR Z,SAVESP ;Z - Exit clean
00438 ;
00439 ; I/O Error Processing
00440 ;
2411 6F 00441 IOERR LD L,A ;Error # to HL
2412 2600 00442 LD H,0
2414 F6C0 00443 OR 0C0H ;Abbrev, return
2416 4F 00444 LD C,A
2417 00445 @@ERROR
2417+3E1A 00446 LD A,26
2419+EF 00447 RST 40
241A 1809 00448 JR SAVESP ;P/u stack & return
00449 ;
00450 ; Internal Message Exit
00451 ;
241C 217325 00452 SPCREQ LD HL,SPCREQ$ ;"Devspec req...
241F 00453 @@LOGOT
00454 IFEQ 00H,1
00455 LD HL,
00456 ENDIF
241F+3E0C 00457 LD A,12
2421+EF 00458 RST 40
2422 21FFFF 00459 ABORT LD HL,-1 ;Set abort code
00460 ;
00461 ; P/u stack & clear any pending
00462 ;
2425 310000 00463 SAVESP LD SP,$-$ ;P/u stack ptr
2428 00464 @@CKBRKC ;Clear any Break
2428+3E6A 00465 LD A,106
242A+EF 00466 RST 40
242B C9 00467 RET
00468 ;
00469 ; RESET1 - Reset a Filespec or Devspec
00470 ;
00471 RESET1
00472 IF @BLD631
242C E5 00473 PUSH HL ;<631>
242D 7E 00474 NXTCHAR LD A,(HL) ;<631>
242E FE28 00475 CP '(' ;<631>
2430 2807 00476 JR Z,ISPAREN ;<631>
2432 FE0E 00477 CP 0EH ;<631>
2434 380B 00478 JR C,ISEOL ;<631>
2436 23 00479 INC HL ;<631>
2437 18F4 00480 JR NXTCHAR ;<631>
00481 ISPAREN ;<631>
00482 ENDIF
00483 IF @BLD631
2439 116225 00484 LD DE,PRMTBL$ ;<631>
243C 00485 @@PARAM ;<631>
243C+3E11 00486 LD A,17
243E+EF 00487 RST 40
243F 20D0 00488 JR NZ,IOERR ;<631>Must reset something
2441 E1 00489 ISEOL POP HL ;<631>
2442 118825 00490 LD DE,FCBDEV ;<631>
2445 00491 @@FSPEC ;<631>
2445+3E4E 00492 LD A,78
2447+EF 00493 RST 40
2448 20D2 00494 JR NZ,SPCREQ ;<631>
00495 ELSE
00496 LD DE,FCBDEV ;Get file/device spec
00497 @@FSPEC
00498 JP NZ,SPCREQ ;Must reset something
00499 ENDIF
244A 1A 00500 LD A,(DE) ;File reset used to
244B FE2A 00501 CP '*' ; reset the
244D C28024 00502 JP NZ,RESFIL ; "file open bit
2450 ED5B8925 00503 LD DE,(FCBDEV+1) ;P/u the device name
2454 00504 @@GTDCB ;Find in device tables
2454+3E52 00505 LD A,82
2456+EF 00506 RST 40
2457 C0 00507 RET NZ ;NZ - "Device not Avail"
2458 E5 00508 PUSH HL ;Save pointer to table
2459 CDEC24 00509 CALL CLSFILS ;Reset routes to files
245C E1 00510 POP HL ;Get DCB pointer
245D C0 00511 RET NZ ;NZ - I/O Error
00512 ;
00513 ; Unhook the device chain
00514 ;
245E E5 00515 PUSH HL
245F F3 00516 DI ;Don't stop me now
2460 CD0825 00517 CALL FIXDCB ;Fixup the DCB
2463 FB 00518 EI ;Now you can interrupt
2464 218825 00519 LD HL,FCBDEV ;Determine if system
2467 54 00520 LD D,H ; device by attempting
2468 5D 00521 LD E,L ; to rename it
2469 00522 @@RENAM ;The error code will be
2469+3E38 00523 LD A,56
246B+EF 00524 RST 40
246C E1 00525 POP HL ; either 19 or 40
246D FE28 00526 CP 40 ;Protected system device?
246F 2804 00527 JR Z,SYSDVC
2471 3608 00528 LD (HL),8 ;Show device is NIL
2473 AF 00529 XOR A ;Set Z
2474 C9 00530 RET ;Z - successful
00531 ;
00532 ; RESET of system device
00533 ;
2475 E5 00534 SYSDVC PUSH HL ;Save DCB ptr
2476 2C 00535 INC L ;If DCB vector is X'0000'
2477 7E 00536 LD A,(HL) ; then do NOT reset the
2478 2C 00537 INC L ; NIL bit
2479 B6 00538 OR (HL)
247A E1 00539 POP HL
247B C8 00540 RET Z ;Z - return
247C CB9E 00541 RES 3,(HL) ;Make sure NIL is off
247E AF 00542 XOR A ;Set Z & Return
247F C9 00543 RET
00544 ;
00545 ; Reset the "file open bit" of a file
00546 ;
2480 00547 RESFIL @@FLAGS ;Get flag table pointer
2480+3E65 00548 LD A,101
2482+EF 00549 RST 40
2483 FDCB12C6 00550 SET 0,(IY+'S'-'A') ;Inhibit file open bit
2487 00551 @@OPEN
2487+3E3B 00552 LD A,59
2489+EF 00553 RST 40
248A C0 00554 RET NZ ;NZ - I/O Error
00555 IF @BLD631
248B D5 00556 PUSH DE ;<631>
248C DDE1 00557 POP IX ;<631>
248E DD7E01 00558 LD A,(IX+1) ;<631>Make sure access level
2491 E607 00559 AND 7 ;<631>is at least UPDATE
2493 FE05 00560 CP 5 ;<631>
2495 3016 00561 JR NC,L24AD ;<631>
2497 3A6725 00562 LD A,(LRLBYT) ;<631>
249A E680 00563 AND 80H ;<631>
249C 47 00564 LD B,A ;<631>
249D 3A6F25 00565 LD A,(DATBYT) ;<631>
24A0 E640 00566 AND 40H ;<631>
24A2 B0 00567 OR B ;<631>
24A3 200C 00568 JR NZ,L24B1 ;<631>
24A5 DDCB00F6 00569 L24A5: SET 6,(IX+0) ;<631>
24A9 00570 @@CLOSE ;<631>
24A9+3E3C 00571 LD A,60
24AB+EF 00572 RST 40
24AC C9 00573 RET ;<631>
24AD 3E25 00574 L24AD: LD A,37 ;<631>Init "Illegal access...
24AF B7 00575 OR A ;<631>
24B0 C9 00576 RET ;<631>
24B1 ED4B8E25 00577 L24B1: LD BC,(FCBDEV+6) ;<631>Get DEC and drive number info
24B5 00578 @@DIRRD ;<631>
24B5+3E57 00579 LD A,87
24B7+EF 00580 RST 40
24B8 C0 00581 RET NZ ;<631>
24B9 E5 00582 PUSH HL ;<631>
24BA FD 00583 DB 0FDH ;<631>
24BB E1 00584 L24BB: POP HL ;<631>
24BC 3A6725 00585 LD A,(LRLBYT) ;<631>
24BF E680 00586 AND 80H ;<631>
24C1 2806 00587 JR Z,L24C9 ;<631>
24C3 110000 00588 LRLPRM: LD DE,0 ;<631>
24C6 FD7304 00589 LD (IY+4),E ;<631>
24C9 3A6F25 00590 L24C9: LD A,(DATBYT) ;<631>
24CC E640 00591 AND 40H ;<631>
24CE 2818 00592 JR Z,L24E8 ;<631>
24D0 110000 00593 DATPRM: LD DE,0 ;<631>
24D3 FD361296 00594 LD (IY+12H),96H ;<631>Default password
24D7 FD361342 00595 LD (IY+13H),42H ;<631>
24DB DDE5 00596 PUSH IX ;<631>
24DD 7A 00597 LD A,D ;<631>
24DE B3 00598 OR E ;<631>
24DF D1 00599 POP DE ;<631>
24E0 DDCB00D6 00600 SET 2,(IX+0) ;<631>
24E4 C4A524 00601 CALL NZ,L24A5 ;<631>
24E7 C0 00602 RET NZ ;<631>
24E8 00603 L24E8 @@DIRWR ;<631>
24E8+3E58 00604 LD A,88
24EA+EF 00605 RST 40
24EB C9 00606 RET ;<631>
00607 ELSE
00608 LD A,(HL) ;Make sure access level
00609 AND 7 ; is at least UPDATE
00610 CP 5
00611 LD A,37 ;Init "Illegal access...
00612 RET NZ ;NZ - I/O error
00613 EX DE,HL
00614 SET 6,(HL) ;Set "close authority
00615 EX DE,HL ; to reset dir bit
00616 @@CLOSE
00617 RET ;Return w/ condition
00618 ENDIF
00619 ;
00620 ; Find the last device route & close any open file
00621 ;
24EC CB66 00622 CLSFILS BIT 4,(HL) ;Jump if no route
24EE 2807 00623 JR Z,CLSFIL1
24F0 23 00624 INC HL ;Else p/u link address
24F1 7E 00625 LD A,(HL) ; and test that one
24F2 23 00626 INC HL ; for a chain
24F3 66 00627 LD H,(HL)
24F4 6F 00628 LD L,A
24F5 18F5 00629 JR CLSFILS
24F7 CB7E 00630 CLSFIL1 BIT 7,(HL) ;A file?
24F9 C8 00631 RET Z ;Ret if not
24FA 11A825 00632 LD DE,FCBFIL ;Pt to fcb area
24FD D5 00633 PUSH DE
24FE 012000 00634 LD BC,32
2501 EDB0 00635 LDIR ;Fill from device vector
2503 D1 00636 POP DE ;Recover start
2504 00637 @@CLOSE ;Close the file
2504+3E3C 00638 LD A,60
2506+EF 00639 RST 40
2507 C9 00640 RET ;Ret with Z, NZ status
00641 ;
00642 ; Routine to fix up a system DCB
00643 ;
2508 CB66 00644 FIXDCB BIT 4,(HL) ;If routed, recover the
250A 2810 00645 JR Z,FIX1 ; original data from
250C E5 00646 PUSH HL ; DCB+3 to DCB+5
250D 54 00647 LD D,H ;DCB start to DE
250E 5D 00648 LD E,L
250F 2C 00649 FIX0 INC L ;Pt to old stored
2510 2C 00650 INC L ; information
2511 2C 00651 INC L
2512 010300 00652 LD BC,3
2515 EDB0 00653 LDIR ;Xfer to DCB
2517 E1 00654 POP HL
2518 CBA6 00655 RES 4,(HL) ;Reset Routed bit
251A 18EC 00656 JR FIXDCB
251C CB6E 00657 FIX1 BIT 5,(HL) ;If linked, recover the
251E 2818 00658 JR Z,FIX2 ; original data from
2520 E5 00659 PUSH HL ; the LINK DCB source &
2521 2C 00660 INC L ; clear the LINK DCB
2522 5E 00661 LD E,(HL) ;P/u the LINK vector
2523 2C 00662 INC L
2524 56 00663 LD D,(HL)
2525 E1 00664 POP HL ;Recover DCB ptr
2526 E5 00665 PUSH HL
2527 EB 00666 EX DE,HL ;Link to HL, DCB to DE
2528 E5 00667 PUSH HL ;Save for clearing
2529 010300 00668 LD BC,3
252C EDB0 00669 LDIR
252E E1 00670 POP HL
252F 0608 00671 LD B,8
00672 IF @BLD631
2531 71 00673 FIX1A LD (HL),C ;<631>Clear the LINK DCB (C=0)
00674 ELSE
00675 FIX1A LD (HL),0 ;Clear the LINK DCB
00676 ENDIF
2532 2C 00677 INC L
2533 10FC 00678 DJNZ FIX1A
2535 E1 00679 POP HL ;Rcvr DCB pointer
2536 18D0 00680 JR FIXDCB
2538 CB76 00681 FIX2 BIT 6,(HL) ;If filtered, recover the
253A C8 00682 RET Z ; original data by
253B E5 00683 PUSH HL ; swapping back the
253C 54 00684 LD D,H
253D 5D 00685 LD E,L
253E 2C 00686 INC L ; 1st three bytes with
253F 7E 00687 LD A,(HL) ; the FILTER DCB
2540 2C 00688 INC L
2541 66 00689 LD H,(HL)
2542 6F 00690 LD L,A
2543 010400 00691 LD BC,4 ;HL now points to the
2546 09 00692 ADD HL,BC ; entry point. Get its
2547 4E 00693 LD C,(HL) ; DCB address by peeking
2548 0C 00694 INC C ; past the name field
2549 09 00695 ADD HL,BC
254A 7E 00696 LD A,(HL) ;Get low-order
254B 23 00697 INC HL
254C 66 00698 LD H,(HL) ;Get hi-order
254D 6F 00699 LD L,A
254E E5 00700 PUSH HL ;If DCB is itself, then
254F ED52 00701 SBC HL,DE ; bring in the NIL
2551 E1 00702 POP HL
2552 28BB 00703 JR Z,FIX0
2554 0603 00704 LD B,3 ; else swap the 1st three
2556 4E 00705 FIX2A LD C,(HL) ; bytes of the DCBs
2557 1A 00706 LD A,(DE)
2558 77 00707 LD (HL),A
2559 79 00708 LD A,C
255A 12 00709 LD (DE),A
255B 2C 00710 INC L
255C 1C 00711 INC E
255D 10F7 00712 DJNZ FIX2A
255F E1 00713 POP HL
2560 18A6 00714 JR FIXDCB
00715 ;
00716 ; Data area
00717 ;
00718 IF @BLD631
2562 80 00719 PRMTBL$ DB 80H ;<631>
2563 93 00720 DB 93H ;<631>
2564 4C 00721 DB 'LRL' ;<631>
52 4C
2567 00 00722 LRLBYT DB 0 ;<631>
2568 C424 00723 DW LRLPRM+1 ;<631>
256A 54 00724 DB 54H ;<631>
256B 44 00725 DB 'DATE' ;<631>
41 54 45
256F 00 00726 DATBYT DB 0 ;<631>
2570 D124 00727 DW DATPRM+1 ;<631>
2572 00 00728 DB 0 ;<631>
00729 ENDIF
2573 44 00730 SPCREQ$ DB 'Device spec required',CR
65 76 69 63 65 20 73 70
65 63 20 72 65 71 75 69
72 65 64 0D
00731 IF @BLD631
00732 ELSE
00733 DC 32,0 ;Patch space
00734 ENDIF
2588 00 00735 FCBDEV DB 0
2589 00736 DS 31
25A8 00 00737 FCBFIL DB 0
25A9 00738 DS 31
00739 ;
2400 00740 END RESET
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_2011 at nemesis.lonestar.org]