APPLICATIONSPROGRAMMATION ★ DIRECT ACCESS ROUTINES ★

Direct Access Routines (The Amstrad User)Applications Programmation
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

It is possible to go one better than the standard AMSDOS file access system, says Petr Lukes

This program demonstrates how to access any part of a disc, without using the sequential file system implemented in AMSDOS. It uses the routines from CUSTOM FORMATS, TAU, February 1988, and could be used as a building block for implementing a Direct Access file system.

Direct Access is often referred to as Random Access, but this term is not very appropriate. A randomly selected record would not be of much use for anything; a particular record is needed, and for that we need some means of locating it. The term Relative Access is also used, meaning that records are referenced in relation to the first record of the file.

Direct Access filing systems incorporate algorithms for computing the location of a record based on its key. An address file would consist of records with fields allocated to surname, initials, etc. with the surname field most likely designated as the key. The filing system would then store and retrieve the individual records using the given algorithm (it could be hashing, binary tree or one of many others), as required. Designing an efficient Direct Access file is not a trivial matter, and I have not attempted it here.

The program merely demonstrates how to read, edit and write any record if its location is known. It considers the whole disc is available to it, without any regard for any reserved tracks or directories. Do not experiment on a disc which holds wanted data.

AMSDOS uses sectors of 512 bytes, each identified by the track number (0 to 39d) and sector number on that track (c1H to c9H in case of a DATA disc); the program uses blocks of the same size as a sector but numbered consecutively from 0 to 359d. For the chosen record size of 128 bytes, there will be 1440 (40*9*512/128) records numbered consecutively from 0 to 1439. A filing system could allocate some records to two or more files or to a directory, the same ways as CP/M does.

One application which would not be too difficult to implement is a year's diary (I know it has been done before, with the AMSDOS filing structure). There would be enough space for close to two years with two days per block on a normal disc; an alternative would be a disc formatted to 41 tracks by FORMATS (one extra track on the disc should be quite safe; I have tried it but the risk is yours), so giving 369 blocks: enough for one day per block and some overlap of the previous and next years.

TAU

★ PUBLISHER: The Amstrad User (Australia)
★ YEAR: 1989
★ CONFIG: ???
★ LANGUAGE:
★ LiCENCE: LISTING
★ AUTHOR: Petr Lukes
 

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» Direct  Access  Routines    LISTINGDATE: 2013-05-31
DL: 312
TYPE: PDF
SiZE: 331Ko
NOTE: 2 pages/PDFlib v1.6

★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
Je participe au site:
» Pour ce titre nous ne disposons de fichier executable sur CPC (Dump, Saisie du listing) , alors si vous avez ça dans vos cartons ou vous désirez usé vos petit doigts boudinés sur votre clavier faites le nous savoir.
» Vous avez des infos personnel ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop
Page créée en 019 millisecondes et consultée 1537 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.