10REM (c) Acorn Computers 8 Dec 1984. 20MODE 7 30 40OsArgs = &FFDA 50OSFILE = &FFDD 60OSWRCH = &FFEE 70OsCli = &FFF7 80OsByte = &FFF4 90 100zp = &A8 110from = &AC 120to = &AE 130 140FOR PASS = 0 TO 2 STEP 2 150P% = &7000 160 170[OPT PASS 180 190 \ Read PAGE for later. 200 Lda #&B4:Ldx #0:Ldy #&FF:Jsr OsByte 210 Stx Buffer+1: Lda #0:Sta Buffer 220 \ 230 \ Pick up command line from OSARGS 1 240 \ 250 Lda #1 260 Ldx #zp 270 Ldy #0 280 Jsr OsArgs 290 \ 300 \ zp(0..3) points to command line 310 \ 320 Ldy #&FF \ Y points to parameter 330 Ldx #0 \ X points to destination 340 350.copy_strings 360 Iny 370 Lda (zp),Y 380 Cmp #32 \ Strip all spaces 390 Beq copy_strings 400 Sta filename,X \ Copy filename into OSFILE 410 Inx \ parameter block 420 Cmp #&0D 430 Bne copy_strings 440 \ 450 \ select telesoft 460 Jsr GetOldFS: Sta OldFS 470 Ldx #TSOFT MOD 256:Ldy #TSOFT DIV 256: Jsr OsCli 480 Lda #22:Jsr OSWRCH:Lda #7:Jsr OSWRCH 490 \ First select page if wanted 500 Ldy #&FF \ Ptr initially points to filename 510.GetPageNo 520 Iny 530 Lda filename,Y 540 Cmp #13: Beq gotfname 541JSR OSWRCH 550 Cmp #ASC(":"): Bne GetPageNo 560 Lda #13 561JSR OSWRCH 562 Sta filename,Y: Tya: Pha \ Replace colon with CR - for oscli. 570 Sec: Adc #filename MOD 256: Pha \ Point to byte AFTER CR. 580 Lda #filename DIV 256: Adc #0: Pha 581 \ Now call command from LAST value of Ptr. 582 Ldx Ptr: Ldy Ptr+1: Jsr OsCli 583 Pla: Sta Ptr+1: Pla: Sta Ptr: Pla: Tay 584 Jmp GetPageNo 590 \ 600 \ Call OSFILE to load telesoftware file 610 \ 611.gotfname 620 Lda Buffer:Sta CB+&02 630 Lda Buffer+1:Sta CB+&03 640 Lda Ptr:Sta CB+&00 650 Lda Ptr+1:Sta CB+&01 660 \ 670 Lda #&FF 680 Ldx #CB MOD 256 690 Ldy #CB DIV 256 700 Jsr OSFILE 710.Save_to_fsys 720 Lda OldFS: Jsr SetFS 730 Lda CB+&0A \length low 740 Clc: Adc Buffer 750 Sta CB+&0E \end-low 760 Lda CB+&0B \length high 770 Adc Buffer+1 780 Sta CB+&0F \End high 790 Lda Buffer: Sta CB+&0A 800 Lda Buffer+1: Sta CB+&0B 810 Lda Ptr:Sta CB 820 Lda Ptr+1:Sta CB+1 830 Lda #&FF: Sta CB+&0C:Sta CB+&0D:Sta CB+&10:Sta CB+&11 840 Lda #0:Ldx #CB MOD 256:Ldy #CB DIV 256: Jsr OSFILE 850 \ 860 BRK: EQUB 5: EQUS "Done": EQUB 0 870.GetOldFS Lda #0:Tay:Jmp OsArgs \ result returned in A 880.SetFS \ File-system ID passed in A 890 Tay 900 Cpy #4: Bpl clean_fs \ < 4 Tape or Rom. Special cases 910 Lda #&8C: Cpy #2: Bne Not300 \ ( assume NOT ROM. ) 920 Ldx #3: Jmp OsByte 930.Not300 940 Ldx #12: Jmp OsByte 950.clean_fs Lda #&8F: Ldx #&12: Jmp OsByte 960.OldFS NOP 970.TSOFT EQUS "telesoft":EQUB 13 980.CB 990 EQUW 0 1000 EQUD 0 1010 EQUD 0 1020 EQUD 0 1030 EQUD 0 1040.Ptr EQUW filename 1050.Buffer NOP:NOP 1060.filename 1070] 1080NEXT 1081IF &7200-filename-16 < 0 THEN PRINT"Code too big???" 1090OSCLI("SAVE TAKE 7000 7200 7000") 1100END