Rev 49 | Blame | Compare with Previous | Last modification | View Log | Download
;length 0 while reading means either absence of files of zero length file (any sector length)readfEXPORT readfreadf.A.=$+1EXPORT readf.A.ld hl,0 ;poi to FCBjr fread1. ;a=data ;keeps bcreadfinEXPORT readfinld hl,[_fin] ;poi to FCBfread1.;a=data;;if ok then inc de?;keeps bcld l,FCB.remain ;0xff = no data, 0xfe = 1 byte, ... 0x00 = 255 bytesld e,[hl]ld d,hinc dinc eld a,[de]ld [hl],e ;inc [hl] ;remainret nzpush bc;push depush hlld l,0ld (readnewbuf.A.),hl ;FCBcall readnewbufpop hl;pop depop bc;ld l,FCB.remainor ajr z,fread1EOF.;hl = poi to remainld l,[hl]inc hld a,[hl];inc deret;EOF - next block doesn't existfread1EOF.ld a,TRUEld [_waseof],ald a,'\n' ;EOF returns '\n';set vars as they were (next time EOF again)dec [hl] ;remain = 0xffretfreadEXPORT freadfread.A.=$+1EXPORT fread.A.ld hl,0 ;poi to data;ld de,0 ;total processed bytesfread.C.=$+1EXPORT fread.C.ld bc,0 ;countfread0.push bcfread.B.=$+1EXPORT fread.B.ld bc,0 ;sizefread00.push hlfread.D.=$+1EXPORT fread.D.ld hl,0 ;poi to FCBcall fread1. ;a=data ;keeps bcpop hlld [hl],ald a,[_waseof]or a ;FALSEjr nz,freadpopret.;cpidb 0xed,0xa1jp pe,fread00.pop bcdec hl;cpidb 0xed,0xa1jp pe,fread0.;ex de,hl ;hl = total processed bytesretfreadpopret.pop bcretwritebyteEXPORT writebytewritebyte.A.=$+1EXPORT writebyte.A.ld hl,0 ;filewritebyte.B.=$+1EXPORT writebyte.B.ld a,0jp fwrite1.writefoutEXPORT writefoutld hl,[_fout]writefout.A.=$+1EXPORT writefout.A.ld a,0;hl = poi to FCB;a=data;keeps bcfwrite1.ld l,FCB.lastlenLSBld e,[hl]ld d,hinc dld [de],ainc [hl] ;lastlen (LSB);Z = end of bufret nzinc linc [hl] ;lastlen (HSB)push bcld l,0ld (flush_.A.),hlcall flush_pop bcretfwriteEXPORT fwritefwrite.A.=$+1EXPORT fwrite.A.ld hl,0 ;poi to data;ld de,0 ;total processed bytes TODOfwrite.C.=$+1EXPORT fwrite.C.ld bc,0 ;countfwrite0.push bcfwrite.B.=$+1EXPORT fwrite.B.ld bc,0 ;sizefwrite00.ld a,[hl]push hl;push defwrite.D.=$+1ld hl,0 ;poi to FCBcall fwrite1. ;a=data ;keeps bc;pop de;inc depop hl;cpidb 0xed,0xa1jp pe,fwrite00.pop bcdec hl;cpidb 0xed,0xa1jp pe,fwrite0.;ex de,hl ;hl = total processed bytesret;FUNC UINT readsectors FORWARD(PBYTE buf, UINT trsec, BYTE count);readsectorsreadsectors.A.=$+1 ;bufld hl,0readsectors.B.=$+1 ;trsecld de,0readsectors.C.=$+2 ;countld bc,0x0105dos3d13.call 0x3d13ld hl,[0x5cf4] ;return hl=next sectorret;FUNC UINT writesectors FORWARD(PBYTE buf, UINT trsec, BYTE count);writesectorswritesectors.A.=$+1 ;bufld hl,0writesectors.B.=$+1 ;trsecld de,0writesectors.C.=$+2 ;countld bc,0x0106jr dos3d13.