1
0
mirror of https://github.com/option8/OUP-M.git synced 2024-07-24 05:28:54 +00:00
OUP-M/DSKUTY.s
2018-10-12 16:03:11 -04:00

1172 lines
25 KiB
ArmAsm

5 ; DISKRTTE UTILITY
10 *=$0200
30 JMP DIKULT
40 BDOS =$05
50 HLREG=$70
60 HLREG1=$72
70 FLAG=$74
80 TEMP=$75
90 TKNDER=$76 ;DESIRED TRACK
100 TRKCRN=$77 ;HEAD POSITION
110 TRKCR1=$78 ;HEAD RESERVATION
120 TKTMAX=$79 ;MAX TIMES FOR MATCH TRAC#
130 ERORFG=$7A ;ERROR FLAG
140 IOBOFA=$7B ;FOR I/O BUF ADDRESS
1S0 PAGNUM=$7D ;PAGE COUNTER
160 PAGENM=$7E ;DESIRED PAGE NO.
170 ERTMAX=$7F ;MAX R/W TIMES
180 NOCMP1=$80 ;CHECK PRAMETER
190 NOCMP2=$82
200 SATTRK=$83 ;STARTING TRACK NO.
210 ENDTRK=$84 ;END TRACK NO.
220 SORCDK=$85 ;SOURCE DISK NO.
230 DESTDK=$86 ;REST. DISK NO.
240 LCTREG=$87 ;ADDRESS FOR DESIRED MOVEING
250 HEADST=$89 ;LOADER VECTOR
260 STPTST=$8B ;STACK POINTER RESERVATION
270 STATF0=$8C ;STATE FLAGE
280 FRYCST=$E41B
290 DVACIA=$C010 ;DISK PORT
300 DVPIA1=$C000 ;DISK CONTROL
310 DVPIA2=$C002 ;DISK CONTROL
320 IOBUF=$B000 ;I/O BUF
330 DIKCRT .BYTE $00 ;CURRENT DISK
340 DKCONT .BYTE $40,$00
350 INBUF .BYTE $05 ;INPUT BUFFER
360 INBUF1*=*+5
370 DPLBF1 .BYTE '-- DISKETTE UTILITY --',$0D,$0A
380 .BYTE $00,$04,'SELECT ONE',$0D
390 .BYTE $0A,$0D,$0A,'1) COPY ALL TRACKS'
400 .BYTE $0D,$0A,$0D,$0A,'2) COPY OPTION '
410 .BYTE 'TRACKS',$0D,$0A,$0D,$0A,'3) IN'
420 .BYTE 'ITIALIZE OPTION TRACKS (TRACK'
430 .BYTE ' 0 IS NOT ALLOWED)'
440 .BYTE $0D,$0AP$0D:$0A,'4) READ '
450 .BYTE 'OPTION TRACK',$0D,$0A,$0D,$0A
460 .BYTE '5) WRITE OPTION TRACK',$0D,$0A
470 .BYTE $0D,$0A,'6) QUIT TO OUP/M',$0D
480 .BYTE $0A,$0D,$0A,'-- TRACK NUMBER:'
490 .BYTE ' A 2-DIGIT DECIMAL VALUE',$0D
500 .BYTE $0A,$0D,$0A,'-- ADDRESS & '
510 .BYTE 'VECTOR: A 4-DIGIT HEXIDECIMAL '
520 .BYTE 'VALUE',$0D,$0A,$0D,$0A,'-- '
530 .BYTE 'PAGE NUMBER: A SINGLE HEXI'
540 .BYTE 'DECIMAL VALUE',$0D,$0A,$0D,$0A
550 .BYTE '?$'
560 DPLBF2 .BYTE 'FROM WHICH DISK (A/B) ?$'
570 DPLBF3 .BYTE 'TO WHICH DISK (A/B) ?$'
580 DPLBF4 .BYTE 'FROM WHICH TRACK ?$'
590 DPLBFS .BYTE 'TO WHICH TRACK ?$'
600 DPLBF6 .BYTE '-- DISKETTE COPIER --',$0D,$0A
610 .BYTE $0D,$0A,$0D,$0A,'THIS ROUTINE '
620 .BYTE 'COPIES ALL TRACKS FROM A TO B'
630 .BYTE $0D,$0A,$0D,$0A,'BE SURE PUT'
640 .BITE 'MASTER DISK INTO A & YOUR DISK'
650 .BYTE $0D,$0A,$0D,$0A,'INTO B$'
660 DPLBF7 .BYTE '-- DISKETTE OPTION COPIER --'
670 .BYTE $0D,$0A,$0D,$0A,$0D,$0A,'THIS '
680 .BYTE 'ROUTINE OPTIONLY COPIES DESIRE'
690 .BYTE ' TRACKS',$0D,$0A,$0D,$0A,'FROM'
700 .BYTE ' SOURCE DISK TO DESTINATION '
710 .BYTE 'DISK$'
720 DPLBF8 .BYTE '-- DISKETTE INITIALIZER --'
730 .BYTE $0D,$0A,$0D,$0A,$0D,$0A,'THIS '
740 .BYTE 'ROUTINE OPTIONLY INITIALIZES '
750 .BYTE 'TRACK HEADER ',$0D,$0A,$0D,$0A
760 .BYTE 'OF DESIRED DISK EXPECT TRACK '
770 .BYTE '0 $'
780 DPLBF9 .BYTE '-- DISKETTE READER --',$00,$0A
790 .BYTE $0D,$0A,$0A,$0A,'THIS ROUTINE '
800 .BYTE 'READS ANY TRACK FROM DESIRED '
810 .BYTE $0D,$0A,$0D,$0A,'DISK TO THE '
820 .BYTE 'LOCATION YOU WANT$'
830 DPLBFA .BYTE '-- DISKETTE WRITER --',$0D,$0A
840 .BYTE $0D,$0A,$0D,$0A,'THIS ROUTINE '
850 .BYTE 'WRITES ANY TRACK FROM THE LO-'
860 .BYTE $0D,$0A,$0D,$0A,'CATION TO THE '
870 .BYTE 'DESIRED DISK$'
880 DPLBFB .BYTE 'TO WHICH LOCATION ?$'
890 DPLBFC .BYTE 'FROM WHICH LOCATION ?$'
900 DPLBFD .BYTE 'GIVE THE LOADER VECTOR ?$ '
910 DPLBFE .BYTE 'HOW MANY PAGES ?$'
920 DPLBFF .BYTE 'ALL DONE I ANOTHER (Y/N) ?$'
930 DPLBFG .BYTE 'AREYOUSURE (Y/N) ?$'
940 DPLBFH .BYTE 'ERROR || INDEX HOLE FOUND'
950 .BYTE ' WHILE WRITING$'
960 DPLBFI .BYTE 'ERROR || INDEX HOLE FOUND '
970 .BYTE 'WHILE READING$'
980 DPLBFJ .BYTE 'ERROR || DRIVE NOT REDAY$'
990 DPLBFK .BYTE 'ERROR || TRACK NOT MATCH$'
1000 DPLBFL .BYTE 'ERROR || DISK WRITING '
1010 .BYTE 'PROTECTION$'
1020 DPLBFM .BYTE 'ERROR || BUFFER X DISK NOT'
1030 .BYTE ' MATCH$'
1040 DPLBFN .BYTE 'ERROR || PARITY ERROR$'
1050 DPLBFO .BYTE 'ERROR || NO SUCH COMMAND$'
1060 DPLBFP .BYTE 'TRY AGAIN (Y/N) ?$'
1070 DPLTAB .WORD DPLBF1,DPLBF2,DPLBF3,DPLBF4
1080 .WORD DPLBF5,DPLBF6,DPLBF7,DPLBF8
1090 .WORD DPLBF9,DPLBFA,DPLBFB,DPLBFC
1100 .WORD DPLBFD,DPLBFE,DPLBFF,DPLBFO
1110 .WORD DPLBFH,DPLBFI,DPLBFJ,DPLBFK
1120 .WORD DPLBFL,DPLBFM,DPLBEN,DPLBFO
1130 .WORD DPLBFP
1140 ;
1150 DELAYB=* ;;DELAY ROUTINE
1160 ;
1170 INC DELYMR
1180 INC DELYMR
1190 INC DELYMR
1200 INC DELYMR
1210 RTS
1220 DELYMR*=*+1
1230 ;
1240 DELYMS=* ;DELAY 1 MS
1250 ;
1260 JSR DELAYB
1270 DEY
1280 BNE DELYMS
1290 RTS
1300 ;
1310 LYMS1=* ;DELAY (X) MS
1320 ;
1330 LDX #$0C
1340 D$YMS1=*
1350 LDY FRYCST
1360 JSR DELYMS
1370 DEX
1380 BNE D$YMS1
1390 DL$MS1=*
1400 RTS
1410 ;
1420 DELYUS=* ;DELAY (X)*100 US
1430 ;
1440 LDA FRYCST
1450 D$LYUS=*
1460 BIT $00
1470 SEC
1480 SBC #$05
1490 BCS DELYUS
1500 DEX
1510 BNE DELYUS
1520 RTS
1530 ;
1540 ;
1550 HOMEHD=* ;HOME HEAD TO ZERO
1560 ;
1570 JSR STPIN
1580 JSR DLYMS1
1590 STY TRKCRN
1600 STY TKNDER
1610 H$MEHD=*
1620 LDA #$02
1630 BIT DVPIA1
1640 BEQ DLYM31
1650 JSR STPOUT
1660 BECK H$MEHD
1670 ;
1680 ADCOF1=*
1690 ;
1700 CLC
1710 ADC HLREG
1720 STA HLREG
1730 LDA TEMP
1740 ADC HLREG+1
1750 STA HLREG+1
1760 RTS
1770 ;
1780 DIKSEL=*
1790 ;
1800 LDX DIKCRT
1810 LDA DKCONT,X
1820 STA DVPIA1
1830 LDA #$FF
1840 STA DVPIA2
1850 DUSEL=*
1860 LDA #$10
1870 CPX #401
1880 BEQ DI$SEL
1890 LDA #$01
1900 DI$SEL=*
1910 BIT DVPIA1
1920 RTS
1930 ;
1940 ;
1950 SEKIHL=* ;SEEK INDEX HOLE
1960 ;
1970 LDA DVPIA1
1980 BMI SEKIHL
1990 S$KIHL=*
2000 LDA DVPIA1
2010 BPL SEKIHL
2020 RTS
2030 ;
2040 STPOUT=* ;;STEP OUT ONE TRACK
2050 ;
2060 LDA DVPIA2
2070 ORA #$04
2080 BNE STEP
2090 STPIN=* ;STEP IN ONE TRACK
2100 LDA #$FB
2110 AND DVPIA2
2120 STEP=*
2130 STA DVPIA2
2140 JSR DL$MS1
2150 AND #$F7
2160 STA DVPIA2
2170 JSR DL$MS1
2180 JSR DL$MS1
2190 ORA #$08
2200 STA DVPIA2
2210 JSR DL$MS1
2220 LDX #$08
2230 JMP D$YMS1
2240 ;
2250 SIHSDK=* ;SEEK HOLE ,SET ACIA
2260 ;
2270 JSR SEKIHL
2280 LDA #$03
2290 STA DVACIA
2300 LDA #$58
2310 STA DVACIA
2320 RTS
2330 ;
2340 LDHEAD=* ;LOAD HEAD
2350 ;
2360 LDA #$7F
2370 AND DVPIA2
2380 L$HEAD=*
2390 STA DVPIA2
2400 LDX #$28
2410 JMP D$YMS1
2420 ;
2430 UNLDHD=* ;UNLOAD HEAD
2440 LDA #$80
2450 ORA DVPIA2
2460 BNE L$HEAD
2470 ;
2480 WRIDIK=* ;WRITE A BYTE TO DISK
2490 ;
2500 LDA DVPIA1
2510 BPL WRTDIK
2520 LDA DVACIA
2530 LSR A
2540 LSR A
2550 BCC WRTDIK
2560 STX DVACIA+1
2570 RTS
2580 W$TDIK=*
2590 LDA #$11
2600 JMP ERROR
2610 RESV25*=*4-5
2620 ;
2630 REDDIK=* ;READ ABYTE FROM DISK
2640 ;
2650 LDA DVPIA1
2660 BPL R$DDIK
2670 LDA DVACIA
2680 LSR A
2690 BCC REDDIK
2700 LDA DVACIA+1
2710 RTS
2720 R$DDIK=*
2730 LDA #$12
2740 JMP ERROR
2750 ;
2760 TRKPSA=* ;PUT HEAD TO DESIRED TRACK
2770 ;
2780 LDX DIKCRT
2790 JSR D$KSEL
2800 BEQ TRKPSA
2810 LDA #$13
2820 JMP ERROR
2830 TRKPSA=*
2840 LDA TKNDER
2850 CMP TRKCRN
2860 BEQ TRKPSA
2870 BCS TRKPSA
2880 JSR STPOUT
2890 LDA #$99
2900 BCC TRKP$A
2910 TRK$SA=*
2920 JSR STPIN
2930 TXA
2940 TRKP$A=*
2950 SED
2960 ADC TRKCRN
2970 STA TRKCRN
2980 CLD
2990 JMP TRKPSA
3000 TR$PSA=*
3010 CMP #$43
3020 LDA DVPIA2
3030 AND #$BF
3040 LDY #$00
3050 NOP
3060 BCS TRKPS$
3070 LDA #$40
3080 ORA DVPIA2
3090 TRKPS$=*
3100 STA DVPIA2
3110 RTS
3120 ;
3130 TRKPSH=*
3140 ;
3150 JSR TRKPSA
3160 LDA #IOBUF
3170 STA IOBUFA
3180 LDA #IOBUF/256
3190 STA IOBUFA+1
3200 JMP LDHEAD
3210 ;
3220 TKNMTH=* ;MATCH TRACK*
3230 ;
3240 LDA #$05
3250 STA TKTMAX
3260 TKNMSH=*
3270 JSR SIHSDK
3280 TSNMTH=*
3290 JSR REDDIK
3300 TK$MTH=*
3310 LDX TKNDER ;IF TRACK 0,
3320 BEQ TKNMTI ;NO CHECKING
3330 CMP #$43
3340 BNE T$NMTH
3350 TKNMT1=*
3360 STA HEADST+1 ;STORE TRACK 0 LDVECTOR
3370 JSR REDDIK
3380 LDX TKNDER
3390 BEQ TKNMT2
3400 CMP #$57
3410 BNE TK$MTH
3420 TKNMT2=*
3430 STA HEADST
3440 JSR REDDIN
3450 LDX TKNDER
3460 BEQ TKNMT3
3470 CMP TKNDER
3480 BNE TKN$TH
3490 TKNMT3=*
3500 STA PAGENM ;STORE TRACK 0 PGNO.
3510 RTS
3520 TKN$TH=*
3530 DEC TKTMAX
3540 BEQ TKNMTS
3550 LDA TKNDER
3560 PHA
3570 JSR HOMEHD
3580 PLA
3590 STA TKNDER
3600 JSR TSKPSA
3610 JMP TKNM$H
3620 TKNMT$=*
3630 LDA #$14
3640 JMP ERROR
3650 RESV26*=*+5
3660 ;
3670 WRTTKS=* ;WRITE A TRACK TO DISK
3680 ;
3690 LDA #$20
3700 BIT DVPIA1
3710 BNE W$TTKS
3720 LDA #$15
3730 JMP ERROR
3740 WSTIKS=*
3750 LDX TKNDER
3760 BNE WRTT$S ;CHECK TRACK 0
3770 JMP WRTTKO ;IF IS.TO WRITE TRACK 0
3780 WRIT$S=*
3790 BIT FLAG ;CHECK INIT
3800 BPL WRT$KS ;GO WRITING NON 0 TK
3810 JSR SIHSDK ;SEARCH HOLE,SET ACIA
3820 LDA #$FC ;ENABLE WRITE & ERASE
3830 AND DVPIA2
3840 STA DVPIA2
3850 LDX #$0A ;DELAY 1MS
3860 JSR DELYUS
3870 LDX #$43 ;WT REGUIAR HEADER
3880 JSR WRTDIK
3890 LDX #$57
3900 JSR WRTDIK
3910 LDX TKNDER
3920 JSR WRTDIK
3930 JMP WRTT$$
3940 WRT$KS=* ;WRITING NON 0 TRACK
3950 JSR TKNMTH ;MATCH TRACK NO.
3960 LDX #$04 ;DELAY 0.4 MS
3970 JSR DELYUS
3980 LDA #$FE ;ENABLE WRTITING
3990 AND DVPIA2
4000 STA DVPIA2
4010 LDX $102 ;DELAY 0.2 MS
4020 JSR DELYUS
4030 LDA #$FD ;ENABLE ERASING
4040 AND DVPIA2
4050 STA DVPIA2
4060 LDX #$08 ;DELAY 0.8 MS
4070 JSR DELYUS
4080 LDX #$76 ;WT START FLSG
4090 JSR WRTDIK
4100 LDX #$0E ;SET REGULAR PGNO.
4110 STX PAGNUB
4120 WRT$$$=*
4130 LDY #$00
4140 WR$TKS=*
4150 LDA (IOBUFA),Y
4160 TAX
4170 JSR WRTDIK
4180 INY
4190 BNE WR$TKS
4200 INC IOBUFA#l
4210 DEC PAGNUB
4220 BNE WR$TKS
4230 LDX #$47
4240 JSR WRTDIK
4250 LDX #$53
4260 JSR WRTDIK
4270 JMP WRTTK$
4280 WRTT$$=*
4290 LDA DVPIA1 ;WAIT,TILL NEXT HOLE
4300 BMI WRTT$$
4310 WRITK$=*
4320 LDA DVPIA2
4330 ORA #$01
4340 STA DVPIA2
4350 LDX #$05
4360 JSR DELYUS
4370 LDA DVPIA2
4380 ORA #$02
4390 STA DVPIA2
4400 LDA #IOBUF/256
4410 STA IOBUFA+1
4420 RTS
4430 WRTIKO=* ;WRITE TRACK 0
4440 LDA DVPIA1
4450 BPL WR-VTKO
4460 W$TTKO=*
4470 LDA DVPIA1
4480 BMI W$TTKO
4490 LDA #$FC ;ENABLING WRITE & ERASE
4500 AND DVPIA2
4510 STA DVPIA2
4520 WR$TKO=*
4530 LDA DVPIA1
4540 BPL WR$TKO
4550 LDX f$0A ;DELAY 1 MS
4560 JSR DELYUS
4570 LDX HEADST+1 ;WT TRACK 0 VECTOR
4580 JSR WRTDIK
4590 LDX HEADST
4600 JSR WRTDIK
4610 LDX PAGENM ;SET DESIRED PGNO.
4620 STX PAGNUB
4630 JSR WRTDIK ;WRITE IT
4640 JMP WRT$$$ ;GO WRITING REST
4650 ;
4660 REDTKS=* ;READ A TRACK
4670 ;
4680 ;
4690 JSR TKNMTH
4700 LDX #$0E
4710 LDA TKNDER
4720 BNE R$DTKS ;IF NOT 0 SET PGNO.
4730 LDX PAGENM
4740 JMP REDT$S ;NOT CHECK START FLAG
4750 R$DKS=*
4760 JSR REDDIK
4770 CMP #$76
4780 BNE R$DTKS
4790 REDT$S=*
4800 LDY #$00
4810 STY ERORFG
4820 LDA #$01
4830 RE$TKS=*
4840 BIT DVACIA
4850 BEQ RE$TKS
4860 LDA DVACIA+1
4870 BVC RED$KS
4880 LDA #$80
4890 STA ERORFG
4900 R$$TKS =*
4910 CLC
4920 RTS
4930 RED$KS=*
4940 BIT STATFG
4950 BPL REDTK$
4960 CMP (IOBUFA),Y
4970 BEQ REDTK$
4980 LDA #$40
4990 STA ERORFG
5000 BNE R$$TKS
5010 REDTK$=*
5020 STA (IOBUFA),Y
5030 LDA #$01
5040 INY
5050 BNE RE$TKS
5060 INC IOBUFA+1
5070 DEX
5080 BNE RESINS
5090 LDA #IOBUF/256
5100 STA IOBUFA+1
5110 SEC
5120 RTS
5130 ;
5140 WRTTRK=* ;WRITE A TRACK UTILL NO ERROR
5150 ;
5160 LDA #$A0
5170 STA STATFG
5180 JSR TRKPSH
5190 LDA #$04
5200 STA ERTMAX+1
5210 W$TTRK=*
5220 JSR WRTTKS
5222 BIT FLAG
5224 BPL W$$TRK
5226 RTS
5228 W$$TRK=*
5230 JMP RE$TRK
5240 ;
5250 REDTRK=* ;READ A TRACK UNTIL NO ERROR
5260 ;
5270 LDA #$40
5280 STA STATFG
5290 JSR TRKPSH
5300 LDA #$04
5310 STA ERTMAX
5320 RE$TRK=*
5330 LDA #$06
5340 STA ERTMAX+2
5350 REDT$K=*
5360 JSR REDTKS
5370 BCC REREAD
5380 BIT STATFG
5390 BMI R$DTRK
5400 LDA #$80
5410 ORA STATFG
5420 STA STATFG
5430 BNE RE$TRK
5440 R$DTRK=*
5450 JMP UNLDHD
5470 REREAD=*
5480 LDA #10BUF/256
5490 STA IOBUFA+1
5500 DEC ERTMAX+2
5510 BNE REDT$K
5520 BIT ERORFG
5530 BMI REREAD
5540 BIT STATFG
5550 BVS R$READ
5560 DEC ERTMAX+1
5570 BNE W$TTRK
5580 REREAD=*
5590 LDA ERORFG
5600 JMP ERROR
5610 REREAD=*
5620 DEC ERTMAX
5630 BEQ R$READ
5640 JSR STPOUT
5650 JSR DLYMS1
5660 JSR STPIN
5670 JSR DLYMS1
5680 BEQ RE$TRK
5690 RESV27*=*+5
5700 ;
5710 LFTSHT=*
5720 ;
5730 ASL A
5740 ASL A
5750 ASL A
5760 ASL A
5770 RTS
5780 ;
5790 RITSHT=*
5800 ;
5810 LSR A
5820 LSR A
5830 LSR A
5840 LSR A
5850 RTS
5860 ;
5870 LUCVSG=* ;COVERT A CHAR LOWER TO UPPER
5880 ;
5890 CMP #$61
5900 BCC L$CVSG
5910 CMP #$7C
5920 BCS L$CVSG
5930 AND #$5F
5940 L$CVSO=*
5950 RTS
5960 ;
5970 LUCVBF=* ;COVERT WHOLE CHARS TO UPPER
5980 ;
5990 LDY #$01
6000 LDA INBUF,Y
6010 TAX
6020 L$CVBF=*
6030 INY
6040 LDA INBUF,Y
6050 JSR LUCVSG ;COVERT CHAR TO UPPER
6060 STA INBUF,Y
6070 DEX
6080 BNE LUCVBF
6090 RTS
6100 ;
6110 CSLINP=* ;CONSOLE INPUT
6120 ;
6130 LDA #INBUF
6140 LDY #INBUF/256
6150 LDX #$06
6160 JSR BDOS
6170 JMP LUCVBF ;COVERT LO TO UP
6180 ;
6190 CSLIN1=* ;INPUT CONSOLE,GET A NO.
6200 ;
6210 JSR CSLINP
6220 LDY #$02
6230 LDA INBUF,Y
6240 RTS
6250 ;
6260 DIGCHK=* ;CKECK DIGIT WITHIN THE RANGE
6270 ;
6280 STX NOCMP1
6290 STY NOCMP2
6300 SEC
6310 SRC NOCMP2
6320 BCC D$GCHK
6330 CMP NOCMP1
6340 BCS D$GCHK
6350 RTS
6360 D$GCHK=*
6370 JMP ERROR1
6380 ;
6390 CRLF=*
6400 ;
6410 LDA #$0D
6420 LDX #$02
6430 JSR BDOS
6440 LDA #$0A
6450 LDX #$02
6460 JMP BDOS
6470 ;
6480 PROMPT=* ;GIVE DISPLAYING
6490 ;
6500 SEC
6510 SBC #$01
6520 PHA
6525 JSR CRLF
6530 JSR CRLF
6540 PLA
6550 ASL A ;(A)*2
6560 LDX #DPLTAB ;GET DISPLAY TABLE
6570 STX HLREG ;ADDRESS
6580 LDX IDPLTAB/256
6590 SIX HLREG+1
6600 LDY #$00 ;ADD OFFSET
6610 STY TEMP
6620 JSR ADC0F1
6630 LDA (HLREG),Y ;GET DESIRED DISPLAY
6640 PHA ;ADDRESS
6650 INY
6660 LDA (HLREG),Y
6670 TAY
6680 PLA
6690 LDX #$05 ;DISPLAY THEM
6700 JMP BDOS
6710 ;
6720 CMNOHD=* ;HANDLE COMMAND NO.
6730 ;
6740 JSR PROMPT ;PROMPT FOR COMMAND NO.
6750 JSR CSLIN1 ;GET IT
6760 LDX #$07 ;CHECK ITS RANGE
6770 LDY #$31
6780 JMP DIGCHK
6790;
6800 DKNOHD=* ;DISK NO. HANDLE
6810;
6820 JSR PROMPT ;PROMPT FOR DISK NO.
6830 JSR CSLIN1 ;GET IT
6840 LDX #$02
6850 LDY #$41 ;CHECK IT
6860 JMP DIGCHK
6870 ;
6880 DIGCH1=*
6890 ;
6900 LDX #1,0A
6910 LDY #$30
6920 JMP DIGCHK
6930 ;
6940 TRNOHD=* ;TRACK NO. HANDLE
6950 ;
6960 JSR PROMPT ;PROMPT FOR TRACK NO.
6970 JSR CSLINP ;GET IT
6980 LDY #$02
6990 LDA INBUF,Y ;GET FIRST DIGIT
7000 JSR DIGCH1 ;CHECK IT
7010 JSR LFTSHT ;LEFT SHIFT FOUR BITS
7020 STA TEMP
7030 LDY #$03 ;GET NEXT DIGIT
7040 LDA INBUFDY
7050 JSR DIGCH1
7060 ORA TEMP ;FORM TRACK NO.
7070 CMP #$77 ;CHECK IT
7080 BCS T$NOHD
7090 RTS
7100 T$NOHD=*
7110 JMP ERRORI
7120 ;
7130 TKNOHD=* ;START AND END TRACK NOHANDL
7140 ;
7150 LDA #$04 ;START NO. HANDLE
7160 JSR TRNOHD
7170 STA SATTRK
7180 LDA #$05 ;END NO. HANDLE
7190 JSR TRNOHD
7200 STA ENDTRK
7210 CMP SATTRK
7220 BCC T$NOHD
7230 RTS
7240 T$NOHD=*
7250 JMP ERROR1
7260 ;
7270 DIGCH2=* ;CHECK DIGIT '0-9' & 'A-F'
7280 ;
7290 SEC
7300 SBC #$30 ;CHECK '0-9'
7310 BCC D$GCH2
7320 CMP #$0A
7330 BCC DI$CH2
7340 SBC #$11 ;CHECK 'A-F'
7350 BCC D$GCH2
7360 CMP #$06
7370 BCS D$GCH2
7380 ADC #$0A
7390 DI$CH2=*
7400 RTS
7410 D$GCH2=*
7420 JMP ERROR1
7430 ;
7440 ADNOCK=* ;CHECK ADDRESS BYTE
7450 ;
7460 LDA INBUF,Y ;GET FIRST DIGIT
7470 JSR DIGCH2
7480 JSR LFTSHT ;LEFT SHIFT FOUR BITS
7490 STA TEMP
7500 INY
7510 LDA INBUF,Y ;GET NEXT DIGIT
7520 JSR DIGCH2 ;CHECK IT
7530 ORA TEMP ;FORM A BYTE
7540 RTS
7550 ;
7560 ADNOH1=* ;ADDRESS NO. HANDLE
7570 ;
7580 JSR PROMPT ;PROMPT FOR ADDRESSS
7590 JSR CSLINP ;GET THEM
7592 LDY #$01 ;CHECK NUMBERS
7594 LDA INBUF,Y
7596 CMP #$04
7598 BEQ A$NOH1
7600 JMP ERRORI
7602 A$NOH1=*
7604 INY ;HANDLE HIGH BYTE
7610 JSR ADNOCK ;CHECK & CONVERT IT
7620 PHA
7630 INY
7640 JSR ADNOCK ;HANDLE LOWER BYTE
7650 TAX
7660 PLA
7670 RTS
7680 ;
7690 ADNOHD=*
7700 ;
7710 JSR ADNOH1
7720 STA LCTREG+1
7730 STX LCTREG
7740 RTS
7750 ;
7760 PGNOHD=* ;PAGE NO. HANDLE
7770 ;
7780 JSR PROMPT ;PROMPT FOR PAGE NO.
7790 JSR CSLINP ;GET IT
7800 LDY #$01 ;CKECK IT
7810 LDA INBUF,Y
7820 CMP #$02
7830 BCS P$NOHD
7840 INY
7850 LDA INBUF,Y
7860 JSR DIGCH2
7870 CMP #$0F ;F PAGE IS NOT ALLOWED
7880 BEQ P$NOHD
7882 CMP 4800 ;0 PAGE IS NOT ALLOWED
7884 BEQ P$NOHD
7890 STA PAGENM
7900 RTS
7910 P$NOHD=*
7920 JMP ERROR1
7930 ;
7940 INCTRN=* ;INCREMENT TRACK NO.
7950 ; BY DECIMAL MOOD
7960 SED
7970 CLC
7980 LDA #$01
7990 ADC TKNDER
8000 STA TKNDER
8010 CLD
8020 RTS
8030 ;
8040 SLSODK=* ;SELECT SOURCE DISK
8050 ;
8060 LDA SORCDK
8070 STA DIKCRT
8080 JMP DIKSEL
8090 ;
8100 SLDNDK=* ;SELECT PEST. DISK
8110 ;
8120 LDA DESTDK
8130 STA DIKCRT
8140 JMP DIKSEL
8150 ;
8160 DIGOUT=* ;DIGIT OUTPUT
8170 ;
8180 CLC
8190 ADC #$30
8200 LDX #$02
8210 JMP BDOS
8220 ;
8230 DPTKNO=* ;DISPLAY TRACK NO.
8240 ;
8250 JSR CRLF
8260 LDA TKNDER ;HIGHER BYTE OUTPUT
8270 JSR RITSHT
8280 JSR DIGOUT
8290 LDA #$0F ;LOWER BYTE OUTPUT
8300 AND TKNDER
8310 JMP DIGOUT
8320 ;
8330 SURERT=*
8340 ;
8350 LDA #$10 ;PROMPT 'ARE YOU SURE'
8360 JSR PROMPT
8370 NOP
8380 NOP
8390 JSR CSLIN1 ;GET THE ANSWER
8400 CMP #'Y
8410 BECK S$RERT
8420 JMP D$KULT
8430 S$RERT=*
8440 RTS
8450 ;
8460 NTRDER=*
8470 ;
8480 LDA #$13
8490 BNE E$ROR ;SHOW 'DISK NO READY'
8500 ERROR1=*
8510 ;
8520 LDA #$18
8530 BNE E$ROR ;SHOW 'COMMAND ERROR'
8540 ;
8550 ERROR=*
8560 ;
8570 STA TEMP
8580 BIT TEMP
8590 BMI ERROR
8600 BVC E$ROR
8610 LDA #$16
8620 BNE E$ROR
8630 ER$0R=*
8640 LDA #$17
8650 E$ROR=*
8660 JSR PROMPT
8665 JSR UNLDHD
8670 JSR CRLF
8680 LDA #$19 ;PROMPT FOR 'TRY AGAIN'
8690 JSR PROMPT
8700 JMP EN$
8710 ;
8720 OPCPY1=* ;MAIN COPY ROUTINE
8730 ;
8740 JSR SURERT
8750 JSR SLSODK ;SELECT SOURCE DISK
8760 BNE 0$CPY1 ;NOT READG,ERROR
8770 JSR HOMEHD
8780 JSR SLDNDK ;SELECT DEST. DISK
8790 BEQ OPCPY$
8800 0$CPY1=*
8810 JMP NTRDER
8820 OPCPY$=*
8830 JSR HOMEHD
8840 LDA TRKCRN
8850 STA TRKCR1 ;RESERVE DEST. HEAD
8860 LDA SATTRK ;SET START TRACK
8865 STA TKNDER
8870 OP$PY1=*
8880 JSR SLSODK ;SELECT SOURCE DISK
8890 JSR DPTKNO ;DISPLAY TRACK NO.
8900 JSR REDTRK ;READ TRACK TO I/O BUF
8910 LDA TRKCR1 ;RECOVE DEST. HEAD
8920 STA TRKCRN
8930 JSR SLDNDK ;SELECT DEST. DISK
8931 LDX TKNDER
8932 8E0 OPCP$1 ;IF TRACK 0,NO INIT
8933 LDX #$80 ;INIT HEADER
8934 SIX FLAG
8935 JSR WRTTRK
8936 LDX #$00 ;WRITE A TRACK FROM I/O
8937 STX FLAG
8938 OPCP$1=*
8940 JSR WRTTRK
8950 LDA TRKCRN ;RESERVE DEST. HEAD
8960 STA TRKCR1
8970 LDA TKNDER ;ALL DONE ?
8980 CMP ENDTRK
8990 BEQ OPC$Y1
9000 JSR INCTRN ;;INCREAMENT TRACK NO,
9010 BNE OP$PY1
9020 OPC$Y1=*
9030 RTS
9040 ;
9050 ; DISKETTE COPIER
9060 ; ***************
9070 ;
9080 ALCOPY=* ;COPY DISK A TO B
9090 ;
9100 LDA #$06
9110 JSR PROMPT ;PROMPT COPIER
9120 LDA #$00
9130 STA SORCDK ;SET SOURCE DISK TO A
9140 STA SATTRK ;SET START TRACK TO 0
9150 LDA #$01 ;SET DEBT. DISK TO B
9160 STA DESTDK
9170 LDA #$76 ;SET END TRACK TO 76
9180 STA ENDTRK
9190 JSR OPCPY1 ;GO COPYING
9200 JMP END
9210 ;
9220 ; DISKETTE OPTION COPIER
9230 ; **********************
9240 ;
9250 OPCOPY=* ;COPY OPTION TRACK ROUTNE
9260 ;
9270 LDA#$07 ;PROMPT OPTION COPIER
9280 JSR PROMPT
9290 LDA #$02
9300 JSR DKNOHD ;PROMPT FOR SOURCE NO.
9310 STA SORCDK ;AND HANDLE IT
9320 LDA #$03 ;PROMPT FOR DEST. NO.
9330 JSR DKNOHD ;AND HANDLE IT
9340 STA DESTDK
9350 JSR TKNOHD ;PROMPT FOR START AND
9360 ;END TRACK,HANDLE THEM
9370 JSR OPCPY1 ;GO COPYING
9380 JMP END
9390 ;
9400 INHDRT=* ;MAIN INIT ROUTINE
9410 ;
9420 LDA SATTRK ;SET START TRACK
9430 STA TKNDER
9440 LDA #$80 ;SET INIT FLAG
9450 STA FLAG
9460 I$HDRT=*
9470 JSR DPTKNO ;DISPLAY TRACK NO.
9480 JSR WRTTRK ;INIT ONE TRACK
9490 LDA TKNDER
9500 CMP ENDTRK ;ALL DONE ?
9510 BEQ IN$DRT
9520 JSR INCTRN ;IF NOT,DO NEXT
9530 BNE I$HDRT
9540 IN$DRT=*
9545 JSR UNLDHD
9550 JMP END
9560 ;
9570 DISKETTE INITIALIFER
9580 ********************
9590 ;
9600 INITRT=*
9610 ;
9620 LOA #$08 ;PROMPT INITIALIZER
9630 JSR PROMPT
9640 LDA #$03 ;PROMPT FOR DISK NO.
9650 JSR DKNOHD ;HANDLE DISK NO.
9660 STA SORCDK
9670 JSR TKNOHD ;HANDLE TRACK NO.S
9680 LDA SATTRK ;TRACK 0 IS NOT ALLOWED
9690 BNE I$ITHD
9700 JMP ERROR1
9710 I$ITHD=*
9720 JSR SURERT
9730 JSR SLSODK ;SELECT DESURED DISK
9740 BEQ IN$THD
9750 JMP NTRDER ;IF NOT READY,ERROR
9760 IN$THD=*
9770 JSR HOMEHD
9780 JMP INHDRT ;GO INIIALIZING
9790 ;
9800 RWIODK=* ;R/W I/O BUF TO/FROM
9810 ;DESIRED LOCATION
9820 ;
9830 LDY #$00
9835 LDX PAGENM
9840 R$IODK=*
9850 LDA (HLREG),Y
9860 STA (HLREG1),Y
9870 INY
9880 BNE R$IODK
9890 INC HLREG+1
9900 INC HLREG1+1
9910 DEX
9920 BNE R$IODK
9930 RTS
9940 ;
9950 RDOPT1=* ;MAIN READER ROUTINE
9960 ;
9970 JSR SLSODK ;SELECT DESIRED DISK
9980 BEQ R$OPT1
9990 JMP NTRDER ;IF NOT READY,ERROR
10000 R$OPT1=*
10010 JSR HOMEHD
10020 LDX SATTRK ;SET DESIRED TRACK
10030 SIX TKNDER
10040 JSR REDTRK ;READ DISK TO I/O DUE
10050 LDA LCTREG ;SET DESIRED ADDRESS
10060 STA HLREG1
10070 LDA LCTREG+1
10080 STA HLREG1+1
10090 LDA COBUF ;SET I/O BUF ADDRESSS
10100 STA HLREG
10110 LDA #IOBUF/256
10120 STA HLREG+1
10130 LDX SATTRK ;CHECK TRACK 0
10140 BEQ RD$PT1
10150 LDX #$0E ;IF NOT O,CHANGE PAGE
10160 STX PAGENM ;NO. TO REGUIAR VALUE
10170 RD$PT1=*
10180 JSR RWIODK ;READ TO I/O IMF
10190 JMP END
10200 ;
10210 ; DISKETTE TRACK READER
10220 ; **********************
10230 ;
10240 RDOPTK=* ;READ OPTION TRACK INTO
10250 ;DESIRED LOCATION
10260 ;
10270 LDA #$09 ;PROMPT READER
10280 JSR PROMPT
10290 LDA #$02 ;PROMPT FOR DISK NO.
10300 JSR DKNOHD
10310 STA SORCDK
10320 LDA #$04 ;PROMPT FOR TRACK NO.
10330 JSR TRNOHD ;HANDLE IT
10340 STA SATTRK
10350 LDA #$0B ;PROMPT FOR LOCATION
10360 JSR ADNOHD
10370 JSR SURERT
10380 JMP RDOPT1 ;GO READING
10390 ;
10400 WTOPT1=* ;MAIN WRITER ROUTINE
10410 ;
10420 JSR SLDNDK ;SELECT DESIRED DISK
10430 BEQ W$OPT1
10440 JMP NTRDER
10450 W$OPT1=*
10460 JSR HOMEHD
10470 LDA ENDTRK ;SET TRACK NO.
10480 STA TKNDER
10490 BEQ WT$PT1
10500 LDX #$0E ;IF NOT TRACK O,CHANG PG
10510 SIX PAGENM ;NO. TO REGULAR VALUE
10520 WT$PT1=*
10530 LDA LCTREG ;MOVE FROM DESIR
10540 STA HLREG ;LOCATION TO I/O BUF
10550 LDA LCTREG+1
10560 STA HLREG+1
10570 LDA #IOBUF
10580 STA HLREG1
10590 LDA #IOBUF/256
10600 STA HLREG1+1
10610 JSR RWIODK
10620 JSR WRTTRK ;WRITE I/O TO DISK
10630 ;
10640 END=*
10650 ;
10660 LDA #$0F ;PROMPT 'ALL DONE
10670 JSR PROMPT ;ANOTHER (Y/N) ? '
10680 NOP
10690 NOP
10700 EN$=*
10710 JSR CSLIN1 ;GET THE ANSWER
10720 CMP #'Y
10730 BNE E$D
10740 JMP D$KULT ;IF YES,GO REPERTING
10750 E$D=*
10760 JMP QUIT
10770 ;
10780 ; DISKETTE TRACK WRITER
10790 ; *********************
10800 ;
10810 WTOPTK=* ;WRITE FROM DESIRED LOCATION
10820 ;TO DESIRED TRACK
10830 ;
10840 LDA #$0A ;PROMPT WRITER
10850 JSR PROMPT
10860 LDA #$03 ;PROMPT FOR DISK NO.
10870 JSR DKNOHD
10880 STA DESTDK
10890 LDA #$05 ;PROMPT FOR TRACK NO.
10900 JSR TRNOHD
10910 STA ENDTRK
10920 LDA #$0C ;PROMPT FOR LOCATION
10930 JSR ADNOHD
10940 LDA ENDTRK
10950 BNE W$OPTY
10960 LDA #$0D ;IF TRACK O,PROMPT FOR
10970 JSR ADNOH1 ;LOADER VECTOR
10980 STA HEADST+1
10990 STX HEADST
11000 LDA #$0E ;PROMPT FOR PAGE NO.
11010 JSR PGNOHD
11020 W$OPTY=*
11030 JSR SURERT
11040 JMP WTOPT1 ;GO WRITING
11050 ;
11060 ; DISKETTE UTILITY
11070 ; ****************
11080 ;
11090 DIKULT=*
11100 CLD
11110 TSX
11120 STX STPTST ;RESERVE STACK POINTER
11130 D$KULT=*
11140 LDX #$80 ;SET NEW STACK POINTER
11150 TXS
11160 LDX #$00 ;RESET INIT FLAG
11170 STX FLAG
11180 LDA #$01 ;PROMPT FORCCOMMAND
11190 JSR CMNOHD ;AND HANDLE IT
11200 STA TEMP
11210 ASL A
11220 CLC
11230 ADC TEMP
11240 LDX #SWTBLE ;DECIDE OPTION
11250 STX HLREG ;COMMAND ADDRESS
11260 LDX #SWTBLE/256
11270 STX HLREG+1
11280 ADC HLREG
11290 STA HLREG
11300 BCC DISULT
11310 INC HLREG+1
11320 DISULT=*
11330 JMP (HLREG) ;BRANCH TO DIFFRENT
11340 ;COMMAND ROUTINE
11350 ;
11360 SWTBLE=* ;SWTICH TABLE
11370 ;
11380 JMP ALCOPY
11390 JMP OPCOPY
11400 JMP INITRT
11410 JMP RDOPTK
11420 JMP WTOPTK
11430 QUIT=*
11440 LDX STPTST ;RECOVE STACK POINTER
11450 TXS
11460 RTS