MYCPU80でCP/Mを!
超巨大基板の8080互換HCMOS・CPUでCP/Mを走らせてしまおうという、なんとも狂気なプロジェクトです!
[第122回]
●ファンクション17
ファンクション17はビルトインコマンドのREN(リネーム)とほぼ同じ働きをします。
RENは変更後の名前と同じ名前のファイルがすでに存在する場合には名前の変更ができませんが、ファンクション17は同じ名前のファイルがすでに存在していても、名前の変更をおこなってしまいます。
その結果同じ名前のファイルが複数できてしまうことになります。
そのようなことがおきないように、ファンクション17の実行前に、同じファイル名が存在しないことを確認しておく必要があります。
ファンクション17は「ワンボードマイコンでCP/Mを!」[第213回]でテストをしました。
そこで作ったテストプログラムはVFTST14です。
テストプログラムVFTST14のソースプログラムをインテルニーモニックに書き直してMFTST14を作りました。
●テストプログラムMFTST14
MFTST14のソースプログラムです。
; BDOS TEST14 function17 (rename ) ;2012/4/10 9/11 ; ORG $0100 FCALL=$0005 FCB=$005C ; MVI C,17 LXI D,FCB CALL FCALL PUSH PSW CALL B2HEXDP POP PSW INR A RNZ ;err LXI D,ERRMSG MVI C,09 CALL FCALL RET ; ;CL & LF CRLF:MVI A,0D CALL ADP MVI A,0A JMP ADP ;space disp SPDP:MVI A,20 ;A disp ADP:PUSH B PUSH H MOV E,A MVI C,02 CALL FCALL POP H POP B RET ; ;binary to hex, 2bytes data to ascii 4charactors,HL to HL,DE B2HEX4:MOV A,H CALL B2HEX2 XCHG MOV A,E ;binary to hex, 1byte data to ascii 2charactors,A to DE B2HEX2:PUSH PSW RRC RRC RRC RRC CALL B2HEX1 MOV D,A POP PSW CALL B2HEX1 MOV E,A RET ;binary to hex, low 4bit to ascii 1charactor B2HEX1:ANI 0F ADI 30 CPI 3A RC;0-9 ADI 07;A-F RET ;hex to binary, ascii 1charactor to low 4bit HTOB1:CPI 30;>="0"? RC;no CPI 3A;<="9"? JC HTOB1_2;yes,"0" to "9" CPI 41;>="A" ? RC;no CPI 47;<="F"? JC HTOB1_1 CPI 61;>="a"? RC;no CPI 67;<="f"? CMC RC;no HTOB1_1:ADI 09;41 to 46 -> 4A to 4F,or 61 to 67 -> 6A to 6F HTOB1_2:ANI 0F RET ;HL(bynary 2bytes) to asckii 4bytes & disp HEX4DP:PUSH B PUSH H CALL B2HEX4;binary 2 bytes to ascii HEX 4bytes PUSH D XCHG CALL DEDP POP D CALL DEDP POP H POP B RET ;A(binary) to asckii 2bytes HEX & disp B2HEXDP:PUSH B PUSH H CALL B2HEX2 CALL DEDP POP H POP B RET ; ;DE(asckii 2bytes) disp DEDP:PUSH D MOV E,D MVI C,02 CALL FCALL POP D MVI C,02 CALL FCALL RET ; ERRMSG:"err" DB 24;$ ; |
2015/1/31 15:38 mftst14.txt END=0197 ; BDOS TEST14 function17 (rename ) ;2012/4/10 9/11 ; ORG $0100 FCALL=$0005 FCB=$005C ; 0100 0E17 MVI C,17 0102 115C00 LXI D,FCB 0105 CD0500 CALL FCALL 0108 F5 PUSH PSW 0109 CD7B01 CALL B2HEXDP 010C F1 POP PSW 010D 3C INR A 010E C0 RNZ ;err 010F 119401 LXI D,ERRMSG 0112 0E09 MVI C,09 0114 CD0500 CALL FCALL 0117 C9 RET ; ;CL & LF 0118 3E0D CRLF:MVI A,0D 011A CD2401 CALL ADP 011D 3E0A MVI A,0A 011F C32401 JMP ADP ;space disp 0122 3E20 SPDP:MVI A,20 ;A disp 0124 C5 ADP:PUSH B 0125 E5 PUSH H 0126 5F MOV E,A 0127 0E02 MVI C,02 0129 CD0500 CALL FCALL 012C E1 POP H 012D C1 POP B 012E C9 RET ; ;binary to hex, 2bytes data to ascii 4charactors,HL to HL,DE 012F 7C B2HEX4:MOV A,H 0130 CD3501 CALL B2HEX2 0133 EB XCHG 0134 7B MOV A,E ;binary to hex, 1byte data to ascii 2charactors,A to DE 0135 F5 B2HEX2:PUSH PSW 0136 0F RRC 0137 0F RRC 0138 0F RRC 0139 0F RRC 013A CD4401 CALL B2HEX1 013D 57 MOV D,A 013E F1 POP PSW 013F CD4401 CALL B2HEX1 0142 5F MOV E,A 0143 C9 RET ;binary to hex, low 4bit to ascii 1charactor 0144 E60F B2HEX1:ANI 0F 0146 C630 ADI 30 0148 FE3A CPI 3A 014A D8 RC;0-9 014B C607 ADI 07;A-F 014D C9 RET ;hex to binary, ascii 1charactor to low 4bit 014E FE30 HTOB1:CPI 30;>="0"? 0150 D8 RC;no 0151 FE3A CPI 3A;<="9"? 0153 DA6701 JC HTOB1_2;yes,"0" to "9" 0156 FE41 CPI 41;>="A" ? 0158 D8 RC;no 0159 FE47 CPI 47;<="F"? 015B DA6501 JC HTOB1_1 015E FE61 CPI 61;>="a"? 0160 D8 RC;no 0161 FE67 CPI 67;<="f"? 0163 3F CMC 0164 D8 RC;no 0165 C609 HTOB1_1:ADI 09;41 to 46 -> 4A to 4F,or 61 to 67 -> 6A to 6F 0167 E60F HTOB1_2:ANI 0F 0169 C9 RET ;HL(bynary 2bytes) to asckii 4bytes & disp 016A C5 HEX4DP:PUSH B 016B E5 PUSH H 016C CD2F01 CALL B2HEX4;binary 2 bytes to ascii HEX 4bytes 016F D5 PUSH D 0170 EB XCHG 0171 CD8601 CALL DEDP 0174 D1 POP D 0175 CD8601 CALL DEDP 0178 E1 POP H 0179 C1 POP B 017A C9 RET ;A(binary) to asckii 2bytes HEX & disp 017B C5 B2HEXDP:PUSH B 017C E5 PUSH H 017D CD3501 CALL B2HEX2 0180 CD8601 CALL DEDP 0183 E1 POP H 0184 C1 POP B 0185 C9 RET ; ;DE(asckii 2bytes) disp 0186 D5 DEDP:PUSH D 0187 5A MOV E,D 0188 0E02 MVI C,02 018A CD0500 CALL FCALL 018D D1 POP D 018E 0E02 MVI C,02 0190 CD0500 CALL FCALL 0193 C9 RET ; 0194 657272 ERRMSG:"err" 0197 24 DB 24;$ ; ADP =0124 B2HEX1 =0144 B2HEX2 =0135 B2HEX4 =012F B2HEXDP =017B CRLF =0118 DEDP =0186 ERRMSG =0194 FCALL =0005 FCB =005C HEX4DP =016A HTOB1 =014E HTOB1_1 =0165 HTOB1_2 =0167 SPDP =0122 |
; BDOS TEST17 file attribute set ; ;2012/4/15 9/12 ; ORG $0100 FCALL=$0005 FCB=$005C FCB9=$0065 FCBA=$0066 DMA=$0080 ; MVI C,11;first file search LXI D,FCB CALL FCALL CPI FF JZ NOFILE ; LOOP:LXI D,RWMSG CALL MSGDP MVI C,01 CALL FCALL CPI 1A;^z RZ ANI 5F;bit 5=0,'a' to 'A' CPI 52;'R' Read only JZ ROSET CPI 57;'W' read Write JZ RWSET CALL CRLF MVI A,3F;'?' CALL ADP CALL CRLF ROSET:LXI H,FCB9 MOV A,M ORI 80 MOV M,A JMP SYSDIRSET RWSET:LXI H,FCB9 MOV A,M ANI 7F MOV M,A SYSDIRSET:CALL CRLF LXI D,SDMSG CALL MSGDP MVI C,01 CALL FCALL CPI 1A;^z RZ ANI 5F;bit 5=0,'a' to 'A' CPI 53;'S' SYS JZ SYSSET CPI 44;'D' DIR JZ DIRSET CALL CRLF MVI A,3F;'?' CALL ADP JMP SYSDIRSET SYSSET:LXI H,FCBA MOV A,M ORI 80 MOV M,A JMP ATTRSET DIRSET:LXI H,FCBA MOV A,M ANI 7F MOV M,A ATTRSET:LXI D,FCB MVI C,1E CALL FCALL CPI FF JZ ERRDP CALL CRLF LXI D,OKMSG JMP MSGDP ; ERRDP:CALL CRLF LXI D,ERRMSG JMP MSGDP ; NOFILE:LXI D,NFMSG JMP MSGDP ; MSGDP:MVI C,09 CALL FCALL RET ; ;CL & LF CRLF:MVI A,0D CALL ADP MVI A,0A JMP ADP ;space disp SPDP:MVI A,20 ;A disp ADP:PUSH B PUSH H MOV E,A MVI C,02 CALL FCALL POP H POP B RET ; RWMSG:"RorW" DB 3F;? DB 24;$ SDMSG:"SorD" DB 3F;? DB 24;$ NFMSG:"not " "foun" "d" DB 0D DB 0A DB 24;$ ERRMSG:"err" DB 0D DB 0A DB 24;$ OKMSG:"ok" DB 0D DB 0A DB 24;$ ; |
2015/1/31 16:32 mftst17.txt END=01E0 ; BDOS TEST17 file attribute set ; ;2012/4/15 9/12 ; ORG $0100 FCALL=$0005 FCB=$005C FCB9=$0065 FCBA=$0066 DMA=$0080 ; 0100 0E11 MVI C,11;first file search 0102 115C00 LXI D,FCB 0105 CD0500 CALL FCALL 0108 FEFF CPI FF 010A CA9B01 JZ NOFILE ; 010D 11BE01 LOOP:LXI D,RWMSG 0110 CDA101 CALL MSGDP 0113 0E01 MVI C,01 0115 CD0500 CALL FCALL 0118 FE1A CPI 1A;^z 011A C8 RZ 011B E65F ANI 5F;bit 5=0,'a' to 'A' 011D FE52 CPI 52;'R' Read only 011F CA3201 JZ ROSET 0122 FE57 CPI 57;'W' read Write 0124 CA3C01 JZ RWSET 0127 CDA701 CALL CRLF 012A 3E3F MVI A,3F;'?' 012C CDB301 CALL ADP 012F CDA701 CALL CRLF 0132 216500 ROSET:LXI H,FCB9 0135 7E MOV A,M 0136 F680 ORI 80 0138 77 MOV M,A 0139 C34301 JMP SYSDIRSET 013C 216500 RWSET:LXI H,FCB9 013F 7E MOV A,M 0140 E67F ANI 7F 0142 77 MOV M,A 0143 CDA701 SYSDIRSET:CALL CRLF 0146 11C401 LXI D,SDMSG 0149 CDA101 CALL MSGDP 014C 0E01 MVI C,01 014E CD0500 CALL FCALL 0151 FE1A CPI 1A;^z 0153 C8 RZ 0154 E65F ANI 5F;bit 5=0,'a' to 'A' 0156 FE53 CPI 53;'S' SYS 0158 CA6B01 JZ SYSSET 015B FE44 CPI 44;'D' DIR 015D CA7501 JZ DIRSET 0160 CDA701 CALL CRLF 0163 3E3F MVI A,3F;'?' 0165 CDB301 CALL ADP 0168 C34301 JMP SYSDIRSET 016B 216600 SYSSET:LXI H,FCBA 016E 7E MOV A,M 016F F680 ORI 80 0171 77 MOV M,A 0172 C37C01 JMP ATTRSET 0175 216600 DIRSET:LXI H,FCBA 0178 7E MOV A,M 0179 E67F ANI 7F 017B 77 MOV M,A 017C 115C00 ATTRSET:LXI D,FCB 017F 0E1E MVI C,1E 0181 CD0500 CALL FCALL 0184 FEFF CPI FF 0186 CA9201 JZ ERRDP 0189 CDA701 CALL CRLF 018C 11DC01 LXI D,OKMSG 018F C3A101 JMP MSGDP ; 0192 CDA701 ERRDP:CALL CRLF 0195 11D601 LXI D,ERRMSG 0198 C3A101 JMP MSGDP ; 019B 11CA01 NOFILE:LXI D,NFMSG 019E C3A101 JMP MSGDP ; 01A1 0E09 MSGDP:MVI C,09 01A3 CD0500 CALL FCALL 01A6 C9 RET ; ;CL & LF 01A7 3E0D CRLF:MVI A,0D 01A9 CDB301 CALL ADP 01AC 3E0A MVI A,0A 01AE C3B301 JMP ADP ;space disp 01B1 3E20 SPDP:MVI A,20 ;A disp 01B3 C5 ADP:PUSH B 01B4 E5 PUSH H 01B5 5F MOV E,A 01B6 0E02 MVI C,02 01B8 CD0500 CALL FCALL 01BB E1 POP H 01BC C1 POP B 01BD C9 RET ; 01BE 526F7257 RWMSG:"RorW" 01C2 3F DB 3F;? 01C3 24 DB 24;$ 01C4 536F7244 SDMSG:"SorD" 01C8 3F DB 3F;? 01C9 24 DB 24;$ 01CA 6E6F7420 NFMSG:"not " 01CE 666F756E "foun" 01D2 64 "d" 01D3 0D DB 0D 01D4 0A DB 0A 01D5 24 DB 24;$ 01D6 657272 ERRMSG:"err" 01D9 0D DB 0D 01DA 0A DB 0A 01DB 24 DB 24;$ 01DC 6F6B OKMSG:"ok" 01DE 0D DB 0D 01DF 0A DB 0A 01E0 24 DB 24;$ ; ADP =01B3 ATTRSET =017C CRLF =01A7 DIRSET =0175 DMA =0080 ERRDP =0192 ERRMSG =01D6 FCALL =0005 FCB =005C FCB9 =0065 FCBA =0066 LOOP =010D MSGDP =01A1 NFMSG =01CA NOFILE =019B OKMSG =01DC ROSET =0132 RWMSG =01BE RWSET =013C SDMSG =01C4 SPDP =01B1 SYSDIRSET =0143 SYSSET =016B |
; BDOS TEST10 filename search function0e,11,12 ;2012/3/19 4/4 ; 4/7 4/9 dir disp ; 4/14 display file attribute ; 9/12 ; ORG $0100 FCALL=$0005 FCB=$005C DMA=$0080 ; LXI H,FCB INX H MOV A,M CPI 20;no fcb data JNZ LOOP MVI B,0B;=11 MVI A,3F;'?' FILL3F:MOV M,A INX H DCR B JNZ FILL3F LOOP:LXI D,INPMSG CALL MSGDP MVI C,01 CALL FCALL CPI 1A;^z RZ CPI 30 JZ DNOPASS ANI 0F DCR A MOV E,A MVI C,0E CALL FCALL DNOPASS:CALL CRLF MVI C,11;first file search LXI D,FCB CALL FCALL CPI FF JZ NOFILE ; LXI H,DMA LXI D,$0020 ORA A;dirctory code 00-03 LOOP1:JZ NMDISP DAD D DCR A JMP LOOP1 NMDISP:INX H;pass drive no. MVI B,08 NMDISP2:MOV A,M CALL ADP NMDISP3:INX H DCR B JNZ NMDISP2 CALL SPDP MVI B,03 PUSH H NMDISP4:MOV A,M ANI 7F CALL ADP INX H DCR B JNZ NMDISP4 CALL SPDP POP H PUSH H MOV A,M RLC JC ROSET LXI D,RWT JMP RODSP ROSET:LXI D,ROT RODSP:CALL MSGDP CALL SPDP POP H INX H MOV A,M RLC JC SYSSET LXI D,DIRT JMP SYSDSP SYSSET:LXI D,SYST SYSDSP:CALL MSGDP CALL CRLF ;next file search MVI C,12;next file search LXI D,FCB CALL FCALL CPI FF JZ END LXI H,DMA LXI D,$0020 ORA A;dirctory code 00-03 NXTSRCH:JZ NMDISP DAD D DCR A JMP NXTSRCH ; NOFILE:LXI D,NFMSG CALL MSGDP JMP LOOP ; END:LXI D,ENDMSG CALL MSGDP JMP LOOP ; MSGDP:MVI C,09 CALL FCALL RET ; ;CL & LF CRLF:MVI A,0D CALL ADP MVI A,0A JMP ADP ;space disp SPDP:MVI A,20 ;A disp ADP:PUSH B PUSH H MOV E,A MVI C,02 CALL FCALL POP H POP B RET ; INPMSG:"drvn" "o." DB 3F;? DB 24;$ NFMSG:"not " "foun" "d" DB 0D DB 0A DB 24;$ ENDMSG:"end" DB 0D DB 0A DB 24;$ RWT:"RW" DB 24;$ ROT:"RO" DB 24;$ DIRT:"DIR" DB 24;$ SYST:"SYS" DB 24;$ ; |
2015/1/31 16:33 mftst107.txt END=020D ; BDOS TEST10 filename search function0e,11,12 ;2012/3/19 4/4 ; 4/7 4/9 dir disp ; 4/14 display file attribute ; 9/12 ; ORG $0100 FCALL=$0005 FCB=$005C DMA=$0080 ; 0100 215C00 LXI H,FCB 0103 23 INX H 0104 7E MOV A,M 0105 FE20 CPI 20;no fcb data 0107 C21401 JNZ LOOP 010A 060B MVI B,0B;=11 010C 3E3F MVI A,3F;'?' 010E 77 FILL3F:MOV M,A 010F 23 INX H 0110 05 DCR B 0111 C20E01 JNZ FILL3F 0114 11E601 LOOP:LXI D,INPMSG 0117 CDC901 CALL MSGDP 011A 0E01 MVI C,01 011C CD0500 CALL FCALL 011F FE1A CPI 1A;^z 0121 C8 RZ 0122 FE30 CPI 30 0124 CA3001 JZ DNOPASS 0127 E60F ANI 0F 0129 3D DCR A 012A 5F MOV E,A 012B 0E0E MVI C,0E 012D CD0500 CALL FCALL 0130 CDCF01 DNOPASS:CALL CRLF 0133 0E11 MVI C,11;first file search 0135 115C00 LXI D,FCB 0138 CD0500 CALL FCALL 013B FEFF CPI FF 013D CAB701 JZ NOFILE ; 0140 218000 LXI H,DMA 0143 112000 LXI D,$0020 0146 B7 ORA A;dirctory code 00-03 0147 CA4F01 LOOP1:JZ NMDISP 014A 19 DAD D 014B 3D DCR A 014C C34701 JMP LOOP1 014F 23 NMDISP:INX H;pass drive no. 0150 0608 MVI B,08 0152 7E NMDISP2:MOV A,M 0153 CDDB01 CALL ADP 0156 23 NMDISP3:INX H 0157 05 DCR B 0158 C25201 JNZ NMDISP2 015B CDD901 CALL SPDP 015E 0603 MVI B,03 0160 E5 PUSH H 0161 7E NMDISP4:MOV A,M 0162 E67F ANI 7F 0164 CDDB01 CALL ADP 0167 23 INX H 0168 05 DCR B 0169 C26101 JNZ NMDISP4 016C CDD901 CALL SPDP 016F E1 POP H 0170 E5 PUSH H 0171 7E MOV A,M 0172 07 RLC 0173 DA7C01 JC ROSET 0176 110002 LXI D,RWT 0179 C37F01 JMP RODSP 017C 110302 ROSET:LXI D,ROT 017F CDC901 RODSP:CALL MSGDP 0182 CDD901 CALL SPDP 0185 E1 POP H 0186 23 INX H 0187 7E MOV A,M 0188 07 RLC 0189 DA9201 JC SYSSET 018C 110602 LXI D,DIRT 018F C39501 JMP SYSDSP 0192 110A02 SYSSET:LXI D,SYST 0195 CDC901 SYSDSP:CALL MSGDP 0198 CDCF01 CALL CRLF ;next file search 019B 0E12 MVI C,12;next file search 019D 115C00 LXI D,FCB 01A0 CD0500 CALL FCALL 01A3 FEFF CPI FF 01A5 CAC001 JZ END 01A8 218000 LXI H,DMA 01AB 112000 LXI D,$0020 01AE B7 ORA A;dirctory code 00-03 01AF CA4F01 NXTSRCH:JZ NMDISP 01B2 19 DAD D 01B3 3D DCR A 01B4 C3AF01 JMP NXTSRCH ; 01B7 11EE01 NOFILE:LXI D,NFMSG 01BA CDC901 CALL MSGDP 01BD C31401 JMP LOOP ; 01C0 11FA01 END:LXI D,ENDMSG 01C3 CDC901 CALL MSGDP 01C6 C31401 JMP LOOP ; 01C9 0E09 MSGDP:MVI C,09 01CB CD0500 CALL FCALL 01CE C9 RET ; ;CL & LF 01CF 3E0D CRLF:MVI A,0D 01D1 CDDB01 CALL ADP 01D4 3E0A MVI A,0A 01D6 C3DB01 JMP ADP ;space disp 01D9 3E20 SPDP:MVI A,20 ;A disp 01DB C5 ADP:PUSH B 01DC E5 PUSH H 01DD 5F MOV E,A 01DE 0E02 MVI C,02 01E0 CD0500 CALL FCALL 01E3 E1 POP H 01E4 C1 POP B 01E5 C9 RET ; 01E6 6472766E INPMSG:"drvn" 01EA 6F2E "o." 01EC 3F DB 3F;? 01ED 24 DB 24;$ 01EE 6E6F7420 NFMSG:"not " 01F2 666F756E "foun" 01F6 64 "d" 01F7 0D DB 0D 01F8 0A DB 0A 01F9 24 DB 24;$ 01FA 656E64 ENDMSG:"end" 01FD 0D DB 0D 01FE 0A DB 0A 01FF 24 DB 24;$ 0200 5257 RWT:"RW" 0202 24 DB 24;$ 0203 524F ROT:"RO" 0205 24 DB 24;$ 0206 444952 DIRT:"DIR" 0209 24 DB 24;$ 020A 535953 SYST:"SYS" 020D 24 DB 24;$ ; ADP =01DB CRLF =01CF DIRT =0206 DMA =0080 DNOPASS =0130 END =01C0 ENDMSG =01FA FCALL =0005 FCB =005C FILL3F =010E INPMSG =01E6 LOOP =0114 LOOP1 =0147 MSGDP =01C9 NFMSG =01EE NMDISP =014F NMDISP2 =0152 NMDISP3 =0156 NMDISP4 =0161 NOFILE =01B7 NXTSRCH =01AF RODSP =017F ROSET =017C ROT =0203 RWT =0200 SPDP =01D9 SYSDSP =0195 SYSSET =0192 SYST =020A |