APPLICATIONSDISQUE ★ RSX - RANDOM DISC ACCESS (POPULAR COMPUTING WEEKLY) ★

RANDOM DISC ACCESSRANDOM DISC ACCESS: Part 2
★ 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 ★ 

Part Two of simulated random access files on the 464 starts right off with syntax details of the new commands available to Basic.

The :ID WRITE command takes three parameters; these are, the filename, the offset at which to start writing in the file, and the string of characters to be written. The offset is usually the record number less one, times the record length. For simplicity, I suggest you always use a function similar to FNr in the demonstration program.

The number of characters written is taken from the length of the buffer string, this is why it must be padded out to the record length. A typical :ID WRITE command might look like this; f$ = "PCW01.DAT"

buf$ "The text to go to the file, padded to the rec len"

  • |IDWRITE, @f$, fnr(2), @buf$

This would write out record two. Obviously records can be written out in any order.

The |IDREAD command has the same syntax as the |ID WRITE command, that is, filename, followed by offset at which to start reading, followed by buffer string. In this case the buffer string must be equal to the record length and is the number of characters read from the file. So to read back the record we saved about into the string buf$, the sequence would be;

  • buf$ string$(rec,len, 32)
  • |IDREAD, @f$, fnr(2), @buf$

If this all seems rather complicated it will become much clearer by studying the demonstration program (printed last week). A final point to the Basic user, a number of errors can occur, if, for instance, you try to read a record number outside the range of the file, or you give the wrong number of parameters to a command. In each case a clear error message is printed and the program halts with an error number 31. Basic calls this an Unknown Error, and as it never normally occurs, you can check for it in your error trapping routines. The files created by the Create command can be erased as normal using the ERA command. It is not advisable to try and read them using the normal INPUT#9, as there are no 'CR' characters at the end of a record, and unpredictable effects may occur.

The assembly language listing is included to illustrate how the program actually works. It should be of interest to anyone who wants to use the DOS from machine code, as it demonstrates reading and writing files, as well as using the Amsdos RSX's from machine code (eg, ERA, REN and DISC). The source code is commented and should be fairly straight forward to understand. The method of simulating random access is to use Amsdos serial files, which are opened, read or written to , and closed within each command. A DWRITE command actually creates a temporary file called "TEMP.RAN" which is never seen by the Basic user as it is deleted before returning to Basic. This simulated random access is not quite as fast as true random access files, but the latter would be very difficult, if not impossible, to implement using Amsdos. However, the method used is much quicker and compact than trying to simulate random access from Basic.

The technique used to return an error to the Basic is to load the E register with the error number required, and then to call the error routine in the Basic ROM directly by its physical address ($CA94), having first selected and enabled the Basic ROM.

PopularComputingWeekly860123

★ PUBLISHER: POPULAR COMPUTING WEEKLY
★ YEAR: 1986
★ AUTHOR: Brian Cadge



★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» RSX-Random  Disc  Access    (Popular  Computing  Weekly)    ENGLISH    LISTINGDATE: 2025-06-09
DL: 432
TYPE: PDF
SiZE: 3290Ko
NOTE: Supplied by archive.org ; 5 pages/PDFlib v1.6

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

Lien(s):
» Applications » DiscUtil
» Applications » RSX Disccat
» Applications » Rsx - Disc Copier v1
» Applications » RSX Disc-Schreibschutz abgefragt (Computer Schau)
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.732-desktop/c
Page créée en 472 millisecondes et consultée 4065 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.