[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 22:44:33 SYS3 - LS-DOS 6.3 Page 00001 00001 ;SYS3/ASM - LS-DOS 6.3 00003 ; 00004 *LIST OFF ;Get SYS0/EQU 00320 *LIST ON 000A 00321 LF EQU 10 000D 00322 CR EQU 13 00323 ; 0000 00324 *GET COPYCOM:3 ;Copyright message 00325 ; COPYCOM - File for Copyright COMment block 00326 ; 0000 00327 *GET BUILDVER/ASM:3 00328 ; 00329 ; Buildver/asm is a bit of a kludge since not all utilities can load 00330 ; equates from LDOS60 and still compile. LOWCORE and everybody else 00331 ; relies on this setting, and it eventually ends up in LDOS60/EQU 00332 ; for programs that can use that. 00333 ; FFFF 00334 @BLD631 EQU -1 ;<631>Build 631 distribution (LEVEL 1B) 00335 ; These switches activate patches made since the 1B release. 00336 ; It is important that all earlier patches be enabled when a higher 00337 ; patch is enabled. 00338 ; Patches C thru F were published in TMQ IV.iv, page 32 (NOTE: the 00339 ; patch addresses listed for SPOOL in SPOOL1/FIX are 19H high.) FFFF 00340 @BLD631C EQU -1 ;<631>Apply 1C patches (SETKI) FFFF 00341 @BLD631D EQU -1 ;<631>Apply 1D patches (DIR) FFFF 00342 @BLD631E EQU -1 ;<631>Apply 1E patches (DIR & MEMDISK/DCT) FFFF 00343 @BLD631F EQU -1 ;<631>Apply 1F patches (SPOOL) 00344 ; Patches G and H were published in TMQ V.i, pages 10 and 18/19. FFFF 00345 @BLD631G EQU -1 ;<631>Apply 1G patches (//KEYIN,DIR,DO *) FFFF 00346 @BLD631H EQU -1 ;<631>Apply 1H patches (MEMORY) 00347 ; 00348 ;End of BUILDVER/ASM 00349 IF @BLD631 00351 ELSE 00352 COM '<*(C) 1982,3,4,6 by LSI*>' 00353 ENDIF 00354 ; 1E00 00355 ORG 1E00H 00356 ; 1E00 E670 00357 SYS3 AND 70H 1E02 C8 00358 RET Z ;Back on zero entry 1E03 FE10 00359 CP 10H 1E05 280B 00360 JR Z,CLOSE ;Jump if close 1E07 FE20 00361 CP 20H 1E09 CA6420 00362 JP Z,FNAME ;Jump if filespec recover 1E0C FE30 00363 CP 30H 1E0E CA3621 00364 JP Z,DOID ;Get CS id number 1E11 C9 00365 RET 1E12 1A 00366 CLOSE LD A,(DE) ;Test for device 1E13 CB7F 00367 BIT 7,A 1E15 CA9D20 00368 JP Z,CLOSDEV ;Jump if closing device 1E18 CD6815 00369 CALL CKOPEN@ ;Test for open file 1E1B DD4E06 00370 LD C,(IX+6) ;P/u drive # 00371 ; 00372 ; Special MINI check drive routine 00373 ; 1E1E FDE5 00374 PUSH IY ;Save IY 1E20 CD1E1A 00375 CALL @GTDCT ;Pick up DCT for drive 1E23 CDD419 00376 CKAGN CALL @RSLCT ;Wait until not busy 1E26 C2C820 00377 JP NZ,HOLDUP ;Go to error handler 1E29 FDCB035E 00378 BIT 3,(IY+3) ;If hard drive, bypass 1E2D 2024 00379 JR NZ,SAWBLK 1E2F FDCB0466 00380 BIT 4,(IY+4) ;If "ALIEN" by pass 1E33 201E 00381 JR NZ,SAWBLK 1E35 FDCB047E 00382 BIT 7,(IY+4) ;Ck if CKDRV inhibit 1E39 2018 00383 JR NZ,SAWBLK ;Go if so 00384 ; 00385 ; Test for diskette in drive (no index) 00386 ; 1E3B D5 00387 PUSH DE 1E3C FD5605 00388 LD D,(IY+5) ;P/u current track 1E3F 1E00 00389 LD E,0 ;Set to sector 0 1E41 CDD019 00390 CALL @SEEK ;Do a command 1E44 D1 00391 POP DE 1E45 0630 00392 LD B,30H ;Set up count (short) 1E47 CDD419 00393 BLACK CALL @RSLCT ;Check for index pulse 1E4A CB4F 00394 BIT 1,A ;Test index 1E4C 2805 00395 JR Z,SAWBLK ;Saw black, seems OK 1E4E 10F7 00396 DJNZ BLACK 1E50 C3C820 00397 JP HOLDUP ;Close fault handler 00398 ; 00399 ; Diskette is there, let's continue 00400 ; 1E53 FDE1 00401 SAWBLK POP IY ;Restore IY 1E55 DD4607 00402 LD B,(IX+7) ;P/u DEC of fpde 1E58 CDBB18 00403 CALL @DIRRD ;Read the directory 1E5B C0 00404 RET NZ ;Quit if error there 1E5C CB66 00405 BIT 4,(HL) ;Ck for killed file 1E5E C8 00406 RET Z ;Quit if killed file 1E5F E5 00407 PUSH HL 1E60 C5 00408 PUSH BC 1E61 CDA213 00409 CALL RWRIT@ ;Write last buffer? 1E64 C1 00410 POP BC 1E65 E1 00411 POP HL 1E66 C0 00412 RET NZ ;Ret on i/o error 1E67 DDCB0076 00413 BIT 6,(IX+0) ;If user does not have 1E6B CA0D20 00414 JP Z,RCVN0 ; close authority... 1E6E 2C 00415 INC L ; else reset possible 1E6F CBAE 00416 RES 5,(HL) ; file-open bit in DIR+1 1E71 2C 00417 INC L ;Determine if the EOF 1E72 2C 00418 INC L ; byte has changed 1E73 DD7E08 00419 LD A,(IX+8) ;P/u EOF byte offset 1E76 E5 00420 PUSH HL ;Save ptr to DIR+3 1E77 BE 00421 CP (HL) 1E78 2014 00422 JR NZ,CLOS1 ;Go if moved 1E7A 3E11 00423 LD A,11H 1E7C 85 00424 ADD A,L 1E7D 6F 00425 LD L,A 1E7E DD7E0C 00426 LD A,(IX+12) ;P/u lo-order ERN 1E81 BE 00427 CP (HL) 1E82 200A 00428 JR NZ,CLOS1 ;Go if moved 1E84 2C 00429 INC L 1E85 DD7E0D 00430 LD A,(IX+13) ;P/u hi-order ERN 1E88 BE 00431 CP (HL) 1E89 2003 00432 JR NZ,CLOS1 ;Go if moved 1E8B F1 00433 POP AF 1E8C 181A 00434 JR CLOS2 ;Didn't move 00435 ; 00436 ; Routine to change the 3-byte EOF marker 00437 ; 1E8E E1 00438 CLOS1 POP HL ;Pop DIR+3 1E8F DD7E08 00439 LD A,(IX+8) ;Xfer the eof offset 1E92 77 00440 LD (HL),A 1E93 3E11 00441 LD A,11H 1E95 85 00442 ADD A,L 1E96 6F 00443 LD L,A 1E97 DD7E0C 00444 LD A,(IX+12) ; and the ERN from the FB 1E9A 77 00445 LD (HL),A 1E9B 2C 00446 INC L 1E9C DD7E0D 00447 LD A,(IX+13) ; to the DIR entry 1E9F 77 00448 LD (HL),A 1EA0 DDCB0056 00449 BIT 2,(IX+0) ;If file was updated 1EA4 2010 00450 JR NZ,CLOS3 ; then update mod date 1EA6 186F 00451 JR CLOS5 ; else don't 00452 ; 00453 ; Three-byte EOF marker did not change 00454 ; 1EA8 DDCB0056 00455 CLOS2 BIT 2,(IX+0) ;If file was updated 1EAC 2008 00456 JR NZ,CLOS3 ; then update mod date 1EAE DDCB0076 00457 BIT 6,(IX+0) ;If close authority then 1EB2 2063 00458 JR NZ,CLOS5 ; write back the DIR 1EB4 1867 00459 JR CLOS6 ; else continue 00460 ; 00461 ; Routine to insert packed date into directory 00462 ; 1EB6 E5 00463 CLOS3 PUSH HL ;Save ptr to DIR+21 1EB7 7D 00464 LD A,L ;Pt to start of dir rec 1EB8 E6E0 00465 AND 0E0H 1EBA 6F 00466 LD L,A 1EBB 2C 00467 INC L ;Pt to DIR+1 1EBC CBF6 00468 SET 6,(HL) ;Set the MOD flag 1EBE 113300 00469 LD DE,DATE$ ;Point to year 1EC1 1A 00470 LD A,(DE) ;P/u year and save 1EC2 F5 00471 PUSH AF ;Save year 1EC3 C5 00472 PUSH BC ;Must save BC 1EC4 13 00473 INC DE ;Pt to day 1EC5 2C 00474 INC L ;DIR+2 1EC6 E607 00475 AND 7 ;Old year mod 8 1EC8 47 00476 LD B,A ;Save bits 0-2 1EC9 1A 00477 LD A,(DE) ;Get day 1ECA 07 00478 RLCA ;Shift to bits 3-7 1ECB 07 00479 RLCA 1ECC 07 00480 RLCA 1ECD B0 00481 OR B ;Merge old bits 0-2 1ECE 77 00482 LD (HL),A ;Save day and old year 1ECF 2D 00483 DEC L ;DIR+1 1ED0 13 00484 INC DE ;Pt to month 1ED1 1A 00485 LD A,(DE) ;Get month 1ED2 47 00486 LD B,A ;Save tempy 1ED3 7E 00487 LD A,(HL) 1ED4 E6F0 00488 AND 0F0H ;Mask old month 1ED6 B0 00489 OR B ;Merge new 1ED7 77 00490 LD (HL),A ;Back in DIR+1 00491 ; 00492 ; If old disk, dont do the rest 00493 ; 1ED8 79 00494 LD A,C ;Get drive 1ED9 E607 00495 AND 7 1EDB 47 00496 LD B,A ;Save in B 1EDC 04 00497 INC B ;Always do once 1EDD 3E3F 00498 LD A,47H-8 ;Set to make bit x,a 1EDF C608 00499 CLOS3A ADD A,8 1EE1 10FC 00500 DJNZ CLOS3A ;Add to get opcode 1EE3 32EA1E 00501 LD (CLOS3B),A ;Stuff opcode 1EE6 3A8200 00502 LD A,(YFLAG$) ;Get date flag byte 1EE9 CB47 00503 BIT 0,A ;Test the bit 1EEA 00504 CLOS3B EQU $-1 1EEB 2004 00505 JR NZ,CLOS3C ;Go if new style 1EED C1 00506 POP BC ;Clean off stack 1EEE F1 00507 POP AF ; cause we're done 1EEF 1825 00508 JR CLOS4 1EF1 7D 00509 CLOS3C LD A,L ;Now pt to 1EF2 C611 00510 ADD A,17 ; DIR+18, time locn 1EF4 6F 00511 LD L,A 1EF5 ED5B2E00 00512 LD DE,(TIME$+1) ;Get hours, mins 1EF9 7A 00513 LD A,D ;Hours to A 1EFA 53 00514 LD D,E ;Mins to D 1EFB 1E00 00515 LD E,0 ;Init fresh 1EFD 0603 00516 LD B,3 1EFF CB3A 00517 CLOSD1 SRL D 1F01 CB1B 00518 RR E 1F03 10FA 00519 DJNZ CLOSD1 ;Split mins to DE 1F05 07 00520 RLCA ;Shif hours bits 3-7 1F06 07 00521 RLCA 1F07 07 00522 RLCA 1F08 B2 00523 OR D ;Merge into D 1F09 57 00524 LD D,A 1F0A C1 00525 POP BC ;Restore BC 1F0B F1 00526 POP AF ;Get back year 1F0C B7 00527 OR A ;Was year set? 1F0D 2804 00528 JR Z,CLOSD2 ;No, use 0 1F0F D650 00529 SUB 80 ;Get year offset 1F11 B3 00530 OR E ;Merge w/mins 1F12 5F 00531 LD E,A 1F13 72 00532 CLOSD2 LD (HL),D ;Save hours/mins 1F14 23 00533 INC HL 1F15 73 00534 LD (HL),E ;Save mins/year 1F16 E1 00535 CLOS4 POP HL ;Rcvr DIR+21 1F17 E5 00536 CLOS5 PUSH HL 1F18 CD0318 00537 CALL @DIRWR ;Write back DIR entry 1F1B E1 00538 POP HL 1F1C C0 00539 RET NZ 1F1D 2C 00540 CLOS6 INC L ;Pt to DIR+22 which is 1F1E E5 00541 PUSH HL ; the 1st extent 1F1F 7D 00542 LD A,L 1F20 D615 00543 SUB 15H ;Backup to DIR+1 1F22 6F 00544 LD L,A 1F23 CB7E 00545 BIT 7,(HL) ;Test if created 1F25 E1 00546 POP HL 1F26 C20D20 00547 JP NZ,RCVN0 ;Bypass if created 1F29 110000 00548 LD DE,0 ;Init gran counter 1F2C 7E 00549 CLOS7 LD A,(HL) ;P/u cyl indicator 1F2D 2C 00550 INC L ;Pt to gran alloc 1F2E FEFE 00551 CP 0FEH ;Extent in use? 1F30 300C 00552 JR NC,CLOS8 ;Jump if spare or FXDE 1F32 7E 00553 LD A,(HL) ;P/u granule allocation 1F33 2C 00554 INC L ;Pt to next extent 1F34 E61F 00555 AND 1FH ;Strip off # of grans & 1F36 3C 00556 INC A ; adjust for zero offset 1F37 83 00557 ADD A,E ;Accumulate the number of 1F38 5F 00558 LD E,A ; grans in this extent 1F39 30F1 00559 JR NC,CLOS7 ;Any previous quantity 1F3B 14 00560 INC D 1F3C 18EE 00561 JR CLOS7 1F3E 200B 00562 CLOS8 JR NZ,CLOS9 ;Found all grans in this 1F40 46 00563 LD B,(HL) ; extent, ck for FXDE 1F41 CDBB18 00564 CALL @DIRRD 1F44 C0 00565 RET NZ 1F45 7D 00566 LD A,L ;Point to extents in FXDE 1F46 C616 00567 ADD A,16H 1F48 6F 00568 LD L,A 1F49 18E1 00569 JR CLOS7 ;Go to continue count 00570 ; 00571 ; Routine to determine need to deallocate 00572 ; 1F4B E5 00573 CLOS9 PUSH HL ;Save ptr to last extent 1F4C DD6E0C 00574 LD L,(IX+12) ;P/u ending record # 1F4F DD660D 00575 LD H,(IX+13) 1F52 3E08 00576 LD A,8 ;Get # sectors/gran 1F54 CD2B1A 00577 CALL @DCTBYT 1F57 E61F 00578 AND 1FH ;Remove other data 1F59 F5 00579 PUSH AF ;Save the # 1F5A 85 00580 ADD A,L ;Round up to next 1F5B 6F 00581 LD L,A ; higher gran 1F5C 3001 00582 JR NC,CLOS10 1F5E 24 00583 INC H 1F5F F1 00584 CLOS10 POP AF ;Rcvr # sectors/gran 1F60 3C 00585 INC A ;Adjust for division 1F61 CDE306 00586 CALL @DIV16 ;Calculate # grans in use 1F64 AF 00587 XOR A ;Subtract the # of grans 1F65 EB 00588 EX DE,HL ; used from the # of 1F66 ED52 00589 SBC HL,DE ; grans allocated in the 1F68 EB 00590 EX DE,HL ; directory, and move DE 1F69 E1 00591 POP HL ;Rcvr ptr to last extent 1F6A CA0D20 00592 JP Z,RCVN0 ;Jump if same quantity 1F6D DA0D20 00593 JP C,RCVN0 ;Jump if now more 00594 ; 00595 ; Need to deallocate space 00596 ; 1F70 CD7418 00597 CALL @GATRD ;Read GAT 1F73 C0 00598 RET NZ 1F74 1841 00599 JR BAKUP ;B/u to last used extent 1F76 D5 00600 CLOS11 PUSH DE ;Sv count of excess grans 1F77 7E 00601 LD A,(HL) ;P/u alloc info 1F78 E6E0 00602 AND 0E0H ;Get starting relative 1F7A 07 00603 RLCA ; gran into reg-E 1F7B 07 00604 RLCA 1F7C 07 00605 RLCA 1F7D 5F 00606 LD E,A 1F7E 7E 00607 LD A,(HL) ;# of contiguous grans 1F7F E61F 00608 AND 1FH ;Remove unneeded data 1F81 83 00609 ADD A,E ;Calculate ending 1F82 5F 00610 LD E,A ; relative gran # 1F83 3E08 00611 LD A,8 ;P/u the # of grans 1F85 CD2B1A 00612 CALL @DCTBYT ; per cylinder 1F88 07 00613 RLCA 1F89 07 00614 RLCA 1F8A 07 00615 RLCA 1F8B E607 00616 AND 7 ;Move into bits 0-2 1F8D 3C 00617 INC A ;Adjust for zero offset 1F8E 57 00618 LD D,A ;Save count 1F8F 3E04 00619 LD A,4 1F91 CD2B1A 00620 CALL @DCTBYT 1F94 CB6F 00621 BIT 5,A ;2-sided disk? 1F96 7A 00622 LD A,D ;Rcvr count 1F97 2801 00623 JR Z,$+3 ;Bypass if 1-sided 1F99 07 00624 RLCA ;Double count 1F9A CD2719 00625 CALL @DIV8 ;A=quotient, E=remainder 1F9D 2D 00626 DEC L ;Pt to starting cylinder 1F9E 86 00627 ADD A,(HL) ;Bump cyl pointer by how 1F9F 57 00628 LD D,A ; many excessive cyls to 1FA0 E5 00629 PUSH HL ; start from the rear 1FA1 C5 00630 PUSH BC 1FA2 2623 00631 LD H,DIRBUF$<-8 ;Pt to that cyl's GAT 1FA4 6A 00632 LD L,D 1FA5 46 00633 LD B,(HL) ;P/u the GAT allocation 1FA6 7B 00634 LD A,E 1FA7 CDBB20 00635 CALL CALCBIT ;Deallocate a gran 1FAA 70 00636 LD (HL),B ;Repl GAT byte 1FAB C1 00637 POP BC 1FAC E1 00638 POP HL 1FAD 2C 00639 INC L ;Repoint to alloc info 1FAE 35 00640 DEC (HL) ;Reduce by 1 gran 1FAF 7E 00641 LD A,(HL) ;Get info on contig gran 1FB0 3C 00642 INC A ;Adj for zero offset 1FB1 E61F 00643 AND 1FH ;Strip unneeded 1FB3 D1 00644 POP DE ;Rcvr excess gran count 1FB4 1B 00645 DEC DE ; and count down 1FB5 2043 00646 JR NZ,CLOS12 ;Go if extent still used 1FB7 36FF 00647 BAKUP LD (HL),0FFH ; else extent is spare 1FB9 2D 00648 DEC L 1FBA 36FF 00649 LD (HL),0FFH 1FBC 2D 00650 DEC L 1FBD 7D 00651 LD A,L ;Chack if backed all the 1FBE E61F 00652 AND 1FH ; way thru this entry 1FC0 FE15 00653 CP 15H 1FC2 2036 00654 JR NZ,CLOS12 ;Go if not 1FC4 AD 00655 XOR L ;Deallocate this FXDE 1FC5 6F 00656 LD L,A 1FC6 CB7E 00657 BIT 7,(HL) ;Was it the FPDE? 1FC8 2830 00658 JR Z,CLOS12 ;Bypass if FPDE 1FCA 3600 00659 LD (HL),0 ;Show dir is spare 1FCC CD0318 00660 CALL @DIRWR ;Write back 1FCF C0 00661 RET NZ 1FD0 78 00662 LD A,B ;P/u deallocated DEC 1FD1 E6E0 00663 AND 0E0H 1FD3 3C 00664 INC A ;Pt to DIR+1 1FD4 6F 00665 LD L,A 1FD5 7E 00666 LD A,(HL) ;P/u previous DEC 1FD6 32E51F 00667 LD (STUFDEC+1),A ;Save in instruction 1FD9 CD9718 00668 CALL @HITRD ;Read the HIT 1FDC C0 00669 RET NZ 1FDD 68 00670 LD L,B ;Point to deallocated HIT 1FDE 3600 00671 LD (HL),0 ;Deallocate space in HIT 1FE0 CD9818 00672 CALL @HITWR ;Write back 1FE3 C0 00673 RET NZ 1FE4 0600 00674 STUFDEC LD B,0 ;P/u previous DEC 1FE6 CDBB18 00675 CALL @DIRRD ;Read its dir entry 1FE9 C0 00676 RET NZ 1FEA 78 00677 LD A,B 1FEB F61F 00678 OR 1FH ;Pt to end of entry 1FED 6F 00679 LD L,A 1FEE 36FF 00680 LD (HL),0FFH ;Erase pointer 1FF0 2D 00681 DEC L ; to deallocated FXDE 1FF1 36FF 00682 LD (HL),0FFH 1FF3 2D 00683 DEC L ;Point to previous extent 1FF4 E5 00684 PUSH HL ;Save pointer 1FF5 CD0318 00685 CALL @DIRWR ;Write back 1FF8 E1 00686 POP HL 1FF9 C0 00687 RET NZ 1FFA 7A 00688 CLOS12 LD A,D ;Loop if still more to 1FFB B3 00689 OR E ; deallocate 1FFC C2761F 00690 JP NZ,CLOS11 1FFF CD0318 00691 CALL @DIRWR 2002 2805 00692 JR Z,CLOS13 ;Go if no write error 2004 FE0F 00693 CP 15 ;"write protected... 2006 C0 00694 RET NZ ;Bad if not 2007 1804 00695 JR RCVN0 00696 ; 2009 CD7518 00697 CLOS13 CALL @GATWR ;Write back the altered GAT 200C C0 00698 RET NZ 00699 ; 00700 ; Routine starts to recover file spec 00701 ; 200D DD7E07 00702 RCVN0 LD A,(IX+7) ;P/u DEC of FPDE 2010 DD4E06 00703 LD C,(IX+6) ;P/u drive 2013 A8 00704 XOR B ;Check if its directory 2014 E61F 00705 AND 1FH ; record is resident 2016 DD4607 00706 LD B,(IX+7) ;P/u DEC of FPDE 2019 C4BB18 00707 CALL NZ,@DIRRD ;Get FPDE dir if needed 201C C0 00708 RET NZ 201D DDE5 00709 PUSH IX ;Transfer FCB to DE 201F D1 00710 POP DE 2020 79 00711 RCVNAM LD A,C 2021 E607 00712 AND 7 ;Convert drive to ASCII 2023 F630 00713 OR '0' 2025 325C20 00714 LD (RCVN5+1),A 2028 261D 00715 LD H,SBUFF$<-8 ;Pt to DIR+5 (name) 202A 78 00716 LD A,B 202B E6E0 00717 AND 0E0H 202D F605 00718 OR 5 202F 6F 00719 LD L,A 2030 E5 00720 PUSH HL ;Save name start posn 2031 0608 00721 LD B,8 ;Init 8 chars max 2033 7E 00722 RCVN1 LD A,(HL) ;Move filename from 2034 FE20 00723 CP ' ' ; direc to fcb 2036 2805 00724 JR Z,RCVN2 2038 12 00725 LD (DE),A 2039 23 00726 INC HL 203A 13 00727 INC DE 203B 10F6 00728 DJNZ RCVN1 ;Loop up to 8 203D E1 00729 RCVN2 POP HL 203E 7D 00730 LD A,L 203F C608 00731 ADD A,8 ;Pt to extension 2041 6F 00732 LD L,A 2042 7E 00733 LD A,(HL) 2043 FE20 00734 CP ' ' 2045 2810 00735 JR Z,RCVN4 ;Jump if none 2047 3E2F 00736 LD A,'/' 2049 12 00737 LD (DE),A ;Stuff separator into fcb 204A 13 00738 INC DE 204B 0603 00739 LD B,3 ;Init 3-char extension 204D 7E 00740 RCVN3 LD A,(HL) ;Stuff the ext 204E FE20 00741 CP ' ' ; into fcb 2050 2805 00742 JR Z,RCVN4 2052 12 00743 LD (DE),A 2053 23 00744 INC HL 2054 13 00745 INC DE 2055 10F6 00746 DJNZ RCVN3 2057 3E3A 00747 RCVN4 LD A,':' ;Stuff drive indicator 2059 12 00748 LD (DE),A 205A 13 00749 INC DE 205B 3E00 00750 RCVN5 LD A,0 ;P/u drive in ASCII 205D 12 00751 LD (DE),A ; & stuff it 205E 13 00752 INC DE 205F 3E03 00753 LD A,3 ;Close FCB with ETX 2061 12 00754 LD (DE),A 2062 AF 00755 XOR A 2063 C9 00756 RET 00757 ; 00758 ; Routine to recover the filespec 00759 ; 2064 E5 00760 FNAME PUSH HL 2065 D5 00761 PUSH DE 00762 ; 00763 ; Calculate the number of directory sectors 00764 ; = (#sectors x #heads) - 2 for GAT & HIT 00765 ; 2066 3E07 00766 LD A,7 ;Get highest # sector 2068 CD2B1A 00767 CALL @DCTBYT 206B 57 00768 LD D,A ;Store heads & sectors 206C E61F 00769 AND 1FH ;Rake off # sectors 206E 5F 00770 LD E,A ; & stuff into E 206F 1C 00771 INC E ;Bump for 0 offset 2070 AA 00772 XOR D ;Recover # heads 2071 07 00773 RLCA ; into bits 0-2 2072 07 00774 RLCA 2073 07 00775 RLCA 2074 3C 00776 INC A ;Bump for 0 offset 2075 CD0A19 00777 CALL @MUL8 ;Multiply sectors x heads 2078 5F 00778 LD E,A ;Now check double bit 2079 3E04 00779 LD A,4 207B CD2B1A 00780 CALL @DCTBYT 207E CB6F 00781 BIT 5,A ;Set if 2-sided 2080 7B 00782 LD A,E 2081 2801 00783 JR Z,ONESID ;Go if not set else 2083 87 00784 ADD A,A ; double value 2084 D602 00785 ONESID SUB 2 ;Reduce for GAT & HIT 2086 57 00786 LD D,A 2087 78 00787 LD A,B 2088 E61F 00788 AND 1FH ;Calc req sector # 208A BA 00789 CP D 208B 3805 00790 JR C,FNAM1 208D 3E10 00791 LD A,16 ;"Illegal logical file # 208F B7 00792 OR A 2090 1808 00793 JR FNAM2 2092 D1 00794 FNAM1 POP DE 2093 D5 00795 PUSH DE 2094 CDBB18 00796 CALL @DIRRD 2097 CC2020 00797 CALL Z,RCVNAM ;Rcvr the filespec 209A D1 00798 FNAM2 POP DE 209B E1 00799 POP HL 209C C9 00800 RET 00801 ; 00802 ; Close a logical device 00803 ; 209D FE10 00804 CLOSDEV CP 10H ;If not open device, 209F 3E26 00805 LD A,38 ; return "file not open... 20A1 C0 00806 RET NZ 20A2 CD6615 00807 CALL LNKFCB@ ;Link to FCB 20A5 DD4E06 00808 LD C,(IX+6) ;Get device name 20A8 DD4607 00809 LD B,(IX+7) 20AB DD36002A 00810 LD (IX+0),'*' ;Stuff device indicator 20AF DD7101 00811 LD (IX+1),C ;Stuff 1st char of name 20B2 DD7002 00812 LD (IX+2),B ;Stuff 2nd char of name 20B5 DD360303 00813 LD (IX+3),3 ;Terminate with ETX 20B9 AF 00814 XOR A 20BA C9 00815 RET 00816 ; 00817 ; Calculate GAT bit to deallocate 00818 ; 20BB E607 00819 CALCBIT AND 7 ;Make binary bit # into 20BD 07 00820 RLCA ; the proper RES 20BE 07 00821 RLCA ; opcode 20BF 07 00822 RLCA 20C0 F680 00823 OR 80H 20C2 32C620 00824 LD (CALC1+1),A 20C5 CB80 00825 CALC1 RES 0,B ;Reset bit in GAT 20C7 C9 00826 RET 00827 ; 00828 ; User removed disk with an open file 00829 ; 20C8 E5 00830 HOLDUP PUSH HL 20C9 D5 00831 PUSH DE 20CA 21EE20 00832 LD HL,HOLDUP$ ;Pt to message 20CD CD2D05 00833 CALL @DSPLY ;Display to console 20D0 CD5305 00834 CALL @CKBRKC ;Clear out break bit 20D3 CD3506 00835 WAITING CALL @KBD ;Scan the keyboard 20D6 20FB 00836 JR NZ,WAITING ;Keep looking 20D8 FE0D 00837 CP CR ;Check for20DA 280D 00838 JR Z,TRYNOW 20DC CD5305 00839 CALL @CKBRKC ;Check for a break 20DF 28F2 00840 JR Z,WAITING 20E1 D1 00841 ABRT POP DE 20E2 E1 00842 POP HL 20E3 FDE1 00843 POP IY ;Restore from above 20E5 3E20 00844 LD A,32 ;Show illegal drive # 20E7 B7 00845 OR A ;Set NZ condition 20E8 C9 00846 RET ;Go back now 20E9 D1 00847 TRYNOW POP DE 20EA E1 00848 POP HL 20EB C3231E 00849 JP CKAGN ;Try checking again 20EE 0A 00850 HOLDUP$ DB LF,'** CLOSE FAULT ** Drive not ready, ' 2A 2A 20 43 4C 4F 53 45 20 46 41 55 4C 54 20 2A 2A 20 20 44 72 69 76 65 20 6E 6F 74 20 72 65 61 64 79 2C 20 2113 3C 00851 DB ' to retry, to abort',CR 45 4E 54 45 52 3E 20 74 6F 20 72 65 74 72 79 2C 20 3C 42 52 45 41 4B 3E 20 74 6F 20 61 62 6F 72 74 0D 00852 ; 00853 DOID 00854 IF @BLD631 2136 C9 00855 RET ;<631> 00856 ELSE 00857 LD DE,22F6H ;Pt to serial # 00858 LD HL,NOTDSP-1 ;Pt to not displayed 00859 LD B,10 ;Bytes to check 00860 LD A,(DE) 00861 XOR 88H 00862 AND 41H 00863 LD C,A ;Save result 00864 INC DE ;Next byte 00865 LD A,(DE) ;Get value 00866 XOR 0C8H 00867 AND 41H ;Must be opposite of 1st 00868 XOR C 00869 RET Z ;Back if 0 00870 INC DE ;1st byte of serial# 00871 EX DE,HL ;Make into ascii 00872 LD B,8 ;8 bytes remaining 00873 DOID1 LD A,(HL) 00874 CP (HL) 00875 LD (HL),A 00876 INC HL 00877 DJNZ DOID1 00878 PUSH IY ;Save IY 00879 PUSH DE 00880 POP IY ;To build area 00881 DEC HL ;Last byte of serial# 00882 LD A,(HL) ;Digit 3 00883 LD (IY+3),A 00884 LD B,A ;B also gets 3 00885 DEC HL 00886 LD C,(HL) ;#3+#5 00887 DEC HL 00888 LD D,(HL) ;Digit 5 00889 LD (IY+5),D 00890 DEC HL 00891 LD E,(HL) 00892 LD (IY+4),E ;Digit 4 00893 ADD A,D ;Add 3,5 00894 CALL ABS 00895 CP C ;Cp 3+5 00896 JR NZ,BADID 00897 DEC HL 00898 LD C,(HL) ;#2-#3 00899 PUSH DE ;Save 4,5 00900 DEC HL 00901 LD E,(HL) ;A+#4+#5 00902 DEC HL 00903 LD A,(HL) ;Digit 1 00904 LD (IY+1),A 00905 DEC HL 00906 LD A,(HL) ;Digit 2 00907 LD (IY+2),A 00908 SUB B ;2-3 00909 CALL ABS 00910 CP C 00911 JR NZ,BADID 00912 LD C,E ;A+4+5 to C 00913 POP DE 00914 LD A,E 00915 ADD A,D 00916 ADD A,'A'-30H 00917 CP C 00918 JR NZ,BADID 00919 ; 00920 JR CKSTOR ;Check hidden one 00921 BADID POP IY 00922 RET 00923 ; Ok, looks like displayed # is ok 00924 ; 00925 CKSTOR POP HL ;Pt HL at ascii 00926 LD HL,NOTDSP 00927 PUSH HL 00928 LD B,5 00929 CKLP LD A,(HL) 00930 ADD A,30H 00931 LD (HL),A 00932 INC HL 00933 DJNZ CKLP 00934 POP HL 00935 CALL @DECHEX ;Make binary 00936 ; 00937 ; Now get CS number 00938 ; 00939 LD HL,STOR$ ;Pt to it 00940 RLC (HL) 00941 RLC (HL) 00942 LD A,(HL) ;Result to A 00943 INC HL 00944 RLC (HL) 00945 RLC (HL) ;2nd byte done 00946 RLD 00947 PUSH BC ;Save real serial # 00948 PUSH BC ;Twice 00949 LD D,(HL) 00950 LD E,A ;Stored to DE 00951 POP HL ;Real serial # 00952 EX DE,HL ;Stored to HL 00953 LD BC,13974 ;Offset 00954 OR A 00955 SBC HL,BC ;Now should match visible 00956 OR A 00957 SBC HL,DE ;Be sure the same 00958 POP HL ;Get in case good 00959 RET NZ ;Back if bad 00960 ADD HL,BC 00961 LD DE,CSBUFF+4 00962 CALL @HEXDEC 00963 LD HL,CSBUFF 00964 CALL @DSPLY 00965 RET 00966 ; 00967 ; Return a number between 0 and 10 00968 ; 00969 ABS CP 0 ;See if negative 00970 JP P,ABS1 ;Go if not 00971 NEG ;Else make pos 00972 RET 00973 ABS1 CP 10 ;Less than 10 00974 RET C ;Done if so 00975 SUB 10 00976 RET 00977 ; 00978 ; 00979 NOTDSP DC 6,0 ;User serial # 00980 STOR$ DB 0A5H,0DCH 00981 CSBUFF DB 'CS# ',13 00982 ; 00983 ENDIF 2137 00984 LAST EQU $ 00985 IFGT $,DIRBUF$ 00986 ERR 'Module too big' 00987 ENDIF 23FE 00988 ORG MAXCOR$-2 23FE 3703 00989 DW LAST-SYS3 ;Overlay length 00990 ; 1E00 00991 END SYS3 1E00 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]