復活!CP/M ワンボードマイコンでCP/Mを!
CP/MがTK−80互換のワンボードマイコンの上で復活します
ND80ZVとMYCPU80の上でCP/Mが走ります!
[第155回]
●CP/M互換DOS(仮RAMディスク版)ZBIOSプログラムのソースリスト
今回は前々回、前回に続いて、出来あがりましたCP/M互換DOS(仮RAMディスク版)ZBIOSプログラムのソースリストをお見せします。
;bios for nd80z ;2012/5/11 5/16 5/17 5/31 6/1 ; REENT=$8000 IOBYTE=$8003 DIRBF=$B800;128bytes ; CSV00=$B880;4bytes ALV00=$B884;2bytes CSV01=$B886;4bytes ALV01=$B88A;2bytes ; CBASE=$BC00 FBASE=$C406 ; ;zb3routine ; ADISP=$1015 ZB3MON=$1033 SOUT=$10AB SIN=$10AE RSOUT=$067C RSIN=$078D ; TRKADRS=$BB00 SCTADRS=$BB02 DMAADRS=$BB04 DRVNO=$BB06 CONSTDT=$BB07 DISKTOP=$8800 DISKTOP2=$A000 ; ORG $D200 ; JP BOOTJ JP WBOOTJ JP CONSTJ JP CONINJ JP CONOUTJ JP LISTJ JP PUNCHJ JP READERJ JP HOMEJ JP SELDSKJ JP SETTRKJ JP SETSECJ JP SETDMAJ JP READJ JP WRITEJ JP PRSTATJ JP SECTRNJ JP SETENTRY JP ZREENTJ ; ; DISK PARAMETER BASE ; ;drive No.0 (a drive) DPBASE:DW $0000;XLATE DW $0000;scratch1 DW $0000;scratch2 DW $0000;scratch3 DW DIRBF;address of dirbf. DW DPTOP;address of disk parameter block. DW CSV00;address of check vector. DW ALV00;address of allocation vector (bit map). ; ;drive No.1 (b drive) DW $0000;XLATE DW $0000;scratch1 DW $0000;scratch2 DW $0000;scratch3 DW DIRBF;address of dirbf. DW DPTOP;address of disk parameter block. DW CSV01;address of check vector. DW ALV01;address of allocation vector (bit map). ; DPTOP:DW $0010;sectors per track from bios. DB 02; 03;block shift.sector in a block 128*2^n DB 03; 07;block mask.sector no. in a block - 1 DB 00;extent mask. DW $000B; $0005;disk size (number of blocks-1). DW $000F; $001F;directory size.(max file name no.-1) DW $0080;storage for first bytes of bit map (dir space used). DW $0000 DW $0000;offset. first usable track number. ; ;BIOS ROUTINE ; SETENTRY:LD HL,REENT LD A,C3 LD (HL),A INC HL LD DE,SETEN2 LD (HL),E INC HL LD (HL),D SETEN2:LD HL,IOBYTE XOR A LD (HL),A INC HL LD (HL),A INC HL LD A,C3 LD (HL),A INC HL LD DE,FBASE LD (HL),E INC HL LD (HL),D XOR A LD HL,CSV00 LD C,0C SETEN3:LD (HL),A INC HL DEC C JP NZ,SETEN3 JP CBASE ; BOOTJ:XOR A LD (IOBYTE),A JP CBASE ; WBOOTJ:LD A,(IOBYTE) LD C,A JP CBASE ; ;CONSOLE STATUS ; CONSTJ:LD A,07 CALL SOUT CALL SIN CP 20 JP NZ,CONSTJ2 XOR A RET CONSTJ2:LD (CONSTDT),A OR 01 RET ; ;CONSOLE INPUT ; CONINJ: LD A,(CONSTDT) OR A JP Z,CONINJ2 PUSH AF XOR A LD (CONSTDT),A POP AF RET CONINJ2:LD A,05;1chr IN,nodp CALL SOUT CALL SIN RET ; ;CONSOLE OUT 12/5/20 ; CONOUTJ:LD A,C CP 08;BS JP Z,ADISP CP 0D JP Z,ADISP CP 0A JP Z,ADISP CP 20 JP NC,ADISP RET ; ;PRINTER OUT ; LISTJ: RET ; ;PUNCHER OUT(RS232C OUT) ; PUNCHJ:LD A,C LD B,E3 CALL RSOUT LD A,EF OUT (98),A RET ; ;READER IN ; READERJ:LD B,EB LD A,B OUT (98),A READERJ1:CALL RSIN LD A,C JP NZ,READERJ2;GET DATA CP FF JP Z,READERJ1;NO DATA ;get data or error READERJ2:PUSH AF LD A,EF OUT (98),A POP AF;if error A=01,02,04 RET ; ;SEEK HOME POSITION ; HOMEJ: LD HL,DISKTOP LD A,(DRVNO) OR A JP Z,HOMEJ2 LD HL,DISKTOP2 HOMEJ2:LD (TRKADRS),HL LD (SCTADRS),HL XOR A RET ; ;SELECT DRIVE PARAMETER SET ; SELDSKJ:LD HL,$0000 LD A,C CP 02 JP C,SELDSKJ2 LD A,FF OR A RET SELDSKJ2:LD (DRVNO),A LD L,A ADD HL,HL;*2 ADD HL,HL;*4 ADD HL,HL;*8 ADD HL,HL;*16 LD DE,DPBASE ADD HL,DE XOR A RET ; ;SET TRKADRS ; SETTRKJ:LD HL,DISKTOP LD A,(DRVNO) OR A JP Z,SETTRKJ2 LD HL,DISKTOP2 SETTRKJ2:LD DE,$0800 INC C STTRK1: DEC C JP Z,STTRK9 ADD HL,DE JP STTRK1 STTRK9:LD (TRKADRS),HL XOR A RET ; ;SET SCTADRS ; SETSECJ:LD HL,(TRKADRS) LD DE,$0080 INC C STSCT1: DEC C JP Z,STSCT9 ADD HL,DE JP STSCT1 STSCT9:LD (SCTADRS),HL XOR A RET ; ;SET DMAADRS ; SETDMAJ:LD H,B LD L,C LD (DMAADRS),HL XOR A RET ; ;READ SECTOR ; READJ:LD HL,(DMAADRS) EX DE,HL LD HL,(SCTADRS) READJ1: LD C,80 READJ2:LD A,(HL) LD (DE),A INC HL INC DE DEC C JP NZ,READJ2 XOR A RET ; ;WRITE SECTOR ; WRITEJ: LD HL,(SCTADRS) EX DE,HL LD HL,(DMAADRS) JP READJ1 ; ;PRINTER STATUS ; PRSTATJ:RET ; ;sector translator ; SECTRNJ:LD L,C LD H,B RET ; ZREENTJ:LD HL,ENDZBDOS ZREENTJ2:LD A,(HL) CP 24;'$'? JP Z,ZREENTJE CALL ADISP INC HL JP ZREENTJ2 ZREENTJE:CALL CRLFDP JP ZB3MON CRLFDP:LD A,0D CALL ADISP LD A,0A JP ADISP ENDZBDOS:"end " "of Z" "BDOS" "$" ; |
2012/6/1 19: ZBIOS1E.TXT END=D3C0 ;bios for nd80z ;2012/5/11 5/16 5/17 5/31 6/1 ; REENT=$8000 IOBYTE=$8003 DIRBF=$B800;128bytes ; CSV00=$B880;4bytes ALV00=$B884;2bytes CSV01=$B886;4bytes ALV01=$B88A;2bytes ; CBASE=$BC00 FBASE=$C406 ; ;zb3routine ; ADISP=$1015 ZB3MON=$1033 SOUT=$10AB SIN=$10AE RSOUT=$067C RSIN=$078D ; TRKADRS=$BB00 SCTADRS=$BB02 DMAADRS=$BB04 DRVNO=$BB06 CONSTDT=$BB07 DISKTOP=$8800 DISKTOP2=$A000 ; ORG $D200 ; D200 C396D2 JP BOOTJ D203 C39DD2 JP WBOOTJ D206 C3A4D2 JP CONSTJ D209 C3B9D2 JP CONINJ D20C C3D0D2 JP CONOUTJ D20F C3E6D2 JP LISTJ D212 C3E7D2 JP PUNCHJ D215 C3F2D2 JP READERJ D218 C30AD3 JP HOMEJ D21B C31FD3 JP SELDSKJ D21E C33AD3 JP SETTRKJ D221 C358D3 JP SETSECJ D224 C36CD3 JP SETDMAJ D227 C373D3 JP READJ D22A C386D3 JP WRITEJ D22D C390D3 JP PRSTATJ D230 C391D3 JP SECTRNJ D233 C368D2 JP SETENTRY D236 C394D3 JP ZREENTJ ; ; DISK PARAMETER BASE ; ;drive No.0 (a drive) D239 0000 DPBASE:DW $0000;XLATE D23B 0000 DW $0000;scratch1 D23D 0000 DW $0000;scratch2 D23F 0000 DW $0000;scratch3 D241 00B8 DW DIRBF;address of dirbf. D243 59D2 DW DPTOP;address of disk parameter block. D245 80B8 DW CSV00;address of check vector. D247 84B8 DW ALV00;address of allocation vector (bit map). ; ;drive No.1 (b drive) D249 0000 DW $0000;XLATE D24B 0000 DW $0000;scratch1 D24D 0000 DW $0000;scratch2 D24F 0000 DW $0000;scratch3 D251 00B8 DW DIRBF;address of dirbf. D253 59D2 DW DPTOP;address of disk parameter block. D255 86B8 DW CSV01;address of check vector. D257 8AB8 DW ALV01;address of allocation vector (bit map). ; D259 1000 DPTOP:DW $0010;sectors per track from bios. D25B 02 DB 02; 03;block shift.sector in a block 128*2^n D25C 03 DB 03; 07;block mask.sector no. in a block - 1 D25D 00 DB 00;extent mask. D25E 0B00 DW $000B; $0005;disk size (number of blocks-1). D260 0F00 DW $000F; $001F;directory size.(max file name no.-1) D262 8000 DW $0080;storage for first bytes of bit map (dir space used). D264 0000 DW $0000 D266 0000 DW $0000;offset. first usable track number. ; ;BIOS ROUTINE ; D268 210080 SETENTRY:LD HL,REENT D26B 3EC3 LD A,C3 D26D 77 LD (HL),A D26E 23 INC HL D26F 1175D2 LD DE,SETEN2 D272 73 LD (HL),E D273 23 INC HL D274 72 LD (HL),D D275 210380 SETEN2:LD HL,IOBYTE D278 AF XOR A D279 77 LD (HL),A D27A 23 INC HL D27B 77 LD (HL),A D27C 23 INC HL D27D 3EC3 LD A,C3 D27F 77 LD (HL),A D280 23 INC HL D281 1106C4 LD DE,FBASE D284 73 LD (HL),E D285 23 INC HL D286 72 LD (HL),D D287 AF XOR A D288 2180B8 LD HL,CSV00 D28B 0E0C LD C,0C D28D 77 SETEN3:LD (HL),A D28E 23 INC HL D28F 0D DEC C D290 C28DD2 JP NZ,SETEN3 D293 C300BC JP CBASE ; D296 AF BOOTJ:XOR A D297 320380 LD (IOBYTE),A D29A C300BC JP CBASE ; D29D 3A0380 WBOOTJ:LD A,(IOBYTE) D2A0 4F LD C,A D2A1 C300BC JP CBASE ; ;CONSOLE STATUS ; D2A4 3E07 CONSTJ:LD A,07 D2A6 CDAB10 CALL SOUT D2A9 CDAE10 CALL SIN D2AC FE20 CP 20 D2AE C2B3D2 JP NZ,CONSTJ2 D2B1 AF XOR A D2B2 C9 RET D2B3 3207BB CONSTJ2:LD (CONSTDT),A D2B6 F601 OR 01 D2B8 C9 RET ; ;CONSOLE INPUT ; D2B9 3A07BB CONINJ: LD A,(CONSTDT) D2BC B7 OR A D2BD CAC7D2 JP Z,CONINJ2 D2C0 F5 PUSH AF D2C1 AF XOR A D2C2 3207BB LD (CONSTDT),A D2C5 F1 POP AF D2C6 C9 RET D2C7 3E05 CONINJ2:LD A,05;1chr IN,nodp D2C9 CDAB10 CALL SOUT D2CC CDAE10 CALL SIN D2CF C9 RET ; ;CONSOLE OUT 12/5/20 ; D2D0 79 CONOUTJ:LD A,C D2D1 FE08 CP 08;BS D2D3 CA1510 JP Z,ADISP D2D6 FE0D CP 0D D2D8 CA1510 JP Z,ADISP D2DB FE0A CP 0A D2DD CA1510 JP Z,ADISP D2E0 FE20 CP 20 D2E2 D21510 JP NC,ADISP D2E5 C9 RET ; ;PRINTER OUT ; D2E6 C9 LISTJ: RET ; ;PUNCHER OUT(RS232C OUT) ; D2E7 79 PUNCHJ:LD A,C D2E8 06E3 LD B,E3 D2EA CD7C06 CALL RSOUT D2ED 3EEF LD A,EF D2EF D398 OUT (98),A D2F1 C9 RET ; ;READER IN ; D2F2 06EB READERJ:LD B,EB D2F4 78 LD A,B D2F5 D398 OUT (98),A D2F7 CD8D07 READERJ1:CALL RSIN D2FA 79 LD A,C D2FB C203D3 JP NZ,READERJ2;GET DATA D2FE FEFF CP FF D300 CAF7D2 JP Z,READERJ1;NO DATA ;get data or error D303 F5 READERJ2:PUSH AF D304 3EEF LD A,EF D306 D398 OUT (98),A D308 F1 POP AF;if error A=01,02,04 D309 C9 RET ; ;SEEK HOME POSITION ; D30A 210088 HOMEJ: LD HL,DISKTOP D30D 3A06BB LD A,(DRVNO) D310 B7 OR A D311 CA17D3 JP Z,HOMEJ2 D314 2100A0 LD HL,DISKTOP2 D317 2200BB HOMEJ2:LD (TRKADRS),HL D31A 2202BB LD (SCTADRS),HL D31D AF XOR A D31E C9 RET ; ;SELECT DRIVE PARAMETER SET ; D31F 210000 SELDSKJ:LD HL,$0000 D322 79 LD A,C D323 FE02 CP 02 D325 DA2CD3 JP C,SELDSKJ2 D328 3EFF LD A,FF D32A B7 OR A D32B C9 RET D32C 3206BB SELDSKJ2:LD (DRVNO),A D32F 6F LD L,A D330 29 ADD HL,HL;*2 D331 29 ADD HL,HL;*4 D332 29 ADD HL,HL;*8 D333 29 ADD HL,HL;*16 D334 1139D2 LD DE,DPBASE D337 19 ADD HL,DE D338 AF XOR A D339 C9 RET ; ;SET TRKADRS ; D33A 210088 SETTRKJ:LD HL,DISKTOP D33D 3A06BB LD A,(DRVNO) D340 B7 OR A D341 CA47D3 JP Z,SETTRKJ2 D344 2100A0 LD HL,DISKTOP2 D347 110008 SETTRKJ2:LD DE,$0800 D34A 0C INC C D34B 0D STTRK1: DEC C D34C CA53D3 JP Z,STTRK9 D34F 19 ADD HL,DE D350 C34BD3 JP STTRK1 D353 2200BB STTRK9:LD (TRKADRS),HL D356 AF XOR A D357 C9 RET ; ;SET SCTADRS ; D358 2A00BB SETSECJ:LD HL,(TRKADRS) D35B 118000 LD DE,$0080 D35E 0C INC C D35F 0D STSCT1: DEC C D360 CA67D3 JP Z,STSCT9 D363 19 ADD HL,DE D364 C35FD3 JP STSCT1 D367 2202BB STSCT9:LD (SCTADRS),HL D36A AF XOR A D36B C9 RET ; ;SET DMAADRS ; D36C 60 SETDMAJ:LD H,B D36D 69 LD L,C D36E 2204BB LD (DMAADRS),HL D371 AF XOR A D372 C9 RET ; ;READ SECTOR ; D373 2A04BB READJ:LD HL,(DMAADRS) D376 EB EX DE,HL D377 2A02BB LD HL,(SCTADRS) D37A 0E80 READJ1: LD C,80 D37C 7E READJ2:LD A,(HL) D37D 12 LD (DE),A D37E 23 INC HL D37F 13 INC DE D380 0D DEC C D381 C27CD3 JP NZ,READJ2 D384 AF XOR A D385 C9 RET ; ;WRITE SECTOR ; D386 2A02BB WRITEJ: LD HL,(SCTADRS) D389 EB EX DE,HL D38A 2A04BB LD HL,(DMAADRS) D38D C37AD3 JP READJ1 ; ;PRINTER STATUS ; D390 C9 PRSTATJ:RET ; ;sector translator ; D391 69 SECTRNJ:LD L,C D392 60 LD H,B D393 C9 RET ; D394 21B4D3 ZREENTJ:LD HL,ENDZBDOS D397 7E ZREENTJ2:LD A,(HL) D398 FE24 CP 24;'$'? D39A CAA4D3 JP Z,ZREENTJE D39D CD1510 CALL ADISP D3A0 23 INC HL D3A1 C397D3 JP ZREENTJ2 D3A4 CDAAD3 ZREENTJE:CALL CRLFDP D3A7 C33310 JP ZB3MON D3AA 3E0D CRLFDP:LD A,0D D3AC CD1510 CALL ADISP D3AF 3E0A LD A,0A D3B1 C31510 JP ADISP D3B4 656E6420 ENDZBDOS:"end " D3B8 6F66205A "of Z" D3BC 42444F53 "BDOS" D3C0 24 "$" ; ADISP =1015 ALV00 =B884 ALV01 =B88A BOOTJ =D296 CBASE =BC00 CONINJ =D2B9 CONINJ2 =D2C7 CONOUTJ =D2D0 CONSTDT =BB07 CONSTJ =D2A4 CONSTJ2 =D2B3 CRLFDP =D3AA CSV00 =B880 CSV01 =B886 DIRBF =B800 DISKTOP =8800 DISKTOP2 =A000 DMAADRS =BB04 DPBASE =D239 DPTOP =D259 DRVNO =BB06 ENDZBDOS =D3B4 FBASE =C406 HOMEJ =D30A HOMEJ2 =D317 IOBYTE =8003 LISTJ =D2E6 PRSTATJ =D390 PUNCHJ =D2E7 READERJ =D2F2 READERJ1 =D2F7 READERJ2 =D303 READJ =D373 READJ1 =D37A READJ2 =D37C REENT =8000 RSIN =078D RSOUT =067C SCTADRS =BB02 SECTRNJ =D391 SELDSKJ =D31F SELDSKJ2 =D32C SETDMAJ =D36C SETEN2 =D275 SETEN3 =D28D SETENTRY =D268 SETSECJ =D358 SETTRKJ =D33A SETTRKJ2 =D347 SIN =10AE SOUT =10AB STSCT1 =D35F STSCT9 =D367 STTRK1 =D34B STTRK9 =D353 TRKADRS =BB00 WBOOTJ =D29D WRITEJ =D386 ZB3MON =1033 ZREENTJ =D394 ZREENTJ2 =D397 ZREENTJE =D3A4 |