ÚVOD | Novinky | 8 Bitů | Příslušenství | Drobnosti | TTL | Kontakt
SAPI-1 | ONDRA | PMI-80 | PMD-85 | klony PMD-85 | klony SM50/40 | PETR | PLAN-80A | IQ151 | TNS | FK-1 | HVĚZDA | SP 830 | PCS 1-QR6000
ZPS | Technické prostředky | Programové vybavení | Dokumentace
PAGE 66 ;******************************************************* ;* * ;* E P R O M B I O S p r o Z P S 2 * ;* * ;******************************************************* ; ; create and modify Jiri Hlavac ; 30.3.1988 ; ;Kod celeho modulu BIOS je ulozen v EPROM. Aktivuje ;se bud pres rozskokovou tabulku ulozenou v oblasti ;vyhrazene dle konvenci CPM za modulem BDOS nebo ;pres rozskokovou tabulku v EPROM (od adresy 1300H) ;Pro realizaci nekterych funkci je pouzito sluzeb ;MONITORU verze 5 pro ZPS2. .z80 ;****************************************************** ; kontrolni hodnoty: lastEB EQU $next - 1 ;posledni adresa v EPROM longEB EQU $next - ebiosb ;delka EBIOSU lastvar EQU $nextv - 1 ;posledni adresa promennych ;(max 41FFH) ;****************************************************** epromb EQU 1300H ;adresa zacatku EPROM varb EQU 41D0H ;adresa promennych BIOSu buff EQU 4280H ;implicitni buffer ramb EQU 4300H ;zacatek pouzitelne RAM TPA EQU 4400H ;zacatek uzivatelske oblasti ebiosb EQU epromb ;adresa zacatku BIOS v EPROM bdosb EQU 0F000H ;pocatecni adresa zavadeni systemu biosb EQU bdosb + 0E00H ;pocatecni adresa BIOSu ebios EQU ebiosb ;vstupni bod EPROM BIOS bdos EQU 5 ;vstupni bod sluzeb BD0S mon EQU 100H ;tab. sluzeb MONITORU ZPS2 dphtab EQU biosb + 33H ;diskova tabulka BIOSu sysdisk EQU 0 ;cislo systemoveho disku ;****************************************************** cr EQU 13 lf EQU 10 ASEG ORG epromb ;rozskokova tabulka sluzeb EBIOS: JP init ;inicializace JP wboot ;wboot JP const ;status konzoly JP conin ;vstup z konzoly JP conout ;vystup na konzolu JP list ;tiskarna JP punch ;derovac JP reader ;smamc jp home ;stopa 0 jp seldsk ;vyber disk jp settrk ;vyber stopu jp setsec ;vyber sektor jp setdma ;nastav adresu DMA jp read ;cti sektor jp write ;zapis sektor jp listst ;status tiskarny jp sectran ;transforamce sektoru ;*********************************************** ;pouziti rutin MONITORU pro nediskove sluzby const EQU mon + 12H ;console status conin EQU mon + 3 ;console input conout EQU mon + 9 ;console output list EQU mon + 0FH ;listing punch EQU mon + 0CH ;derovac reader EQU mon + 6 ;sniaac retmon EQU mon + 39H ;navrat do aonitoru ;***************************************** init: ;inicializace celeho diskoveho ;systemu, vraci se do volajiciho ;programu (normalni return) CALL initrpd ;inicializace radice CALL loaddos ;zavedeni systemu CALL setsyspa ;nastaveni syst. parametru LD HL,signon ;a vypis uvodniho hlaseni pmsg: ;vypis hlaseni od adresy LD A,(HL) ;v CHL3 do konc.bytu 88H INC HL OR A RET Z LD C,A CALL conout JP pmsg ;**************************************** signon: DEFB CR,LF,'ZAVEDEN DISKOVY SYSTEM' DEFB CR,LF,'VOLNA RAM OD ADRESY 4400H DO EFFFH' DEFB CR,LF,0 ;**************************************** wboot: ;provadi reinicializaci diskoveho ;systemu, po skonceni se vraci ;do MONITORU (vzdy) LD SP,4040H ;nastaveni zosobniku CALL loaddos ;zavedeni systemu CALL setsyspa ;nastaveni syst. paraaetru JP retmon ;predani rizeni MONITORu ;*************************************** loaddos: LD C,sysdisk ;nastaveni cisls disku CALL seldsk CALL seldsk JP NZ,loaderr CALL home ;nastaveni stopy 0 JP NZ,loaderr LD HL,bdosb ;pocatecni adresa LD B,9 ;pocet sektoru LD C,18 ;pocatecni sektor CALL rdloop ;precteni stopy 0 LD C,1 ;nastaveni stopy 1 CALL settrk JP NZ,loaderr LD HL,bdosb + 480H LD B,20 LD C,1 CALL rdloop ;precteni stopy 1 LD DE,synseq ;verifikace synchrosekvence LD HL,bdosb ;na zacatku BDOSu LD B,6 verif: LD A,(DE) CP (HL) JP NZ,badsys INC HL INC DE DEC B JP NZ,verif RET synseq: DEFB 'ZPS-2 ' ;synchrosekvence ;***************************************************** rdloop: ; ctini bloku sektoru ; [HL] := pocatecni adresa ; [C] := prvni sektor ; [B] := pocet sektoru LD A,C ADD A,B LD B,A ;zarazka:=max.sektor + 1 LD D,3 ;pocet pruchodu rd1: PUSH DE PUSH BC PUSH HL rd2: PUSH HL PUSH BC CALL .read ;precteni sektoru JP NZ,loaderr POP BC POP HL LD DE,180H ;zvyseni ukazatele adres ADD HL,DE ;v [HL] o 3 * 80H LD A,3 ADD A,C ;zvyseni cisla sektoru LD C,A ;v [C] o 3 CP B JP C,rd2 ;test konce pruchodu POP HL POP BC LD DE,80H ;priprava dalsiho pruchodu ADD HL,DE INC C POP DE DEC D ;snizsni pocitadla JP NZ,rd1 ;skok na dalsi pruchod RET ;**************************************** setsyspa: LD C,8 ;nastaveni RAMTOP dle LD DE,bdosb - 1 ;konvenci HONITORu CALL mon + 1EH LD C,32 ;nastaveni uzivatele 0 LD E,0 CALL bdos LD C,13 ;inicializace diskoveho systemu JP bdos ;a return ;**************************************** loaderr: LD HL,errmsg JP wrmsg badsys: LD HL,badmsg wrmsg: CALL pmsg JP retmon badmsg: DEFB cr,lf,'SPATNA SYSTEMOVA DISKETA' errmsg: DEFB CR,LF,'NELZE ZAVEST DISKOVY SYSTEM' DEFB CR,LF,0 ;**************************************** ;.XLIST .8080 ;*************************************** listst: XRA A RET ;*************************************** setsec: MOV A,C STA SECTOR RET ;**************************************** sectran: XCHG DAD B MOV L,M MVI H,0 RET ;**************************************** setdma: MOV H,B MOV L,C SHLD POINTR RET ;**************************************** seldsk: LXI H,0 MOV A,C CPI 2 RNC MOV L,A DAD H DAD H DAD H DAD H LXI D,DPHTAB DAD D PUSH H call .select POP H RZ LXI H,0 RET ;**************************************** home: jmp .home ;**************************************** settrk: lxi h,50 dly: dcx h mov a,l ora h jnz dly jmp .seek ;**************************************** read: LHLD POINTR LDA SECTOR MOV C,A jmp .read ;**************************************** write: LHLD POINTR LDA SECTOR MOV C,A jmp .write ;******************************************************** ;* * ;* Ovladac floppy B" SS/SD pres radic RPD-1A+RPD-1B * ;* * ;******************************************************** ;************************************** ; DEFINICE ;************************************** CSRA EQU 25H RAM EQU 8 RDM EQU 4 WE EQU 2 RE EQU 1 CSRB EQU 3CH HLR EQU 128 STR EQU 64 T00 EQU 32 RDY EQU 4 WF EQU 2 T43 EQU 8 UP EQU 4 DOWN EQU 0 FR EQU 2 CNT0 EQU 20H CNT1 EQU 21H CNT2 EQU 22H CNT0M EQU 0CH CNT1M EQU 5EH CNT2M EQU 0DH MD53 EQU 23H STEPR EQU 3EH HLOADR EQU 3DH RDATA EQU 24H WDATA EQU 24H INITF EQU 2 NT43 EQU 43 RETRY EQU 5 AMMRK EQU 0FEH DAMMRK EQU 0FBH ;************************************** ; CHARAKTERISTIKY JEDNOTKY ;************************************** TRKS EQU 77 SECTRS EQU 26 SECLEN EQU 128 NDISKS EQU 2 ;************************************** ; KONSTATNTY 8253 ;************************************** TDAM EQU 0C4FCH AML1 EQU 60H TAML EQU 0D2H TAMH EQU 0B8H AML EQU 7 DLENL EQU 41H DLENH EQU 0 DLWL EQU 11H DLWH EQU 0 TAW EQU 20FCH SLID EQU 0 ;************************************** initrpd: XRA A OUT CSRA OUT CSRB MVI A,CNT0M OUT MD53 MVI A,CNT1M OUT MD53 MVI A,CNT2M OUT MD53 MVI C,0 CALL .SELECT ;************************************** .HOME: CALL SELACT CALL CTRK MVI M,0 LXI B,UP SHL 8+INITF CALL STEP MVI E,TRKS+INITF+1 HOME05: IN CSRB ANI T00 JNZ FNOK DCR E JZ HOME10 LXI B,DOWN SHL 8+1 CALL STEP JMP HOME05 HOME10: CMA HOME15: ORA A RET ;************************************** .SELECT: MOV A,C CPI NDISKS JNC HOME15 STA DRVBAK XRA A RET SELACT: LDA DRVBAK MOV C,A LDA DRVNO CMP C JZ SAME MVI A,150 STA CON MOV A,C SAME: STA DRVNO OUT CSRB FNOK: XRA A RET ;************************************** .SEEK: PUSH B CALL SELACT POP B MOV A,C CPI TRKS JNC HOME10 CALL CTRK SUB C RZ MOV M,C MVI B,DOWN JP SEEK05 MVI B,UP CMA INR A SEEK05: MOV C,A JMP STEP ;************************************** .READ: PUSH H PUSH B CALL SELACT POP B POP H MOV A,C PUSH H CALL PREPAM POP H CALL STORE DCX H MVI C,RETRY XCHG READ03: PUSH B PUSH D READ05: LXI H,TDAM CALL RDAM JNC READ15 READ07: POP D POP B CPI 1 JZ READ20 READ10: DCR C MVI A,2 JZ READ20 JMP READ03 READ15: POP D PUSH D CALL RDDAM JC READ07 POP H PUSH H MVI B,SECLEN+3 CALL CRC MOV A,E ORA D POP D POP B JNZ READ10 READ20: ORA A JMP RECALL ;************************************** .WRITE: PUSH H PUSH B CALL SELACT POP B POP H MOV A,C PUSH H CALL PREPAM CALL CTRK CPI NT43 LDA DRVNO JC WRIT02 ORI T43 WRIT02: ORI FR OUT CSRB ANI FR XOR 0FFH OUT CSRB OUT HLOADR POP H CALL STORE PUSH H DCX H MVI B,SECLEN+1 CALL CRC MOV M,D INX H MOV M,E POP H LXI D,-5 DAD D XCHG MVI C,RETRY WRIT03: PUSH B PUSH D WRIT05: LXI H,TAW CALL RDAM JNC WRIT15 WRIT10: POP D POP B CPI 1 JZ READ20 DCR C MVI A,2 JZ READ20 JMP WRIT03 WRIT15: POP D PUSH D CALL WRDATA JC WRIT10 POP D POP B IN CSRB ANI WF JMP READ20 ;************************************** ; PODPROGRAMY ;************************************** STEP: LDA DRVNO ORA B OUT CSRB OUT STEPR STEP05: IN CSRB ANI STR JZ STEP05 DCR C JNZ STEP XRA A RET ;************************************** STORE: PUSH H PUSH PSW SHLD RCLPTR LXI D,-5 DAD D LXI D,MEM5 LXI B,5 CALL MOVE DCX H MVI M,DAMMRK LXI D,SECLEN+1 DAD D LXI D,MEM3 LXI B,0FF03H CALL MOVE POP PSW POP H RET ;************************************** RECALL: PUSH PSW LHLD RCLPTR LXI D,-5 DAD D LXI D,MEM5 MVI C,5 CALL MOVE2 LXI D,SECLEN DAD D LXI D,MEM3 MVI C,3 CALL MOVE2 POP PSW RET ;************************************** MOVE: MOV A,M STAX D MOV M,B INX H INX D DCR C JNZ MOVE RET ;************************************** MOVE2: LDAX D INX D MOV M,A INX H DCR C JNZ MOVE2 RET ;************************************** RDAM: SHLD TCNT1 MVI B,SECTRS+SECTRS/2 RDAM05: PUSH B CALL HEAD CALL RDYCHK POP B RC LHLD TCNT1 MVI A,AML1 OUT CNT2 XRA A OUT CNT2 MOV A,L OUT CNT1 MOV A,H OUT CNT1 MVI A,TAML OUT CNT0 MVI A,TAMH OUT CNT0 MVI A,(RTAB AND 0E0H)+RAM+RE OUT CSRA MVI H,RTAB SHR 8 LXI D,CMPAM PUSH D CALL .RDLOOP POP D RC LXI H,SRCHAM MVI C,AML-1 RDAM10: INX D INX H LDAX D CMP M JNZ RDAM15 DCR C JNZ RDAM10 XRA A RET RDAM15: DCR B JNZ RDAM25 RDAM20: XRA A STC RET RDAM25: LDA SRCHTRK MOV C,A LDA CMPTRK CMP C JZ RDAM05 CALL .HOME LDA SRCHTRK MOV C,A CALL .SEEK JMP RDAM20 ;************************************** RDDAM: MVI A,DLENL OUT CNT2 MVI A,DLENH OUT CNT2 MVI A,(RTAB AND 0E0H)+RDM+RE PUSH PSW MVI A,20 L5: DCR A JNZ L5 POP PSW OUT CSRA MVI H,RTAB SHR 8 JMP .RDLOOP ;************************************** WRDATA: MVI A,DLWL OUT CNT2 MVI A,DLWH OUT CNT2 MVI A,(WTAB AND 0E0H)+WE OUT CSRA MVI H,WTAB SHR 8 JMP .WRLOOP ;************************************** CTRK: PUSH D LXI H,DRVNO MOV E,M MVI D,0 DAD D INX H MOV A,M POP D RET ;************************************* HEAD: OUT HLOADR LDA CON CPI 0 JZ HEAD05 CALL DELAY MVI A,0 STA CON HEAD05: IN CSRB ANI HLR JZ HEAD05 RET ;************************************** RDYCHK: MVI C,200 RDY10: IN CSRB ANI RDY RNZ MVI A,1 CALL DELAY DCR C JNZ RDY10 MVI A,1 STC RET ;************************************** DELAY: L4: MVI B,140 L3: DCR B JNZ L3 DCR A JNZ L4 RET ;************************************** PREPAM: LXI H,SRCHAM PUSH H LXI B,SLID SHL 8+AMMRK MOV M,C INX H PUSH PSW PUSH H CALL CTRK POP H MOV M,A INX H MVI M,0 INX H POP PSW MOV M,A INX H MOV M,B POP H MVI B,AML-2 CALL CRC MOV M,D INX H MOV M,E RET ;************************************** CRC: LXI D,-1 CRC05: MOV A,M INX H XRA D MOV D,E MOV C,A RRC RRC RRC RRC ANI 15 XRA C MOV E,A RRC RRC RRC MOV C,A ANI 1FH XRA D MOV D,A MOV A,C ANI 0E0H XRA E MOV E,A MOV A,C RRC ANI 0F0H XRA D MOV D,A DCR B RZ JMP CRC05 ;************************************** ; SKOKOVE TABULKY CTENI A ZAPISU ;************************************** ROM EQU 0 TMP SET ($-ROM) AND 1FH IF TMP DS 32-TMP ENDC ;************************************** RTAB: IN RDATA STAX D INX D .RDLOOP: IN CSRA MOV L,A PCHL XRA A JMP TERR XRA A JMP TERR JMP LPDONE NOP LPDONE: XRA A RET NOP NOP XRA A JMP TERR TERR: OUT CSRA STC RET ;************************************** WTAB: LDAX D OUT WDATA INX D .WRLOOP: IN CSRA MOV L,A PCHL XRA A JMP TERR XRA A JMP TERR JMP LPDONE NOP JMP LPDONE NOP XRA A JMP TERR XRA A JMP TERR DB 0 ;************************************** DB 'Jiri Hlavac' DB 'Tesla DIZ 1988 ' .LIST $next: ;prvni volna adresa za EBIOS ; ;kontrola delky EBIOSu (max adresa < 1800H) IF $next GT 1800H .PRINTX 'EBIOS presahuje konec EPROM' ENDIF ;**************************************** ;PROMENNE BIOSU ;**************************************** .PHASE varb SECTOR: DS 1 POINTR: DS 2 DRVNO: DS 3 SRCHAM: DS 7 SRCHTRK EQU SRCHAM+1 CMPAM: DS 7 CMPTRK EQU CMPAM+1 TCNT1: DS 2 RCLPTR: DS 2 MEM5: DS 5 MEM3: DS 3 CON: DB 0 KUPR: DB 0 DRVBAK: DB 0 $nextv: ;volna RAM za promennymi ; ;kontrola delky promennych EBIOSu (max adresa < 4200H) IF $nextv GT 4200H .PRIhiTX 'promenne EBIOSu presahuji 41FFH' ENDIF .DEPHASE ; IF1 .PRINTX 'konec prvniho pruchodu' ENDIF END
ÚVOD | Novinky | 8 Bitů | Příslušenství | Drobnosti | TTL | Kontakt
SAPI-1 | ONDRA | PMI-80 | PMD-85 | klony PMD-85 | klony SM50/40 | PETR | PLAN-80A | IQ151 | TNS | FK-1 | HVĚZDA | SP 830 | PCS 1-QR6000
ZPS | Technické prostředky | Programové vybavení | Dokumentace