Top 10k strings from USBforSpectrum.rtf
in <root> / doc / technical / RoelofKoning / usb.zip /
Back to the directory listing
2 -------------------------------------------------\par 1 {\rtf1\ansi\ansicpg1252\deff0\deflang1043\deflangfe1043\deftab708{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\fmodern\fprq1\fcharset0 Courier New;}} 1 {\colortbl ;\red0\green0\blue0;\red255\green0\blue0;} 1 {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\nowidctlpar\lang2057\f0\fs24 For unknown reasons I could not embed the pictures!!\ul\b\fs36\par 1 the listing given here was written to a file that I created on an USB memory stick connected to the Spectrum, which file then was read by PC...\par 1 \ul Selection of available commands\ulnone\par 1 \tab\tab\tab 1st parameter in the currently open file \par 1 \tab\tab\tab 1st parameter from the currently open file \par 1 \tab\tab\tab 1st data parameter to the currently open file \par 1 \tab CHR$ a AND a=13;\par 1 \pard\nowidctlpar\ri-784\tx8662\tab \b http://www.vinculum.com/prd_vdip1.html\b0 \par 1 \pard\nowidctlpar\ri-784\tx8662\lang2057\par 1 \pard\nowidctlpar\ri-784\tx8662\f0\fs24\par 1 \pard\nowidctlpar\ri-784\tx8662\cf1 The diagram as shown is sufficient for working with USB mass storage devices. But the VDIP1 module is really a full USB host and can be used as such when the hardware (a little) and the software (a lot!!) is expanded. \par 1 \pard\nowidctlpar\ri-784\tx8662 I choose to connect the VDIP1 using the parallel (FIFO) method because I want it to be compatible with all the Spectrum models that I own. For isolating the DATA lines from the Z80 bus I needed an 8-bit transceiver type 74LS623 and also a few gates to decode a #Read and a #Write signal for the module. And another buffer to read two status signals from the VDIP1. It is usual for me to construct such simple "glue logic" in a programmable logic array chip, i.c. a GAL 16V8. Because little is learned from the contents (JEDEC file) of such GAL, I choose to depict in the following diagram the very simple functions that I used, as if these were build by using standard gates. \par 1 \pard\nowidctlpar\ri-784\tx8662 And as usual there exists a firm 'contra indication': the price of this module lies in the E.30-E35,- range depending on postal fees. :-(((((\par 1 \pard\nowidctlpar\ri-784\tx8662 \cf1\f0\fs24\par 1 \pard\nowidctlpar\f1\fs20\par 1 \pard\nowidctlpar\f1\fs18\par 1 \pard\nowidctlpar\cf2\lang1043 see pic 'cardreaders'\cf0\par 1 \pard\nowidctlpar\cf2 see pic. 'module'\cf0\par 1 \pard\nowidctlpar\cf2 see pic 'pcb2'\cf0\par 1 \pard\nowidctlpar\cf0\par 1 \pard\nowidctlpar The following screenshots tell probably more than words can say. They were taken before I added the PRINT i$ command to line 100. \par 1 \lang2057 To make a long story short: yes it can be done! The USB, I mean. And it is done, just check the pictures given here. It all comes down to the "prototype module" VDIP1 made by the company FTDI ltd. from Glasgow (U.K.). Full information about this module can be found at their web site\par 1 \lang1043 Roelof Koning NL, october 2007. \par 1 \cf2 see pic 'screen2'\cf0\par 1 \cf2 see pic 'screen1'\cf0\par 1 \cf2 see pic 'nodisk'\cf0\par 1 \cf2 see pic 'diagram-e'\cf1\par 1 \cf1 Some of us who have read sofar will say "why bother, the Spectrum is dead anyway". \par 1 \cf0 10 GO SUB 1000: IF n = 3 THEN GO TO 10\par 1 [enter]\tab .....\tab Test presency of disk\par 1 Why else did we defend the earth against space invaders every night, for months and months .......\par 1 WRF dword .......\tab Write the number of bytes specified in the \par 1 This what an 'ENTER' returns when nothing is connected \par 1 The results of a FWV command (version 03.61 now) and an IDD command\par 1 The module holds an embedded USB host controller and can be connected to the real world (read: Spectrum...) using a\cf1 (free selectable) serial or a parallel \cf0 connection. The special feature which made this module extra attractive for me was the fact that it can handle mass storage devices (such as USB Flash drives) in a transparent way, including the FAT structure. We're talking indeed about MS-DOS and Windows formats!!! (Alas long names are shortened in the DOS way...) A simple to implement command set makes it possible to manage directly files on USB drives.\par 1 The circuit works with the commands\cf1 IN 63, IN 127 und OUT 127. As shown in the example program this can be done in BASIC. By IN 63 the signals RFX and TXE are read into bit 0 and 1, values 0 - 3. Before these signals can be evaluated the value that is read must be cleaned. (bit 2-7 removed). By IN 127 a byte is read from the VDIP1 module and by OUT 127 a byte is written to the VDIP1. In the diagram can be found that this #WR signal is electrically inverted before sending it to VDIP1 and buffer LS623. It is the buffer chip that needs an inverted (=positive) signal on pin GAB and the VDIP1 module likes it too...\par 1 SEK dword .......\tab Seek to the byte position specified by the \par 1 Roelof.\par 1 Recognize the results of a DIR command, and the 'shortened' filenames.\par 1 REN file file\tab Rename a file or directory \par 1 REM read 'status' and reduce number to bit 0-1 value. 3=busy, \par 1 REM now keep on reading bytes as long RXF='0'\par 1 REM Stay in wait-loop when not ready for read or write\par 1 REM Start here\par 1 REM Because TXE='0' a command can be issued\par 1 RDF dword .......\tab Read the number of bytes specified in the \par 1 RD file .......\tab Reads a whole file \par 1 Please check the downloadable (www.vinculum.com) Firmware Manual for further details and the complete list of commands. Rather significant is the 'IPA' command which allows to enter numbers in ASCII like the string "65535" instead of the 4 bytes of a 'double word' being 0,0,255,255.\par 1 P.S. The VDIP1 can of course in a similar way be fitted to all other 8 bit equipment\par 1 OPW file .......\tab Open a file for writing or create a new file \par 1 OPR file .......\tab Open a file for reading \par 1 Now, what can we do with a connected drive. The selection of the available commands given here, shows the similarity to the Interface1 commands. Do I need say more?\par 1 My experiments with USB Card Readers (normally used with PC) showed me that three out of the four readers that I own can co-operate with the VDIP1 without real problems. A minor disadvantage is that the type of card I want to work with must be in its slot when I connect the reader. USB memory sticks work right away. The external USB harddisk which I use on PC was not recognized however, probably because it is partitioned in a number of logical drives.\par 1 MKD file .......\tab Make a new subdirectory in the current directory \par 1 Let me respond: "I must agree with the second part, but I see no reason for being brain dead myself\rdblquote . Some things have to be done just because the challenge presents itself.\par 1 IPA\tab ...........\tab Accept ASCII values in Monitor commands\par 1 IDD \tab ...........\tab Display information about the disk \par 1 I used the following BASIC program for testing the device. It turned out that I could do so much with these few lines that I hardly needed another 'Norton Commander'. In fact\par 1 How to construct an USB port for the Spectrum. \ulnone\b0\fs24 \par 1 FS \tab ...........\tab Returns the free space available on disk\par 1 DVL \tab ...........\tab Display disk volume label\par 1 DSN \tab ...........\tab Display disk serial number \par 1 DLF file .......\tab Delete a file \par 1 DLD file .......\tab Delete subdirectory from current directory \par 1 DIR file .......\tab List specified file and size \par 1 DIR \tab ...........\tab List files in current directory \par 1 CLF file .......\tab Close the currently open file \par 1 CD file .......\tab Change current directory \par 1 CD .. .......\tab Move up one directory level \par 1 And remember we are talking about PC files now!\par 1 2=data waiting to be read, 1=command allowed, 0= R&W both allowed\par 1 1030 RETURN \par 1 1010 LET n= n-(INT (n/4)*4)\par 1 1000 LET n= IN 63\par 1 ------------------------------------------------------\par 1 ------------------------------------------------------------------\par 1 110 STOP \par 1 100 PRINT i$: GO TO 10\par 1 90 FOR f=1 TO LEN i$: OUT 127, CODE i$(f): NEXT f: OUT 127,13\par 1 80 INPUT "Command ? ";i$\par 1 70 GOTO 10\par 1 60 IF n=0 OR n=2 THEN GO TO 40\par 1 50 PRINT CHR$ a AND a >= 32;""+ STR$ a+"" AND a<32; \par 1 40 LET a= IN 127: GO SUB 1000\par 1 20 IF n>1 THEN GO TO 80: REM nothing to read now\par 1 in this design is not that large.... \par 1 and/or micro controller designs. It is designed for that purpose, so my role\par