# HG changeset patch # User boisy # Date 1203723156 0 # Node ID aaff55744d7d50f9de8348b75e811a56ecd1429e # Parent aa3228536418bd2ffeebc2aa17e516275dab669e comments updated diff -r aa3228536418 -r aaff55744d7d level1/cmds/backup.asm --- a/level1/cmds/backup.asm Fri Feb 22 15:15:35 2008 +0000 +++ b/level1/cmds/backup.asm Fri Feb 22 23:32:36 2008 +0000 @@ -9,7 +9,7 @@ * 8 ????/??/?? * From Tandy OS-9 Level Two VR 02.00.01. * -* 9 2005/5/3 Robert Gault +* 9 2005/05/03 Robert Gault * Folded in a new option F to permit a .dsk image file to be used * instead of dev1. Full path or local file can be used. There is * still a comparison of LSN0 to make sure that a disk actually has @@ -42,26 +42,28 @@ pmptsng rmb 1 single disk copy prompt flag (1 = prompt for single, 0 = don't) dontvfy rmb 1 don't verify backup (1 = Don't!, 0 = do) fileflg rmb 1 0 = disk, 1 = file (.dsk) to disk; RG -u000D rmb 1 -u000E rmb 1 -u000F rmb 1 -u0010 rmb 1 -u0011 rmb 2 -u0013 rmb 1 -u0014 rmb 1 -u0015 rmb 32 -u0035 rmb 32 +noprompt rmb 1 0 = prompt user, 1 = do not prompt user +srcerr rmb 1 source disk error code on I$Read +curlsn rmb 3 current 24-bit LSN counter used while backing up +sctbuf rmb 2 sector buffer pointer +numpages rmb 1 number of 256 byte pages we can use for backup buffer +pagcntr rmb 1 256 byte page counter (for backup buffer) +dstdev rmb 32 +optbuf rmb 32 SS/GS OPT buffer bufptr rmb 2 buffer pointer strbuf rmb 424 buffer -u01FF rmb 81 -u0250 rmb 256 -u0350 rmb 3840 +stack rmb 80 +* Important, the next two lines MUST STAY TOGETHER because of assumptions +* about their location in the code. +dstlsn0 rmb 256 +srclsn0 rmb 256 +backbuff rmb 14*256 reserve pages for backup buffer size equ . name fcs /Backup/ fcb edition -L0014 fcc "/d0 /d1" +defparms fcc "/d0 /d1" fcb C$CR IFNE DOHELP * Added F option; RG @@ -74,6 +76,8 @@ fcb C$LF fcc " f - replace dev1 with .dsk image file" fcb C$LF + fcc " p - do not prompt user" + fcb C$LF fcc " s - single drive prompts" fcb C$LF fcc " -v - inhibit verify pass" @@ -81,41 +85,58 @@ L00A0 fcb $80+C$CR L00A1 fcc "Ready to backup from" L00B5 fcb $80+C$SPAC -L00B6 fcs " to " -L00BA fcc "Ok" -L00BC fcs " ?: " -L00C0 fcs "Ready Source, hit a key: " -L00D9 fcs "Ready Destination, hit a key: " +to fcs " to " +ok fcc "Ok" +ask fcs " ?: " +rdysrc fcs "Ready Source, hit a key: " +rdydst fcs "Ready Destination, hit a key: " L00F7 fcs "Sector $" -L00FF fcs "Sectors copied: $" -L0112 fcb C$LF +sctscpd fcs "Sectors copied: $" +vfypass fcb C$LF fcc "Verify pass" fcb $80+C$CR -L011F fcs "Sectors verified: $" -L0132 fcb C$LF +sctvfd fcs "Sectors verified: $" +scratch fcb C$LF fcc " is being scratched" fcb $80+C$CR -NotSame fcc "Disks not formatted identically" +notsame fcc "Disks not formatted identically" fcb C$LF -L0167 fcc "Backup Aborted" +bkabort fcc "Backup Aborted" fcb $80+C$CR -start leas >u01FF,u - pshs b,a - pshs u - tfr y,d - subd ,s++ - subd #$0250 - sta stack,u move stack pointer to here + pshs b,a save parameter area size + pshs u save lowest addr + tfr y,d move top of parameter area to Y + subd ,s++ D=Y-U + subd #backbuff-stack +* A = number of 256 byte pages that are available for backup buffer + sta $30 + bcc Chk4P branch if char after option is > $30 inc L0014,pcr +L01E3 leax >defparms,pcr L01E7 leay >L00A1,pcr ready to backup lbsr L044B ready message ldy L00B6,pcr "to" + leay >to,pcr "to" lbsr L044B print ldy L00BC,pcr - lbsr L0421 + leay >ask,pcr + lbsr getkey comb eora #'Y anda #$DF - lbne L03BA + lbne exit tst u0350,u + leax >srclsn0,u ldy #256 - os9 I$Read read LSN 0 + os9 I$Read read LSN 0 of source bcs L027C os9 I$Close ldx u0250,u + leax >dstlsn0,u ldy #256 - os9 I$Read read LSN0 + os9 I$Read read LSN0 of destination pshs u,x ldx #$0000 leau ,x os9 I$Seek reseek to start of disk puls u,x bcs L027C branch if error - ldd >256,x check for source/dest disk having same format + ldd >256,x check for source/dest disk having same number of sectors cmpd ,x bne DsksNOk branch if different ldb >$0102,x cmpb $02,x beq DsksOk -DsksNOk leay >NotSame,pcr +DsksNOk leay >notsame,pcr lbra L03B6 -DsksOk leax >u0250,u +DsksOk leax >dstlsn0,u X now points to source LSN0 lda #$BF - sta <$3F,x - leay <$1F,x + sta L0132,pcr + leay >scratch,pcr lbsr L0456 - leay >L00BA,pcr - lbsr L0421 + leay >ok,pcr + lbsr getkey get a key from the stdin comb eora #'Y anda #$DF - lbne L03BA + lbne exit exit if not ok to scratch lda u0350,u + leax >srclsn0,u get src LSN0 read earlier ldy #256 - os9 I$Write - lbcs L03AF + os9 I$Write write it to destination + lbcs L03AF pshs u ldx #$0000 leau ,x os9 I$Seek seek to LSN0 puls u - leax >u0350,u + lbcs L03AF added Feb 8, 2008 BGP + leax >srclsn0,u os9 I$Read lbcs L03AF os9 I$Close close path - leax L00C0,pcr - lbsr L041D - lda u0250,u + +copyloop leay >rdysrc,pcr + lbsr doprompt possibly show "ready source" message + lda dstlsn0,u lbsr L0403 lbsr L0419 - ldd u0250,u - stx dstlsn0,u + stx L00FF,pcr + bne copyloop + leay >sctscpd,pcr lbsr L0470 tst L0112,pcr + leay >vfypass,pcr lbsr L0456 lda u0250,u + clr dstlsn0,u bsr L0403 - lda L011F,pcr + leay >sctvfd,pcr lbsr L0470 - bra L03BA + bra exit L03AF os9 F$PErr - leay >L0167,pcr + leay >bkabort,pcr L03B6 lbsr L0456 comb -L03BA ldb #$00 +exit ldb #$00 os9 F$Exit L03BF ldy #256 lda 256,x -L0403 stx HelpMsg,pcr point to help message data bra L03B6 ELSE - bra L03BA + bra exit ENDC -L0419 leay >L00D9,pcr -L041D tst rdydst,pcr +doprompt tst L00F7,pcr L0470 bsr L044B - lda L00B5,pcr bra L0456