enter();
FATAL EXCEPTION! MEMORY DUMP: PUSH ES PUSH DS PUSH BP PUSH DI PUSH SI PUSH DX PUSH CX PUSH BX PUSH AX IF DSKTEST MOV AX,CS:[SPSAVE] MOV CS:[NSP],AX MOV AX,CS:[SSSAVE] MOV CS:[NSS],AX POP AX PUSH AX ENDIF MOV CS:[SPSAVE],SP MOV CS:[SSSAVE],SS MOV SP,CS MOV SS,SP REDISP: MOV SP,OFFSET DOSGROUP:IOSTACK MOV BL,AH MOV BH,0 SHL BX,1 CLD CMP AH,12 JLE SAMSTK MOV SP,OFFSET DOSGROUP:DSKSTACK SAMSTK: CALL CS:[BX+DISPATCH] LEAVE: CLI MOV SP,CS:[SPSAVE] MOV SS,CS:[SSSAVE] MOV BP,SP MOV BYTE PTR [BP.AXSAVE],AL IF DSKTEST MOV AX,CS:[NSP] MOV CS:[SPSAVE],AX MOV AX,CS:[NSS] MOV CS:[SSSAVE],AX ENDIF POP AX POP BX POP CX POP DX POP SI POP DI POP BP POP DS POP ES IRET DW CONIN DW CONOUT DW READER DW PUNCH DW RAWIO DW RAWINP DW IN DW PRTBUF DW CONSTAT DW FLUSHKB DW DSKRESET DW SELDSK DW CLOSE DW SRCHFRST DW SRCHNXT DW DELETE DW SEQWRT DW CREATE DW RENAME DW INUSE DW SETDMA DW GETFATPT DW GETFATPTDL DW GETRDONLY DW GETDSKPT DW USERCODE DW RNDRD DW RNDWRT DW SETRNDREC DW SETVECT DW NEWBASE DW BLKRD DW MAKEFCB DW GETDATE DW SETDATE DW GETTIME DW VERIFY INUSE: GETIO: SETIO: GETRDONLY: SETATTRIB: USERCODE: MOV AL,0 RET VERIFY: AND AL,1 MOV CS:VERFLG,AL RET FLUSHKB: PUSH AX CALL FAR PTR BIOSFLUSH POP AX MOV AH,AL CMP AL,1 JZ REDISPJ CMP AL,6 JZ REDISPJ CMP AL,7 JZ REDISPJ CMP AL,8 JZ REDISPJ CMP AL,10 JZ REDISPJ MOV AL,0 RET REDISPJ:JMP REDISP READER: AUXIN: CALL STATCHK CALL FAR PTR BIOSAUXIN RET PUNCH: MOV AL,DL AUXOUT: PUSH AX CALL STATCHK POP AX CALL FAR PTR BIOSAUXOUT RET UNPACK: CMP BX,[BP.MAXCLUS] JA HURTFAT LEA DI,[SI+BX] SHR BX,1 MOV DI,[DI+BX] JNC HAVCLUS SHR DI,1 SHR DI,1 SHR DI,1 SHR DI,1 STC HAVCLUS: RCL BX,1 AND DI,0FFFH RET HURTFAT: PUSH AX CALL FATAL RET PACK: MOV DI,BX SHR BX,1 ADD BX,SI ADD BX,DI SHR DI,1 MOV DI,[BX] JNC ALIGNED SHL DX,1 SHL DX,1 SHL DX,1 SHL DX,1 AND DI,0FH JMP SHORT PACKIN ALIGNED: AND DI,0F000H PACKIN: OR DI,DX MOV [BX],DI RET DEVNAME: LOOKIO: MOV DI,OFFSET DOSGROUP:NAME1 DEC BH JNZ LOOKIO CRET: RET IOCHK: IF IBM JNZ NOTCOM1 NOTCOM1: ENDIF NEG BH MOV AX,2020H JNZ CRET GETFILE: CALL MOVNAME JC RET1 PUSH DX PUSH DS CALL FINDNAME POP ES POP DI RET2: RET GETNAME: CALL MOVNAME FINDNAME: MOV AX,CS MOV DS,AX CALL DEVNAME JNC RET2 CALL STARTSRCH CONTSRCH: CALL GETENTRY JC RET2 SRCH: MOV AH,BYTE PTR [BX] JZ FREE JZ FREE MOV SI,BX MOV DI,OFFSET DOSGROUP:NAME1 MOV CX,11 WILDCRD: REPE CMPSB JZ FOUND CMP BYTE PTR [DI-1],"?" JZ WILDCRD NEXTENT: CALL NEXTENTRY JNC SRCH RET3: RET FREE: MOV CX,[LASTENT] MOV [ENTFREE],CX TSTALL: RET FOUND: NOT AH ADD SI,15 JZ RET3 RET GETENTRY: MOV AX,[LASTENT] CMP AX,[BP.MAXENT] JAE NONE GETENT: MOV [LASTENT],AX MOV CL,4 SHL AX,CL XOR DX,DX SHL AX,1 MOV BX,[BP.SECSIZ] DIV BX CMP AX,[DIRBUFID] JZ HAVDIRBUF PUSH BX CALL DIRREAD POP BX HAVDIRBUF: MOV DX,OFFSET DOSGROUP:DIRBUF ADD BX,DX ADD DX,[BP.SECSIZ] RET NEXTENTRY: MOV DI,[LASTENT] INC DI CMP DI,[BP.MAXENT] JAE NONE MOV [LASTENT],DI ADD BX,32 CMP BX,DX JB HAVIT CALL DIRREAD POP DX MOV BX,OFFSET DOSGROUP:DIRBUF HAVIT: CLC RET NONE: CALL CHKDIRWRITE STC RET4: RET CALL MOVNAME MOV AL,-1 JC RET4 MOV AL,CS:[ATTRIB] JNZ NOTALL MOV CX,11 MOV AL,"?" MOV DI,OFFSET DOSGROUP:NAME1 JNZ NOTALL NOTALL: CALL FINDNAME MOV AL,-1 JC RET4 DELFILE: MOV BYTE PTR [DIRTYDIR],-1 MOV AH,[DELALL] MOV BYTE PTR [BX],AH MOV BX,[SI] MOV SI,[BP.FAT] OR BX,BX JZ DELNXT CMP BX,[BP.MAXCLUS] JA DELNXT CALL RELEASE DELNXT: CALL CONTSRCH JNC DELFILE CALL FATWRT CALL CHKDIRWRITE XOR AL,AL RET CALL MOVNAME JC ERRET ADD SI,5 MOV DI,OFFSET DOSGROUP:NAME2 CALL LODNAME CALL FINDNAME JC ERRET MOV SI,OFFSET DOSGROUP:NAME1 MOV DI,OFFSET DOSGROUP:NAME3 RENFIL: MOV DI,OFFSET DOSGROUP:NAME1 MOV SI,OFFSET DOSGROUP:NAME2 MOV CX,11 NEWNAM: LODSB CMP AL,"?" JNZ NOCHG MOV AL,[BX] NOCHG: STOSB INC BX LOOP NEWNAM JNC RENERR POP AX MOV DI,BX MOV SI,OFFSET DOSGROUP:NAME1 MOV CX,5 MOVSB MOV SI,OFFSET DOSGROUP:NAME3 MOV DI,OFFSET DOSGROUP:NAME1 CALL CONTSRCH JNC RENFIL CALL CHKDIRWRITE XOR AL,AL RET RENERR: CALL CHKDIRWRITE ERRET: MOV AL,-1 RET5: RET MOVNAME: MOV AX,CS MOV ES,AX MOV DI,OFFSET DOSGROUP:NAME1 MOV SI,DX LODSB JNZ HAVATTRB HAVATTRB: CALL GETTHISDRV LODNAME: JZ RET5 MOV CX,11 MOVCHK: CALL GETLET JB RET5 JNZ RET5 STOLET: STOSB LOOP MOVCHK RET6: RET GETTHISDRV: CMP CS:[NUMDRV],AL JC RET6 DEC AL JNS PHYDRV MOV AL,CS:[CURDRV] PHYDRV: MOV CS:[THISDRV],AL RET CALL GETFILE DOOPEN: JC ERRET MOV AL,[THISDRV] INC AX STOSB XOR AX,AX IF ZEROEXT ADD DI,11 ENDIF IF NOT ZEROEXT ENDIF MOVSW MOV AL,[BP.DEVNUM] OR AL,40H STOSB XOR AX,AX RET OPENDEV: XOR AX,AX MOV AL,128 XOR AX,AX STOSW CALL DATE16 XCHG AX,DX STOSB RET FATERR: CALL FATAL1 JMP SHORT FATREAD STARTSRCH: MOV AX,-1 MOV [LASTENT],AX MOV [ENTFREE],AX FATREAD: MOV AL,[THISDRV] JC FATERR CALL GETBP MOV SI,[BP.FAT] JNZ MAPDRV MOV AH,1 JZ MAPDRV NEWDSK: MOV WORD PTR [BUFDRVNO],00FFH BUFOK: MOV [DIRBUFID],-1 CALL FIGFAT NEXTFAT: PUSH AX CALL DSKREAD POP AX JC BADFAT SUB AL,[BP.FATCNT] JZ NEWFAT CALL FATWRT NEWFAT: MOV SI,[BP.FAT] MOV AL,[BP.DEVNUM] CALL FAR PTR BIOSMAPDEV MOV AH,0 MAPDRV: GETBP: CMP AL,[NUMIO] CMC JC RET7 PUSH AX MOV AH,DPBSIZ MUL AH ADD BP,AX POP AX RET7: RET BADFAT: MOV CX,DI ADD DX,CX DEC AL JNZ NEXTFAT JMP SHORT NEWFAT OKRET1: MOV AL,0 RET MOV DI,DX JNZ NORMFCB3 ADD DI,7 NORMFCB3: CMP AX,CS:WORD PTR [BUFDRVNO] JNZ FNDDIR PUSH DX PUSH DS PUSH CS POP DS MOV BYTE PTR [DIRTYBUF],0 MOV BX,[BUFFER] MOV CX,1 MOV DX,[BUFSECNO] MOV BP,[BUFDRVBP] CALL DWRITE POP DS POP DX FNDDIR: CALL GETFILE BADCLOSEJ: JC BADCLOSE MOV CX,ES:[DI.FIRCLUS] MOV [SI],CX MOV DX,ES:WORD PTR [DI.FILSIZ] MOV [SI+2],DX MOV DX,ES:WORD PTR [DI.FILSIZ+2] MOV [SI+4],DX MOV DX,ES:[DI.FDATE] MOV [SI-2],DX MOV DX,ES:[DI.FTIME] MOV [SI-4],DX CALL DIRWRITE CHKFATWRT: MOV SI,[BP.FAT] MOV AL,[BP.DEVNUM] MOV AH,1 JNZ OKRET FATWRT: CALL FIGFAT MOV BYTE PTR [BX-1],0 EACHFAT: PUSH DX PUSH CX PUSH BX PUSH AX CALL DWRITE POP AX POP BX POP CX POP DX ADD DX,CX DEC AL JNZ EACHFAT OKRET: MOV AL,0 RET BADCLOSE: MOV SI,[BP.FAT] MOV BYTE PTR [SI-1],0 MOV AL,-1 RET FIGFAT: MOV AL,[BP.FATCNT] MOV BX,[BP.FAT] MOV CH,0 RET DIRCOMP: CBW ADD AX,[BP.FIRDIR] MOV DX,AX MOV BX,OFFSET DOSGROUP:DIRBUF MOV CX,1 RET CALL MOVNAME JC ERRET3 MOV DI,OFFSET DOSGROUP:NAME1 MOV CX,11 MOV AL,"?" REPNE SCASB JZ ERRET3 MOV CS:BYTE PTR [CREATING],-1 PUSH DX PUSH DS CALL FINDNAME JNC EXISTENT CMP AX,-1 JZ ERRPOP JMP SHORT FREESPOT ERRPOP: POP DS POP DX ERRET3: MOV AL,-1 RET EXISTENT: JCXZ FREESPOT CMP CX,[BP.MAXCLUS] JA FREESPOT PUSH BX MOV BX,CX MOV SI,[BP.FAT] CALL FATWRT POP BX FREESPOT: MOV DI,BX MOV SI,OFFSET DOSGROUP:NAME1 MOV CX,5 MOVSB REP MOVSW MOV AL,[ATTRIB] STOSB XOR AX,AX MOV CL,5 REP STOSW CALL DATE16 XCHG AX,DX STOSW XCHG AX,DX STOSW XOR AX,AX PUSH DI MOV CL,6 SMALLENT: REP STOSB PUSH BX CALL DIRWRITE POP BX POP SI OPENJMP: POP ES POP DI JMP DOOPEN DIRREAD: PUSH AX CALL CHKDIRWRITE POP AX PUSH AX MOV AH,[BP.DEVNUM] MOV [DIRBUFID],AX CALL DIRCOMP CALL DREAD POP AX RET8: RET DREAD: CALL DSKREAD JNC RET8 MOV CS:BYTE PTR [READOP],0 CALL HARDERR JZ DREAD HARDERR: PUSH DX POP DX JB ERRINT JB ERRINT INC AH JB ERRINT ERRINT: OR AH,CS:[READOP] FATAL: FATAL1: MOV CS:[CONTSTK],SP MOV SS,CS:[SSSAVE] MOV CS:[SPSAVE],SP MOV CS:[SSSAVE],SS MOV SP,CS MOV SS,SP MOV SP,CS:[CONTSTK] STI POP BP CMP AL,2 JZ ERROR RET DSKREAD: MOV AL,[BP.DEVNUM] PUSH BP PUSH BX PUSH CX PUSH DX CALL FAR PTR BIOSREAD POP DX POP DI POP BX POP BP RET9: RET CHKDIRWRITE: TEST BYTE PTR [DIRTYDIR],-1 JZ RET9 DIRWRITE: MOV BYTE PTR [DIRTYDIR],0 MOV AL,BYTE PTR [DIRBUFID] CALL DIRCOMP DWRITE: MOV AL,[BP.DEVNUM] MOV AH,CS:VERFLG PUSH BP PUSH BX PUSH CX PUSH DX CALL FAR PTR BIOSWRITE POP DX POP DI POP BX POP BP JNC RET9 MOV CS:BYTE PTR [READOP],1 CALL HARDERR JZ DWRITE RET ABORT: LDS SI,CS:DWORD PTR [SPSAVE] MOV DS,[SI.CSSAVE] XOR AX,AX MOV ES,AX MOV SI,SAVEXIT MOV DI,EXIT MOVSW MOVSW MOVSW MOVSW MOVSW MOVSW ERROR: MOV AX,CS MOV DS,AX MOV ES,AX CALL WRTFATS XOR AX,AX CLI MOV SS,[SSSAVE] MOV SP,[SPSAVE] MOV DS,AX MOV SI,EXIT MOV DI,OFFSET DOSGROUP:EXITHOLD MOVSW MOVSW POP AX POP BX POP CX POP DX POP SI POP DI POP BP POP DS POP ES JMP CS:DWORD PTR [EXITHOLD] CALL GETREC CALL LOAD JMP SHORT FINSEQ CALL GETREC CALL STORE FINSEQ: JCXZ SETNREX ADD AX,1 ADC DX,0 JMP SHORT SETNREX CALL GETRRPOS1 CALL LOAD JMP SHORT FINRND CALL GETRRPOS1 CALL STORE JMP SHORT FINRND CALL GETRRPOS CALL LOAD JMP SHORT FINBLK CALL GETRRPOS CALL STORE FINBLK: LDS SI,DWORD PTR [SPSAVE] MOV [SI.CXSAVE],CX JCXZ FINRND ADD AX,1 ADC DX,0 FINRND: MOV ES:WORD PTR [DI.RR],AX MOV ES:[DI.RR+2],DL OR DH,DH JZ SETNREX SETNREX: MOV CX,AX AND AL,7FH MOV ES:[DI.NR],AL AND CL,80H SHL CX,1 RCL DX,1 MOV AL,CH MOV AH,DL MOV ES:[DI.EXTENT],AX MOV AL,CS:[DSKERR] RET GETRRPOS1: MOV CX,1 GETRRPOS: MOV DI,DX CMP BYTE PTR [DI],-1 JNZ NORMFCB1 ADD DI,7 NORMFCB1: MOV AX,WORD PTR [DI.RR] MOV DX,WORD PTR [DI.RR+2] RET NOFILERR: XOR CX,CX MOV BYTE PTR [DSKERR],4 POP BX RET SETUP: PUSH AX MOV AL,[DI] DEC AL MOV CS:[THISDRV],AL MOV AL,[DI.DEVID] MOV SI,[DI.RECSIZ] OR SI,SI JNZ HAVRECSIZ MOV SI,128 MOV [DI.RECSIZ],SI HAVRECSIZ: PUSH DS PUSH CS JNS NOTDEVICE NOTDEVICE: CALL GETBP POP AX JC NOFILERR JB SMALREC SMALREC: MOV [RECCNT],CX MOV WORD PTR [RECPOS],AX MOV WORD PTR [RECPOS+2],DX MOV [FCB],DI MOV BX,[DMAADD] MOV [NEXTADD],BX MOV BYTE PTR [DSKERR],0 MOV BYTE PTR [TRANS],0 MOV BX,DX MUL SI MOV WORD PTR [BYTPOS],AX PUSH DX MOV AX,BX MUL SI POP BX ADD AX,BX JNZ EOFERR MOV WORD PTR [BYTPOS+2],AX MOV DX,AX MOV AX,WORD PTR [BYTPOS] MOV BX,[BP.SECSIZ] JNC EOFERR DIV BX MOV [SECPOS],AX MOV [BYTSECPOS],DX MOV DX,AX AND AL,[BP.CLUSMSK] MOV [SECCLUSPOS],AL MOV CL,[BP.CLUSSHFT] SHR DX,CL MOV [CLUSNUM],DX MOV CX,AX ADC DX,0 MOV AX,[DMAADD] PARTSEG: XOR DX,DX MOV [RECCNT],AX MOV CX,AX JCXZ NOROOM OK: MOV BL,ES:[DI.DEVID] MOV SI,[BP.FAT] RET EOFERR: MOV BYTE PTR [DSKERR],1 XOR CX,CX NOROOM: RET BREAKDOWN: MOV AX,[BYTSECPOS] MOV BX,CX OR AX,AX SUB AX,[BP.SECSIZ] JAE SAVFIR SAVFIR: MOV [BYTCNT1],AX MOV AX,BX XOR DX,DX MOV [SECCNT],AX RET10: RET FNDCLUS: MOV BX,ES:[DI.LSTCLUS] MOV DX,ES:[DI.CLUSPOS] OR BX,BX JZ NOCLUS SUB CX,DX JNB FINDIT ADD CX,DX XOR DX,DX MOV BX,ES:[DI.FIRCLUS] FINDIT: JCXZ RET10 SKPCLP: CALL UNPACK CMP DI,0FF8H JAE RET10 XCHG BX,DI INC DX LOOP SKPCLP RET NOCLUS: INC CX DEC DX RET BUFSEC: MOV DX,[CLUSNUM] MOV BL,[SECCLUSPOS] CALL FIGREC MOV [PREREAD],AL CMP DX,[BUFSECNO] JNZ GETSEC MOV AL,[BUFDRVNO] CMP AL,[THISDRV] GETSEC: XOR AL,AL OR AL,AL JZ RDSEC PUSH DX PUSH BP MOV BP,[BUFDRVBP] MOV BX,[BUFFER] MOV CX,1 MOV DX,[BUFSECNO] CALL DWRITE POP BP POP DX RDSEC: TEST BYTE PTR [PREREAD],-1 JNZ SETBUF XOR AX,AX DEC AX MOV [BUFDRVNO],AL MOV BX,[BUFFER] MOV CX,1 PUSH DX CALL DREAD POP DX SETBUF: MOV [BUFSECNO],DX MOV AL,[THISDRV] MOV [BUFDRVNO],AL MOV [BUFDRVBP],BP FINBUF: MOV DI,[NEXTADD] MOV SI,DI MOV CX,[BYTCNT1] ADD SI,CX MOV [NEXTADD],SI MOV SI,[BUFFER] ADD SI,[BYTSECPOS] RET BUFRD: CALL BUFSEC PUSH ES MOV ES,[DMAADD+2] SHR CX,1 JNC EVENRD MOVSB EVENRD: REP MOVSW POP ES RET BUFWRT: MOV AX,[SECPOS] MOV [SECPOS],AX MOV AL,1 MOV AL,0 NOREAD: CALL BUFSEC XCHG DI,SI PUSH DS PUSH ES PUSH CS POP ES MOV DS,[DMAADD+2] SHR CX,1 JNC EVENWRT MOVSB EVENWRT: REP MOVSW POP ES POP DS MOV BYTE PTR [DIRTYBUF],1 RET NEXTSEC: TEST BYTE PTR [TRANS],-1 JZ CLRET MOV AL,[SECCLUSPOS] INC AL CMP AL,[BP.CLUSMSK] JBE SAVPOS MOV BX,[CLUSNUM] CMP BX,0FF8H JAE NONEXT MOV SI,[BP.FAT] CALL UNPACK MOV [CLUSNUM],DI INC [LASTPOS] MOV AL,0 SAVPOS: MOV [SECCLUSPOS],AL CLRET: CLC RET NONEXT: STC RET TRANBUF: LODSB STOSB JNZ NORMCH MOV BYTE PTR [SI],10 NORMCH: CMP AL,10 LOOPNZ TRANBUF JNZ ENDRDCON XOR SI,SI OR CX,CX JNZ GETBUF ENDRDCON: MOV [CONTPOS],SI ENDRDDEV: MOV [NEXTADD],DI POP ES MOV DI,[FCB] SETFCBJ: JMP SETFCB READDEV: PUSH ES LES DI,DWORD PTR [DMAADD] INC BL JZ READCON INC BL JNZ ENDRDDEV READAUX: CALL AUXIN STOSB CMP AL,1AH LOOPNZ READAUX JMP SHORT ENDRDDEV READCON: PUSH CS POP DS MOV SI,[CONTPOS] OR SI,SI JNZ TRANBUF CMP BYTE PTR [CONBUF],128 JZ GETBUF GETBUF: PUSH CX PUSH ES PUSH DI MOV DX,OFFSET DOSGROUP:CONBUF POP DI POP ES POP CX MOV SI,2 + OFFSET DOSGROUP:CONBUF JNZ TRANBUF MOV AL,1AH STOSB MOV AL,10 XOR SI,SI JMP SHORT ENDRDCON RDERR: XOR CX,CX JMP WRTERR RDLASTJ:JMP RDLAST LOAD: CALL SETUP JS READDEV MOV AX,ES:WORD PTR [DI.FILSIZ] MOV BX,ES:WORD PTR [DI.FILSIZ+2] SUB AX,WORD PTR [BYTPOS] SBB BX,WORD PTR [BYTPOS+2] JB RDERR JNZ ENUF OR AX,AX JZ RDERR CMP AX,CX JAE ENUF MOV CX,AX ENUF: CALL BREAKDOWN MOV CX,[CLUSNUM] CALL FNDCLUS OR CX,CX JNZ RDERR MOV [LASTPOS],DX MOV [CLUSNUM],BX CMP [BYTCNT1],0 JZ RDMID CALL BUFRD RDMID: CMP [SECCNT],0 JZ RDLASTJ CALL NEXTSEC JC SETFCB ONSEC: MOV DL,[SECCLUSPOS] MOV CX,[SECCNT] MOV BX,[CLUSNUM] RDLP: CALL OPTIMIZE PUSH DI PUSH AX PUSH DS MOV DS,[DMAADD+2] PUSH DX PUSH BX CALL DREAD POP DS NEG AX MOV CX,[BP.SECSIZ] ADD DI,AX MOV SI,[BUFFER] PUSH ES SHR CX,1 REP MOVSW JNC EVENMOV MOVSB EVENMOV: POP ES NOTBUFFED: POP CX POP BX JCXZ RDLAST CMP BX,0FF8H JAE SETFCB MOV DL,0 JMP SHORT RDLP SETFCB: MOV SI,[FCB] MOV AX,[NEXTADD] MOV DI,AX XOR DX,DX MOV CX,ES:[SI.RECSIZ] JZ FULLREC MOV BYTE PTR [DSKERR],1 OR DX,DX PUSH ES MOV ES,[DMAADD+2] SHR CX,1 JNC EVENFIL STOSB EVENFIL: REP STOSW POP ES FULLREC: MOV CX,AX SETCLUS: MOV AX,[CLUSNUM] MOV ES:[DI.LSTCLUS],AX MOV AX,[LASTPOS] MOV ES:[DI.CLUSPOS],AX ADDREC: MOV AX,WORD PTR [RECPOS] MOV DX,WORD PTR [RECPOS+2] DEC CX ADC DX,0 INC CX RET28: RET RDLAST: MOV AX,[BYTCNT2] OR AX,AX JZ SETFCB MOV [BYTCNT1],AX CALL NEXTSEC JC SETFCB MOV [BYTSECPOS],0 CALL BUFRD JMP SHORT SETFCB WRTDEV: PUSH DS LDS SI,DWORD PTR [DMAADD] OR BL,40H INC BL JZ WRTCON INC BL JZ WRTAUX INC BL WRTLST: LODSB CMP AL,1AH JZ ENDWRDEV CALL LISTOUT LOOP WRTLST JMP SHORT ENDWRDEV WRTAUX: LODSB CALL AUXOUT CMP AL,1AH LOOPNZ WRTAUX JMP SHORT ENDWRDEV WRTCON: LODSB CMP AL,1AH JZ ENDWRDEV CALL OUT LOOP WRTCON ENDWRDEV: POP DS MOV CX,[RECCNT] MOV DI,[FCB] JMP SHORT ADDREC HAVSTART: MOV CX,AX CALL SKPCLP JCXZ DOWRTJ CALL ALLOCATE JNC DOWRTJ WRTERR: MOV BYTE PTR [DSKERR],1 LVDSK: MOV AX,WORD PTR [RECPOS] MOV DX,WORD PTR [RECPOS+2] MOV DI,[FCB] RET DOWRTJ: JMP DOWRT WRTEOFJ: JMP WRTEOF STORE: CALL SETUP CALL DATE16 MOV ES:[DI.FDATE],AX MOV ES:[DI.FTIME],DX OR BL,BL JS WRTDEV MOV ES:[DI.DEVID],BL CALL BREAKDOWN MOV AX,WORD PTR [BYTPOS] MOV DX,WORD PTR [BYTPOS+2] JCXZ WRTEOFJ DEC CX ADD AX,CX MOV CL,[BP.CLUSSHFT] PUSH AX MOV AX,ES:WORD PTR [DI.FILSIZ] MOV DX,ES:WORD PTR [DI.FILSIZ+2] DIV [BP.SECSIZ] OR DX,DX JZ NORNDUP NORNDUP: POP AX CALL FNDCLUS MOV [CLUSNUM],BX MOV [LASTPOS],DX MOV CX,AX CALL ALLOCATE POP AX JC WRTERR MOV CX,AX MOV DX,[LASTPOS] INC DX DEC CX JZ NOSKIP CALL SKPCLP NOSKIP: MOV [CLUSNUM],BX MOV [LASTPOS],DX DOWRT: CMP [BYTCNT1],0 JZ WRTMID MOV BX,[CLUSNUM] CALL BUFWRT WRTMID: MOV AX,[SECCNT] OR AX,AX JZ WRTLAST ADD [SECPOS],AX CALL NEXTSEC MOV DL,[SECCLUSPOS] MOV BX,[CLUSNUM] MOV CX,[SECCNT] WRTLP: CALL OPTIMIZE NOTINBUF: PUSH DI PUSH AX PUSH DS MOV DS,[DMAADD+2] CALL DWRITE POP DS POP CX POP BX JCXZ WRTLAST MOV DL,0 JMP SHORT WRTLP WRTLAST: MOV AX,[BYTCNT2] OR AX,AX JZ FINWRT MOV [BYTCNT1],AX CALL NEXTSEC MOV [BYTSECPOS],0 CALL BUFWRT FINWRT: MOV AX,[NEXTADD] SUB AX,[DMAADD] ADD AX,WORD PTR [BYTPOS] MOV DX,WORD PTR [BYTPOS+2] ADC DX,0 MOV CX,DX MOV DI,[FCB] CMP AX,ES:WORD PTR [DI.FILSIZ] SBB CX,ES:WORD PTR [DI.FILSIZ+2] JB SAMSIZ MOV ES:WORD PTR [DI.FILSIZ],AX MOV ES:WORD PTR [DI.FILSIZ+2],DX SAMSIZ: MOV CX,[RECCNT] JMP SETCLUS WRTERRJ:JMP WRTERR WRTEOF: MOV CX,AX OR CX,DX JZ KILLFIL SUB AX,1 SBB DX,0 DIV [BP.SECSIZ] MOV CL,[BP.CLUSSHFT] SHR AX,CL MOV CX,AX CALL FNDCLUS JCXZ RELFILE CALL ALLOCATE JC WRTERRJ UPDATE: MOV DI,[FCB] MOV AX,WORD PTR [BYTPOS] MOV ES:WORD PTR [DI.FILSIZ],AX MOV AX,WORD PTR [BYTPOS+2] MOV ES:WORD PTR [DI.FILSIZ+2],AX XOR CX,CX JMP ADDREC RELFILE: MOV DX,0FFFH CALL RELBLKS SETDIRT: MOV BYTE PTR [SI-1],1 JMP SHORT UPDATE KILLFIL: XOR BX,BX XCHG BX,ES:[DI.FIRCLUS] OR BX,BX JZ UPDATE CALL RELEASE JMP SHORT SETDIRT OPTIMIZE: PUSH DX PUSH BX MOV AL,[BP.CLUSMSK] MOV AH,AL MOV DX,CX MOV SI,[BP.FAT] MOV CX,0 OPTCLUS: CALL UNPACK ADD CL,AL ADC CH,0 CMP CX,DX JAE BLKDON MOV AL,AH INC BX CMP DI,BX JZ OPTCLUS DEC BX FINCLUS: PUSH DX MOV AX,CX MOV SI,[NEXTADD] MOV [NEXTADD],AX ADD [LASTPOS],BX CALL FIGREC MOV BX,SI CMP [BUFSECNO],DX MOV SI,DX CMP [BUFSECNO],SI CMC PUSH AX MOV AL,[BP.DEVNUM] POP AX RET100: RET BLKDON: MOV [SECCLUSPOS],AH JMP SHORT FINCLUS FIGREC: PUSH CX MOV CL,[BP.CLUSSHFT] DEC DX DEC DX SHL DX,CL OR DL,BL ADD DX,[BP.FIRREC] POP CX RET GETREC: MOV DI,DX JNZ NORMFCB2 ADD DI,7 NORMFCB2: MOV CX,1 MOV AL,[DI.NR] MOV DX,[DI.EXTENT] SHL AL,1 SHR DX,1 RCR AL,1 MOV AH,DL MOV DL,DH MOV DH,0 RET ALLOCATE: PUSH [SI] PUSH DX PUSH CX PUSH BX MOV AX,BX ALLOC: MOV DX,BX FINDFRE: INC BX CMP BX,[BP.MAXCLUS] JLE TRYOUT CMP AX,1 JG TRYIN POP BX MOV DX,0FFFH CALL RELBLKS POP DX POP [SI] MOV DL,[BP.CLUSMSK] MOV DH,0 MOV CX,AX JA MAXREC MAXREC: STC RET11: RET TRYOUT: CALL UNPACK JZ HAVFRE TRYIN: DEC AX JLE FINDFRE XCHG AX,BX CALL UNPACK JZ HAVFRE XCHG AX,BX JMP SHORT FINDFRE HAVFRE: XCHG BX,DX MOV AX,DX CALL PACK MOV BX,AX LOOP ALLOC MOV DX,0FFFH CALL PACK MOV BYTE PTR [SI-1],1 POP BX POP DX CALL UNPACK POP [SI] XCHG BX,DI OR DI,DI JNZ RET11 MOV DI,[FCB] MOV ES:[DI.FIRCLUS],BX RET12: RET RELEASE: XOR DX,DX RELBLKS: CALL UNPACK JZ RET12 MOV AX,DI CALL PACK CMP AX,0FF8H MOV BX,AX JB RELEASE RET13: RET GETEOF: CALL UNPACK CMP DI,0FF8H JAE RET13 MOV BX,DI JMP SHORT GETEOF CALL GETFILE SAVPLCE: JC KILLSRCH OR BH,BH JS SRCHDEV MOV AX,[LASTENT] MOV ES:[DI.FILDIRENT],AX MOV ES:[DI.DRVBP],BP MOV SI,BX LES DI,DWORD PTR [DMAADD] MOV AX,00FFH CMP AL,[EXTFCB] JNZ NORMFCB STOSW INC AL STOSW STOSW MOV AL,[ATTRIB] STOSB NORMFCB: MOV AL,[THISDRV] INC AL MOV CX,16 XOR AL,AL RET KILLSRCH: KILLSRCH1 EQU KILLSRCH+1 MOV WORD PTR ES:[DI.FILDIRENT],-1 MOV AL,-1 RET SRCHDEV: MOV ES:[DI.FILDIRENT],BX LES DI,DWORD PTR [DMAADD] XOR AX,AX MOVSW MOVSW MOV AX,2020H STOSB STOSW STOSW XOR AX,AX MOV CX,10 REP STOSW STOSB RET14: RET CALL MOVNAME MOV DI,DX JC NEAR PTR KILLSRCH1 MOV BP,[DI.DRVBP] MOV AX,[DI.FILDIRENT] OR AX,AX JS NEAR PTR KILLSRCH1 PUSH DX PUSH DS PUSH CS POP DS MOV [LASTENT],AX CALL CONTSRCH POP ES POP DI JMP SAVPLCE CALL GETFILE MOV AL,-1 JC RET14 MOV CX,ES:[DI.RECSIZ-33] OR CX,CX JNZ RECOK MOV CX,128 RECOK: XOR AX,AX JS DEVSIZ INC SI DIV CX DIV CX POP DX JZ DEVSIZ INC DX DEVSIZ: STOSW MOV AX,DX STOSB MOV AL,0 CMP CX,64 MOV ES:[DI],AH RET MOV CS:[DMAADD],DX MOV CS:[DMAADD+2],DS RET NOSUCHDRV: MOV AL,-1 RET PUSH CS POP DS MOV AL,DL CALL GETTHISDRV JC NOSUCHDRV CALL FATREAD MOV BX,[BP.FAT] MOV AL,[BP.CLUSMSK] INC AL MOV DX,[BP.MAXCLUS] DEC DX MOV CX,[BP.SECSIZ] LDS SI,DWORD PTR [SPSAVE] MOV [SI.BXSAVE],BX MOV [SI.DXSAVE],DX MOV [SI.CXSAVE],CX MOV [SI.DSSAVE],CS RET PUSH CS POP DS MOV AL,[CURDRV] MOV [THISDRV],AL CALL FATREAD LDS SI,DWORD PTR [SPSAVE] MOV [SI.BXSAVE],BP MOV [SI.DSSAVE],CS RET PUSH CS POP DS WRTFATS: XOR AL,AL XCHG AL,[DIRTYBUF] OR AL,AL JZ NOBUF MOV BP,[BUFDRVBP] MOV DX,[BUFSECNO] MOV BX,[BUFFER] MOV CX,1 CALL DWRITE NOBUF: MOV CL,[NUMIO] MOV CH,0 MOV BP,[DRVTAB] WRTFAT: PUSH CX CALL CHKFATWRT POP CX ADD BP,DPBSIZ LOOP WRTFAT RET MOV AL,CS:[CURDRV] RET15: RET CALL GETREC MOV [DI+33],AX MOV [DI+35],DL CMP [DI.RECSIZ],64 JAE RET15 RET16: RET