home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / club100 / pg / pggene / info.pdd < prev    next >
Text File  |  2006-10-19  |  7KB  |  270 lines

  1. The following discussion will outline the communication 
  2. structure needed to address the PDD.  I will discuss both 
  3. the FDC mode and the BROTHER mode.
  4.  
  5.                     PACKET PROTOCOL
  6.  
  7. BROTHER mode is the most commonly used PDD mode and requires
  8. packet protocol.
  9.  
  10. Every packet is structured exactly alike.  The format of the
  11. packet is as follows:
  12.  
  13. +--+-+-+----------------------------+-+
  14. |2 |1|1|  0 to 128                  |1|
  15. +--+-+-+----------------------------+-+
  16.  ^  ^ ^     block data               ^
  17.  |  | |____ block data length        |
  18.  |  |______ block form               |
  19.  |_________ preamble                 |
  20.             checksum_________________|
  21.  
  22. preamble:       sync bytes (ascii "ZZ")
  23. block form:     disk command (0-12)
  24. block data len: data length (0-128)
  25. block data:     data sent (0-128 bytes)
  26. checksum:       sum from block form to
  27.                 checksum is FFH (LSD).
  28.  
  29. The composition of the block data will vary from one command
  30. (block form) to another.  There are 12 block forms.
  31.  
  32. block
  33. form     description
  34. ------   ------------
  35.    0     directory search
  36.    1     open file
  37.    2     close file
  38.    3     read request
  39.    4     write data
  40.    5     kill file
  41.    6     format
  42.    7     interrogate
  43.    8     change to FDC mode
  44.  
  45.   10     read data
  46.   11     directory info
  47.   12     return info
  48.  
  49. Block forms 0-8:    data sent to PDD.
  50. Block forms 10-12:  block data sent by
  51.                     PDD to host.
  52.  
  53. ^P
  54.                     BLOCK FORM COMMANDS
  55.  
  56. BLOCK FORM 0  (directory search)
  57.  
  58. Block data form (26 bytes)
  59. +---------------------------+-----+-+-+
  60. |   20 bytes                |  4  |1|1|
  61. +---------------------------+-----+-+-+
  62.       file name                ^   ^ ^
  63.       null_____________________|   | |
  64.       attribute____________________| |
  65.       search form____________________|
  66.  
  67. file name:    first character non-blank
  68. null:         add 4 blanks to file name
  69. attribute:    any letter is acceptable
  70. search form:  (0) search for file by 
  71.                   name and attribute.
  72.                   output file info.
  73.                   use for file open or
  74.                   file kill operation.
  75.               (1) begin sequential dir
  76.                   search and output 1st
  77.                   file info.  file name
  78.                   and attribute not
  79.                   required.
  80.              (2) continue sequential
  81.                   dir search and output
  82.                   file info.  file name
  83.                   and attribute not
  84.                   required.
  85.  
  86.  
  87. BLOCK FORM 1  (open file specified by block form 0)
  88.  
  89. Block data format (1 byte)
  90. +---------+
  91. |  1 byte |
  92. +---------+
  93.  open form
  94.  
  95. open form:  (1) to open new file. error
  96.                 if no room in directory
  97.             (2) to open for append.
  98.             (3) to open for read.
  99.  
  100.  
  101. BLOCK FORM 2  (close the open file)
  102.               (register file opened by
  103.                open form 1 or 2 in the
  104.                directory.)
  105.  
  106. Block data format:  NONE
  107.  
  108. ^P
  109. BLOCK FORM 3  (read request)
  110.               (PDD sends data from file
  111.                opened by open form 3)
  112.  
  113. Block data format:  NONE
  114.  
  115.  
  116. BLOCK FORM 4  (write data to file
  117.                opened by open form 1 or
  118.                open form 2.)
  119.  
  120. Block data form (1 to 128 bytes)
  121. +---------------------------+
  122. |  1 to 128 bytes           |
  123. +---------------------------+
  124.  file data to be written in file
  125.  
  126.  
  127. BLOCK FORM 5  (kill file specified by
  128.                search form 0)
  129.  
  130. Block data format:  NONE
  131.  
  132.  
  133. BLOCK FORM 6  (initialize=format disk)
  134.  
  135. Block data format:  NONE
  136.  
  137.  
  138. BLOCK FORM 7  (interrogate ready status
  139.                initiate block comm.
  140.                sequence of PDD.  block
  141.                communication error will
  142.                not occur if this is
  143.                used.)
  144.  
  145. Block data format:  NONE
  146.  
  147.  
  148. BLOCK FORM 8  (move into FCD mode)
  149.  
  150. Block data format:  NONE
  151.  
  152.  
  153. BLOCK FORM 10  (send file data to host
  154.                according to the request
  155.                of file data)
  156.  
  157. Block data form (1 to 128 bytes)
  158. +---------------------------+
  159. |  1 to 128 bytes           |
  160. +---------------------------+
  161.       data read from file
  162.  
  163. ^P
  164. BLOCK FORM 11  (send directory info to
  165.                host according to the
  166.                directory reference
  167.                command from host)
  168.  
  169. Block data form (28 bytes)
  170. +-----------------------+-+-+--+-+--+-+
  171. |   20 bytes            |1|1| 2|1| 2|1|
  172. +-----------------------+-+-+--+-+--+-+
  173.       file name          ^ ^  ^ ^  ^ ^
  174.       0FFH_______________| |  | |  | |
  175.       00H__________________|  | |  | |
  176.       left block amount_______| |  | |
  177.       attribute_________________|  | |
  178.       file size____________________| |
  179.       left sector amount_____________|
  180.  
  181. file name:    same as dir. ref but when
  182. attribute:    there is no designated
  183.               file or all of dir. info
  184.               has been output at 
  185.               sequential search, file
  186.               name and attribute are
  187.               set to null.
  188. lft blk amt:  unused block amount of
  189.               the disk (1 block = 256
  190.               bytes). Set to NULL for
  191.               PDD1.
  192. file size:    designated file size.
  193.               Byte amount (1 to 65535).
  194. lft sctr amt: unused sector amount of
  195.               the disk (1 sector = 1280
  196.               bytes).  Set this amount
  197.               as integer part of (left
  198.               block amount/5) for PDD2.
  199.  
  200.  
  201. BLOCK FORM 12  (return information for
  202.                normal end responses to
  203.                commands except dir.
  204.                reference, file data
  205.                request, and mode
  206.                change.  Also ERROR
  207.                responses except for DTR
  208.                going LOW.)
  209.  
  210. Block data format (1 byte)
  211. +---------+
  212. |  1 byte |
  213. +---------+
  214. return code    Meaning
  215. -----------    -------------------
  216.  00h           Normal end
  217.  30h           Parameter error or block
  218.                  sequence error.
  219.  4Xh           Read error
  220.  50h           Write protect
  221.  60h           Shortage of disk space
  222.  7Xh           Disk mount error
  223.  8Xh           Hardware error
  224.  
  225. ^P
  226.  
  227. This is a preliminary file.
  228. I will update it regularly until it is complete.
  229.  
  230. For those who want to experiment, the following basic 
  231. program will KILL "SEARCH.DO" from the PDD (no error 
  232. detection).  If you wanted to FORMAT the disk, LINE 32 would
  233. be:
  234.  
  235. 32 PRINT#1,FM$
  236.  
  237. ...and LINE 33 can be eliminated.
  238.  
  239.  
  240. 0 'Packet testing by Paul Globman
  241. 1 '                    Feb. 1986
  242. 2 '
  243. 5 MAXFILES=3:GOTO100
  244. 30 PRINT#1,RY$:GOSUB 1000
  245. 32 PRINT#1,D$(0):GOSUB 1000
  246. 33 PRINT#1,KL$
  247. 99 END
  248. 100 D$(0)="ZZ"+CHR$(0)+CHR$(26)+"SEARCH.DO               "+
  249. CHR$(70)+CHR$(0)+CHR$(72)
  250. 101 D$(1)="ZZ"+CHR$(0)+CHR$(26)+"                        "+
  251. CHR$(70)+CHR$(1)+CHR$(158)
  252. 102 D$(2)="ZZ"+CHR$(0)+CHR$(26)+"                        "+
  253. CHR$(70)+CHR$(2)+CHR$(157)
  254. 110 O$(1)="ZZ"+CHR$(1)+CHR$(1)+CHR$(1)+CHR$(252)
  255. 111 O$(2)="ZZ"+CHR$(1)+CHR$(1)+CHR$(2)+CHR$(251)
  256. 112 O$(3)="ZZ"+CHR$(1)+CHR$(1)+CHR$(3)+CHR$(250)
  257. 115 CL$="ZZ"+CHR$(2)+CHR$(0)+CHR$(253)
  258. 120 RD$="ZZ"+CHR$(3)+CHR$(0)+CHR$(252)
  259. 130 'WR$="ZZ"+CHR$(4)+CHR$(0)+CHR$(251)
  260. 140 KL$="ZZ"+CHR$(5)+CHR$(0)+CHR$(250)+CHR$(13)
  261. 150 FM$="ZZ"+CHR$(6)+CHR$(0)+CHR$(249)
  262. 160 RY$="ZZ"+CHR$(7)+CHR$(0)+CHR$(248)+CHR$(13)
  263. 180 OPEN"COM:98N1DNN"FOR OUTPUT AS 1
  264. 190 OPEN"COM:98N1DNN"FOR INPUT AS 2
  265. 299 GOTO30
  266. 1000 'WAIT
  267. 1010 FOR I=1 TO 1000:NEXT:RETURN
  268.  
  269.  
  270.