title Module from library BASE_5 : WRRECF name ('WRRECF') maclib baselib.lib ; Write a record with variable length ; Copyright (C) Werner Cirsovius ; Hohe Weide 44 ; D-20253 Hamburg ; Tel.: +49-40-4223247 ; Version 1.0 December 1989 ; ENTRY Reg pair DE points to parameter block ; Byte 0 Record length (1 .. 255) ; Byte 1,2 Max record number (1 .. 65535) ; Byte 3,4 FCB of file ; Byte 5,6 Pointer to 128 byte buffer ; Byte 7,8 Pointer to record data ; EXIT Carry set on error, either disk or parameter error ; Carry reset on successfull operation entry wrrecf extrn $rndrg,$tsrec,$gtphs,$gtrec,$mvrec extrn $fxnxt,rndwrt,$bufsw,$bufrs wrrecf: call $rndrg ; Get regs call $tsrec ; Test valid record number ret c ; Exit on parameter error call $bufsw ; Swap buffers call $gtphs ; Get 'physical' sector wrlop: push de call $gtrec ; Get a random record ex de,hl call $mvrec ; Move record from buffer jr z,endwrt ; Ok, that's it ex de,hl pop de call rndwrt ; Write record jr c,wrerr ; End on error call $fxnxt ; Else fix for another record jr wrlop endwrt: pop de call rndwrt ; Write second record wrerr: push af ; Save flag call $bufrs ; Reset DMA buffer pop af ret end