General Information
Author: Erhard Pütz
Assembler: Bibo Assembler
Published: 1991
Download: http://www.atari-central.de/floppyservice/floppy/gb/index.htm
The interface for connecting up to 4 standard drives to the XL/XE. Here you can mix 3,5" and 5,25" floppies at will. Required is that the drive supports the Disk Change signal at pin 34 of the Shugart bus. It doesn't support Medium Density (128 bytes/sector in MFM mode and 1.2 MB drives). Maximum transfer rate: 500 Kbit/s (1.44 MByte disks). The HDI is sold out.
The HDI is designed, build and all Source written by Erhard Pütz, (aka ABBUC Floppy Doc, Atreju)
00010 ****************************** 00020 * * 00030 * Betriebssystem für das * 00040 * 3.5" Interface * 00050 * für den Atari XL/XE * 00060 * * 00070 * Hersteller: Erhard Pütz * 00080 * OS-Code : Erhard P}tz * 00090 * * 00100 * (c) 1989, 1990, 1991 * 00110 * * 00120 * Version : 2.0 * 00130 * * 00140 * UltraSpeed : Ja * 00150 * HD-Modus : Ja * 00160 * Sektoranordnung : Calc. * 00170 * Bootsektorpuffer : Nein * 00180 * Trackpuffer read : Nein * 00190 * Trackpuffer write: Nein * 00200 * ROM-Boot: Nein * 00210 * * 00220 ****************************** 00230 .LI OF 00240 .NO 00250 ****************************** 00260 * * 00270 * Definition von Macros * 00280 * von 65C02 - Befehlen, * 00290 * die dieser bloede * 00300 * Assembler nicht kann. * 00310 * * 00320 ****************************** 00330 ; 00340 RBO = $07 ;Clear Bit on 00350 RB1 = $17 ;Page 0 Adr. 00360 RB2 = $27 00370 RB3 = $37 00380 RB4 = $47 00390 RB5 = $57 00400 RB6 = $67 00410 RB7 = $77 00420 ; 00430 SB0 = $87 ;Set Bit on 00440 SB1 = $97 ;Page 0 Adr. 00450 SB2 = $A7 00460 SB3 = $B7 00470 SB4 = $C7 00480 SB5 = $D7 00490 SB6 = $E7 00500 SB7 = $F7 00510 ; 00520 BR0 = $0F ;Branch on 00530 BR1 = $1F ;Bit reset 00540 BR2 = $2F 00550 BR3 = $3F 00560 BR4 = $4F 00570 BR5 = $5F 00580 BR6 = $6F 00590 BR7 = $7F 00600 ; 00610 BS0 = $8F ;Branch on 00620 BS1 = $9F ;Bit set 00630 BS2 = $AF 00640 BS3 = $BF 00650 BS4 = $CF 00660 BS5 = $DF 00670 BS6 = $EF 00680 BS7 = $FF 00690 ------------------------------ 00700 ;RIOT Ports (Ram: $4000-$407F) 00710 ------------------------------ 00720 RRAM = $4000 00730 PORTA = $4080 Bit 00740 ; 0 o TxC 00750 ; 1 o TC 00760 ; 2 i /IDX 00770 ; 3 o HDL 00780 ; 4 nc 00790 ; 5 nc 00800 ; 6 o PCVal 00810 ; 7 i /DC 00820 PACTL = $4081 00830 PORTB = $4082 00840 ; 0 o RST SIO 00850 ; 1 o RST FDC 00860 ; 2 o DRV FDC 00870 ; 3 i IRQ FDC 00880 ; 4 o A14 Rom 00890 ; 5 o A15 Rom 00900 ; 6 i /RDY 00910 ; 7 i D# 00920 PBCTL = $4083 00930 ------------------------------ 00940 ;RIOT Timer 00950 ------------------------------ 00960 RTIMID = $4084 ;%1000 0100 R 00970 RTIMIE = $408C ;%1000 1100 R 00980 IFLG = $4085 ;%1000 0101 R 00990 T0001D = $4094 ;%1001 0100 W 01000 T0008D = $4095 ;%1001 0101 W 01010 T0064D = $4096 ;%1001 0110 W 01020 T1024D = $4097 ;%1001 0111 W 01030 T0001E = $409C ;%1001 1100 W 01040 T0008E = $409D ;%1001 1101 W 01050 T0064E = $409E ;%1001 1110 W 01060 T1024E = $409F ;%1001 1111 W 01070 ------------------------------ 01080 ;SIO Adressen 01090 ------------------------------ 01100 SIODAT = $4100 01110 SIOCMD = $4101 01120 SIOST = $4101 01130 ------------------------------ 01140 ;Floppy Controller Adressen 01150 ------------------------------ 01160 FDCST = $4200 ;FDC Status R 01170 FDCDAT = $4201 ;FDC Data R/W 01180 OR = $4300 01190 CR = $4400 01200 ------------------------------ 01210 ACK = 'A 01220 NACK = 'N 01230 COMPLT = 'C 01240 ERROR = 'E 01250 ------------------------------ 01260 ;Seite 0 01270 ------------------------------ 01280 .OR $0000 01290 BUFADR .HX 0000 01300 BUFLEN .HX 0000 01310 BUFEND .HX 0000 01320 DIV .HX 0000 01330 DOR .HX 0000 01340 ZSP .HX 0000 01350 D0PB .DA $2A00 01360 D1PB .DA $2B80 01370 D2PB .DA $2D00 01380 D3PB .DA $2E80 01390 D0PT .HX 0000 01400 D1PT .HX 0000 01410 D2PT .HX 0000 01420 D3PT .HX 0000 01430 ------------------------------ 01440 ;Variablen f}r SIO 01450 ------------------------------ 01460 PSUMME .HX 00 01470 DRIVE .HX 00 01480 COMAND .HX 00 01490 DAUX1 .HX 00 01500 DAUX2 .HX 00 01510 .HX 00 empf.PSUMME 01520 STATUS .HX 00 01530 BAUD .HX 00 Zaehler f}r 01540 ;Sendetakt 01550 ------------------------------ 01560 ;Variablen f}r FDC 01570 ------------------------------ 01580 OFFDEL .HX 00 MotTimeout 01590 MOTIM .HX 000000 01600 ACTDRV .HX 00 01610 CYL .HX 00 01620 HEA .HX 00 01630 REC .HX 00 ;$04 01640 NUM .HX 00 01650 EOT .HX 12 01660 GPL .HX 01 01670 DTL .HX 00 ;$08 01680 STM .HX 00 01690 .HX 000000 ;$0C 01700 IDTAB .HX 00 ;CYL 01710 .HX 00 ;HEA 01720 .HX 00 ;REC 01730 FOTAB .HX 00 ;NUM 01740 .HX 00 ;EOT 01750 .HX 00 ;GPL 01760 .HX 00 ;DTL 01770 CHKROMZ .HX 0000 01780 RTIMIDZ .HX 00 01790 ------------------------------ 01800 ;Prozessorstapel (STACK) 01810 ------------------------------ 01820 .OR $0100 01830 STACK .BL $0100,$00 01840 ------------------------------ 01850 ;Tabellen 01860 ------------------------------ 01870 .OR $0200 01880 DRVTAB .HX FFFFFFFF 01890 ST0TAB .HX FFFFFFFF 01900 ST1TAB .HX FFFFFFFF 01910 ST2TAB .HX FFFFFFFF 01920 ST3TAB .HX FFFFFFFF 01930 PCNTAB .HX FFFFFFFF 01940 ------------------------------ 01950 PTRACK .HX 50505050 # Tracks 01960 PSTEPR .HX 02020202 Steprate 01970 PSEKHI .HX 00000000 # Sektors 01980 PSEKLO .HX 12121212 per Track 01990 PSIDE .HX 00000000 (00/01) 02000 PMF .HX 00000000 (00/04) 02010 PBYTHI .HX 00000000 00/1/2/3 02020 PBYTLO .HX 80808080 80/0/0/0 02030 PONLIN .HX FFFFFFFF 02040 .HX 00000000 unused 02050 .HX 00000000 unused 02060 .HX 00000000 unused 02070 PBAUD .HX 0A0A0A0A ser.Clock 02080 PHD .HX FFFFFFFF 2ND/0HD 02090 PMT .HX 00000000 MT=$80 02100 PMAXLO .HX 00000000 # Sektors 02110 PMAXHI .HX 00000000 per Disk 02120 ------------------------------ 02130 ST02EA .HX 00000000 ;->$02EA 02140 ST02EB .HX 00000000 ;->$02EB 02150 ST02EC .HX 00000000 ;->$02EC 02160 ST02ED .HX 00000000 ;->$02ED 02170 ------------------------------ 02180 HPYFLG .HX 00000000 02190 RDFLAG .HX 00000000 02200 ------------------------------ 02210 SKEW .BL $24,$00 02220 SKWSEC .HX 00 02230 SKEWPT .HX 00 02240 INTRLV .HX 00 02250 ------------------------------ 02260 .OR $0300 02270 SKWADR .BL $90,$00 02280 ------------------------------ 02290 ;Puffer 02300 ------------------------------ 02310 .OR $0400 02320 BOOTBF .BL $0200,$00 02330 ------------------------------ 02340 SIOBUF .BL $0100,$00 02350 SECBUF .BL $0100,$00 02360 ------------------------------
00010 .IN "D:OSV24EQU.BIB 00020 .OR $C000 00030 .OF "D:TEAC.ROM 00040 * 00050 CHKROM .HX FFFF 00060 .AS "EP HDI Version 2.8" 00070 * 00080 ROMTST LDA #$02 00090 STA BUFADR 00100 LDA #$C0 00110 STA BUFADR+1 00120 LDA #$FF 00130 STA BUFEND 00140 STA BUFEND+1 00150 STZ CHKROMZ 00160 STZ CHKROMZ+1 00170 .01 LDA (BUFADR) 00180 CLC 00190 ADC CHKROMZ 00200 STA CHKROMZ 00210 BCC .02 00220 INC CHKROMZ+1 00230 .02 JSR BUFINC 00240 BCC .01 00250 LDA CHKROM 00260 AND CHKROM+1 00270 CMP #$FF 00280 BEQ .99 00290 LDA CHKROMZ 00300 CMP CHKROM 00310 .03 BNE .03 00320 LDA CHKROMZ+1 00330 CMP CHKROM+1 00340 .04 BNE .04 00350 .99 RTS 00360 ------------------------------ 00370 SETX SEC 00380 LDA BUFEND+1 00390 SBC BUFADR+1 00400 TAX 00410 RTS 00420 ------------------------------ 00430 RAMSET LDY #$00 00440 JSR SETX 00450 .01 LDA BUFADR+1 00460 .02 STA (BUFADR),Y 00470 INY 00480 BNE .02 00490 INC BUFADR+1 00500 DEX 00510 BNE .01 00520 RTS 00530 * 00540 RAMCHK LDY #$00 00550 JSR SETX 00560 .01 LDA BUFADR+1 00570 EOR (BUFADR),Y 00580 .02 BNE .02 00590 STA (BUFADR),Y 00600 INY 00610 BNE .01 00620 INC BUFADR+1 00630 DEX 00640 BNE .01 00650 RTS 00660 * 00670 RAMTST STZ BUFADR 00680 LDA #$02 00690 STA BUFADR+1 00700 LDA #$40 00710 STA BUFEND+1 00720 JSR RAMSET 00730 LDA #$80 00740 STA BUFADR+1 00750 LDA #$C0 00760 STA BUFEND+1 00770 JSR RAMSET 00780 LDA #$02 00790 STA BUFADR+1 00800 LDA #$40 00810 STA BUFEND+1 00820 JSR RAMCHK 00830 LDA #$80 00840 STA BUFADR+1 00850 LDA #$C0 00860 STA BUFEND+1 00870 JMP RAMCHK 00880 ------------------------------ 00890 MOVTAB LDX #$5F 00900 .01 LDA CMDTAB,X 00910 STA RRAM,X 00920 DEX 00930 BPL .01 00940 RTS 00950 ------------------------------ 00960 CALC SEC 00970 LDA DAUX1 00980 SBC #$01 00990 STA DIV 01000 LDA DAUX2 01010 SBC #$00 01020 STA DIV+1 01030 LDA PSEKLO,Y ;# SecLO 01040 STA DOR 01050 LDX #$00 01060 STX ZSP 01070 STX ZSP+1 01080 STX DOR+1 01090 SHIFT BIT DOR+1 01100 BMI SCHLEIF 01110 ASL DOR 01120 ROL DOR+1 01130 INX 01140 BNE SHIFT 01150 SCHLEIF SEC 01160 LDA DIV 01170 SBC DOR 01180 STA ZSP 01190 LDA DIV+1 01200 SBC DOR+1 01210 STA ZSP+1 01220 PHP 01230 ROL CYL 01240 PLP 01250 BCC NEG 01260 LDA ZSP 01270 STA DIV 01280 LDA ZSP+1 01290 STA DIV+1 01300 NEG LSR DOR+1 01310 ROR DOR 01320 DEX 01330 BPL SCHLEIF 01340 LDX DIV 01350 INX 01360 STX REC 01370 LDX #$00 ;HEA 01380 LDA PMT,Y ;MT ? 01390 BPL .01 ;Nein -> 01400 LDA CYL 01410 LSR 01420 STA CYL 01430 BCC .01 01440 INX ;HEA=1 01450 .01 LDA CYL 01460 CMP PTRACK,Y 01470 BCC NSIDE1 01480 SBC PTRACK,Y 01490 STA CYL 01500 INX ;HEA=1 01510 NSIDE1 STX HEA 01520 RTS 01530 ------------------------------ 01540 LENTAB .HX 00010204081020 01550 ; 01560 SECBFL LDA PBYTLO,Y 01570 STA BUFLEN 01580 LDA PBYTHI,Y 01590 TAX 01600 LDA LENTAB,X 01610 STA BUFLEN+1 01620 ; 01630 SSECBF LDA /SECBUF 01640 STA BUFADR+1 01650 LDA #SECBUF 01660 STA BUFADR 01670 SBFEND CLC 01680 LDA BUFADR 01690 ADC BUFLEN 01700 STA BUFEND 01710 LDA BUFADR+1 01720 ADC BUFLEN+1 01730 STA BUFEND+1 01740 RTS 01750 ------------------------------ 01760 SSIOBF LDA /SIOBUF 01770 STA BUFADR+1 01780 LDA #SIOBUF 01790 STA BUFADR 01800 JMP SBFEND 01810 ------------------------------ 01820 BUFINC INC BUFADR C=1 if 01830 BNE .01 end of 01840 INC BUFADR+1 Buffer 01850 .01 LDA BUFADR+1 01860 CMP BUFEND+1 01870 BCC .02 01880 LDA BUFADR 01890 CMP BUFEND 01900 .02 RTS 01910 ------------------------------ 01920 PBYTE BIT FDCST 01930 BPL PBYTE 01940 STA FDCDAT 01950 RTS 01960 ------------------------------ 01970 GBYTE BIT FDCST 01980 BPL GBYTE 01990 LDA FDCDAT 02000 RTS 02010 ------------------------------ 02020 RESULTS PHA 02030 LDA #$02 ;Terminal 02040 TSB PORTA ;Count Set 02050 TRB PORTA ;Cleared 02060 PHX 02070 LDY ACTDRV Get 7 02080 JSR GBYTE Result 02090 STA ST0TAB,Y Bytes 02100 JSR GBYTE from FDC 02110 STA ST1TAB,Y 02120 JSR GBYTE 02130 STA ST2TAB,Y 02140 LDX #$00 02150 .01 JSR GBYTE 02160 STA CYL,X 02170 INX 02180 CPX #$04 02190 BNE .01 02200 * 02210 LDA ST0TAB,Y C=1 bei 02220 ASL Error 02230 ORA ST0TAB,Y 02240 ASL 02250 PLX 02260 PLA 02270 RTS 02280 ------------------------------ 02290 SPEC PHX 02300 LDX #$02 ;verm. ND 02310 LDA PSEKLO,Y ;Bei mehr 02320 CMP #19 ;als 18 02330 BCC .01 ;Sektoren 02340 LDX #0 ;=HD 02350 .01 TXA 02360 STA CR 02370 STA PHD,Y 02380 LDA #$03 ;CMD 02390 JSR PBYTE 02400 LDA PSTEPR,Y ;Stepr. 02410 AND #$0F 02420 BEQ .02 02430 DEA 02440 .02 EOR #$0F 02450 ASL 02460 ASL 02470 ASL 02480 ASL 02490 BPL .03 02500 CPX #$00 Bei HD 02510 BNE .03 SRT x 2 02520 ASL 02530 .03 ORA #$0F ;SRT/HUT 02540 JSR PBYTE 02550 LDA #$1F ;HLT 02560 ASL 02570 CPX #$00 02580 BNE .04 02590 ASL 02600 .04 ORA #$01 No DMA 02610 JSR PBYTE 02620 PLX 02630 RTS 02640 ------------------------------ 02650 DSTAT PHA 02660 LDA #$04 ;CMD 02670 JSR PBYTE 02680 TYA ;D# 02690 JSR PBYTE 02700 .01 BIT FDCST 02710 BPL .01 02720 LDA PORTA ;DChange 02730 AND #$80 02740 ORA FDCDAT 02750 STA ST3TAB,Y 02760 PLA 02770 RTS 02780 ------------------------------ 02790 ISTAT PHA 02800 PHX 02810 .04 LDA FDCST ;FDC RQM 02820 BPL .04 02830 AND #$70 02840 BNE .04 02850 LDA FDCST 02860 AND #$0F ;Busy ? 02870 BEQ .03 ;Nein -> 02880 LDA #$08 ;W IRQ 02890 .01 BIT PORTB 02900 BEQ .01 02910 .03 LDA #$08 ;CMD 02920 JSR PBYTE 02930 JSR GBYTE 02940 CMP #$80 02950 BEQ .02 02960 PHA 02970 AND #$03 02980 TAX 02990 PLA 03000 STA ST0TAB,X 03010 JSR GBYTE 03020 STA PCNTAB,X 03030 .02 PLX 03040 PLA 03050 RTS 03060 ------------------------------ 03070 TR00 LDA #$07 ;CMD 03080 JSR PBYTE 03090 TYA ;D# 03100 JSR PBYTE 03110 JSR ISTAT 03120 JMP DSTAT 03130 ------------------------------ 03140 STEPIN LDA #$01 03150 BNE SEEK1 03160 STEPOUT LDA #$FF 03170 SEEK1 CLC 03180 ADC PCNTAB,Y 03190 SEEK CMP PTRACK,Y 03200 BCS SEEKX 03210 PHA 03220 LDA #$0F ;CMD 03230 JSR PBYTE 03240 TYA 03250 JSR PBYTE ;D# 03260 PLA 03270 JSR PBYTE ;NCN 03280 JSR ISTAT 03290 JSR DSTAT 03300 CLC 03310 SEEKX RTS 03320 ------------------------------ 03330 XMTCMD PHA ;CMD 03340 PHX 03350 PHP 03360 LDA PMF,Y 03370 ASL 03380 ASL 03390 ASL 03400 ASL 03410 AND #$40 03420 TSX 03430 ORA $0103,X 03440 JSR PBYTE 03450 LDA HEA 03460 ASL 03470 ASL 03480 ORA ACTDRV 03490 JSR PBYTE 03500 PLP 03510 BCC .02 03520 LDX #$00 03530 .01 LDA CYL,X 03540 JSR PBYTE 03550 INX 03560 CPX #$07 03570 BNE .01 03580 .02 PLX 03590 PLA 03600 RTS 03610 ------------------------------ 03620 RESET CLD 03630 LDX #$FF Ca. 130ms 03640 TXS Verz|ge- 03650 LDY #$FF rung zum 03660 .01 DEY Einschwin- 03670 BNE .01 gen der 03680 DEX Betriebs- 03690 BNE .01 spannung. 03700 * 03710 STX PACTL Eing{nge 03720 STX PBCTL 03730 * 03740 STX $00 65C02 CPU? 03750 .HX 8700 SB0 $00 03760 LDA $00 03770 .02 BEQ .02 Nein -> 03780 * 03790 .03 TXA Ramtest 03800 STA $00,X Seiten 03810 EOR #$FF 03820 STA $0100,X 0 und 1 03830 INX 03840 BNE .03 03850 .31 TXA 03860 CMP $00,X 03870 .32 BNE .32 03880 EOR #$FF 03890 CMP $0100,X 03900 .33 BNE .33 03910 INX 03920 BNE .31 03930 * 03940 LDA #$FD Motor an 03950 STA PORTA TC zur}ck- 03960 LDA #$5B setzen 03970 STA PACTL 03980 * 03990 LDA #$FC /Reset f}r 04000 STA PORTB FDC und 04010 LDA #$37 SIO 04020 STA PBCTL 04030 * 04040 JSR ROMTST 04050 JSR RAMTST 04060 JSR MOVTAB 04070 * 04080 LDA #$FF 04090 STA T1024D 65ms Pause 04100 .13 BIT IFLG nach Reset 04110 BPL .13 04120 * 04130 LDA #$4D SIO:8/N/1 04140 STA SIOCMD asynchron 04150 LDA #$37 04160 STA SIOCMD 04170 * 04180 LDA FDCST FDC: Base 04190 LDA #$08 Warte auf 04200 .14 BIT PORTB FDC IRQ 04210 BEQ .14 nach Reset 04220 * 04230 LDX #$02 ND 04240 STX CR 04250 * 04260 LDY #$03 Ein Reset 04270 .15 JSR ISTAT bedingt 04280 DEY den Nicht- 04290 BPL .15 RDY-Status 04300 * aller FDD 04310 * u. erzeugt 04320 * einen IRQ 04330 * 04340 LDA #$03 2ms SRT 04350 JSR PBYTE 04360 LDA #$EF 04370 JSR PBYTE 04380 JSR PBYTE 04390 * 04400 LDY #$03 Alle Lauf- 04410 .16 LDA #$07 werke nach 04420 JSR PBYTE Track 0 04430 TYA 04440 JSR PBYTE 04450 DEY 04460 BPL .16 04470 * 04480 .17 JSR ISTAT Es sind 04490 LDA FDCST noch nicht 04500 AND #$0F alle 04510 BNE .17 fertig -> 04520 * 04530 LDA #$31 Vorhandene 04540 PHA Floppies 04550 LDY #$00 eintragen 04560 .18 STY ACTDRV und konfi- 04570 LDA #40 gurieren 04580 STA PTRACK,Y 04590 LDA #$02 04600 STA PSTEPR,Y 04610 STA PHD,Y 04620 LDA #$00 04630 STA PSEKHI,Y 04640 STA PSIDE,Y 04650 STA PMF,Y 04660 STA PBYTHI,Y 04670 STA PMT,Y 04680 STA DRVTAB,Y 04690 STA HPYFLG,Y 04700 LDA #$12 04710 STA PSEKLO,Y 04720 LDA #$80 04730 STA PBYTLO,Y 04740 LDA #$FF 04750 STA PONLIN,Y 04760 LDA #$0A 04770 STA PBAUD,Y 04780 LDA #$D0 Max # of 04790 STA PMAXLO,Y Sectors 04800 LDA #$02 04810 STA PMAXHI,Y 04820 JSR DSTAT 04830 LDA ST0TAB,Y ;Fehler= 04840 AND #$D0 ;keine 04850 BNE .19 ;Floppy 04860 PLA 04870 STA DRVTAB,Y 04880 INA 04890 PHA 04900 JSR CFGDRV 04910 .19 INY 04920 CPY #$04 04930 BCC .18 04940 PLA 04950 LDA #$08 Motor aus 04960 TRB PORTA 04970 LDA #$25 19200 Bd 04980 STA BAUD Sendetakt 04990 LDA #$FA 3 Sekunden 05000 STA OFFDEL Nachlauf 05010 JMP WAITCMD 05020 ------------------------------ 05030 CFGDRV JSR IFDISK 05040 BMI .00 ;Ja -> 05050 RTS 05060 .00 JSR MOTON 05070 LDA #$50 05080 STA PTRACK,Y 05090 LDA #$02 ;SD/DD 05100 STA CR 05110 STA PHD,Y 05120 LDA #$00 ;FM 05130 STA PMF,Y 05140 STA HEA 05150 JSR READID 05160 BCC .01 05170 LDA #$04 ;MFM 05180 STA PMF,Y 05190 LDA #$00 05200 STA HEA 05210 JSR READID 05220 BCC .01 05230 LDA #$00 ;HD/MFM 05240 STA CR 05250 STA PHD,Y 05260 STA HEA 05270 JSR READID 05280 BCC .01 05290 LDA #$00 ;HD/FM 05300 STA PMF,Y 05310 STA HEA 05320 JSR READID 05330 BCC .01 05340 LDA #$02 ;Default 05350 STA PHD,Y ;ND/FM 05360 LDA #$00 ;80 Byte 05370 STA PBYTHI,Y 05380 LDA #$80 05390 STA PBYTLO,Y 05400 BNE LASTSEC 05410 .01 LDA ST02EB,Y 05420 ORA #$40 05430 STA ST02EB,Y 05440 LDA NUM ;Setze 05450 STA PBYTHI,Y ;Disk- 05460 LDA #$00 ;Sektor- 05470 CMP NUM ;L{nge. 05480 ROR 05490 STA PBYTLO,Y 05500 JSR NUMSEC 05510 JSR SE01BF 05520 LDA ST02EB,Y read sec. 05530 ORA #$40 forces 05540 STA ST02EB,Y unprot. 05550 JSR SRDST 05560 LDA #$01 Seite 1? 05570 STA HEA 05580 JSR READID 05590 BCS .03 05600 CMP HEA 05610 BEQ .10 05620 .03 LDA #$00 05630 .10 STA PSIDE,Y 05640 LDA #$00 05650 STA HEA 05660 JSR SPEC 05670 LDA #40 05680 JSR SEEK 05690 JSR READID 05700 BCS .04 05710 LDA #77 05720 JSR SEEK 05730 JSR READID 05740 BCS .04 05750 LDA #80 05760 .04 STA PTRACK,Y 05770 .05 JSR TR00 05780 LASTSEC LDA PTRACK,Y ;T*H*S= 05790 STA DIV ;max Sec 05800 LDX PSIDE,Y 05810 LDA PSEKLO,Y 05820 DEX 05830 BMI .06 05840 ASL 05850 .06 STA DOR 05860 LDA #$00 05870 STA PMAXLO,Y 05880 STA PMAXHI,Y 05890 STA DOR+1 05900 .07 LDA DIV 05910 BNE .08 05920 RTS 05930 .08 AND #$01 05940 BEQ .09 05950 CLC 05960 LDA PMAXLO,Y 05970 ADC DOR 05980 STA PMAXLO,Y 05990 LDA PMAXHI,Y 06000 ADC DOR+1 06010 STA PMAXHI,Y 06020 .09 LSR DIV 06030 ASL DOR 06040 ROL DOR+1 06050 JMP .07 06060 ------------------------------ 06070 SE01BF LDA DAUX1 06080 PHA 06090 LDA DAUX2 06100 PHA 06110 LDA #1 06120 STA DAUX1 06130 STZ DAUX2 06140 JSR RSEC 06150 PLA 06160 STA DAUX2 06170 PLA 06180 STA DAUX1 06190 JSR SBTBF 06200 LDY #$7F 06210 .01 LDA SECBUF,Y 06220 STA (BUFADR),Y 06230 DEY 06240 BPL .01 06250 LDY ACTDRV 06260 RTS 06270 ------------------------------ 06280 SBTBF TYA 06290 LSR 06300 PHA 06310 ROR 06320 CLC 06330 ADC #BOOTBF 06340 STA BUFADR 06350 PLA 06360 ADC /BOOTBF 06370 STA BUFADR+1 06380 RTS 06390 ------------------------------ 06400 READID PHA 06410 LDA #$0A ;CMD 06420 CLC 06430 JSR XMTCMD 06440 JSR RESULTS 06450 PLA 06460 RTS 06470 ------------------------------ 06480 NUMSEC LDX #$23 L|sche 06490 .00 STZ SKEW,X Tabelle 06500 DEX 06510 BPL .00 06520 * Drive Sel. 06530 JSR READID durch HUT 06540 LDA #4 Warte auf 06550 .01 BIT PORTA IDX: 06560 BEQ .01 LO-HI 06570 .02 BIT PORTA HI-LO 06580 BNE .02 06590 * 06600 LDX #0 06610 .03 JSR READID Starte das 06620 LDA REC Lesen der 06630 CMP SKEW Header mit 06640 BEQ .04 d. fallen- 06650 STA SKEW,X den Flanke 06660 INX des Index- 06670 CPX #$24 impulses. 06680 BCC .03 06690 * 06700 .04 TXA 06710 STA PSEKLO,Y 06720 LDX #0 06730 JSR Y40 06740 .05 LDA SKEW,X 06750 STA SKWADR,Y 06760 INY 06770 INX 06780 CPX #$24 06790 BNE .05 06800 LDY ACTDRV 06810 RTS 06820 ------------------------------ 06830 Y40 TYA Y=Y*40 06840 ASL 06850 ASL 06860 ASL 06870 STA DIV 06880 ASL 06890 ASL 06900 ADC DIV 06910 TAY 06920 RTS 06930 ------------------------------ 06940 RSEC LDY ACTDRV 06950 JSR CALC 06960 LDA CYL 06970 JSR SEEK 06980 LDA PBYTLO,Y 06990 STA DTL 07000 LDA PBYTHI,Y 07010 STA NUM 07020 LDA PSEKLO,Y 07030 STA EOT 07040 ; 07050 JSR SECBFL 07060 ; 07070 LDA #$06 ;CMD 07080 SEC 07090 JSR XMTCMD 07100 ; 07110 LDY #$00 07120 .04 LDA #$20 ;FDC EXM 07130 .05 BIT FDCST 07140 BPL .05 07150 BEQ .06 07160 LDA FDCDAT 07170 EOR #$FF 07180 STA (BUFADR),Y 07190 ; 07200 INY 07210 BNE .07 07220 INC BUFADR+1 07230 DEC BUFLEN+1 07240 .07 CPY BUFLEN 07250 BNE .04 07260 LDA BUFLEN+1 07270 BNE .04 07280 ; 07290 .06 JMP RESULTS 07300 ------------------------------ 07310 WSEC LDY ACTDRV 07320 JSR CALC 07330 LDA CYL 07340 JSR SEEK 07350 LDA PBYTLO,Y 07360 STA DTL 07370 LDA PBYTHI,Y 07380 STA NUM 07390 LDA PSEKLO,Y 07400 STA EOT 07410 ; 07420 JSR SECBFL 07430 ; 07440 LDA #$05 07450 SEC 07460 JSR XMTCMD 07470 ; 07480 LDY #$00 07490 .01 LDA #$20 07500 .02 BIT FDCST 07510 BPL .02 07520 BEQ .04 07530 LDA (BUFADR),Y 07540 EOR #$FF 07550 STA FDCDAT 07560 ; 07570 INY 07580 BNE .03 07590 INC BUFADR+1 07600 DEC BUFLEN+1 07610 .03 CPY BUFLEN 07620 BNE .01 07630 LDA BUFLEN+1 07640 BNE .01 07650 ; 07660 .04 JMP RESULTS 07670 ------------------------------ 07680 FODISK LDY ACTDRV 07690 JSR TR00 07700 LDA PBYTHI,Y 07710 STA FOTAB ;NUM 07720 LDA PSEKLO,Y 07730 STA FOTAB+1 ;EOT 07740 LDA #$0A 07750 LDX PMF,Y ;MFM? 07760 BEQ .01 ;Nein -> 07770 ASL 07780 .01 STA FOTAB+2 ;GPL 07790 LDA #$FF 07800 STA FOTAB+3 ;FILLER 07810 FOTRK LDA PCNTAB,Y 07820 STA IDTAB ;CYL 07830 LDA PSIDE,Y 07840 STA IDTAB+1 ;HEA 07850 FOSIDE LDA IDTAB+1 07860 STA HEA 07870 LDA #$0D ;Format 07880 CLC 07890 JSR XMTCMD 07900 LDX #$00 07910 .01 LDA FOTAB,X 07920 .02 BIT FDCST 07930 BPL .02 07940 BVS FOERR 07950 STA FDCDAT 07960 INX 07970 CPX #$04 07980 BCC .01 07990 LDY #$00 08000 WRID LDA SKEW,Y 08010 STA IDTAB+2 ;REC 08020 LDX #$00 08030 .01 LDA IDTAB,X 08040 .02 BIT FDCST 08050 BPL .02 08060 BVS FOERR 08070 STA FDCDAT 08080 INX 08090 CPX #$04 08100 BCC .01 08110 INY 08120 CPY FOTAB+1 ;EOT 08130 BNE WRID 08140 LDA #$08 08150 .03 BIT PORTB 08160 BEQ .03 08170 FOERR LDY ACTDRV 08180 JSR RESULTS 08190 BCS FOX 08200 DEC IDTAB+1 ;HEA 08210 BPL FOSIDE 08220 JSR STEPIN 08230 BCC FOTRK 08240 JSR TR00 08250 CLC 08260 FOX RTS 08270 ------------------------------ 08280 SETSKEW LDX #$05 Interleave 08290 LDA PHD,Y ist es HD? 08300 BNE .00 Nein-> 08310 LDX #$0B 08320 .00 LDA PMF,Y 08330 BEQ .01 08340 INX > 128 Byte 08350 INX je Sektor 08360 .01 STX INTRLV 08370 ; 08380 LDA PSEKLO,Y L|sche 08390 TAX Sektor- 08400 DEX 08410 .02 STZ SKEW,X tabelle 08420 DEX 08430 BPL .02 08440 ; 08450 LDX #$01 08460 STX SKWSEC 08470 DEX 08480 STX SKEWPT 08490 .03 LDA SKEW,X 08500 BEQ .04 08510 INC SKEWPT 08520 JSR .07 08530 BCC .03 08540 .04 LDA SKWSEC 08550 STA SKEW,X 08560 INC SKWSEC 08570 LDA PSEKLO,Y 08580 CMP SKWSEC 08590 BCC .05 08600 JSR .06 08610 BCC .03 08620 .05 RTS 08630 ; 08640 .06 CLC Addiere 08650 LDA SKEWPT Interleave 08660 ADC INTRLV 08670 STA SKEWPT 08680 ; 08690 .07 LDA SKEWPT 0<=PT<PSEKLO 08700 CMP PSEKLO,Y 08710 BCC .08 08720 SBC PSEKLO,Y 08730 STA SKEWPT 08740 CLC 08750 .08 TAX 08760 RTS 08770 ------------------------------ 08780 MOTOR0 LDA MOTIM+2 08790 BEQ .01 08800 INC MOTIM 08810 BNE .01 08820 INC MOTIM+1 08830 BNE .01 08840 INC MOTIM+2 08850 BNE .01 08860 LDA PORTA 08870 AND #$F7 08880 STA PORTA 08890 .01 RTS 08900 ------------------------------ 08910 IFDISK JSR SPEC 08920 JSR DSTAT 08930 LDA ST3TAB,Y ;Disk in 08940 BMI .01 ;Drive-> 08950 AND #$10 ;TR0? 08960 BEQ .02 ;Nein -> 08970 JSR STEPIN 08980 .02 JSR TR00 08990 JSR DSTAT 09000 LDA ST3TAB,Y 09010 .01 RTS 09020 .BL $4B,$FF 09030 ------------------------------ 09040 SIOGET LDA SIOST Schon was 09050 AND #$3A empfangen? 09060 LSR 09070 LSR 09080 BCC SIOGET Nein -> 09090 BNE .01 Fehler -> 09100 CLC 09110 .01 ORA STATUS 09120 STA STATUS 09130 LDA SIODAT Bei Fehler 09140 RTS ist C=1 09150 ------------------------------ 09160 SIOPUT PHA 09170 STA SIODAT 09180 .01 LDA PORTA 09190 AND #$FE 09200 STA PORTA 09210 ORA #$01 09220 STA PORTA 09230 LDA BAUD 09240 .02 DEA 09250 BNE .02 09260 LDA #$04 09270 BIT SIOST 09280 BEQ .01 09290 PLA 09300 RTS 09310 ------------------------------ 09320 CHKSUM CLC 09330 ADC PSUMME 09340 ADC #$00 09350 STA PSUMME 09360 RTS 09370 ------------------------------ 09380 BOOTSEC LDA DAUX2 ;Ist es 09390 BNE .01 ;ein Boot- 09400 LDA DAUX1 ;sektor ? 09410 CMP #$04 09420 BCS .01 09430 LDA #$80 09440 STA BUFLEN 09450 STZ BUFLEN+1 09460 JMP SSECBF ;Ja 09470 .01 JMP SECBFL ;Nein 09480 ------------------------------ 09490 RECV JSR SIOGET Lese Byte 09500 BCS .02 Fehler -> 09510 STA (BUFADR) Schleife 09520 JSR CHKSUM bis 09530 JSR BUFINC Puffer 09540 BCC RECV voll -> 09550 JSR SIOGET 09560 CMP PSUMME 09570 PHP 09580 LDA #$30 09590 STA T0064D 09600 .01 BIT IFLG 09610 BPL .01 09620 PLP 09630 BNE POP 09640 LDA #ACK 09650 JMP SIOPUT ;ok, Ret. 09660 ; 09670 .02 LDA #3 Timeout 09680 STA T1024D 768 us 09690 .03 LDA SIOST 09700 LSR 09710 LSR 09720 BIT IFLG 09730 BMI POP 09740 BCC .03 09750 LDA SIODAT 09760 BCS .02 09770 ; 09780 POP PLA 09790 PLA 09800 ; 09810 DATNACK LDA ST02EA,Y 09820 ORA #$02 09830 STA ST02EA,Y 09840 LDA #NACK 09850 JMP XIT ;Err, POP 09860 ------------------------------ 09870 XMIT LDA (BUFADR) 09880 STA SIODAT 09890 JSR CHKSUM 09900 .01 LDA PORTA TxCLK LO 09910 AND #$FE 09920 STA PORTA 09930 ORA #$01 TxCLK HI 09940 STA PORTA 09950 LDA BAUD Verz|ge- 09960 .02 DEA rung, gem. 09970 BNE .02 Baudrate 09980 LDA #$01 Warte auf 09990 BIT SIOST T_Ready 10000 BEQ .01 10010 JSR BUFINC 10020 BCC XMIT 10030 LDA PSUMME 10040 JMP SIOPUT 10050 ------------------------------ 10060 MOTON LDA #$08 Motor an 10070 TSB PORTA 10080 BNE .03 war an -> 10090 PHX 10100 LDX #8 500 ms 10110 .01 LDA #$FF Motorhoch- 10120 STA T1024D laufzeit 10130 .02 BIT IFLG 10140 BPL .02 10150 DEX 10160 BNE .01 10170 PLX 10180 .03 LDA OFFDEL Motornach- 10190 STA MOTIM+2 laufzeit 10200 STZ MOTIM+1 10210 STZ MOTIM 10220 RTS 10230 ------------------------------ 10240 WAITCMD BIT SIOST Wait 'til 10250 BPL WAITCMD CMD end 10260 LDY #$00 10270 STY STATUS 10280 STY PSUMME 10290 .03 LDA SIODAT Clr Bugs 10300 JSR MOTOR0 3s delay 10310 BIT SIOST CMD set? 10320 BMI .03 No -> 10330 BIT PORTB Host on? 10340 BVS WAITCMD No -> 10350 LDA #$37 SIO an 10360 STA SIOCMD 10370 JSR SIOGET 10380 BCS WAITCMD 10390 STA DRIVE 10400 STA PSUMME 10410 LDA #$FF Baudrate 10420 STA T0064D ermitteln 10430 INY 10440 .01 JSR SIOGET 10450 BCS WAITCMD 10460 STA DRIVE,Y 10470 JSR CHKSUM 10480 INY 10490 CPY #$05 10500 BNE .01 10510 BIT IFLG 10520 BMI WAITCMD 10530 LDY RTIMID 10540 STY RTIMIDZ 10550 .04 BIT SIOST 10560 BPL .04 10570 CMP PSUMME 10580 BNE WAITCMD 10590 ; 10600 DRVCHK LDY #$03 10610 .01 LDA DRVTAB,Y 10620 BMI .02 10630 BIT PORTB 10640 BPL .02 10650 INA 10660 .02 AND #$7F 10670 CMP DRIVE 10680 BEQ DRVFND 10690 DEY 10700 BPL .01 10710 BMI WAITCMD 10720 ; 10730 DRVFND STY ACTDRV 10740 LDA #$25 10750 LDX RTIMIDZ 10760 CPX #$80 10770 BCC .01 10780 LDA PBAUD,Y 10790 .01 STA BAUD 10800 ; 10810 CMDCHK LDX #$1F 10820 LDA COMAND 10830 .01 CMP RRAM,X 10840 BEQ CMDJMP 10850 DEX 10860 BPL .01 10870 ; 10880 CMDNACK LDA ST02EA,Y 10890 ORA #$01 10900 STA ST02EA,Y 10910 LDA #NACK 10920 JMP XIT 10930 ; 10940 CMDJMP CPX #$05 Ext. CMD? 10950 BCC .01 Nein -> 10960 LDA HPYFLG,Y Happy ist 10970 BMI CMDNACK aus -> 10980 .01 CPX #$03 R/W SEC? 10990 BCS .04 No -> 11000 ; 11010 LDA DAUX2 Sektor # 11020 BPL .02 negativ? 11030 LDA HPYFLG,Y Ram/Rom 11040 BMI CMDNACK Adr. wenn 11050 BPL .04 Happy an. 11060 ; 11070 LDA DAUX2 Es gibt 11080 .02 ORA DAUX1 keinen 11090 BEQ CMDNACK Sektor 0! 11100 ; 11110 SEC Sektor - 11120 LDA PMAXLO,Y nummer zu 11130 SBC DAUX1 gro~? 11140 LDA PMAXHI,Y 11150 SBC DAUX2 11160 BCC CMDNACK Ja -> 11170 ; 11180 .04 JSR SPEC 11190 LDA #ACK 11200 JSR SIOPUT 11210 STZ PSUMME 11220 LDA RRAM+$20,X 11230 STA DIV 11240 LDA RRAM+$40,X 11250 STA DIV+1 11260 JMP (DIV) 11270 ; 11280 CMDTAB .AS "PWR!S" ;$97A0 11290 .AS " ?AHNOQThif" 11300 .BL $10,$00 11310 ; 11320 .DA #PTSEC,#WRSEC 11330 .DA #RDSEC,#FORMT 11340 .DA #STATS 11350 .DA #AUTOF,#GETBD 11360 .DA #CHCMD,#HAPPY 11370 .DA #RPERC,#WPERC 11380 .DA #QQQQQ,#RDRAM 11390 .DA #RSIOL,#RSIOD 11400 .DA #CUSTM 11410 .BL $10,$00 11420 ; 11430 .DA /PTSEC,/WRSEC 11440 .DA /RDSEC,/FORMT 11450 .DA /STATS 11460 .DA /AUTOF,/GETBD 11470 .DA /CHCMD,/HAPPY 11480 .DA /RPERC,/WPERC 11490 .DA /QQQQQ,/RDRAM 11500 .DA /RSIOL,/RSIOD 11510 .DA /CUSTM 11520 .BL $10,$00 11530 ------------------------------ 11540 RWMEM JSR SECBFL 11550 LDA COMAND 11560 CMP #'R 11570 BEQ .04 11580 ; 11590 JSR RECV 11600 BIT DAUX2 11610 BVC .01 11620 JMP XERR 11630 ; 11640 .01 JSR SSECBF 11650 .02 LDA (BUFADR) 11660 STA (DAUX1) 11670 INC DAUX1 11680 BNE .03 11690 INC DAUX2 11700 .03 JSR BUFINC 11710 BCC .02 11720 JMP XWOK 11730 ; 11740 .04 LDA DAUX1 11750 STA BUFADR 11760 LDA DAUX2 11770 STA BUFADR+1 11780 LDA #COMPLT 11790 JSR SIOPUT 11800 JSR SBFEND 11810 JSR XMIT 11820 JMP WAITCMD 11830 ------------------------------ 11840 WRSEC 11850 PTSEC LDA DAUX2 RAM Adr.? 11860 BPL .00 11870 JMP RWMEM 11880 ; 11890 .00 JSR BOOTSEC 11900 JSR RECV 11910 JSR DSTAT 11920 LDA ST3TAB,Y 11930 BMI .01 11940 JSR CFGDRV 11950 BPL .02 11960 .01 LDA HPYFLG,Y 11970 LSR 11980 BCS .03 11990 JSR MOTON 12000 JSR SSECBF 12010 JSR WSEC 12020 LDA ST2TAB,Y 12030 AND #$10 12040 BEQ .03 12050 JSR TR00 12060 JSR WSEC 12070 .03 PHP 12080 JSR SRDST 12090 PLP 12100 BCS .02 12110 LDA DAUX2 12120 BNE .04 12130 LDA DAUX1 12140 CMP #1 12150 BNE .04 12160 JSR SE01BF 12170 .04 JMP XWOK 12180 .02 JMP XERR 12190 ------------------------------ 12200 RDSEC LDA DAUX2 12210 BPL .00 12220 JMP RWMEM 12230 ; 12240 .00 JSR DSTAT 12250 LDA ST02EB,Y 12260 ORA #$40 12270 STA ST02EB,Y 12280 LDA ST3TAB,Y;Dsk still 12290 BMI .01 ;in Drive 12300 JSR CFGDRV 12310 LDA ST3TAB,Y 12320 BPL .03 ;No Disk 12330 .01 LDA DAUX2 12340 BNE .02 12350 LDA DAUX1 12360 CMP #1 12370 BNE .02 12380 JMP RSECRAM 12390 .02 JSR MOTON 12400 JSR RSEC 12410 BCC .04 12420 LDA ST2TAB,Y 12430 AND #$10 12440 BEQ .03 12450 JSR TR00 12460 JSR RSEC 12470 BCC .04 12480 .03 LDA #ERROR 12490 .HX 2C 12500 .04 LDA #COMPLT ;Sektor ok 12510 JSR SIOPUT 12520 JSR BOOTSEC 12530 JSR XMIT 12540 JSR SRDST 12550 JMP WAITCMD 12560 ; 12570 RSECRAM JSR SBTBF 12580 LDA #$80 12590 STA BUFLEN 12600 STZ BUFLEN+1 12610 JSR SBFEND 12620 LDA #COMPLT 12630 JSR SIOPUT 12640 JSR XMIT 12650 JSR SRDST 12660 JMP WAITCMD 12670 ------------------------------ 12680 FORMT JSR IFDISK 12690 SEC 12700 BPL .07 12710 LDA HPYFLG,Y 12720 LSR 12730 BCS .07 12740 JSR MOTON 12750 JSR SETSKEW 12760 JSR FODISK 12770 LDA #$FF 12780 BCC .04 12790 .07 LDA #$00 12800 .04 LDX #$00 12810 .05 STA SIOBUF,X 12820 INX 12830 BNE .05 12840 BCS .06 12850 JSR LASTSEC 12860 LDA #COMPLT 12870 .HX 2C 12880 .06 LDA #ERROR 12890 JSR SIOPUT 12900 LDA PBYTLO,Y 12910 STA BUFLEN 12920 LDA PBYTHI,Y 12930 STA BUFLEN+1 12940 JSR SSIOBF 12950 JSR XMIT 12960 JSR SRDST 12970 JMP WAITCMD 12980 ------------------------------ 12990 .IN "D:STATS.BIB 13000 ------------------------------ 13010 AUTOF JSR IFDISK 13020 BPL .01 No Disk 13030 ASL 13040 BMI .01 Write prot 13050 LDA HPYFLG,Y 13060 LSR 13070 BCS .01 13080 LDA #COMPLT 13090 JSR SIOPUT 13100 JSR MOTON 13110 JSR SETSKEW 13120 JSR FODISK 13130 JMP WAITCMD 13140 ; 13150 .01 JMP XERR 13160 ------------------------------ 13170 GETBD LDA #COMPLT 13180 JSR SIOPUT 13190 LDA PBAUD,Y 13200 JSR SIOPUT 13210 JMP XIT 13220 ------------------------------ 13230 CHCMD LDA #3 Lese 3 13240 STA BUFLEN Bytes 13250 STZ BUFLEN+1 13260 JSR SSIOBF 13270 JSR RECV 13280 LDA SIOBUF 13290 AND #$7F 13300 STA SIOBUF+3 13310 LDX #0 13320 .01 LDA RRAM,X Eintrag 13330 BEQ .02 frei 13340 AND #$7F 13350 CMP SIOBUF+3 Eintrag 13360 BEQ .02 vorhanden 13370 INX 13380 CPX #$20 13390 BCC .01 13400 JMP XERR 13410 ; 13420 .02 LDA SIOBUF+1 13430 ORA SIOBUF+2 13440 BNE .04 13450 .03 LDA RRAM+1,X 13460 STA RRAM,X 13470 LDA RRAM+$21,X 13480 STA RRAM+$20,X 13490 LDA RRAM+$41,X 13500 STA RRAM+$40,X 13510 INX 13520 CPX #$1F 13530 BCC .03 13540 STZ RRAM,X 13550 STZ RRAM+$20,X 13560 STZ RRAM+$40,X 13570 JMP XWOK gel|scht 13580 ; 13590 .04 LDA SIOBUF 13600 STA RRAM,X 13610 LDA SIOBUF+1 13620 STA RRAM+$20,X 13630 LDA SIOBUF+2 13640 STA RRAM+$40,X 13650 JMP XWOK eingetragen 13660 ; 13670 ------------------------------ 13680 HAPPY LDX #$0F 13690 .01 LDA HAPTAB,X 13700 CMP DAUX1 13710 BEQ .02 13720 DEX 13730 BPL .01 13740 JMP XERR 13750 ; 13760 .02 LDA HAPTAB+$10,X 13770 STA DIV 13780 LDA HAPTAB+$20,X 13790 STA DIV+1 13800 JMP (DIV) 13810 ; 13820 HAPTAB .HX 00010203 13830 .HX 182060E0 13840 .BL $08,$FF 13850 ; 13860 .DA #HPY1,#OFFD 13870 .DA #NDVN,#IDRV 13880 .DA #WRPE,#FAWR 13890 .DA #SLOW,#HOFF 13900 .DA #XERR,#XERR 13910 .DA #XERR,#XERR 13920 .DA #XERR,#XERR 13930 .DA #XERR,#XERR 13940 ; 13950 .DA /HPY1,/OFFD 13960 .DA /NDVN,/IDRV 13970 .DA /WRPE,/FAWR 13980 .DA /SLOW,/HOFF 13990 .DA /XERR,/XERR 14000 .DA /XERR,/XERR 14010 .DA /XERR,/XERR 14020 .DA /XERR,/XERR 14030 ; 14040 HPY1 LDA DAUX2 14050 CMP #$80 14060 BNE .01 14070 JMP XWOK 14080 .01 JMP CMDNACK 14090 ; 14100 OFFD LDA DAUX2 14110 LSR 14120 LSR 14130 LSR 14140 LSR 14150 LSR 14160 CLC 14170 ADC #$F8 14180 STA OFFDEL 14190 JMP XWOK 14200 ; 14210 NDVN LDX ACTDRV 14220 LDA DAUX2 Befehl ok? 14230 BPL .03 Fehler -> 14240 AND #$7F 14250 CMP #$3A Nummer 14260 BCS .03 1...9 14270 CMP #$31 erlaubt 14280 BCC .03 14290 LDY DRVTAB,X Alte Nr. 14300 STY DIV retten u. 14310 LDY #$00 Eintrag 14320 STZ DRVTAB,X l|schen. 14330 BIT PORTB 14340 BPL .01 14350 DEA 14360 .01 CMP DRVTAB,Y Gibt es 14370 BEQ .02 schon -> 14380 INY 14390 CPY #4 14400 BCC .01 14410 LDA DAUX2 Setze 14420 STA DRVTAB,X Kennung 14430 JMP XWOK 14440 ; 14450 .02 LDA DIV 14460 STA DRVTAB,X 14470 .03 JMP CMDNACK 14480 ; 14490 IDRV LDA DAUX2 14500 BNE .01 14510 STA HPYFLG,Y 14520 CLC 14530 TYA 14540 ADC #$31 14550 STA DRVTAB,Y 14560 LDA #$FA 14570 STA OFFDEL 14580 JSR MOTON 14590 JSR CFGDRV 14600 JMP XWOK 14610 .01 JMP CMDNACK 14620 ; 14630 WRPE LDA HPYFLG,Y 14640 LDX DAUX2 14650 CPX #$10 14660 BNE .01 14670 ORA #$01 14680 BNE .02 14690 .01 CPX #$08 14700 BNE .03 14710 AND #$FE 14720 .02 STA HPYFLG,Y 14730 JMP XWOK 14740 .03 JMP CMDNACK 14750 ; 14760 FAWR LDA DAUX2 14770 BNE .01 14780 LDA HPYFLG,Y 14790 ORA #$02 14800 STA HPYFLG,Y 14810 JMP XWOK 14820 .01 JMP CMDNACK 14830 ; 14840 SLOW LDA DAUX2 14850 CMP #$60 14860 BNE .01 14870 LDA HPYFLG,Y 14880 ORA #$4 14890 STA HPYFLG,Y 14900 JMP XWOK 14910 .01 JMP CMDNACK 14920 ; 14930 HOFF LDA DAUX2 14940 CMP #$E0 14950 BNE .01 14960 LDA HPYFLG,Y 14970 ORA #$80 14980 STA HPYFLG,Y 14990 JMP XWOK 15000 .01 JMP CMDNACK 15010 ------------------------------ 15020 RPERC LDA #COMPLT 15030 JSR SIOPUT 15040 .01 LDA PTRACK,Y 15050 JSR SIOPUT 15060 JSR CHKSUM 15070 INY 15080 INY 15090 INY 15100 INY 15110 CPY #$30 15120 BCC .01 15130 BCS XRD 15140 ------------------------------ 15150 CUSTM 15160 WPERC LDA #12 15170 LDX COMAND 15180 CPX #'f 15190 BNE .00 15200 LDA #128 15210 .00 STA BUFLEN 15220 LDA #0 15230 STA BUFLEN+1 15240 TAX 15250 JSR SSIOBF 15260 JSR RECV 15270 .01 LDA SIOBUF,X 15280 STA PTRACK,Y 15290 INX 15300 INY 15310 INY 15320 INY 15330 INY 15340 CPY #$30 15350 BCC .01 15360 ; 15370 LDY ACTDRV 15380 LDA PSTEPR,Y Steprate 15390 CMP #$02 minimal 15400 BCS .04 2 ms 15410 LDA #$02 15420 STA PSTEPR,Y 15430 ; 15440 .04 JSR SPEC HD ? 15450 LDA COMAND 15460 CMP #'f 15470 BNE .03 15480 LDY #0 15490 .02 LDA SIOBUF,X 15500 STA SKEW,Y 15510 INX 15520 INY 15530 CPY SIOBUF+3 15540 BCC .02 15550 LDY ACTDRV 15560 JSR IFDISK 15570 BPL XERR 15580 JSR MOTON 15590 JSR FODISK 15600 BCS XERR 15610 JSR LASTSEC 15620 .03 JMP XWOK 15630 ------------------------------ 15640 QQQQQ LDA #$08 15650 TRB PORTA 15660 LDA #COMPLT 15670 JSR SIOPUT 15680 JMP WAITCMD 15690 ------------------------------ 15700 XRD LDA PSUMME 15710 .HX 2C 15720 XWOK LDA #COMPLT 15730 .HX 2C 15740 XERR LDA #ERROR 15750 XIT JSR SIOPUT 15760 JMP WAITCMD 15770 ------------------------------ 15780 RDRAM LDA DAUX1 15790 STA BUFADR 15800 LDA DAUX2 15810 STA BUFADR+1 15820 STZ BUFLEN 15830 LDA #$01 15840 STA BUFLEN+1 15850 LDA #COMPLT 15860 JSR SIOPUT 15870 JSR SBFEND 15880 JSR XMIT 15890 JMP WAITCMD 15900 ------------------------------ 15910 RSIOL LDA #COMPLT 15920 JSR SIOPUT 15930 LDA #$02 15940 STA BUFLEN 15950 STZ BUFLEN+1 15960 LDA #USIOL 15970 STA BUFADR 15980 LDA /USIOL 15990 STA BUFADR+1 16000 JSR SBFEND 16010 JSR XMIT 16020 JMP WAITCMD 16030 USIOL .DA USIOE-USIOA 16040 ------------------------------ 16050 RSIOD LDA USIOL Puffer f}r 16060 STA BUFLEN SIO setzen 16070 LDA USIOL+1 16080 STA BUFLEN+1 16090 JSR SSIOBF 16100 LDA #USIOA Errechne 16110 STA DIV Differenz 16120 SEC zur Ziel - 16130 SBC DAUX1 adresse 16140 STA DAUX1 16150 LDA /USIOA DIV zeigt 16160 STA DIV+1 auf die 16170 SBC DAUX2 Adresse im 16180 STA DAUX2 ROM 16190 ; 16200 LDX #$00 Zu ver - 16210 .01 LDA ABSTBL,X legende 16220 CMP DIV Adresse? 16230 BNE .02 16240 LDA ABSTBL+1,X 16250 CMP DIV+1 16260 BNE .02 16270 JSR .04 Byte aus 16280 SEC ROM 16290 SBC DAUX1 umrechnen 16300 PHP 16310 JSR .06 16320 JSR .04 16330 PLP 16340 SBC DAUX2 16350 JSR .06 16360 INX Zeiger 16370 INX auf naechste 16380 BNE .03 Adresse 16390 .02 JSR .04 16400 JSR .06 16410 .03 LDA DIV Ende 16420 CMP #USIOE erreicht? 16430 BNE .01 16440 LDA DIV+1 16450 CMP /USIOE 16460 BNE .01 16470 LDA #COMPLT Ja. 16480 JSR SIOPUT Puffer 16490 JSR SSIOBF senden 16500 JSR XMIT 16510 JMP WAITCMD 16520 ; 16530 .04 LDA (DIV) Byte 16540 INC DIV lesen, 16550 BNE .05 Zeiger 16560 INC DIV+1 erh|hen. 16570 .05 RTS 16580 ; 16590 .06 STA (BUFADR) 16600 JMP BUFINC 16610 ------------------------------ 16620 .IN "D:EPSIO.BIB 16630 ------------------------------ 16640 .OR $FFF9 16650 IRQ 16660 NMI RTI 16670 .DA NMI 16680 .DA RESET 16690 .DA IRQ 16700 ------------------------------
00010 STATS JSR DSTAT 00020 *-02EA-* 00030 LDA ST02EA,Y 0,1 00040 AND #$03 00050 STA DIV 00060 LDA ST1TAB,Y 2 (WE) 00070 ASL 00080 AND #4 00090 TSB DIV 00100 LDA ST3TAB,Y 3 (WP) 00110 AND #8 00120 TSB DIV 00130 LDA PORTA 4 (MOT) 00140 ASL 00150 AND #$10 00160 TSB DIV 00170 LDA PBYTHI,Y 5 (DD) 00180 CMP #$01 00190 BCC .01 00200 .DA #SB5,#DIV 00210 .01 LDA PSEKLO,Y 7 (MD) 00220 CMP #$13 ;>18=MD 00230 LDA PBYTHI,Y ;if not 00240 BEQ .02 ;>128 00250 CLC ;By/Sec 00260 .02 BCC .03 00270 .DA #SB7,#DIV 00280 .03 LDA DIV 00290 STA ST02EA,Y 00300 STA SIOBUF 00310 *-02EB-* 00320 LDA ST02EB,Y (2-6) 00330 AND #$7C 00340 STA DIV 00350 LDA ST3TAB,Y 7 (DC) 00360 AND #$80 00370 TSB DIV 00380 LDA FDCST 0,1 00390 AND #$50 00400 ASL 00410 ASL 00420 ASL 00430 ASL 00440 CMP #2 00450 BCC .04 00460 EOR #6 00470 .04 EOR #3 00480 ORA DIV 00490 STA ST02EB,Y 00500 STA SIOBUF+1 00510 *-02EC-* 00520 LDA #$E0 Timeout 00530 STA ST02EC,Y 00540 STA SIOBUF+2 00550 *-02ED-* 00560 LDA FDCST 00570 STA ST02ED,Y 00580 STA SIOBUF+3 00590 ; 00600 LDA #COMPLT Senden 00610 JSR SIOPUT 00620 LDA #4 00630 STA BUFLEN 00640 STZ BUFLEN+1 00650 JSR SSIOBF 00660 JSR XMIT 00670 ; 00680 LDA ST02EA,Y 00690 AND #$FC 00700 STA ST02EA,Y 00710 ; 00720 LDA ST02EB,Y 00730 AND #$83 00740 ORA #$18 00750 STA DIV 00760 LDA ST3TAB,Y 00770 AND #$40 00780 EOR #$40 00790 TSB DIV 00800 LDA ST3TAB,Y 00810 AND #$10 00820 LSR 00830 LSR 00840 ORA DIV 00850 STA ST02EB,Y 00860 JMP WAITCMD 00870 ------------------------------ 00880 SRDST LDY ACTDRV 00890 LDA ST02EB,Y Reset 00900 ORA #$3C 2,3,4,5 00910 STA DIV 00920 LDA ST2TAB,Y 5 (CM) 00930 AND #$40 00940 LSR 00950 TRB DIV 00960 LDA ST1TAB,Y 5,4,?,2 00970 AND #$34 -> 00980 LSR 2,5,4 00990 LSR 01000 LSR 01010 BCC .01 01020 ORA #8 01030 .01 ASL 01040 EOR #$FF 01050 AND DIV 01060 STA ST02EB,Y 01070 RTS 01080 ------------------------------
01000 * High-Speed SIO-Driver, will 01010 * be relocated by HDI and 01020 * send to computer. 01030 ; 01040 USIOA LDA $0301 ;DUNIT 01050 BNE SIO2 01060 LDX #$08 01070 DLWTBLL STA LWTBL-1,X ;$F614 01080 DEX 01090 BNE DLWTBLL 01100 RTS 01110 SIO2 TAX 01120 REL01 LDA LWTBL-1,X ;$F614 01130 BNE SIO3 01140 LDA #$28 01150 REL02 STA LWTBL-1,X ;$F614 01160 LDY #$07 01170 SIOCL LDA $0302,Y ;DCOMND 01180 PHA 01190 REL03 LDA C3F,Y ;$F60D 01200 STA $0302,Y ;DCOMND 01210 DEY 01220 BPL SIOCL 01230 REL04 JSR SIO3 ;$F450 01240 LDX $0301 ;DUNIT 01250 LDY $0303 ;DSTATS 01260 BMI SIO21 01270 LDA $01 01280 REL05 STA LWTBL-1,X ;$F614 01290 SIO21 LDY #$00 01300 SIO21CL PLA 01310 STA $0302,Y ;DCOMND 01320 INY 01330 CPY #$08 01340 BCC SIO21CL 01350 SIO3 SEI 01360 TXA 01370 ORA #$30 01380 STA $023A ;CDEVIC 01390 LDA $0302 ;DCOMND 01400 STA $023B ;CCOMND 01410 LDA $030A ;DAUX1 01420 STA $023C ;CAUX1 01430 LDA $030B ;DAUX2 01440 STA $023D ;CAUX2 01450 REL06 LDA LWTBL-1,X ;$F614 01460 STA $D204 ;AUDF3 01470 TSX 01480 STX $3F ;FEOF 01490 LDA #$02 01500 STA $37 ;DRETRY 01510 IO11 LDA #$07 01520 STA $36 ;CRETRY 01530 IO12 LDA #$34 01540 STA $D303 01550 LDA #$00 01560 STA $30 ;STATUS 01570 STA $3E ;FTYPE 01580 STA $35 ;BUFEND+1 01590 STA $D206 ;AUDF4 01600 LDA #$3A 01610 STA $32 ;BUFADR 01620 LDA #$02 01630 STA $33 ;BUFADR+1 01640 ASL 01650 STA $34 ;BUFEND 01660 REL07 JSR SEND1 ;$F4DC 01670 LDA $0304 ;DBUFLO 01680 STA $32 ;BUFADR 01690 LDA $0305 ;DBUFHI 01700 STA $33 ;BUFADR+1 01710 LDA $0308 ;DBYTLO 01720 STA $34 ;BUFEND 01730 LDA $0309 ;DBYTHI 01740 STA $35 ;BUFEND+1 01750 LDA $0303 ;DSTATS 01760 BPL IO2 01770 REL08 JSR SEND1 ;$F4DC 01780 IO2 DEC $3E ;FTYPE 01790 REL09 JSR SETTI1 ;$F544 01800 BIT $0303 ;DSTATS 01810 BVC IO3 01820 REL10 JSR GETA1 ;$F521 01830 IO3 LDA #$A0 01840 STA $D207 ;AUDC4 01850 LDA $10 01860 STA $D20E ;IRQEN 01870 REL11 JSR CLRTI1 ;$F576 01880 LDA $30 ;STATUS 01890 BEQ IO4 01900 DEC $37 ;DRETRY 01910 BNE IO11 01920 IO4 TAY 01930 BNE IO5 01940 INY 01950 IO5 STY $0303 ;DSTATS 01960 CLI 01970 RTS 01980 SEND1 LDY #$00 01990 SE1 INY 02000 BNE SE1 02010 LDA #$23 02020 REL12 JSR POKEY ;$F5F7 02030 LDA ($32),Y ;BUFADR 02040 STA $31 ;CHKSUM 02050 STA $D20D ;SEROUT 02060 INY 02070 BNE SE3 02080 SE2 LDA ($32),Y ;BUFADR 02090 REL13 JSR PUTBYTE ;$F5D4 02100 INY 02110 BNE SE3 02120 INC $33 ;BUFADR+1 02130 DEC $35 ;BUFEND+1 02140 LDX #$E0 02150 SEWL INX 02160 BNE SEWL 02170 SE3 CPY $34 ;BUFEND 02180 BNE SE2 02190 LDA $35 ;BUFEND+1 02200 BNE SE2 02210 LDA $31 ;CHKSUM 02220 REL14 JSR PUTBYTE ;$F5D4 02230 SEO1 LDA $D20E ;IRQST 02240 AND #$08 02250 BNE SEO1 02260 LDY #$03 02270 REL15 JSR STOUTX0 ;$F578 02280 LDA #$C0 02290 STA $D20E ;IRQEN 02300 BNE RDQUIT 02310 GETA1 LDY #$00 02320 STY $31 ;CHKSUM 02330 GE1 JSR GETBYTE ;$F5B1 02340 STA ($32),Y ;BUFADR 02350 REL16 JSR ADDSUM ;$F5EF 02360 INY 02370 BNE GE2 02380 INC $33 ;BUFADR+1 02390 DEC $35 ;BUFEND+1 02400 GE2 CPY $34 ;BUFEND 02410 BNE GE1 02420 LDA $35 ;BUFEND+1 02430 BNE GE1 02440 REL17 JSR GETBYTE ;$F5B1 02450 CMP $31 ;CHKSUM 02460 BNE ERR8F 02470 RTS 02480 SETTI1 LDA $0306 ;DTIMLO 02490 ROR 02500 ROR 02510 TAY 02520 AND #$3F 02530 TAX 02540 TYA 02550 ROR 02560 AND #$C0 02570 TAY 02580 REL18 JSR STOUT ;$F57A 02590 RDQUIT LDA #$3C 02600 STA $D303 02610 LDA #$13 02620 REL19 JSR POKEY ;$F5F7 02630 REL20 JSR GETBYTE ;$F5B1 02640 CMP #$41 02650 BEQ CLRTI1 02660 CMP #$43 02670 BEQ CLRTI1 02680 CMP #$45 02690 BEQ ERR90 02700 LDA #$8B 02710 BNE ERR 02720 ERR90 LDA #$90 02730 STA $30 ;STATUS 02740 CLRTI1 LDY #$00 02750 STOUTX0 LDX #$00 02760 STOUT LDA ERRABS ;$F 02770 STA $0226 ;CDTMA1 02780 STOU2 LDA ERRABS+1 ;$F 02790 STA $0227 ;CDTMA1+1 02800 LDA #$01 02810 JMP $E45C ;Setze CDTMV1 02820 ERRABS .DA ERR8A ;$F 02830 IOER80 LDX $3F ;FEOF 02840 TXS 02850 LDA #$80 02860 STA $30 ;STATUS 02870 BNE EABS3 02880 ERR8F LDA #$8F 02890 .HX 2C 02900 ERR8A LDA #$8A ;Timeout 02910 ERR STA $30 ;STATUS 02920 LDX $3F ;FEOF 02930 TXS 02940 LDA $3E ;FTYPE 02950 BMI ERRA 02960 DEC $36 ;CRETRY 02970 BEQ ERRA 02980 REL21 JMP IO12 ;$F47A 02990 ERRA LDA #$28 03000 STA $D204 ;AUDF3 03010 EABS3 JMP IO3 ;$F4C1 03020 GETBYTE LDA $D20E ;IRQST 03030 BPL IOER80 03040 AND #$20 03050 BNE GETBYTE 03060 LDA #$DF 03070 STA $D20E ;IRQEN 03080 LDA #$E0 03090 STA $D20E ;IRQEN 03100 LDA $D20F ;SKSTAT 03110 STA $D20A ;SKRES 03120 BPL ERR8A 03130 AND #$20 03140 BEQ ERR8A 03150 LDA $D20D ;SERIN 03160 RTS 03170 PUTBYTE TAX 03180 PUTA1 LDA $D20E ;IRQST 03190 AND #$10 03200 BNE PUTA1 03210 LDA #$EF 03220 STA $D20E ;IRQEN 03230 LDA #$D0 03240 STA $D20E ;IRQEN 03250 TXA 03260 STA $D20D ;SEROUT 03270 LDX $D20E ;IRQST 03280 BPL IOER80 03290 ADDSUM CLC 03300 ADC $31 ;CHKSUM 03310 ADC #$00 03320 STA $31 ;CHKSUM 03330 RTS 03340 POKEY STA $D20F ;SKCTL 03350 STA $D20A ;SKRES 03360 LDA #$28 03370 STA $D208 ;AUDCTL 03380 LDA #$A8 03390 STA $D207 ;AUDC4 03400 LDA #$F8 03410 STA $D20E ;IRQEN 03420 RTS 03430 C3F .HX 3F40 03440 .DA $0001 03450 .DA $0001 03460 .DA $0001 03470 LWTBL .BL 8,0 03480 USIOE 03490 ABSTBL .DA DLWTBLL+1,REL01+1,REL02+1,REL03+1,REL04+1,REL05+1,REL06+1 03500 .DA REL07+1,REL08+1,REL09+1,REL10+1,REL11+1,REL12+1,REL13+1 03510 .DA REL14+1,REL15+1,GE1+1,REL16+1,REL17+1,REL18+1,REL19+1 03520 .DA REL20+1,STOUT+1,STOU2+1,ERRABS,REL21+1,EABS3+1