Classic Computer Magazine Archive PROGRAM LISTING: 84-09/COPYMATE.M65


0100     .OPT NO LIST
0110     .TAB 11,15,31
0120     .TITLE "COPYMATE 1.4   03/21/84"
0130 ;  
0160 ;            COPYMATE 1.4  
0180 ;           BY MIKE PALMER 
0190 ;           ANTIC MAGAZINE
0250 ;
0260 ;      PAGE ZERO
0270 ;      ---------
0280 ;
0290 SRCDRV = $80    SOURCE DRIVE
0300 DSTDRV = $81    DESTINATION DRIVE
0310 NUMDRV = $82    NUMBER OF DRIVES ON SYSTEM
0320 FMTTYP = $84    FORMAT TYPE
0330 SECSIZ = $85    SECTOR SIZE (DENISTY)
0340 WRTMOD = $89    WRITE MODE $57=VERIFY
0350 BUFFER = $8A    BUFFER POINTER
0360 BUFSAV = $8C    BUFFER POINTER SAVE
0370 SECSAV = $8E    SECTOR POINTER SAVE
0380 VTOC =  $90     SCREEN VTOC POINTER
0390 VTOSAV = $92    SCREEN VTOC POINTER SAVE
0400 VTOCI = $94     SCREEN VTOC INIT POINTER
0410 FMTFLG = $96    FORMAT FLAG
0420 ONMSG = $A0     ' ON' MESSAGE
0430 OFFMSG = $A3    'OFF' MESSAGE
0440 ;
0450 ;      O S
0460 ;      ---
0470 ;
0480 TRAMSZ = $06    TEST FOR LEFT CART
0490 TSTDAT = $07    TEST FOR RIGHT CART
0500 DOSVEC = $0A    DISK START VECTOR LSB
0510 DOSINI = $0C    DISK INIT VECTOR LSB
0520 POKMSK = $10    POKEY INTERUPTS
0530 ATRACT = $4D    ATTRACT MODE TIMER
0540 LMARGN = $52    LEFT MARGIN
0550 RMARGN = $53    RIGHT MARGIN
0560 ROWCRS = $54    CURSOR ROW
0570 SAVMSC = $59    START OF SCREEN DISPLAY MSB
0580 BOTSCR = $02BF  WINDOW ON=4 OFF=24
0590 BACKGR = $02C6  GR.0 BACKGROUND
0600 BORDER = $02C8  GR.0 BORDER
0610 CRSINH = $02F0  GR.0 CURSOR INHIBIT 0=ON
0620 CH  =   $02FC   INTERNAL VALUE FOR LAST KEY HIT
0630 DRVBYT = $070A  ZERO IF BOOTING
0640 IRQEN = $D20E   INTERUPT REQUEST ENABLE
0650 CONSOL = $D01F  CONSOL SWITCHES
0660 SIOV =  $E459   SERIAL I/O SUBROUTINE VECTOR
0670 COLDSV = $E477  COLD START VECTOR
0680 WARMSV = $E474  WARM START VECTOR
0690 PUTLIN = $F385  LINE PRINT SUBROUTINE
0700     .PAGE 
0710 ;      SERIAL I/O
0720 ;      ----------
0730 ;
0740 DBUSID = $0300  SERIAL BUS ID
0750 DUNIT = $0301   DRIVE NUMBER
0760 DCOMND = $0302  COMMAND
0770 DSTATS = $0303  STATUS / DATA DIRECTION
0780 DBUFLO = $0304  BUFFER ADDRESS LSB
0790 DBUFHI = $0305  BUFFER ADDRESS MSB
0800 DTIMLO = $0306  TIMEOUT (SECONDS)
0810 DCNTLO = $0308  TRANSFER COUNT LSB
0820 DCNTHI = $0309  TRANSFER COUNT MSB
0830 DSECLO = $030A  SECTOR NUMBER LSB
0840 DSECHI = $030B  SECTOR NUMBER MSB
0850 ;
0860 ;      I/O COMMANDS
0870 ;      ------------
0880 ;
0890 FMTDSK = $21    FORMAT DISK
0900 PUTSEC = $50    PUT SECTOR (NO VERIFY)
0910 GETSEC = $52    GET SECTOR
0920 PUTVER = $57    PUT SECTOR (WITH VERIFY)
0930 PUTDEL = $59    PUT SECTOR (DELETED)
0940 PUTCRC = $5A    PUT SECTOR (CRC ERROR)
0950 GETDAT = $40    DATA DIRECTION IN
0960 PUTDAT = $80    DATA DIRECTION OUT
0970 ;
0980 ;      MISCELLANEOUS
0990 ;      -------------
1000 ;
1010 OFF =   $00     FLAG OFF
1020 ON  =   $01     FLAG ON
1030 TIMOUT = $07    I/O TIMEOUT (SECONDS)
1040 TIMFMT = $A0    FORMAT TIMEOUT (SECONDS)
1050 BUFBOT = $0350  BUFFER BOTTOM
1060 DISKID = $31    DISK DEVICE ID
1070 LSTSEC = $02D0  LAST SECTOR TO COPY
1080 SCVTOC = $90    SCREEN VTOC OFFSET ADDRESS
1090 SCNSEC = $BFA1  SCREEN W/R SEC # ADDR (48K)
1100 BRKINH = $40    INHIBIT BREAK KEY CODE
1110 BRKENA = $C0    ENABLE BREAK KEY CODE
1120 OPTNKY = $03    ������ KEY CODE
1130 SELKEY = $05    ������ KEY PRESSED
1140 STRTKY = $06    ���� KEY CODE
1150 RTNKEY = $0C    ������ KEY CODE
1160 DKEY =  $3A     D KEY KEY CODE
1170 FKEY =  $38     F KEY KEY CODE
1180 SKEY =  $3E     S KEY KEY CODE
1190 VKEY =  $10     V KEY KEY CODE
1200 WKEY =  $2E     W KEY KEY CODE
1210 EMPTY = $0E     EMPTY SECTOR SCREEN CODE
1220 DATA =  $54     DATA SECTOR SCREEN CODE
1230 BAD =   $1F     BAD SECTOR SCREEN CODE
1240 POINT = $4E     VTOC POINTER SCREEN CODE
1250     .PAGE 
1260 ORIGN1 = $3400  INITIALIZATION CODE ORIGIN
1270 ;
1280     *=  ORIGN1
1290 ;
1300 ;      BOOT HEADER (6 BYTES)
1310 ;      ---------------------
1320 ;
1330     .BYTE $00   BOOT FLAG
1340     .BYTE $0E   # SECTORS
1350     .WORD ORIGN1 LOAD ADDRESS
1360     .WORD BOONIT BOOT INIT
1370 ;
1380 ;      BOOT CONTINUATION
1390 ;      -----------------
1400 ;
1410     CLC         SIGNAL BOOT OK
1420     RTS 
1430 ;
1440 ;
1450 ;      *************************
1460 ;      * USER DEFINITION TABLE *
1470 ;      *************************
1480 ;
1490 DEFSRC .BYTE $01 SOURCE DRIVE #
1500 DEFDST .BYTE $02 DESTINATION DRIVE #
1510 DEFFMT .BYTE $00 FOMATTING $00=OFF $01=ON
1520 DEFVFY .BYTE $50 WRITE VERIFY $50=OFF $57=ON
1530 NDRIVE .BYTE $02 NUMBER OF DRIVES ON SYSTEM
1540 FMTCHR .BYTE $00 ATARI=$00 PERCOM=$1A
1550 ;
1560 DENSIT .WORD $80 CURRENTLY SINGLE DENSITY ONLY
1570 ;
1580 ;
1590 ;      BOOT INITIALIZATION
1600 ;      ===================
1610 ;
1620 BOONIT LDA TRAMSZ ANY CARTRIDGES
1630     ORA TSTDAT  PLUGGED IN ?
1640     BEQ BOOMAK
1650     LDX #CRTMSG&255 TELL USER TO
1660     LDY #CRTMSG/256 REMOVE IT
1670     JSR PRINT
1680 BOODIE JMP BOODIE HANG AROUND
1690 ;
1700 BOOMAK LDA CONSOL MAKE BOOT DISK?
1710     CMP #OPTNKY
1720     BNE BOOSET  NO
1730     JMP MAKER   YES
1740 ;
1750 BOOSET LDA #RUNNIT&255 SET UP RESET
1760     STA DOSVEC  KEY VECTORS
1770     STA DOSINI
1780     LDA #RUNNIT/256
1790     STA DOSVEC+1
1800     STA DOSINI+1
1810 ;
1820     LDA #0      INIT POINTER
1830     STA SECSAV  SAVERS
1840     STA SECSAV+1
1850     STA BUFSAV
1860     STA BUFSAV+1
1870 ;
1880 ;   SET-UP USING USER DEFINITION TABLE
1890 ;
1900     LDA DEFSRC  SOURCE DRIVE
1910     STA SRCDRV
1920     CLC 
1930     ADC #$30
1940     STA OPTS
1950     LDA DEFDST  DESTINATION DRIVE
1960     STA DSTDRV
1970     CLC 
1980     ADC #$30
1990     STA OPTD
2000     LDA NDRIVE  TOTAL # DRIVES
2010     STA NUMDRV
2020     INC NUMDRV
2030     LDA FMTCHR  FORMAT CHARACTER
2040     STA FMTTYP
2050     LDA DENSIT  DISK DENSITY
2060     STA SECSIZ
2070     LDA DENSIT+1
2080     STA SECSIZ+1
2090 ;
2100     LDA #'      SET UP ' ON'
2110     STA ONMSG   AND 'OFF' MSGS
2120     LDA #'O
2130     STA ONMSG+1
2140     STA OFFMSG
2150     LDA #'N
2160     STA ONMSG+2
2170     LDA #'F
2180     STA OFFMSG+1
2190     STA OFFMSG+2
2200 ;
2210     LDY #OPTV-OPTMS3 WRITE
2220     LDA #PUTVER VERIFICATION
2230     CMP DEFVFY
2240     BNE BOOVOF
2250 BOOVON STA WRTMOD
2260     LDX #0
2270     BEQ BOOVFY  (JMP)
2280 BOOVOF LDA #PUTSEC
2290     STA WRTMOD
2300     LDX #3
2310 BOOVFY JSR BOOUPD
2320 ;
2330     LDY #OPTF-OPTMS3 FORMAT
2340     LDA #ON     DESTINATION
2350     CMP DEFFMT
2360     BNE BOOFOF
2370 BOOFON STA FMTFLG
2380     LDX #0
2390     BEQ BOOFMT  (JMP)
2400 BOOFOF LDA #0
2410     STA FMTFLG
2420     LDX #3
2430 BOOFMT JSR BOOUPD
2440 ;
2450     LDA SAVMSC  FIX SCREEN WRITE
2460     CLC         ADDRESSES FOR
2470     ADC #3      MEMORY SIZES
2480     STA SECFIX+2 OTHER THAN 48K
2490     STA SECFIX+5
2500     STA SECFIX+$0E
2510 ;
2520 BOOEPL LDA DRVBYT IS THIS A BOOT ?
2530     BEQ BOODON
2540     JMP WARMSV  NO - DO ��Ӡ�����
2550 BOODON RTS      YES - INIT DONE
2560 ;
2570 BOOUPD LDA ONMSG,X UPDATE ON/OFF
2580     STA OPTMS3,Y MESSAGES
2590     LDA ONMSG+1,X
2600     STA OPTMS3+1,Y
2610     LDA ONMSG+2,X
2620     STA OPTMS3+2,Y
2630 BOOEND RTS 
2640 ;
2650 CRTMSG .BYTE "}    PLEASE REMOVE ALL CARTRIDGES"
2660     .BYTE "                AND THEN RE-BOOT�",$9B
2670     .PAGE 
2680 ORIGN2 *= $3550 MAIN CODE ORIGIN
2690 ;
2700 ;
2710 ;      RUN INITIALIZATION
2720 ;      ==================
2730 ;
2740 RUNNIT LDA #9   SET LEFT &
2750     STA LMARGN  RIGHT MARGIN
2760     LDA #31     TO ASSIST IN
2770     STA RMARGN  MSG OUTPUT
2780 ;
2790     LDA #$94    STANDARD
2800     STA BORDER  SCREEN COLOR
2810 ;
2820     LDA #0
2830     LDX #$0A    ZERO OUT
2840 RUNZRO STA DUNIT,X DISK DCB
2850     DEX 
2860     BNE RUNZRO
2870 ;
2880 ;
2890     LDA #DISKID UNIT ID = DISK
2900     STA DBUSID
2910     INC DSECLO  FIRST SEC = 1
2920 ;
2930     LDX #HDRMSG&255 O/P COPYMATE
2940     LDY #HDRMSG/256 HEADER MSG
2950     JSR PRINT
2960 ;
2970 ;      OPTION CHANGER
2980 ;      --------------
2990 ;
3000 OPTCHG LDA #7   RESET TO OPTION
3010     STA ROWCRS  DISPLAY AREA
3020 ;
3030     LDX #OPTMS1&255 DISPLAY
3040     LDY #OPTMS1/256 CURRENT
3050     JSR PRINT   OPTIONS
3060     LDX #OPTMS2&255
3070     LDY #OPTMS2/256
3080     JSR PRINT
3090     LDX #OPTMS3&255
3100     LDY #OPTMS3/256
3110     JSR PRINT
3120     LDX #OPTMS4&255
3130     LDY #OPTMS4/256
3140     JSR PRINT
3150 ;
3160     LDA #GETDAT DATA DIRECTION
3170     STA DSTATS
3180     JSR INSER2 ;"INSERT" MSG
3190     LDA #BRKINH INHIBIT BREAK KEY
3200     STA IRQEN
3210     STA POKMSK
3220 ;
3230 OPTLUP LDA CONSOL ���� PRESSED
3240     CMP #STRTKY YET ?
3250     BNE OPTKEY
3260     BEQ VTONIT  GO!
3270 ;
3280 OPTKEY LDA CH   CHANGE OPTIONS?
3290     CMP #SKEY   SOURCE DISK
3300     BEQ OPTSRC
3310     CMP #DKEY   DESTINATION DISK
3320     BEQ OPTDST
3330     CMP #FKEY   FORMAT
3340     BEQ OPTFMT
3350     CMP #VKEY   VERIFY
3360     BEQ OPTVFY
3370     CMP #WKEY   VERIFY
3380     BNE OPTLUP
3390 ;
3400 ;      CHANGE VERIFY OPTION
3410 ;
3420 OPTVFY LDY #OPTV-OPTMS3 MSG OFFSET
3430     LDA #PUTVER
3440     CMP WRTMOD  VERIFY ON?
3450     BEQ OPTVOF
3460 OPTVON STA WRTMOD TURN VFY ON
3470     LDX #0      SELECT ON MSG
3480     BEQ OPTUPD  (JMP)
3490 OPTVOF LDA #PUTSEC
3500     STA WRTMOD  TURN VFY OFF
3510     LDX #3      SELECT OFF MSG
3520     BNE OPTUPD  (JMP)
3530 ;
3540 ;      CHANGE FORMAT OPTION
3550 ;
3560 OPTFMT LDY #OPTF-OPTMS3 MSG OFFSET
3570     LDA #ON
3580     CMP FMTFLG  FORMAT ON?
3590     BEQ OPTFOF
3600 OPTFON STA FMTFLG TURN FMT ON
3610     LDX #0      ON MSG
3620     BEQ OPTUPD  (JMP)
3630 OPTFOF DEC FMTFLG TURN FMT OFF
3640     LDX #3      OFF MSG
3650 ;
3660 ;      CHANGE OPTION MESSAGES
3670 ;
3680 OPTUPD LDA ONMSG,X X=FROM OFFSET
3690     STA OPTMS3,Y Y=TO OFFSET
3700     LDA ONMSG+1,X
3710     STA OPTMS3+1,Y
3720     LDA ONMSG+2,X
3730     STA OPTMS3+2,Y
3740     BNE OPTCLK  (JMP)
3750 ;
3760 ;      CHANGE DRIVE OPTIONS
3770 ;
3780 OPTSRC LDX #0   SET UP TO
3790     LDY #0      CHANGE SRC
3800     BEQ OPTDRV  (JMP)
3810 OPTDST LDX #1   SET UP TO
3820     LDY #OPTD-OPTS CHANGE DEST
3830 OPTDRV INC SRCDRV,X
3840     LDA SRCDRV,X
3850     CMP NUMDRV
3860     BCC OPTLT
3870     LDA #1      RESET TO 1
3880     STA SRCDRV,X
3890     CLC 
3900 OPTLT ADC #$30
3910     STA OPTS,Y  UPDATE MSG
3920 ;
3930 OPTCLK LDA #$FF CLEAR KEY
3940     STA CH      PRESS
3950 OPTEND JMP OPTCHG
3960 ;
3970 ;      SCREEN VTOC INITIALIZATION
3980 ;      --------------------------
3990 ;
4000 VTONIT LDA #SCVTOC VTOC SCRN OFFSET
4010     STA VTOC
4020     STA VTOCI
4030     LDA SAVMSC
4040     STA VTOC+1
4050     STA VTOCI+1
4060     LDX #3      LOOP 3 TIMES
4070     LDA #EMPTY
4080 VTOLP1 LDY #0   INIT $100 BYTES
4090 VTOLP2 STA (VTOCI),Y EACH PASS
4100     INY 
4110     BNE VTOLP2
4120     INC VTOCI+1
4130     DEX 
4140     BNE VTOLP1
4150 ;
4160 ;      COPY DISK
4170 ;      =========
4180 ;
4190 ;      GET BLOCK OF SECTORS
4200 ;      --------------------
4210 ;
4220 GET LDA SRCDRV
4230     STA DUNIT
4240     LDA #GETSEC
4250     STA DCOMND
4260     LDA DSECLO  NO MSG ON
4270     CMP #1      FIRST PASS
4280     BEQ GET.0
4290     JSR INSER1 ;"INSERT" MSG
4300     JSR WAIT1   WAIT FOR GO!
4310 ;
4320 GET.0 LDA DSECLO SAVE START
4330     STA SECSAV  SEC # AND VTOC
4340     LDA DSECHI  POINTER FOR
4350     STA SECSAV+1 WRITE BACK OUT
4360     LDA VTOC    TO DISK LATER
4370     STA VTOSAV
4380     LDA VTOC+1
4390     STA VTOSAV+1
4400 ;
4410     LDX #REDMSG&255;"READING" MSG
4420     LDY #REDMSG/256
4430     JSR PASNIT  PASS INIT
4440 ;
4450 GET.1 LDA CONSOL ������ KEY
4460     CMP #SELKEY PRESSED?
4470     BEQ PUT     SKIP READING
4480 ;
4490     LDA #GETDAT SET DATA DIR
4500     JSR SECTIO  GET A SECTOR
4510     BPL GET.2   NO ERROR
4520 ;
4530     TYA         RE-TRY UNTIL
4540     AND #$0F    ERR $80 (BRK)
4550     BNE GET.1   OR $90 (DONE)
4560     LDA #BAD    SHOW BAD
4570     BNE GET.5   (JMP)
4580 ;
4590 GET.2 LDY DCNTLO
4600     DEY 
4610 GET.3 LDA (BUFFER),Y ANY DATA IN
4620     CMP FMTTYP  THIS SECTOR
4630     BNE GET.4   YES
4640     DEY 
4650     BPL GET.3   KEEP LOOKING
4660     LDA #EMPTY  NO
4670     BNE GET.5   (JMP)
4680 GET.4 JSR INCBUF INC BUFFER POINTERS
4690     LDA #DATA
4700 ;
4710 GET.5 LDY #0
4720     STA (VTOC),Y STORE SECTOR STATUS
4730     JSR INCSEC  INC OTHER POINTERS
4740 ;
4750     BCC GET.1   GET NEXT SECTOR
4760 ;
4770 ;      PUT BLOCK OF SECTORS
4780 ;      --------------------
4790 ;
4800 PUT LDA DSTDRV  DESTINATION DRV
4810     STA DUNIT
4820     LDA #PUTDAT SET DATA DIR
4830     STA DSTATS
4840     JSR INSER1 ;"INSERT" MSG
4850     JSR WAIT1   WAIT FOR GO!
4860 ;
4870 PUT.1 JSR FMTDST
4880 ;
4890     LDA SECSAV  RESET
4900     STA DSECLO  SECTOR & VTOC
4910     LDA SECSAV+1 POINTERS FOR
4920     STA DSECHI  WRITING SECTORS
4930     LDA VTOSAV
4940     STA VTOC
4950     LDA VTOSAV+1
4960     STA VTOC+1
4970     LDX #WRTMSG&255;"WRITING"
4980     LDY #WRTMSG/256
4990     JSR PASNIT
5000     LDA WRTMOD  WITH OR WITHOUT VFY
5010     STA DCOMND
5020 ;
5030 ;
5040 PUT.2 LDY #0    DATA IN THIS SEC?
5050     LDA (VTOC),Y
5060     AND #$E0
5070     BEQ PUT.4   NO - NOTHING TO DO
5080 ;
5090     LDA #PUTDAT SET DATA DIR
5100     JSR SECTIO  PUT A SECTOR
5110     BPL PUT.3
5120 ;
5130     LDX #WERMSG&255;"WRITE ERROR"
5140     LDY #WERMSG/256
5150     JSR CHKDST ;"CHECK DEST"
5160     LDX SECSAV  RE-TRY ON
5170     CPX #1      1ST PASS ONLY
5180     BNE PUT.2A
5190     LDX SECSAV+1
5200     BEQ PUT.1
5210 ;
5220 PUT.2A JMP (DOSVEC) ABORT COPY
5230 ;
5240 PUT.3 LDA #DATA
5250     LDY #0
5260     STA (VTOC),Y
5270 ;
5280     JSR INCBUF  INCREMENT
5290 PUT.4 JSR INCSEC POINTERS
5300 ;
5310     BCC PUT.2   PUT NEXT SECTOR
5320 ;
5330     BEQ DONE    COPY COMPLETE?
5340     JMP GET     NO
5350 ;
5360 ;      COPY DONE
5370 ;      ---------
5380 ;
5390 DONE LDX #DNEMSG&255;"DONE"
5400     LDY #DNEMSG/256
5410     JSR PRINTW
5420     JSR WAIT
5430     JMP (DOSVEC) NEXT COPY
5440 ;
5450 ;      SUBROUTINES
5460 ;      ===========
5470 ;
5480 ;      DISK INSERT MESSAGES
5490 ;      --------------------
5500 ;
5510 INSER1 LDA SRCDRV 2 DRIVES ?
5520     CMP DSTDRV
5530     BNE INSEND  NO MSG
5540 INSER2 LDA SRCDRV 2 DRIVES ?
5550     CMP DSTDRV
5560     BNE INSBOT
5570 INSROW LDA DSTATS READ OR WRITE?
5580     BPL INSSRC  WRT=+VE READ=-VE
5590 INSDST LDX #DSTMSG&255;"INSERT
5600     LDY #DSTMSG/256 DESTINATION"
5610     BNE INSPRT  (JMP)
5620 INSSRC LDX #SRCMSG&255;"INSERT
5630     LDY #SRCMSG/256 SOURCE DISK"
5640     BNE INSPRT  (JMP)
5650 INSBOT LDX #BOTMSG&255;"INSERT
5660     LDY #BOTMSG/256 BOTH DISKS"
5670 INSPRT JSR PRINTW
5680 INSTRT LDX #TPSMSG&255;"THEN PRESS
5690     LDY #TPSMSG/256 START"
5700     JSR PRINTW
5710 INSEND RTS 
5720 ;
5730 ;      PASS INITIALIZATION
5740 ;      -------------------
5750 ;
5760 PASNIT JSR PRINTW O/P MSG
5770 ;
5780     LDA #BUFBOT&255 INIT TO START
5790     STA DBUFLO  OF BUFFER
5800     STA BUFFER
5810     LDA #BUFBOT/256
5820     STA DBUFHI
5830     STA BUFFER+1
5840 ;
5850 PASEPL STA ATRACT ATTRACT MODE OFF
5860     LDA #BRKENA ENABLE BREAK KEY
5870     STA IRQEN
5880     STA POKMSK
5890 PASEND RTS 
5900 ;
5910 ;      INCREMENT POINTERS
5920 ;      ------------------
5930 ;
5940 INCBUF LDA BUFFER INC BUFFER
5950     CLC         POINTERS BY
5960     ADC SECSIZ  SECTOR SIZE
5970     STA DBUFLO
5980     STA BUFFER
5990     LDA BUFFER+1
6000     ADC SECSIZ+1
6010     STA DBUFHI
6020     STA BUFFER+1
6030 ;
6040 ;      IF WE HAVE REACHED THE CODE
6050 ;      SECTION OF MEMORY - SKIP IT
6060 ;
6070     CMP #ORIGN2/256
6080     BNE INCRTS
6090     LDA #ORIGN2/256+5
6100     STA BUFFER+1
6110     STA DBUFHI
6120     LDA #0
6130     STA BUFFER
6140     STA DBUFLO
6150 INCRTS RTS 
6160 ;
6170 INCSEC LDX DSECLO LAST
6180     CPX #LSTSEC&255 SECTOR ?
6190     BNE INC.2
6200     LDX DSECHI
6210     CPX #LSTSEC/256
6220     BEQ INCEND
6230 ;
6240 INC.2 INC DSECLO INCREMENT SECTOR
6250     BNE INC.3   AND VTOC POINTERS
6260     INC DSECHI
6270 INC.3 INC VTOC
6280     BNE INC.4
6290     INC VTOC+1
6300 ;
6310 INC.4 LDA BUFFER+1
6320     CMP SAVMSC  BUFFER FULL?
6330     BCC INCEND  NO
6340     LDA #1      SHOW BUFFER FULL
6350 INCEND RTS 
6360 ;
6370 ;      WAIT FOR ���� KEY PRESS
6380 ;      ------------------------
6390 ;
6400 WAIT1 LDA SRCDRV 2 DRIVES ?
6410     CMP DSTDRV
6420     BNE WAIEND
6430 ;
6440 WAIT LDA #BRKINH INHIBIT BREAK KEY
6450     STA IRQEN   DURING THE WAIT
6460     STA POKMSK
6470 ;
6480     LDX CONSOL
6490     CPX #STRTKY ���� KEY?
6500     BEQ WAIEND
6510     CPX #OPTNKY OPTION KEY?
6520     BNE WAIT
6530 ;
6540     PLA         LOSE RETURN ADDR
6550     PLA         ������ =
6560     JMP PUT     REPEAT COPY
6570 WAIEND RTS 
6580 ;
6590 ;      "CHECK DESTINATION"
6600 ;      -------------------
6610 ;
6620 CHKDST JSR PRINTW O/P ERROR MSG
6630     LDX #CHKMSG&255;"CHECK DEST"
6640     LDY #CHKMSG/256
6650     JSR PRINTW
6660     JSR INSTRT ;"START"
6670     JSR WAIT    WAIT FOR GO
6680 CHKEND RTS 
6690 ;
6700 ;      SECTOR I/O
6710 ;      ----------
6720 ;
6730 SECTIO STA DSTATS DATA DIRECTION
6740     LDA #TIMOUT
6750     STA DTIMLO
6760     LDA SECSIZ
6770     STA DCNTLO
6780 ;
6790     LDA #POINT  POINT TO CURRENT
6800     LDY #0      SECTOR IN THE
6810     STA (VTOC),Y SCREEN VTOC
6820 ;
6830     LDA DSECLO  WRITE SECTOR
6840     JSR HEXSCR  NUMBER TO THE
6850 SECFIX STX SCNSEC+3 SCREEN
6860     STY SCNSEC+2
6870     LDA DSECHI
6880     JSR HEXSCR
6890     STA SCNSEC+1
6900 ;
6910     JSR SIOV    DO THE I/O
6920 SHOEND RTS 
6930 ;
6940 ;      CONVERT HEX TO SCREEN CODE
6950 ;      --------------------------
6960 ;      A=HEX -> X=LSB Y=MSB
6970 ;
6980 HEXSCR PHA      SAVE #
6990     LSR A       GET MSB
7000     LSR A
7010     LSR A
7020     LSR A
7030     JSR HEX1    CONV SCN CODE
7040     TAY         RETURN IN Y
7050     PLA 
7060     AND #$0F    GET LSB
7070     JSR HEX1    CONV SCN CODE
7080     TAX         RETURN IN X
7090     RTS 
7100 ;
7110 HEX1 CMP #$0A   BETWEEN 0&9?
7120     BCC HEX2
7130     CLC         NO A-F
7140     ADC #$07    'A'=$21
7150 HEX2 ADC #$10   '0'=$10
7160 HEXEND RTS 
7170 ;
7180 ;      SCREEN PRINT
7190 ;      ------------
7200 ;
7210 PRINTW LDA #4   WINDOW ON
7220     STA BOTSCR
7230 PRINT STY CRSINH INHIBIT CURSOR
7240     JSR PUTLIN
7250     LDA #24
7260     STA BOTSCR  WINDOW OFF
7270 PRIEND RTS 
7280 ;
7290 ;      FORMAT DESTINATION
7300 ;      ------------------
7310 ;
7320 FMTDST LDX FMTFLG FORMAT ?
7330     BEQ FOREND
7340     LDX SECSAV  FORMAT ON FIRST
7350     CPX #1      PASS ONLY
7360     BNE FOREND
7370     LDX SECSAV+1
7380     BNE FOREND
7390 ;
7400     LDA #FMTDSK
7410     STA DCOMND
7420     LDA #TIMFMT
7430     STA DTIMLO
7440     LDA #GETDAT
7450     STA DSTATS
7460     LDA #$FF    DUMP BAD SECTORS
7470     STA DBUFHI
7480     LDX #FMTMSG&255;"FORMATTING"
7490     LDY #FMTMSG/256
7500     JSR PRINTW
7510 ;
7520     JSR SIOV    GO DO IT
7530     BPL FOREND  OK
7540 ;
7550     LDX #FERMSG&255;"FORMAT ERR"
7560     LDY #FERMSG/256
7570     JSR CHKDST ;"CHECK DEST"
7580     BEQ FMTDST  JMP RE-TRY
7590 ;
7600 FOREND RTS 
7610 ;
7620 ;      MESSAGE BASE
7630 ;      ============
7640 ;
7650 HDRMSG .BYTE "}     COPYMATE 1.4    "
7660     .BYTE "      BY MIKE PALMER",$9B
7670 OPTMS1 .BYTE "SOURCE DRIVE ....   #"
7680 OPTS .BYTE "?",$9B
7690 OPTMS2 .BYTE "DESTINATION DRIVE   #"
7700 OPTD .BYTE "?",$9B
7710 OPTMS3 .BYTE "FORMAT DESTINATION "
7720 OPTF .BYTE "???",$9B
7730 OPTMS4 .BYTE "WRITE VERIFICATION "
7740 OPTV .BYTE "???",$9B
7750 DNEMSG .BYTE "}    COPY COMPLETED    �"
7760     .BYTE "     PRESS  ����Ԡ",$9B
7770 FMTMSG .BYTE "}      FORMATTING",$9B
7780 FERMSG .BYTE "}   FORMATTING ERROR",$9B
7790 WERMSG .BYTE "}      WRITE ERROR",$9B
7800 CHKMSG .BYTE "�CHECK DESTINATION DISK",$9B
7810 REDMSG .BYTE "}  READING SECTOR",$9B
7820 WRTMSG .BYTE "}  WRITING SECTOR",$9B
7830 DSTMSG .BYTE "}INSERT DESTINATION DISK",$9B
7840 SRCMSG .BYTE "}  INSERT SOURCE DISK",$9B
7850 BOTMSG .BYTE "}  INSERT  BOTH DISKS",$9B
7860 TPSMSG .BYTE "  THEN PRESS ����Ԡ",$9B
7870     .PAGE 
7880 ;
7890 ;   BOOT DISK MAKER
7900 ;   ===============
7910 ;
7920     *=  $3A00
7930 ;
7940 MAKER LDA #$34  RED WARNING
7950     STA BACKGR  SCREEN COLOR
7960     STA BORDER
7970     LDA #2      LEFT MARGIN=2
7980     STA LMARGN
7990 ;
8000     LDX #MAKMSG&255;"MAKER"
8010     LDY #MAKMSG/256 MESSAGE
8020     JSR PRINT
8030 ;
8040 MAKEWT LDA CH   WAIT FOR
8050     CMP #RTNKEY ������ KEY?
8060     BNE MAKEWT
8070 ;
8080     LDA #0
8090     LDX #$0A    CLEAR OUT
8100 MAKEZR STA DUNIT,X DISK DCB
8110     DEX 
8120     BNE MAKEZR
8130 ;
8140     LDA #DISKID SET UP THE DCB
8150     STA DBUSID
8160     LDA #1
8170     STA DUNIT
8180     INC DSECLO
8190     LDA #ORIGN1&255
8200     STA DBUFLO
8210     LDA #ORIGN1/256
8220     STA DBUFHI
8230     LDA #$80
8240     STA DCNTLO
8250     LDA #PUTVER
8260     STA DCOMND
8270     LDA #TIMOUT
8280     STA DTIMLO
8290 ;
8300 MAKEIO LDA #PUTDAT WRITE COPYMATE
8310     STA DSTATS
8320     JSR SIOV    PUT SECTOR
8330     BMI MAKEIO  TRY AGAIN ON ERROR
8340     LDA DBUFLO
8350     CLC 
8360     ADC #$80
8370     STA DBUFLO
8380     LDA DBUFHI
8390     ADC #$00
8400     STA DBUFHI
8410 ;
8420     CMP #END/256+1 ALL DONE?
8430     BEQ MAKEDN
8440     INC DSECLO
8450     JMP MAKEIO
8460 ;
8470 MAKEDN JMP COLDSV COLD START
8480 ;
8490 MAKMSG .BYTE "}  COPYMATE 1.4 - BOOT DISK MAKER     ���"
8500     .BYTE " INSERT A NEWLY FORMATTED DISK INTO "
8510     .BYTE "    DRIVE ONE -- THEN PRESS ������Π"
8520 END .BYTE $9B
8530     *=  $02E0   LOAD & GO ADDRESS
8540     .WORD BOONIT
8550     .OPT NO LIST

Back to previous page