復活!CP/M ワンボードマイコンでCP/Mを!
CP/MがTK−80互換のワンボードマイコンの上で復活します
ND80ZVとMYCPU80の上でCP/Mが走ります!
[第119回]
●CP/M互換オリジナルDOS(2)
前回は作ったばかりのCP/M互換オリジナルDOSの、CCP(Console Command Processer)プログラムをご紹介しました。
今回はDOS(Disk Operating System)プログラムをご紹介します。
2012/5/13 21:42 ZBDOS1A.TXT END=CA64 ;bdos for nd80z3 ;CP/M2.2 compatible ;2012/5/6 5/7 5/8 5/9 5/11 5/12 5/13 ; ORG $C406 ; B_BOOT=$D200 B_WBOOT=$D203 B_CONST=$D206 B_CONIN=$D209 B_CONOUT=$D20C B_LIST=$D20F B_PUNCH=$D212 B_READER=$D215 B_HOME=$D218 B_SELDSK=$D21B B_SETTRK=$D21E B_SETSEC=$D221 B_SETDMA=$D224 B_READ=$D227 B_WRITE=$D22A B_PRSTAT=$D22D SECTRN=$D230 ; IOBYTE=$8003 CURDRVVCT=$D000 ROVCT=$D002 CURDRV=$D004 CDRV_DIRWK=$D005 DMABFADRS=$D006 DIRTRK=$D008 DIRSCT=$D009 FNPOS=$D00A;in DIR all FNPOSS=$D00B;in SECTOR SAVECNTR=$D00C;-D00D DIRCNTR=$D00E DRVCHR=$D00F ; DPARAM=$D010;to $D02E DIRADRS=$D018 DPTOP=$D01A CSVTOP=$D01C ALVTOP=$D01E SEC=$D020;SECTORS PER TRACK/DISK PARAMETER TOP BLKSFT=$D022 BLKMSK=$D023 ; BLKMAX=$D025 DIRMAX=$D027 DIRALC=$D029 ; SYSFCB=$D03C SYSFCBEX=$D048 SYSFCBRC=$D04B SYSFCBALC=$D04C;=SYSFCB2 SYSFCBCR=$D05C ;D05D-D05F reserved USRDMAADRS=$D060 DIRBFADRS=$D062 ; CONINBF=$D07E;-D0FF ; ;BDOS ENTRY ; C406 C37BC4 JP BDOS ;jump table C409 C3DAC4 JP SYSRES;00 C40C C3DBC4 JP CONIN;01 C40F C3DFC4 JP CONOUT;02 C412 C3E4C4 JP RDRIN;03 C415 C3E8C4 JP PUNOUT;04 C418 C3EDC4 JP LSTOUT;05 C41B C3EEC4 JP CONINOT;06 C41E C3F6C4 JP IOBYTERD;07 C421 C3FAC4 JP IOBYTESET;08 C424 C3FFC4 JP DEOUT;09 C427 C30DC5 JP CONBFIN;0A C42A C33BC5 JP CONCHK;0B C42D C342C5 JP VERRD;0C C430 C346C5 JP DISKRES;0D C433 C34DC5 JP DRVNOSET;0E C436 C36BC5 JP OPEN;0F C439 C3A4C5 JP CLOSE;10 C43C C3E1C5 JP SRCHFST;11 C43F C355C6 JP SRCHNXT;12 C442 C378C6 JP DELETE;13 C445 C3E4C6 JP SEQRD;14 C448 C336C7 JP SEQWR;15 C44B C3BEC7 JP NEWOPEN;16 C44E C318C8 JP RENAME;17 C451 C33DC8 JP CURDRVVCTRD;18 C454 C341C8 JP CURDRVNORD;19 C457 C345C8 JP DMAADRSSET;1A C45A C34BC8 JP ALVADRSRD;1B C45D C34FC8 JP WPSET;1C C460 C36CC8 JP ROVRD;1D C463 C370C8 JP ATTRSET;1E C466 C3AAC8 JP DPARAMRD;1F C469 C3AFC8 JP RNDMRD;21 C46C C306C9 JP RNDMWR;22 C46F C31CC9 JP FSIZERD;23 C472 C35CC9 JP RNDMNOSET;24 C475 C35FC9 JP DRVVCTRES;25 C478 C37EC9 JP RNDMWR0;28 C47B 69 BDOS:LD L,C C47C 2600 LD H,00 C47E 29 ADD HL,HL C47F 0188C4 LD BC,FNCTBL C482 09 ADD HL,BC C483 7E LD A,(HL) C484 23 INC HL C485 66 LD H,(HL) C486 6F LD L,A C487 E9 JP (HL) ; C488 DAC4 FNCTBL:DW SYSRES;00 C48A DBC4 DW CONIN;01 C48C DFC4 DW CONOUT;02 C48E E4C4 DW RDRIN;03 C490 E8C4 DW PUNOUT;04 C492 EDC4 DW LSTOUT;05 C494 EEC4 DW CONINOT;06 C496 F6C4 DW IOBYTERD;07 C498 FAC4 DW IOBYTESET;08 C49A FFC4 DW DEOUT;09 C49C 0DC5 DW CONBFIN;0A C49E 3BC5 DW CONCHK;0B C4A0 42C5 DW VERRD;0C C4A2 46C5 DW DISKRES;0D C4A4 4DC5 DW DRVNOSET;0E C4A6 6BC5 DW OPEN;0F C4A8 A4C5 DW CLOSE;10 C4AA E1C5 DW SRCHFST;11 C4AC 55C6 DW SRCHNXT;12 C4AE 78C6 DW DELETE;13 C4B0 E4C6 DW SEQRD;14 C4B2 36C7 DW SEQWR;15 C4B4 BEC7 DW NEWOPEN;16 C4B6 18C8 DW RENAME;17 C4B8 3DC8 DW CURDRVVCTRD;18 C4BA 41C8 DW CURDRVNORD;19 C4BC 45C8 DW DMAADRSSET;1A C4BE 4BC8 DW ALVADRSRD;1B C4C0 4FC8 DW WPSET;1C C4C2 6CC8 DW ROVRD;1D C4C4 70C8 DW ATTRSET;1E C4C6 AAC8 DW DPARAMRD;1F C4C8 AEC8 DW UNDEFINE;20 C4CA AFC8 DW RNDMRD;21 C4CC 06C9 DW RNDMWR;22 C4CE 1CC9 DW FSIZERD;23 C4D0 5CC9 DW RNDMNOSET;24 C4D2 5FC9 DW DRVVCTRES;25 C4D4 AEC8 DW UNDEFINE;26 C4D6 AEC8 DW UNDEFINE;27 C4D8 7EC9 DW RNDMWR0;28 ; ;SYSTEM RESET FCALL 00 ; C4DA C9 SYSRES:RET ; ;CONSOLE INPUT FCALL 01 ; C4DB CD09D2 CONIN:CALL B_CONIN C4DE C9 RET ; ;CONSOLE OUTPUT FCALL 02 ; C4DF 4B CONOUT:LD C,E C4E0 CD0CD2 CALL B_CONOUT C4E3 C9 RET ; ;READER INPUT FCALL 03 ; C4E4 CD15D2 RDRIN:CALL B_READER C4E7 C9 RET ; ;PUNCHER OUTPUT FCALL 04 ; C4E8 4B PUNOUT:LD C,E C4E9 CD12D2 CALL B_PUNCH C4EC C9 RET ; ;PRINTER OUTPUT FCALL 05 ; C4ED C9 LSTOUT:RET ; ;CONSOLE INPUT/OUTPUT FCALL 06 ; C4EE 7B CONINOT:LD A,E C4EF 3C INC A;if FF C4F0 CADFC4 JP Z,CONOUT C4F3 C3DBC4 JP CONIN ; ;IOBYTE READ FCALL 07 ; C4F6 3A0380 IOBYTERD:LD A,(IOBYTE) C4F9 C9 RET ; ;IOBYTE SET FCALL 08 ; C4FA 7B IOBYTESET:LD A,E C4FB 320380 LD (IOBYTE),A C4FE C9 RET ; ;CHARACTER OUT FROM (DE) TO $ / FCALL 09 ; C4FF 62 DEOUT:LD H,D C500 6B LD L,E C501 7E DEOUT2:LD A,(HL) C502 FE24 CP 24;$ C504 C8 RET Z C505 4F LD C,A C506 CD0CD2 CALL B_CONOUT C509 23 INC HL C50A C301C5 JP DEOUT2 ; ;CONSOLE BUFFER INPUT FCALL 0A ; C50D 62 CONBFIN:LD H,D C50E 6B LD L,E C50F 4E LD C,(HL) C510 0600 LD B,00 C512 23 INC HL C513 E5 PUSH HL C514 23 INC HL C515 CD09D2 CONBFIN2:CALL B_CONIN C518 FE04 CP 04;ctrl+D C51A C220C5 JP NZ,CONBFIN3 C51D E1 POP HL C51E B7 OR A C51F C9 RET C520 4F CONBFIN3:LD C,A C521 F5 PUSH AF C522 CD0CD2 CALL B_CONOUT C525 F1 POP AF C526 FE0D CP 0D C528 CA32C5 JP Z,CONBFINEND C52B 77 LD (HL),A C52C 23 INC HL C52D 04 INC B C52E 0D DEC C C52F C215C5 JP NZ,CONBFIN2 C532 0E0A CONBFINEND:LD C,0A C534 CD0CD2 CALL B_CONOUT C537 E1 POP HL C538 70 LD (HL),B C539 AF XOR A C53A C9 RET ; ;CONSOLE STATUS CHECK FCALL 0B ; C53B CD06D2 CONCHK:CALL B_CONST C53E C8 RET Z C53F 3EFF LD A,FF C541 C9 RET ; ;VERSION NO. READ FCALL 0C ; C542 212200 VERRD:LD HL,$0022 C545 C9 RET ; ;DISK RESET FCALL 0D ; C546 210000 DISKRES:LD HL,$0000 C549 2202D0 LD (ROVCT),HL C54C C9 RET ; ;DISK DRIVE NO. SET FCALL 0E ; C54D 7B DRVNOSET:LD A,E C54E 3204D0 DRVNOSET1:LD (CURDRV),A C551 4F LD C,A C552 CD1BD2 CALL B_SELDSK C555 1110D0 LD DE,DPARAM C558 0E10 LD C,10 C55A CD62C5 CALL PRMCOPY C55D 2A1AD0 LD HL,(DPTOP) C560 0E0F LD C,0F ; C562 7E PRMCOPY:LD A,(HL) C563 12 LD (DE),A C564 23 INC HL C565 13 INC DE C566 0D DEC C C567 C262C5 JP NZ,PRMCOPY C56A C9 RET ; ;DISK FILE OPEN FCALL 0F ; C56B CDE1C5 OPEN:CALL SRCHFST C56E FEFF CP FF C570 C8 RET Z C571 E5 PUSH HL C572 010C00 LD BC,$000C C575 09 ADD HL,BC C576 7E LD A,(HL);extent No. C577 E1 POP HL C578 B7 OR A C579 CA90C5 JP Z,OPEN2 C57C CD55C6 CALL SRCHNXT C57F FEFF CP FF C581 C8 RET Z C582 E5 PUSH HL C583 010C00 LD BC,$000C C586 09 ADD HL,BC C587 7E LD A,(HL);extent No. C588 E1 POP HL C589 B7 OR A C58A CA90C5 JP Z,OPEN2 C58D 3EFF LD A,FF C58F C9 RET C590 0620 OPEN2:LD B,20 C592 1A LD A,(DE) C593 F5 PUSH AF C594 D5 PUSH DE C595 7E OPEN3:LD A,(HL) C596 12 LD (DE),A C597 13 INC DE C598 23 INC HL C599 05 DEC B C59A C295C5 JP NZ,OPEN3 C59D D1 POP DE C59E F1 POP AF C59F 12 LD (DE),A C5A0 3A0BD0 LD A,(FNPOSS) C5A3 C9 RET ; ;DISK FILE CLOSE FCALL 10 ; C5A4 CDE1C5 CLOSE:CALL SRCHFST C5A7 FEFF CP FF C5A9 C8 RET Z C5AA E5 PUSH HL C5AB 010C00 LD BC,$000C C5AE 09 ADD HL,BC C5AF 7E LD A,(HL);extent No. C5B0 E1 POP HL C5B1 B7 OR A C5B2 CAC9C5 JP Z,CLOSE2 C5B5 CD55C6 CALL SRCHNXT C5B8 FEFF CP FF C5BA C8 RET Z C5BB E5 PUSH HL C5BC 010C00 LD BC,$000C C5BF 09 ADD HL,BC C5C0 7E LD A,(HL);extent No. C5C1 E1 POP HL C5C2 B7 OR A C5C3 CAC9C5 JP Z,CLOSE2 C5C6 3EFF LD A,FF C5C8 C9 RET C5C9 0620 CLOSE2:LD B,20 C5CB E5 PUSH HL C5CC 7E CLOSE3:LD A,(HL) C5CD 12 LD (DE),A C5CE 05 DEC B C5CF C2CCC5 JP NZ,CLOSE3 C5D2 E1 POP HL C5D3 3600 LD (HL),00 C5D5 EB EX DE,HL C5D6 2A62D0 LD HL,(DIRBFADRS) C5D9 EB EX DE,HL C5DA CD2AD2 CALL B_WRITE C5DD 3A0BD0 LD A,(FNPOSS) C5E0 C9 RET ; ;FILE NAME SEARCH FIRST FCALL 11 return with HL=FCB ; C5E1 CDDEC9 SRCHFST:CALL DIRSET C5E4 2A62D0 SRCHFST3:LD HL,(DIRBFADRS) C5E7 010004 LD BC,$0400 C5EA C5 SRCHFST4:PUSH BC C5EB CD18C6 CALL NMCMP C5EE CA0FC6 JP Z,SRCHFST8 C5F1 012000 SRCHFST42:LD BC,$0020 C5F4 09 ADD HL,BC C5F5 C1 POP BC C5F6 0C INC C C5F7 05 DEC B C5F8 C2EAC5 JP NZ,SRCHFST4 C5FB 210AD0 SRCHFST43:LD HL,FNPOS C5FE 34 INC (HL) C5FF 34 INC (HL) C600 34 INC (HL) C601 34 INC (HL) C602 3A27D0 LD A,(DIRMAX) C605 BE CP (HL) C606 DA15C6 JP C,SRCHFST9 C609 CD25CA CALL NDIRSET C60C C3E4C5 JP SRCHFST3 ; C60F C1 SRCHFST8:POP BC C610 79 LD A,C C611 320BD0 LD (FNPOSS),A C614 C9 RET C615 3EFF SRCHFST9:LD A,FF C617 C9 RET ; ;NAME COMP return with HL=FCB C618 7E NMCMP:LD A,(HL) C619 FEE5 CP E5 C61B C220C6 JP NZ,NMCMP02 C61E B7 OR A;reset zflag C61F C9 RET C620 D5 NMCMP02:PUSH DE C621 E5 PUSH HL C622 13 INC DE C623 23 INC HL C624 0E08 LD C,08 C626 1A NMCMP1:LD A,(DE) C627 FE3F CP 3F;? C629 CA33C6 JP Z,NMCMP2 C62C BE CP (HL) C62D CA33C6 JP Z,NMCMP2 C630 E1 POP HL C631 D1 POP DE C632 C9 RET C633 13 NMCMP2:INC DE C634 23 INC HL C635 0D DEC C C636 C226C6 JP NZ,NMCMP1 C639 0E03 LD C,03 C63B 1A NMCMP3:LD A,(DE) C63C FE3F CP 3F;? C63E CA4CC6 JP Z,NMCMP4 C641 47 LD B,A C642 7E LD A,(HL) C643 E67F AND 7F C645 B8 CP B C646 CA4CC6 JP Z,NMCMP4 C649 E1 POP HL C64A D1 POP DE C64B C9 RET C64C 13 NMCMP4:INC DE C64D 23 INC HL C64E 0D DEC C C64F C23BC6 JP NZ,NMCMP3 C652 E1 POP HL C653 D1 POP DE C654 C9 RET ; ;FILE NAME SEARCH NEXT FCALL 12 ; C655 3A0BD0 SRCHNXT:LD A,(FNPOSS) C658 FE03 CP 03 C65A CAFBC5 JP Z,SRCHFST43 C65D 4F LD C,A C65E 3E04 LD A,04 C660 91 SUB C C661 47 LD B,A C662 79 LD A,C C663 2A62D0 LD HL,(DIRBFADRS) C666 B7 OR A C667 CA74C6 JP Z,SRCHNXT22 C66A D5 PUSH DE C66B 112000 LD DE,$0020 C66E 19 SRCHNXT2:ADD HL,DE C66F 3D DEC A C670 C26EC6 JP NZ,SRCHNXT2 C673 D1 POP DE C674 C5 SRCHNXT22:PUSH BC C675 C3F1C5 JP SRCHFST42 ; ;FILE DELETE FCALL 13 ; C678 CDE1C5 DELETE:CALL SRCHFST C67B FEFF CP FF C67D C8 RET Z C67E 36E5 DELETE2:LD (HL),E5 C680 D5 PUSH DE C681 112000 LD DE,$0020 C684 19 ADD HL,DE C685 0610 LD B,10;=16 C687 7E DELETE3:LD A,(HL) C688 B7 OR A C689 CA92C6 JP Z,DELETE4 C68C CDAFC6 CALL ALCCLR C68F DAABC6 JP C,DELETE9 C692 05 DELETE4:DEC B C693 C287C6 JP NZ,DELETE3 C696 EB EX DE,HL C697 2A62D0 LD HL,(DIRBFADRS) C69A EB EX DE,HL C69B CD2AD2 CALL B_WRITE C69E D1 POP DE C69F CD55C6 CALL SRCHNXT C6A2 FEFF CP FF C6A4 C27EC6 JP NZ,DELETE2 C6A7 3A0BD0 LD A,(FNPOSS) C6AA C9 RET ; C6AB D1 DELETE9:POP DE C6AC 3EFF LD A,FF C6AE C9 RET ; ;block alloc bit clear C6AF E5 ALCCLR:PUSH HL C6B0 D5 PUSH DE C6B1 C5 PUSH BC C6B2 4F LD C,A;block no. C6B3 2A1ED0 LD HL,(ALVTOP) C6B6 3A25D0 LD A,(BLKMAX);<FF ! toriaezu C6B9 47 LD B,A C6BA 04 INC B C6BB 1608 ALCCLR1:LD D,08 C6BD 1E00 LD E,00 C6BF 7E LD A,(HL) C6C0 07 ALCCLR2:RLCA C6C1 1C INC E C6C2 05 DEC B C6C3 CADFC6 JP Z,ALCCLR9;err C6C6 0D DEC C C6C7 CAD2C6 JP Z,ALCCLR3 C6CA 15 DEC D C6CB C2C0C6 JP NZ,ALCCLR2 C6CE 23 INC HL C6CF C3BBC6 JP ALCCLR1 C6D2 E6FE ALCCLR3:AND FE C6D4 0F ALCCLR4:RRCA C6D5 1D DEC E C6D6 C2D4C6 JP NZ,ALCCLR4 C6D9 77 LD (HL),A C6DA C1 POP BC C6DB D1 POP DE C6DC E1 POP HL C6DD B7 OR A;reset Cflag C6DE C9 RET C6DF C1 ALCCLR9:POP BC C6E0 D1 POP DE C6E1 E1 POP HL C6E2 37 SCF;err C6E3 C9 RET ; ; ;SEQUENTIAL READ FCALL 14 ; C6E4 210F00 SEQRD:LD HL,$000F C6E7 19 ADD HL,DE C6E8 46 LD B,(HL);rec no. in this extent C6E9 E5 PUSH HL C6EA 111100 LD DE,$0011 C6ED 19 ADD HL,DE C6EE 7E LD A,(HL);next rec no. C6EF B8 CP B C6F0 CA23C7 JP Z,SEQRDEND; end or next extent!! C6F3 34 INC (HL) C6F4 E1 POP HL C6F5 23 INC HL C6F6 CD27C7 SQRD1:CALL SRCHBLK C6F9 F5 PUSH AF;position C6FA 4E LD C,(HL) C6FB 0600 LD B,00 C6FD CD3ACA CALL BLKTOTS;B=TRK,C=SEC C700 F1 POP AF C701 81 ADD A,C C702 4F LD C,A C703 2120D0 LD HL,SEC C706 BE CP (HL) C707 DA0DC7 JP C,SEQRD2 C70A 04 INC B C70B 96 SUB (HL) C70C 4F LD C,A C70D C5 SEQRD2:PUSH BC C70E 48 LD C,B C70F CD1ED2 CALL B_SETTRK C712 C1 POP BC C713 CD21D2 CALL B_SETSEC C716 2A06D0 LD HL,(DMABFADRS) C719 44 LD B,H C71A 4D LD C,L C71B CD24D2 CALL B_SETDMA C71E CD27D2 CALL B_READ C721 AF XOR A C722 C9 RET ; C723 E1 SEQRDEND:POP HL C724 3E01 LD A,01;end of file C726 C9 RET ; ;rec no. to brock no. alloc & position ; C727 F5 SRCHBLK:PUSH AF C728 3A23D0 LD A,(BLKMSK) C72B 3C INC A C72C 4F LD C,A C72D F1 POP AF C72E B9 CP C C72F D8 RET C C730 23 INC HL C731 91 SUB C C732 C327C7 JP SRCHBLK C735 C9 RET ; ;SEQUENTIAL WRITE FCALL 15 ; C736 210F00 SEQWR:LD HL,$000F C739 19 ADD HL,DE C73A 7E LD A,(HL);rec no. in this extent C73B 3C INC A C73C FE81 CP 81 C73E CA83C7 JP Z,SEQWR8;next extent C741 77 LD (HL),A C742 E5 PUSH HL C743 111100 LD DE,$0011 C746 19 ADD HL,DE C747 7E LD A,(HL) C748 34 INC (HL);next rec no. C749 E1 POP HL C74A 23 INC HL C74B CD27C7 SEQWR1:CALL SRCHBLK C74E B7 OR A C74F C25AC7 JP NZ,SEQWR2 C752 CD87C7 CALL SRCHNXTBLK;A=next block no. C755 DA84C7 JP C,SEQWR9;DISK FULL C758 77 LD (HL),A;next block no. C759 AF XOR A C75A F5 SEQWR2:PUSH AF;position C75B 4E LD C,(HL) C75C 0600 LD B,00 C75E CD3ACA CALL BLKTOTS;B=TRK,C=SEC C761 F1 POP AF C762 81 ADD A,C C763 2120D0 LD HL,SEC C766 BE CP (HL) C767 DA6DC7 JP C,SEQWR3 C76A 04 INC B C76B 96 SUB (HL) C76C 4F LD C,A C76D C5 SEQWR3:PUSH BC C76E 48 LD C,B C76F CD1ED2 CALL B_SETTRK C772 C1 POP BC C773 CD21D2 CALL B_SETSEC C776 2A06D0 LD HL,(DMABFADRS) C779 44 LD B,H C77A 4D LD C,L C77B CD24D2 CALL B_SETDMA C77E CD2AD2 CALL B_WRITE C781 AF XOR A C782 C9 RET ; ;next extent make !!! C783 C9 SEQWR8:RET ; C784 3E02 SEQWR9:LD A,02;DISK FULL C786 C9 RET ; ;search next block return with A=next block no. C787 E5 SRCHNXTBLK:PUSH HL C788 D5 PUSH DE C789 C5 PUSH BC C78A 2A1ED0 LD HL,(ALVTOP) C78D 3A25D0 LD A,(BLKMAX);>FF ! C790 47 LD B,A C791 0E00 LD C,00 C793 1608 SRCHNXTBLK1:LD D,08 C795 1E00 LD E,00 C797 7E LD A,(HL) C798 07 SRCHNXTBLK2:RLCA C799 D2AAC7 JP NC,SRCHNXTBLK3 C79C 05 DEC B C79D CAB9C7 JP Z,SRCHNXTBLK9;disk full C7A0 0C INC C C7A1 1C INC E C7A2 15 DEC D C7A3 C298C7 JP NZ,SRCHNXTBLK2 C7A6 23 INC HL C7A7 C393C7 JP SRCHNXTBLK1 C7AA F601 SRCHNXTBLK3:OR 01 C7AC 0F SRCHNXTBLK4:RRCA C7AD 1D DEC E C7AE C2ACC7 JP NZ,SRCHNXTBLK4 C7B1 77 LD (HL),A C7B2 79 LD A,C C7B3 C1 POP BC C7B4 D1 POP DE C7B5 E1 POP HL C7B6 3C INC A C7B7 B7 OR A;reset Cflag C7B8 C9 RET C7B9 C1 SRCHNXTBLK9:POP BC C7BA D1 POP DE C7BB E1 POP HL C7BC 37 SCF;disk full C7BD C9 RET ; ;NEW FILE OPEN FCALL 16 ; C7BE CDE1C5 NEWOPEN:CALL SRCHFST C7C1 FEFF CP FF C7C3 CAD3C7 JP Z,NEWOPEN2 C7C6 3E01 LD A,01;file name existed C7C8 C9 RET C7C9 CDE5C7 CALL SRCHE5 C7CC C0 RET NZ;directory full C7CD 3600 LD (HL),00 C7CF 23 INC HL C7D0 13 INC DE C7D1 060B LD B,0B;=11 C7D3 1A NEWOPEN2:LD A,(DE) C7D4 77 LD (HL),A C7D5 23 INC HL C7D6 13 INC DE C7D7 05 DEC B C7D8 C2D3C7 JP NZ,NEWOPEN2 C7DB AF XOR A C7DC 0614 LD B,14;=20 C7DE 77 NEWOPEN3:LD (HL),A C7DF 23 INC HL C7E0 05 DEC B C7E1 C2DEC7 JP NZ,NEWOPEN3 C7E4 C9 RET ; ;dir search 'E5' C7E5 D5 SRCHE5:PUSH DE C7E6 CDDEC9 CALL DIRSET C7E9 2A62D0 SRCHE5_2:LD HL,(DIRBFADRS) C7EC 1604 LD D,04 C7EE 7E SRCHE5_3:LD A,(HL) C7EF FEE5 CP E5 C7F1 CA10C8 JP Z,SRCHE5_8 C7F4 012000 LD BC,$0020 C7F7 09 ADD HL,BC C7F8 15 DEC D C7F9 C2EEC7 JP NZ,SRCHE5_3 C7FC 210AD0 LD HL,FNPOS C7FF 34 INC (HL) C800 34 INC (HL) C801 34 INC (HL) C802 34 INC (HL) C803 3A27D0 LD A,(DIRMAX) C806 BE CP (HL) C807 D213C8 JP NC,SRCHE5_9 C80A CD25CA CALL NDIRSET C80D C3E9C7 JP SRCHE5_2 ; C810 D1 SRCHE5_8:POP DE C811 AF XOR A C812 C9 RET C813 D1 SRCHE5_9:POP DE C814 3EFF LD A,FF C816 B7 OR A C817 C9 RET ; ;RENAME FCALL 17 ; C818 CDE1C5 RENAME:CALL SRCHFST C81B FEFF CP FF C81D C8 RET Z C81E 23 RENAME2:INC HL C81F D5 PUSH DE C820 EB EX DE,HL C821 011100 LD BC,$0011 C824 09 ADD HL,BC C825 060B LD B,0B;=11 C827 7E RENAME3:LD A,(HL) C828 12 LD (DE),A C829 23 INC HL C82A 13 INC DE C82B 05 DEC B C82C C227C8 JP NZ,RENAME3 C82F CD2AD2 CALL B_WRITE C832 D1 POP DE C833 CD55C6 CALL SRCHNXT C836 FEFF CP FF C838 C21EC8 JP NZ,RENAME2 C83B AF XOR A C83C C9 RET ; ;CURRENT DRIVE VECTOR(LOGIN VECTOR) ADDRESS READ FCALL 18 ; C83D 2100D0 CURDRVVCTRD:LD HL,CURDRVVCT C840 C9 RET ; ;CURRENT DRIVE NO. READ FCALL 19 ; C841 3A04D0 CURDRVNORD:LD A,(CURDRV) C844 C9 RET ; ;DMA ADRRESS SET FCALL 1A ; C845 62 DMAADRSSET:LD H,D C846 6B LD L,E C847 2260D0 LD (USRDMAADRS),HL C84A C9 RET ; ;ALLOCATION VECTOR ADDRESS READ FCALL 1B ; C84B 211ED0 ALVADRSRD:LD HL,ALVTOP C84E C9 RET ; ;WRITE PROTECT SET FCALL 1C ; C84F 2A02D0 WPSET:LD HL,(ROVCT) C852 EB EX DE,HL C853 3A04D0 LD A,(CURDRV) C856 3C INC A C857 210100 LD HL,$0001 C85A 3D WPSET1:DEC A C85B CA62C8 JP Z,WPSET2 C85E 29 ADD HL,HL C85F C35AC8 JP WPSET1 C862 7C WPSET2:LD A,H C863 B2 OR D C864 67 LD H,A C865 7D LD A,L C866 B3 OR E C867 6F LD L,A C868 2202D0 LD (ROVCT),HL C86B C9 RET ; ;READ ONLY VECTOR ADDRESS READ FCALL 1D ; C86C 2102D0 ROVRD:LD HL,ROVCT C86F C9 RET ; ;FILE ATTRIBUTE SET FCALL 1E ; C870 CDE1C5 ATTRSET:CALL SRCHFST C873 FEFF CP FF C875 C8 RET Z C876 E5 PUSH HL C877 010C00 LD BC,$000C C87A 09 ADD HL,BC C87B 7E LD A,(HL);extent No. C87C E1 POP HL C87D B7 OR A C87E CA95C8 JP Z,ATTRSET2 C881 CD55C6 CALL SRCHNXT C884 FEFF CP FF C886 C8 RET Z C887 E5 PUSH HL C888 010C00 LD BC,$000C C88B 09 ADD HL,BC C88C 7E LD A,(HL);extent No. C88D E1 POP HL C88E B7 OR A C88F CA95C8 JP Z,ATTRSET2 C892 3EFF LD A,FF C894 C9 RET C895 010900 ATTRSET2:LD BC,$0009 C898 09 ADD HL,BC C899 EB EX DE,HL C89A 09 ADD HL,BC C89B 0603 LD B,03 C89D 7E ATTRSET3:LD A,(HL) C89E 12 LD (DE),A C89F 05 DEC B C8A0 C29DC8 JP NZ,ATTRSET3 C8A3 CD2AD2 CALL B_WRITE C8A6 3A0BD0 LD A,(FNPOSS) C8A9 C9 RET ; ;DISK PARAMETER ADDRESS READ FCALL 1F ; C8AA 2120D0 DPARAMRD:LD HL,SEC C8AD C9 RET ; ;UNDEFINE FCALL 20,26,27 ; C8AE C9 UNDEFINE:RET ; ;RANDOM READ FCALL 21 ; C8AF CDC5C8 RNDMRD:CALL RNDMSB C8B2 C2C2C8 JP NZ,RNDMRDERR C8B5 7E LD A,(HL) C8B6 B7 OR A C8B7 CAC2C8 JP Z,RNDMRDERR C8BA 211000 LD HL,$0010 C8BD 19 ADD HL,DE C8BE 79 LD A,C C8BF C3F6C6 JP SQRD1 C8C2 3EFF RNDMRDERR:LD A,FF C8C4 C9 RET ; ;rec no. to BLOCK aloc position ;return value B=this extent no. C=rec no. in this extent ;HL=BLOCK ALOC POINT ; ZFoff & A=FF if err C8C5 212100 RNDMSB:LD HL,$0021 C8C8 19 ADD HL,DE C8C9 7E LD A,(HL) C8CA 23 INC HL C8CB 66 LD H,(HL) C8CC 6F LD L,A;HL=next rec no. C8CD 0607 LD B,07 C8CF 7C RNDMSB2:LD A,H C8D0 1F RRA C8D1 67 LD H,A C8D2 7D LD A,L C8D3 1F RRA C8D4 6F LD L,A C8D5 05 DEC B C8D6 C2CFC8 JP NZ,RNDMSB2 C8D9 7C LD A,H C8DA 1F RRA C8DB 1F RRA C8DC 4F LD C,A;rec no. in extent C8DD 45 LD B,L;extent no. C8DE 210C00 RNDMSB3:LD HL,$000C C8E1 19 ADD HL,DE C8E2 78 LD A,B C8E3 BE CP (HL) C8E4 C2F8C8 JP NZ,RNDMSB5;read next extent C8E7 23 INC HL C8E8 23 INC HL C8E9 23 INC HL C8EA 23 INC HL C8EB 79 LD A,C C8EC 0F RRCA C8ED 0F RRCA C8EE 0F RRCA C8EF E61F AND 1F C8F1 C8 RET Z C8F2 23 RNDMSB4:INC HL C8F3 3D DEC A C8F4 C2F2C8 JP NZ,RNDMSB4 C8F7 C9 RET ; C8F8 C5 RNDMSB5:PUSH BC C8F9 D5 PUSH DE C8FA CD55C6 CALL SRCHNXT C8FD D1 POP DE C8FE C1 POP BC C8FF FEFF CP FF C901 C2DEC8 JP NZ,RNDMSB3 C904 B7 OR A C905 C9 RET ; ;RANDOM WRITE FCALL 22 ; C906 CDC5C8 RNDMWR:CALL RNDMSB C909 C219C9 JP NZ,RNDMWRERR C90C 7E LD A,(HL) C90D B7 OR A C90E CA19C9 JP Z,RNDMWRERR C911 211000 LD HL,$0010 C914 19 ADD HL,DE C915 79 LD A,C C916 C34BC7 JP SEQWR1 C919 3EFF RNDMWRERR:LD A,FF C91B C9 RET ; ;FILE SIZE READ FCALL 23 ; C91C 0600 FSIZERD:LD B,00 C91E C5 PUSH BC;B=max extent No. C91F CDE1C5 CALL SRCHFST C922 FEFF CP FF C924 CA58C9 JP Z,FSIZERDERR C927 010C00 FSIZERD1:LD BC,$000C C92A 09 ADD HL,BC C92B 7E LD A,(HL);extent No. C92C C1 POP BC;max extent No. C92D B8 CP B C92E DA36C9 JP C,FSIZERD2 C931 47 LD B,A C932 23 INC HL C933 23 INC HL C934 23 INC HL C935 4E LD C,(HL);sectors in this extent C936 C5 FSIZERD2:PUSH BC C937 CD55C6 CALL SRCHNXT C93A FEFF CP FF C93C C227C9 JP NZ,FSIZERD1 C93F C1 POP BC C940 68 LD L,B C941 2600 LD H,00 C943 0607 LD B,07 C945 29 FSIZERD3:ADD HL,HL C946 05 DEC B C947 C245C9 JP NZ,FSIZERD3;*128 C94A 09 ADD HL,BC C94B EB EX DE,HL C94C 012100 LD BC,$0021 C94F 09 ADD HL,BC C950 73 LD (HL),E C951 23 INC HL C952 72 LD (HL),D C953 23 INC HL C954 3600 LD (HL),00;************** C956 AF XOR A C957 C9 RET C958 C1 FSIZERDERR:POP BC C959 3EFF LD A,FF C95B C9 RET ; ;RANDOM ACCESS RECOAD NO. SET FCALL 24 ; C95C C31CC9 RNDMNOSET:JP FSIZERD ; ;WITH DISK DRIVE VECTOR RESET FCALLO 25 ; C95F 78 DRVVCTRES:LD A,B C960 2A00D0 LD HL,(CURDRVVCT) C963 EB EX DE,HL C964 2A02D0 LD HL,(ROVCT) C967 2F CPL C968 47 LD B,A C969 A4 AND H C96A 67 LD H,A C96B 78 LD A,B C96C A2 AND D C96D 57 LD D,A C96E 79 LD A,C C96F 2F CPL C970 4F LD C,A C971 A5 AND L C972 6F LD L,A C973 79 LD A,C C974 A3 AND E C975 5F LD E,A C976 2202D0 LD (ROVCT),HL C979 EB EX DE,HL C97A 2200D0 LD (CURDRVVCT),HL C97D C9 RET ; ;RANDOM WRITE WITH 00 FCALL 28 ; C97E CDC5C8 RNDMWR0:CALL RNDMSB C981 C29AC9 JP NZ,RNDMWR0ERR C984 7E LD A,(HL) C985 B7 OR A C986 CA9AC9 JP Z,RNDMWR0ERR C989 211000 LD HL,$0010 C98C 19 ADD HL,DE C98D 79 LD A,C C98E F5 PUSH AF C98F E5 PUSH HL C990 CD4BC7 CALL SEQWR1 C993 FEFF CP FF C995 C29DC9 JP NZ,RNDMWR02 C998 E1 RNDMWR01:POP HL C999 F1 POP AF C99A 3EFF RNDMWR0ERR:LD A,FF C99C C9 RET C99D E1 RNDMWR02:POP HL C99E F1 POP AF C99F E6F8 AND F8 C9A1 F5 RNDMWR03:PUSH AF C9A2 E5 PUSH HL C9A3 CDF6C6 CALL SQRD1 C9A6 FEFF CP FF C9A8 CA98C9 JP Z,RNDMWR01 C9AB 2A06D0 LD HL,(DMABFADRS) C9AE 0680 LD B,80 C9B0 3EE5 LD A,E5 C9B2 7E RNDMWR04:LD A,(HL) C9B3 BE CP (HL) C9B4 C2D4C9 JP NZ,RNDMWR06 C9B7 23 INC HL C9B8 05 DEC B C9B9 C2B2C9 JP NZ,RNDMWR04 C9BC 0680 LD B,80 C9BE 2A06D0 LD HL,(DMABFADRS) C9C1 AF XOR A C9C2 77 RNDMWR05:LD (HL),A C9C3 23 INC HL C9C4 05 DEC B C9C5 C2C2C9 JP NZ,RNDMWR05 C9C8 E1 POP HL C9C9 F1 POP AF C9CA F5 PUSH AF C9CB E5 PUSH HL C9CC CD4BC7 CALL SEQWR1 C9CF FEFF CP FF C9D1 CA98C9 JP Z,RNDMWR01 C9D4 E1 RNDMWR06:POP HL C9D5 F1 POP AF C9D6 3C INC A C9D7 FE08 CP 08 C9D9 C2A1C9 JP NZ,RNDMWR03 C9DC AF XOR A C9DD C9 RET ; ;DIR TRACK&SECTOR SET & READ C9DE D5 DIRSET:PUSH DE C9DF 2129D0 LD HL,DIRALC C9E2 7E LD A,(HL) C9E3 0608 LD B,08 C9E5 0E00 LD C,00 C9E7 07 DIRSET1:RLCA C9E8 DAFDC9 JP C,DIRSETE C9EB 0C INC C C9EC 05 DEC B C9ED C2E7C9 JP NZ,DIRSET1 C9F0 23 INC HL C9F1 7E LD A,(HL) C9F2 0608 LD B,08 C9F4 07 DIRSET2:RLCA C9F5 DAFDC9 JP C,DIRSETE C9F8 0C INC C C9F9 05 DEC B C9FA C2F4C9 JP NZ,DIRSET2 ; C9FD AF DIRSETE:XOR A C9FE 320AD0 LD (FNPOS),A CA01 0600 LD B,00 CA03 CD3ACA CALL BLKTOTS CA06 2108D0 DIRSETE2:LD HL,DIRTRK CA09 70 LD (HL),B CA0A 23 INC HL CA0B 71 LD (HL),C CA0C C5 PUSH BC CA0D 48 LD C,B CA0E CD1ED2 CALL B_SETTRK CA11 C1 POP BC CA12 CD21D2 CALL B_SETSEC CA15 2A62D0 LD HL,(DIRBFADRS) CA18 44 LD B,H CA19 4D LD C,L CA1A CD24D2 CALL B_SETDMA CA1D CD27D2 CALL B_READ CA20 320BD0 LD (FNPOSS),A CA23 D1 POP DE CA24 C9 RET ; ;NECT DIR TRACK&SECTOR SET & READ CA25 D5 NDIRSET:PUSH DE CA26 2108D0 LD HL,DIRTRK CA29 46 LD B,(HL) CA2A 23 INC HL CA2B 4E LD C,(HL) CA2C 0C INC C CA2D 3A20D0 LD A,(SEC) CA30 B9 CP C CA31 C206CA JP NZ,DIRSETE2 CA34 0E00 LD C,00 CA36 04 INC B CA37 C306CA JP DIRSETE2 ; ;FROM BLOCK NO. TO TRACK,SECTOR ;BC=BLKNo. > B=TRK C=SEC CA3A 3A22D0 BLKTOTS:LD A,(BLKSFT);BROCK TO SECTOR CA3D 5F LD E,A CA3E 79 BLKTOTS1:LD A,C CA3F B7 OR A CA40 17 RLA CA41 4F LD C,A CA42 78 LD A,B CA43 17 RLA CA44 47 LD B,A CA45 1D DEC E CA46 C23ECA JP NZ,BLKTOTS1 ;TRACK=BC/SEC SEC must be 2^n CA49 3A20D0 LD A,(SEC) CA4C 57 LD D,A CA4D 79 LD A,C CA4E 15 DEC D CA4F A2 AND D CA50 F5 PUSH AF;SECTOR CA51 14 INC D CA52 7A BLKTOTS2:LD A,D CA53 1F RRA CA54 57 LD D,A CA55 DA61CA JP C,BLKTOTS3 CA58 78 LD A,B CA59 1F RRA CA5A 47 LD B,A CA5B 79 LD A,C CA5C 1F RRA CA5D 4F LD C,A CA5E C352CA JP BLKTOTS2 CA61 41 BLKTOTS3:LD B,C CA62 F1 POP AF CA63 4F LD C,A;SECTOR CA64 C9 RET ;ALCCLR =C6AF ALCCLR1 =C6BB ALCCLR2 =C6C0 ALCCLR3 =C6D2 ALCCLR4 =C6D4 ALCCLR9 =C6DF ALVADRSRD =C84B ALVTOP =D01E ATTRSET =C870 ATTRSET2 =C895 ATTRSET3 =C89D BDOS =C47B BLKMAX =D025 BLKMSK =D023 BLKSFT =D022 BLKTOTS =CA3A BLKTOTS1 =CA3E BLKTOTS2 =CA52 BLKTOTS3 =CA61 B_BOOT =D200 B_CONIN =D209 B_CONOUT =D20C B_CONST =D206 B_HOME =D218 B_LIST =D20F B_PRSTAT =D22D B_PUNCH =D212 B_READ =D227 B_READER =D215 B_SELDSK =D21B B_SETDMA =D224 B_SETSEC =D221 B_SETTRK =D21E B_WBOOT =D203 B_WRITE =D22A CDRV_DIRWK =D005 CLOSE =C5A4 CLOSE2 =C5C9 CLOSE3 =C5CC CONBFIN =C50D CONBFIN2 =C515 CONBFIN3 =C520 CONBFINEND =C532 CONCHK =C53B CONIN =C4DB CONINBF =D07E CONINOT =C4EE CONOUT =C4DF CSVTOP =D01C CURDRV =D004 CURDRVNORD =C841 CURDRVVCT =D000 CURDRVVCTRD =C83D DELETE =C678 DELETE2 =C67E DELETE3 =C687 DELETE4 =C692 DELETE9 =C6AB DEOUT =C4FF DEOUT2 =C501 DIRADRS =D018 DIRALC =D029 DIRBFADRS =D062 DIRCNTR =D00E DIRMAX =D027 DIRSCT =D009 DIRSET =C9DE DIRSET1 =C9E7 DIRSET2 =C9F4 DIRSETE =C9FD DIRSETE2 =CA06 DIRTRK =D008 DISKRES =C546 DMAADRSSET =C845 DMABFADRS =D006 DPARAM =D010 DPARAMRD =C8AA DPTOP =D01A DRVCHR =D00F DRVNOSET =C54D DRVNOSET1 =C54E DRVVCTRES =C95F FNCTBL =C488 FNPOS =D00A FNPOSS =D00B FSIZERD =C91C FSIZERD1 =C927 FSIZERD2 =C936 FSIZERD3 =C945 FSIZERDERR =C958 IOBYTE =8003 IOBYTERD =C4F6 IOBYTESET =C4FA LSTOUT =C4ED NDIRSET =CA25 NEWOPEN =C7BE NEWOPEN2 =C7D3 NEWOPEN3 =C7DE NMCMP =C618 NMCMP02 =C620 NMCMP1 =C626 NMCMP2 =C633 NMCMP3 =C63B NMCMP4 =C64C OPEN =C56B OPEN2 =C590 OPEN3 =C595 PRMCOPY =C562 PUNOUT =C4E8 RDRIN =C4E4 RENAME =C818 RENAME2 =C81E RENAME3 =C827 RNDMNOSET =C95C RNDMRD =C8AF RNDMRDERR =C8C2 RNDMSB =C8C5 RNDMSB2 =C8CF RNDMSB3 =C8DE RNDMSB4 =C8F2 RNDMSB5 =C8F8 RNDMWR =C906 RNDMWR0 =C97E RNDMWR01 =C998 RNDMWR02 =C99D RNDMWR03 =C9A1 RNDMWR04 =C9B2 RNDMWR05 =C9C2 RNDMWR06 =C9D4 RNDMWR0ERR =C99A RNDMWRERR =C919 ROVCT =D002 ROVRD =C86C SAVECNTR =D00C SEC =D020 SECTRN =D230 SEQRD =C6E4 SEQRD2 =C70D SEQRDEND =C723 SEQWR =C736 SEQWR1 =C74B SEQWR2 =C75A SEQWR3 =C76D SEQWR8 =C783 SEQWR9 =C784 SQRD1 =C6F6 SRCHBLK =C727 SRCHE5 =C7E5 SRCHE5_2 =C7E9 SRCHE5_3 =C7EE SRCHE5_8 =C810 SRCHE5_9 =C813 SRCHFST =C5E1 SRCHFST3 =C5E4 SRCHFST4 =C5EA SRCHFST42 =C5F1 SRCHFST43 =C5FB SRCHFST8 =C60F SRCHFST9 =C615 SRCHNXT =C655 SRCHNXT2 =C66E SRCHNXT22 =C674 SRCHNXTBLK =C787 SRCHNXTBLK1 =C793 SRCHNXTBLK2 =C798 SRCHNXTBLK3 =C7AA SRCHNXTBLK4 =C7AC SRCHNXTBLK9 =C7B9 SYSFCB =D03C SYSFCBALC =D04C SYSFCBCR =D05C SYSFCBEX =D048 SYSFCBRC =D04B SYSRES =C4DA UNDEFINE =C8AE USRDMAADRS =D060 VERRD =C542 WPSET =C84F WPSET1 =C85A WPSET2 =C862 |