10REM *CATALL 20REM Utility to catalogue all files and directories from current point 30REM (C) John Robinson 1988 40REM Method: Recursive routine that catalogues current dir and calls 50REM itself for dirs inside current dir 60: 70DIM code &200 80origin=&900 90proc=&FFFF 100processor=&FFFF0000 110file$="CatAll" 120: 130osgbpb=&FFD1 140osfile=&FFDD 150osnewl=&FFE7 160oswrch=&FFEE 170oscli =&FFF7 180: 190FOR pass=4 TO 7 STEP 3 200P%=origin 210O%=code 220[OPT pass 230 240.catall 250LDA #0 260STA indent 270.recursive 280LDA #0 290STA gbpbblock+9 300STA gbpbblock+10 310STA gbpbblock+11 320STA gbpbblock+12 330.catloop 340LDY #proc DIV 256 350LDX #proc MOD 256 360STY gbpbblock+4 370STX gbpbblock+3 380LDY #cat_entry DIV 256 390LDX #cat_entry MOD 256 400STY gbpbblock+2 410STX gbpbblock+1 420LDA #0 430STA gbpbblock+6 440STA gbpbblock+7 450STA gbpbblock+8 460LDA #1 470STA gbpbblock+5 480LDY #gbpbblock DIV 256 490LDX #gbpbblock MOD 256 500LDA #8 510JSR osgbpb 520BCC continue 530RTS 540.continue 550LDX cat_entry 560LDA #&D 570STA cat_entry+1,X 580LDY #osfileblock DIV 256 590LDX #osfileblock MOD 256 600LDA #5 610JSR osfile 620PHA 630LDX indent 640BEQ done_spaces 650LDA #&20 660.print_spaces 670JSR oswrch 680DEX 690BNE print_spaces 700.done_spaces 710PLA 720PHA 730CMP #2 740BNE not_directory 750LDX #0 760.print_dir_string 770LDA directory,X 780JSR oswrch 790INX 800CPX #eo_dir_string-directory 810BCC print_dir_string 820.not_directory 830LDX #0 840.print_filename 850LDA cat_entry+1,X 860JSR oswrch 870INX 880CPX cat_entry 890BCC print_filename 900JSR osnewl 910LDA &FF 920BPL not_escape 930BRK 940EQUB 17 950EQUS "Escape" 960EQUB 0 970.not_escape 980PLA 990CMP #2 1000BNE gcatloop 1010INC indent 1020INC indent 1030LDA #&20 1040STA cat_entry 1050LDY #dir DIV 256 1060LDX #dir MOD 256 1070JSR oscli 1080LDA gbpbblock+9 1090PHA 1100JSR recursive 1110PLA 1120STA gbpbblock+9 1130LDY #dirup DIV 256 1140LDX #dirup MOD 256 1150JSR oscli 1160DEC indent 1170DEC indent 1171.gcatloop 1180JMP catloop 1190 1200.gbpbblock 1210EQUB 0 1220EQUD 0 1230EQUD 0 1240EQUD 0 1250 1260.osfileblock 1270EQUW cat_entry+1 1280EQUD 0 1290EQUD 0 1300EQUD 0 1310EQUD 0 1320 1330.dirup 1340EQUS "DIR^" 1350EQUB &D 1360 1370.indent 1380EQUB 0 1390 1400.directory 1410EQUS "Directory " 1420.eo_dir_string 1430 1440.dir 1450EQUS "DIR" 1460.cat_entry 1470EQUS " **********/" 1480 1490] 1500NEXT pass 1510: 1520save$="*SAVE "+file$+" "+STR$~code+" "+STR$~O%+" "+STR$~(catall OR processor)+" "+STR$~(origin OR processor) 1530PRINT ;save$;" ? (Y/N) "; 1540IF (GET OR &20)=ASC "y" THEN PRINT "Yes":OSCLI save$:PRINT "OK" ELSE PRINT "No" 1550: