*----------------------------------------------------- * standard subroutines * A46F8 MOV @>834E,8 sbr >10: sector access MOV @>8350,6 ====================== C 6,@DRIVSZ check sector # JHE A478A too high MOV 6,@>834A BL @A546A point to sector A470E LI 0,>0100 256 bytes LI 11,A4734 return MOVB @>834D,1 JNE A46D2 read ABS @WPRFL JEQ A46B0 write A4722 MOVB @H2000,0 JMP A4736 error >20: write protected * * A4728 ABS @WPRFL sbr >11: format JNE A4722 =============== MOV @DRIVSZ,@>834A # of sectors A4734 CLR 0 no errors A4736 MOVB 0,@>8350 B @A4550 return * * A473E ABS @WPRFL sbr >12: (un)protect JNE A4722 ==================== BL @A4690 filename->pab buffer BL @A548C find file JMP A478A not found AI 6,>000C MOVB @>834D,0 JEQ A475E SOC @H0800,*6 protect JMP A4734 A475E SZC @H0800,*6 unprotect JMP A4734 * * A4764 ABS @WPRFL sbr >13: rename JNE A4722 =============== MOV @>8350,8 old name->pab buffer BL @A4694 BL @A548C find file JMP A478A not found MOV @HEADER,@RWFL save header's sector # AI 6,>000C check if protected MOVB *6,0 COC @H0800,0 JNE A4790 no A478A MOVB @HC0,0 error JMP A4736 A4790 BL @A4690 new name->pab buffer BL @A548C find file JMP A479C JMP A478A already exists A479C MOV @RWFL,@HEADER BL @A5466 point to old file header LI 1,FILNAM copy file name LI 2,>000A A47AE MOVB *1+,*6+ DEC 2 JNE A47AE BL @A54DC count files BL @A53AA put ptr in alphabetical order JMP A4734 done * * A47BE BL @A4690 sbr >14: input LI 11,A4550 ============== copy filename, save ret A47C6 MOV 11,@A483E+2 entry point from dsr BL @A548C find file JMP A4800 not found MOVB @>8350,10 file info ptr SRL 10,8 AI 10,>8300 in scratch-pad MOVB @>834D,5 opcode JNE A4808 C *10+,*10+ code 0: tranfer file parameters AI 6,>000C ----------------------- MOV *6+,*10 status + rec/sect DECT 10 MOV *6+,*10+ # of first sect INCT 10 MOV *6+,*10+ eof offset + rec length MOV *6,*10 # of rec alloc MOV @>8356,@>834E ptr to file name MOVB @HFF00,@>834D >ff JMP A483A done A4800 MOVB @HC0,@>8350 error JMP A483E A4808 SRL 5,8 # of sectors to read CLR @>834C -------------------- MOV *10+,8 data buffer address MOV *10,3 first sector to read (in file) A4812 BL @A5466 point to file header BL @A5670 find sector # in drive MOV 4,6 JEQ A483A past eof C 6,@DRIVSZ check drive size JHE A4800 outside: error BL @A546A point to sector LI 0,>0100 256 bytes BL @A46D2 read INC 3 INC @>834C DEC 5 next sector? JNE A4812 yes A483A CLR @>8350 A483E B @0000 address may vary * * A4842 BL @A4690 sbr >15: output LI 11,A4550 =============== copy name A484A MOV 11,@A483E+2 save return, entry point from open ABS @WPRFL JEQ A485C A4854 MOVB @H2000,@>8350 error: write protected JMP A483E A485C BL @A548C find file CLR 8 not found MOVB @>834D,5 JEQ A48AA code 0: create file ABS 8 JEQ A4800 write: error if not found MOVB @>8350,10 file info ptr SRL 10,8 AI 10,>8300 in scratch pad SRL 5,8 # of sector to write CLR @>834C MOV *10+,8 data buffer address MOV *10,3 first sector to write A4880 BL @A5466 point to file header BL @A5670 find sector # in drive MOV 4,6 JEQ A483A past eof: return C 6,@DRIVSZ check drive size JHE A4800 outside: error BL @A546A point to sector LI 0,>0100 256 bytes BL @A46B0 write INC 3 INC @>834C DEC 5 next sector? JNE A4880 yes JMP A483A done A48AA ABS 8 create file with params JNE A48D8 ------ already exists BL @A54DC count files in drive CI 11,>007F JEQ A48C2 list is full BL @A563C find a free sector MOV 1,@HEADER save its # JNE A48CA 0= none is free A48C2 MOVB @H8000,@>8350 error >80: memory full JMP A483E A48CA INC @NBOFIL increment # of files SETO @FLAG do not remove that pointer BL @A53AE alpha-sort pointers list JMP A48EE A48D8 BL @A5466 copy parameters AI 6,>000C point to file header MOVB *6,0 COC @H0800,0 write protected ? JEQ A4854 yes BL @A56E4 update bitmap SZCB 7,*6 data: mark file sectors as free A48EE MOV @HEADER,0 BL @A5436 find header in bitmap SOCB 7,*6 mark as used BL @A5466 point to file header MOV 6,1 clear 128 bytes LI 2,>0080 A4902 CLR *1+ DEC 2 JNE A4902 LI 1,>000A copy file name LI 2,FILNAM A4910 MOVB *2+,*6+ DEC 1 JNE A4910 CLR *6+ MOVB @>8350,1 file parameters SRL 1,8 AI 1,>8304 MOV *1+,*6+ status + rec/sect CLR *6+ first sector MOV *1+,*6+ eof + rec length MOV *1+,*6 # of rec alloc MOVB @>8350,0 SRL 0,8 AI 0,>8302 MOV *0,9 sectors to write JNE A495A A4938 BL @A56E4 0: parameter passing SOCB 7,*6 mark file sectors as used MOVB @>8350,0 SRL 0,8 AI 0,>8302 file parameters: # of first sector BL @A5466 point to file header AI 6,>000E MOV *0,*6 write first sector # B @A483A done A4956 B @A48C2 to mem full error A495A BL @A5466 write sectors: point to header AI 6,>001C ----- offset list MOV 6,10 r10 cluster pointer CLR 8 first sector in cluster LI 1,>0002 current sector in file CLR 2 offset in cluster A496C MOV 1,0 BL @A5436 find sector in bitmap MOVB *6,0 CZC 7,0 test if free JEQ A49AA free: add it to cluster MOV 8,8 used: new cluster JEQ A49A0 this one is empty: next sector A497C BL @A5466 point to file header A 1,2 r1 current sector S 8,2 r8 first sector in cluster MOV 2,3 r2 offset MOV 9,9 JEQ A498C last DEC 3 adjust offset A498C BL @A572E write cluster def *10+ CLR 8 new cluster flag MOV 9,9 JEQ A4938 done: update bitmap S 6,10 r6: point to file header CI 10,>00FF JGT A4956 error: header full A 6,10 A49A0 INC 1 C 1,@DRIVSZ check drive size JHE A4956 error: drive full JMP A496C next sector A49AA MOV 8,8 adjacent to previous sector JNE A49B0 MOV 1,8 first sector in cluster A49B0 DEC 9 JEQ A497C done JMP A49A0 next sector *