Introduction
    Il "Quarto" fuso ] The 4th Time Zone ]   


 

Introduction
Tech notes


                                   

 

The Forth version here implemented works with the ZX Interface 1 fitted in only, since it uses some "shadow ROM" calls via the hook-codes. Then I used some tricks to make the typical Microdrive sequential access into a quasi-random access

The program is loaded from tape. After loading, channel #3 is open toward the Interface 1 serial port (RS-232) and the channel #4 is open toward the Microdrive to open the sequential file !Blocks and then it enters the Forth interpreting status with the prompt "Ok" and the flashing cursor on the next line.

To go back to the Basic you have to type in

   BASIC [enter]

or, type the ANS-compliant 

BYE [enter]

If during a Microdrive access you press the Break key, you could suddenly exit to Basic with a message L BREAK into program, 11:2. This is a side effect due to the BASIC dependance of the channel #4. In every case you will have no data loss, but those blocks not  FLUSHed  to Microdrive. To re-enter to the Forth give at the Basic prompt:

RUN [enter] 

This causes a Warm start which calls an EMPTY-BUFFERS.

To verify that the Microdrive access try with

 4 LIST [enter] 

that displays the Screen 4 which contains the text of the error message between 1 and 15.

In this implementation a block is 512 bytes each instead of the standard 1024; every Block correspond to a Screen; every Screen is made up by 16 lines, each 32 character long .

The block access is performed by  BUFFER: it is possible to see its definitions typing: 

SEE BUFFER [enter]

: (RD) ( -- )
  CHANNEL @ >R R 0= 5 ?ERROR
  3 R 12 + C! 
  0 R 67 + C! 
  254 R> 24 + C! 
  STREAM @ SELECT INKEY DROP 
  DEVICE @ SELECT ;

: (READ) ( n -- )
  CHANNEL @ >R 
  DUP  R 13 +  C@ - 
  IF 
     1 -  R 13 +  C!  (RD) 
  ELSE 
     DROP 
  THEN 
  R> DROP ;

: B-READ ( addr n -- ) 
  (READ) CHANNEL @ 82 + SWAP B/BUF CMOVE ;

: B-WRITE ( addr n -- )
  (READ) CHANNEL @ >R 
  R 82 + B/BUF CMOVE 
  SECTOR 
  255 R 25 + C! 
  511 R 11 + ! 
  STREAM @ SELECT 
  R 593 + C@ EMITC 
  DEVICE @ SELECT 
  255 R> 13 + C! ;

: R/W ( addr n f -- )
  >R 1 - DUP 0< 6 ?ERROR DUP #SEC > 6 ?ERROR R>
  IF B-READ ELSE B-WRITE THEN ;

: BUFFER ( n -- addr )
  USE @ DUP >R  BEGIN +BUF UNTIL
  USE ! R@ @  0< IF R@ 2+ 32767 AND 0 B-R/W THEN
  R@ ! R@ PREV ! R> 2+ ;

This means that you can access a single Microdrive per time; with some trick it is possible to access the other seven: see Screen 70 for some example definition.

.


Ultimo aggiornamento: 10-09-2002. Copyright (c) 2000-2002 Matteo Vitturi. 
Per problemi o domande relativamente a questo sito contattare il webmaster
Last update: 09.10.2002. Copyright (c) 2000-2002 Matteo Vitturi.
For problems or questions related to this web please contact the webmaster.
Hosted by www.Geocities.ws

1