
384
[ 3 ] Calculating Memory Requirements
The FTP protocol specifications do not provide for checking the amount of BHT memory
available during downloads. If the BHT runs out of memory during a download, the FTP client
cancels the transfer and deletes the partially downloaded file. The user application program
must, therefore, check availability with the FRE function or equivalent method and compare
the result with the BHT file size (BFS) before using the download function. The formula for
calculating the BHT memory requirements (MEM) depends on the file format.
• The line delimiter size (LDS) refers to the number of bytes in each line
delimiter: two for operating systems using the CR-LF combination and
one for those using only LF or CR.
•
The number 4096 (4K) is the assumed memory management unit.
Change this to 8192 (8K) if the BHT uses that larger block size.
•
HFS = host file size
■
User Programs (*.PD3)
Determine MEM from HFS.
BFS = ROUND_UP (HFS ÷ (128 + LDS)) × 64
MEM = ROUND_UP (BFS ÷ 4096) × 4096
Example: File size of 12,345 bytes on operating system using CR-LF combination
BFS = ROUND_UP (12345 ÷ (128 + 2)) × 64 = ROUND_UP(94.96) × 64 = 6080
MEM = ROUND_UP (6080 ÷ 4096) × 4096 = ROUND_UP(1.48) × 4096 = 8192
Note that 128K of free memory is enough to download even the largest (128K) BASIC
program.
■
Extension Libraries (*.FN3 and *.EX3)
Determine MEM from HFS.
BFS = ROUND_UP (HFS ÷ (130 + LDS)) × 64
MEM = ROUND_UP (BFS ÷ 4096) × 4096
The rest of the procedure is the same as for BASIC program files.
Comentarios a estos manuales