File Structure And Memory Organisation ====================================== HUNTER is capable of storing a great deal of differing information within its large memory. There may be Basic programs, text files, data files or object code CP/M programs. Superficially the operating system handles its memory in a similar manner to disk backing stores, and indeed may be considered as a 'RAM Disk'. However HUNTER is much faster than any disk system and incorporates special facilities to enable the memory to be efficiently utilised. HUNTER's File Manager DEMOS (Disk EMulation Operating System) manipulates files and runs CP/M programs. The File Manager environment is totally unconnected with Basic. Environment And Structure ------------------------- The File Manager facility is located in firmware, so there is no overwriting of existing programs in execution RAM. A CP/M call 0, or a JMP 0000 both cause a "warm" start which executes the File Manager in ROM. This would be a typical method of ending a .COM program. Entering the File Manager on power up is equivalent to a "cold" start, in which the operating system is completely reset, although programs in R0 are preserved. HUNTER'S File Manager will implement several commands and load and execute .COM files. Files may be erased, renamed or saved from memory, ASCII files may be displayed on the screen, as can the file directory. Finally, there is a facility for loading and dumping the files via the serial port in either Intel hex format or 8 bit binary format. The File Manager is structured around the CP/M compatible operating system and file structure. The RAM filespace, organised in exactly the same manner as disk based files, can be accessed through the system calls. Utility commands can be quickly selected from the soft keys. File Space ---------- Files are stored, as on magnetic disk, in records of 128 bytes grouped by 16's into 2K bytes. This means that the smallest file size is 2K bytes, but, as with magnetic media, allows for very large files to be stored. The memory space is allocated by the file manager and is transparent to the user. File Errors ----------- Each time a file is modified an error checksum is calculated and stored in the directory. This operation is completely transparent, as is each accuracy check when the file is accessed for reading or executing. If any discrepancy is found then a "no file" message is displayed. HUNTER Memory Organisation -------------------------- .. figure:: hunter-memory-map.png HUNTER Memory Map HUNTER is designed for very large RAM memories and 48K ROM. The memory is organised into pages: one page of ROM operating execution memory and further pages of RAM file space. All pages except for R0, the execution memory (also known as the Transient Program Area, or TPA) are limited to 48k. R0 extends to 54k, although the top 6k together with the 10k of common RAM are never paged out. There is, therefore, up to 54k of RAM for programming. Common RAM is used to link together the various pages of RAM and ROM. It organises the paging and contains the jump tables for CP/M compatibility. The operation of paging is totally transparent to the user so HUNTER is seen to have 54k program space with a powerful 48k operating system and Basic interpreter in ROM, and a block of file space. .. figure:: hunter-file-access.png HUNTER File Access .. figure:: system-ram-memory-map.png System RAM Memory Map Basic Programming ----------------- Since the Basic interpreter resides in ROM, the whole 54k of R0 is available for a Basic source program, variables and arrays. Simple variables are stored with the source program and Basic may access files for further storage. CP/M Programming ---------------- Object code programs must be executed from R0. Again, there is 54k RAM available for the program, plus the file space. Normally, the program will reside in the HUNTER as a .COM file, and will be loaded and run by the File Manager. However, the File Manager is very versatile, and provides flexibility in file manipulation and execution. File Organisation ----------------- The pages reserved for file storage have, as magnetic media, a "sector allocation map" and the actual directory, split into 16K extents. Any good text on CP/M file storage will give an adequate explanation, which is also true for HUNTER. This means that 2K byte blocks of a file are in no particular order within the filespace RAM, making large files and fast updating possible.