Changeset 7258c6a in buchla-68k for libcio/filesys.c
- Timestamp:
- 07/09/2017 04:45:34 PM (7 years ago)
- Branches:
- master
- Children:
- 8618599
- Parents:
- 0292fbb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcio/filesys.c
r0292fbb r7258c6a 29 29 #define DE_NULL ((struct dirent *)0L) 30 30 31 extern short micons(short wi);32 extern long miconl(longwi);33 extern void _ptcl12(u nsigned *fat, unsigned cl, unsignedval);34 extern char *FilName(char *s, char*p);35 extern char *FilExt(char *s, char*p);31 extern int16_t micons(int16_t wi); 32 extern int32_t miconl(int32_t wi); 33 extern void _ptcl12(uint16_t *fat, uint16_t cl, uint16_t val); 34 extern int8_t *FilName(int8_t *s, int8_t *p); 35 extern int8_t *FilExt(int8_t *s, int8_t *p); 36 36 37 37 #if DEBUGIT … … 44 44 struct dirent *_dptr; /* internal directory pointer */ 45 45 46 u nsigned_thefat[MAXFAT * WDPSEC]; /* file allocation table */47 48 int _fatin; /* FAT has been read */49 int _dirin; /* directory has been read */50 int _bpbin; /* BPB has been read */51 int _fatmod; /* FAT modified flag */52 int _dirmod; /* directory modified flag */53 54 long_berrno; /* BIOS error number */46 uint16_t _thefat[MAXFAT * WDPSEC]; /* file allocation table */ 47 48 int16_t _fatin; /* FAT has been read */ 49 int16_t _dirin; /* directory has been read */ 50 int16_t _bpbin; /* BPB has been read */ 51 int16_t _fatmod; /* FAT modified flag */ 52 int16_t _dirmod; /* directory modified flag */ 53 54 int32_t _berrno; /* BIOS error number */ 55 55 56 56 /* … … 66 66 */ 67 67 68 u nsigned _cl2lsn(struct bpb *bpp, unsignedclnum)68 uint16_t _cl2lsn(struct bpb *bpp, uint16_t clnum) 69 69 { 70 70 return(bpp->datrec + (bpp->clsiz * (clnum - 2)) ); … … 78 78 */ 79 79 80 u nsigned _gtcl12(char *fat, unsignedcl)81 { 82 register u nsignedcla, clt;80 uint16_t _gtcl12(int8_t *fat, uint16_t cl) 81 { 82 register uint16_t cla, clt; 83 83 84 84 cla = cl + (cl >> 1); 85 clt = ((u nsigned)0xFF00 & (fat[cla+1] << 8))86 | ((u nsigned)0x00FF & fat[cla]);85 clt = ((uint16_t)0xFF00 & (fat[cla+1] << 8)) 86 | ((uint16_t)0x00FF & fat[cla]); 87 87 88 88 if (cl & 1) 89 89 clt >>= 4; 90 90 91 clt &= (u nsigned)0x0FFF;91 clt &= (uint16_t)0x0FFF; 92 92 return(clt); 93 93 } … … 104 104 */ 105 105 106 u nsigned _getfat(unsigned *bufad, unsignednfat, struct bpb *bpp)107 { 108 u nsignedfatsec;106 uint16_t _getfat(uint16_t *bufad, uint16_t nfat, struct bpb *bpp) 107 { 108 uint16_t fatsec; 109 109 110 110 fatsec = nfat ? bpp->fatrec : (bpp->fatrec - bpp->fsiz); 111 return(BIOS(B_RDWR, 0, ( char*)bufad, bpp->fsiz, fatsec, 0));111 return(BIOS(B_RDWR, 0, (int8_t *)bufad, bpp->fsiz, fatsec, 0)); 112 112 } 113 113 … … 123 123 */ 124 124 125 int _rdfat(unsigned*bufad, struct bpb *bpp)125 int16_t _rdfat(uint16_t *bufad, struct bpb *bpp) 126 126 { 127 127 if (_getfat(bufad, bpp, 0)) { … … 143 143 */ 144 144 145 int _rdroot(unsigned*buf, struct bpb *bpp)146 { 147 return(BIOS(B_RDWR, 0, ( char*)buf, bpp->rdlen,145 int16_t _rdroot(uint16_t *buf, struct bpb *bpp) 146 { 147 return(BIOS(B_RDWR, 0, (int8_t *)buf, bpp->rdlen, 148 148 (bpp->fatrec + bpp->fsiz), 0)); 149 149 } … … 162 162 */ 163 163 164 int _nsic(struct fcb *fcp, struct bpb *bpp, char*fp)165 { 166 register u nsignedtfe;164 int16_t _nsic(struct fcb *fcp, struct bpb *bpp, int8_t *fp) 165 { 166 register uint16_t tfe; 167 167 168 168 /* check the FCB flags */ … … 261 261 struct dirent *_dsrch(struct dirent *de) 262 262 { 263 u nsignedi, dl;263 uint16_t i, dl; 264 264 register struct dirent *dp; 265 265 … … 298 298 struct dirent *_dsnew(void) 299 299 { 300 u nsignedi, dl;300 uint16_t i, dl; 301 301 register struct dirent *dp; 302 302 … … 332 332 */ 333 333 334 void _deadio(struct fcb *fcp, int err)334 void _deadio(struct fcb *fcp, int16_t err) 335 335 { 336 336 fcp->clsec = 0; … … 355 355 */ 356 356 357 int _seek(struct fcb *fcp)358 { 359 register u nsignedacls, rcls, nc;360 u nsignedsic, spc;357 int16_t _seek(struct fcb *fcp) 358 { 359 register uint16_t acls, rcls, nc; 360 uint16_t sic, spc; 361 361 362 362 if (!(fcp->modefl & FC_OPN)) { /* file must be open */ … … 461 461 */ 462 462 463 int _ftrnc(struct dirent *dp)464 { 465 register u nsignedacls, ncls;463 int16_t _ftrnc(struct dirent *dp) 464 { 465 register uint16_t acls, ncls; 466 466 467 467 #if DEBUGIT … … 525 525 */ 526 526 527 int _newcls(void)528 { 529 register int tc, i;527 int16_t _newcls(void) 528 { 529 register int16_t tc, i; 530 530 531 531 tc = _thebpb->numcl; … … 548 548 */ 549 549 550 int _alcnew(struct fcb *fcp)551 { 552 register int ac, nc, pc;550 int16_t _alcnew(struct fcb *fcp) 551 { 552 register int16_t ac, nc, pc; 553 553 554 554 #if DEBUGIT … … 639 639 */ 640 640 641 int _fmake(struct fcb *fcp)641 int16_t _fmake(struct fcb *fcp) 642 642 { 643 643 register struct dirent *dp; … … 664 664 */ 665 665 666 int _opnvol(void)667 { 668 register longdrc;666 int16_t _opnvol(void) 667 { 668 register int32_t drc; 669 669 670 670 /* check for media change if we already have a BPB */ … … 750 750 */ 751 751 752 int _opfcb(struct fcb *fcp)753 { 754 int rc;752 int16_t _opfcb(struct fcb *fcp) 753 { 754 int16_t rc; 755 755 756 756 /* check for an already open FCB */ … … 892 892 */ 893 893 894 int _inifcb(struct fcb *fcp, char *name, char *ext, int mode)895 { 896 int fl;897 register int i;898 register char*s1, *s2, c;894 int16_t _inifcb(struct fcb *fcp, int8_t *name, int8_t *ext, int16_t mode) 895 { 896 int16_t fl; 897 register int16_t i; 898 register int8_t *s1, *s2, c; 899 899 900 900 /* clear the FCB */ 901 901 902 memset(( char*)fcp, 0, sizeof (struct fcb));902 memset((int8_t *)fcp, 0, sizeof (struct fcb)); 903 903 904 904 /* check for valid flags */ … … 1024 1024 */ 1025 1025 1026 int ClsFile(struct fcb *fcp)1026 int16_t ClsFile(struct fcb *fcp) 1027 1027 { 1028 1028 register struct dirent *dp; … … 1136 1136 */ 1137 1137 1138 short fcbinit(char*name, struct fcb *fcp)1139 { 1140 chartmpname[9], tmpext[4];1138 int16_t fcbinit(int8_t *name, struct fcb *fcp) 1139 { 1140 int8_t tmpname[9], tmpext[4]; 1141 1141 1142 1142 return(_inifcb(fcp, FilName(name, tmpname), FilExt(name, tmpext), 0)); … … 1153 1153 */ 1154 1154 1155 int DelFile(struct fcb *fcp)1155 int16_t DelFile(struct fcb *fcp) 1156 1156 { 1157 1157 #if DEBUGIT
Note:
See TracChangeset
for help on using the changeset viewer.