10
20
30 DIM mcode% &200:load%=&FFFF0900
40 OSWRCH=&FFEE:OSNEWL=&FFE7
50 OSGBPB=&FFD1:OSFILE=&FFDD
60 :
70 FOR P=0 TO 1
80 P%=load%:O%=mcode%
90 [OPT P*3+4
100 .dir
110 EQUS "riD "
120 :
130 .start%
140 .loop
150 LDA #data AND 255:STA gbpb+1
160 LDA #data DIV 256:STA gbpb+2
170 LDA #1:STA gbpb+5
180 LDX #gbpb AND 255
190 LDY #gbpb DIV 256
200 LDA #8:JSR OSGBPB
210 LDA gbpb+5:BNE done
220 JSR dofile:JMP loop
230 :
240 .dofile
250 LDY data+0:LDX #0
260 LDA #13:STA data+1,Y
270 .lp4
280 LDA data+1,X:JSR OSWRCH
290 INX:DEY:BNE lp4:LDA #32
300 .lp5
310 JSR OSWRCH:INX:CPX #11
320 BCC lp5
330 :
340 LDA #(data+1)AND 255:STA file+0
350 LDA #(data+1)DIV 256:STA file+1
360 LDX #file AND 255
370 LDY #file DIV 256
380 LDA #5:JSR OSFILE
390 CMP #2:BNE prsize
400 LDX #5
410 .lp6
420 LDA dir,X:JSR OSWRCH
430 DEX:BPL lp6:BMI prnext
440 .prsize
450 LDA file+11:AND #3
460 ORA file+10:PHA
470 LSR file+12:ROR file+11
480 LSR file+12:ROR file+11
490 PLA:BEQ prsize2
500 INC file+11:BNE prsize2
510 INC file+12
520 .prsize2
530 JSR prdec16
540 LDA #ASC"K":JSR OSWRCH
550 .prnext
560 LDX #3:DEC col:BPL space
570 STX col
580 .done
590 LDA #8:JSR OSWRCH
600 JMP OSNEWL
610 .space
620 LDA #32
630 .spclp
640 JSR OSWRCH:DEX:BNE spclp
650 RTS
660 :
670 .prdec16
680 LDY #0
690 .prdeclp1
700 LDX #16:LDA #0:CLV
710 .prdeclp2
720 CMP #5:BCC prdecskip
730 SBC #5+128:SEC
740 .prdecskip
750 ROL file+11:ROL file+12
760 ROL A:DEX:BNE prdeclp2
770 ORA #48:PHA:INY
780 BVS prdeclp1:LDA #32
790 .prdeclp3
800 CPY #5:BCS prdeclp4
810 PHA:INY:BNE prdeclp3
820 .prdeclp4
830 PLA:JSR OSWRCH
840 DEY:BNE prdeclp4:RTS
850 :
860 .col
870 EQUB 3
880 .gbpb
890 EQUB 0:EQUW data:EQUW &FFFF
900 EQUD 1:EQUD 0
910 .file
920 EQUS "v1.00 JGH"
930 EQUB 0:EQUD 0:EQUD 0
940 .data
950 ]NEXT
960 PRINT"*SAVE ls ";~mcode%;" ";~O%;" ";~start%OR&FFFF0000;" ";~load%