Multi-media documentation 08/28/87 GmK Block buffers: 02/22/87 GmK There are two arrays associated with the block buffers, >>BUFS and >BUFFERS. >>BUFS is a byte array and is #BUFFERS bytes long.>BUFFERS has #BUFFERS records which are 8 bytes long and containthe fields indicated below. When initalized, the tables contain: >>BUFS >BUFFERS BUFFERS (index) (>dcb blk# buf-addr update) (address) 0 --> 0 -1 FIRST 0 --> FIRST 1 --> " " +1024 " --> + 2 --> " " +1024 " --> + 3 --> " " +1024 " --> + LAST (The example assumes that #BUFFERS is four.) Block buffers: 02/07/87 GmK The status of a buffer is determined by the contents of the blk#and the update fields. Status blk# update Produced by: Buf affected: Unassigned, empty -1 0 EMPTY-BUFFERS all buffers Assigned, empty u 0 u BUFFER next avail Assigned, read u 1 u BLOCK assigned Assigned, updated u -1 UPDATE current Assigned, updated u' -1 ESTABLISH current Assigned, empty u 0 DISCARD current The current buffer is the one most resently used. Block buffers: 02/22/87 GmK The >dcb field in the >BUFFERS record is used to contain the address of a device-control-block (dcb). The first two fields in the dcb contain the addresses of the block-read/write and the error routines for that device. The rest of the entries in the dcb are described in the dcb documentation. Block management: 02/08/87 GmK The virtual memory (block-buffer) manager functions as follows: When a block is requested, the block-buffer list is searched to see if a buffer has been assigned to the block and to see if theblock has been read into the assigned buffer. If the requested block is in one of the buffers, the buffer- pointer list is manipulated to make that buffer current. If the block is not in any of the buffers, the least-recently- used (LRU) buffer is made current. (The word ABSENT? does buffer search and LRU management.) Block management: 02/22/87 GmK If the now-current buffer contains the requested block, the address of the current buffer is returned. If the requested block was not found and the now-current buffer contains an updated block, that block is written back to it's media and the requested block is assigned to the current buffer. (The word MISSING writes an updated block and assigns a buffer.) If the requested block has been assigned to the current buffer but the buffer is empty, the requested block is read into the current buffer. The address of the current buffer is returned. (The word BLOCK will do the read operation if necessary.) Device-control-blocks: 02/07/87 GmK The dcb's contain the cfa's of the device-read/write and error routines and data specific to the device for which the dcb is created. The general block-read/write routine, BLK-R/W fetches the dcb address from the current >BUFFER record and then executes the device read/write routine (and if necessary, the error routine) from that dcb. The device is assumed to start with block zero and extend through `max-blk'-1. The read/write routine associated with a particular device is expected to know the details of it's own dcb contents. Device-control-blocks: 03/16/87 GmK The dcb for reading and writing to the A drive (a floppy diskette) using the ROM-BIOS routines (using 4Kbytes per track and with blocks 0 thru 159 on the top surface and blocks 160 thru 319 on the bottom surface) is as follows: cfa-r/w cfa-err max-blks link drv# #sec/blk #sec/side #sec/trk addr addr 320 addr 0 2 320 8 The dcb for the same device, but with 4.5 Kbytes per track and accessing each cylinder (all heads) in order, would be: cfa-r/w cfa-err max-blks link drv# #sec/blk #sec/cyln #sec/trk addr addr 360 addr 0 2 18 9 Device-control-blocks: 03/16/87 GmK The dcb for reading and writing to the C drive (a 10 Meg fixed disk) using the ROM-BIOS routines would be: cfa-r/w cfa-err max-blks link drv# #sec/blk #sec/cyle #sec/trk addr addr 10,000 addr 2 2 68 17 The dcb for the same device, but using the DOS direct read/writeroutines would be shorter and would contain: cfa-r/w cfa-err max-blks link drv# #sec/blk addr addr 10,000 addr 2 2 The link-field is used to form a linked-list of the dcb's Media management: 02/22/87 GmK A multi-media system has been imposed upon an 83-Standard Forth system. An attempt was made to make the implementation as transparent and code-size efficient as possible. An attempt was also made to make the syntax as compatible as possible with botha stand-alone and an MS-DOS versions of the system. The implementation is compatible with the traditional Forth block mechanism and with Forth blocks within MS-DOS files. Existing media may be redefined and additional media added at compile or runtime. Other file sistems can also be supported. Media management: 03/16/87 GmK Source screens are included for four different access methods: PC-Forth direct blocks - via ROM-BIOS interrput 13h BIOS direct blocks - via ROM-BIOS interrupt 13h DOS direct blocks - via DOS interrupts 25h and 26h DOS files with blocks - via DOS interrupt 21h Source screens are included to access four different devices: Floppy drive A - 160, 190, 320, 360, 720, 1,200 blocks or up Floppy drive B - same choices as drive A (up to 64K blocks) Fixed disk C - up to 32K (via DOS) or 64K (via BIOS) Ram disk R - may include all available memory Any device may be accessed by any appropriate method. Other devices and methods may be easily added. Media management: 03/16/87 GmK Access methods are selected by using the words: FORTH-BLOCKS BIOS-BLOCKS DOS-BLOCKS DOS-FILES Devices are selected by using the words: A: B: C: R: A device may be assigned as any one (or more) of the media: DEFAULT SOURCE DEST Blocks may be copied from any device to any other, using any appropriate access method on the source device and the same or any other access method for the destination device. Load screens may access any device from any other by any method.Media management: 03/16/87 GmK The following syntax is used: [access-method] [media] [device] Example: If we wish to access PC-Forth formatted direct blocks as the default media on drive A, to access DOS formatted direct blocks as the source media on drive B, and to access DOS files (containing blocks) as the destination media on drive C: we would use the phrases: ( access-method ) ( media ) ( device ) FORTH-BLOCKS USING A: DOS-BLOCKS SOURCE B: DOS-FILES DEST [d:\][path\]file-name Media management: 08/28/87 GmK The access-method words FORTH-BLOCKS, BIOS-BLOCKS, DOS-BLOCKS, and DOS-FILES re-vector the device words A:, B:, C:, D:, and R: to provide action appropriate for the access-method. The media-selection words USING, SOURCE and DEST set the device flag to the proper state so that the device words A:, B:, C:, and R: will store the proper device-control-block (dcb) address into the appropriate media-pointer. The media-pointers are system (or user) variables named: >DFT, >SRC, and >DST. Editing is done to the default media, loading from the current media, and copying is from the source to the destination media. Media management: 07/31/87 GmK Example: The Forth system is using DOS-FILES as the access-method. We want to copy blocks from an opened DOS file toa diskette, on drive B, containing direct-access Forth-blocks. Set-up the system for the copy by: FORTH-BLOCKS DEST B: (access-method is now FORTH-BLOCKS) (media is dest., device is B drive) Now copy blocks from the DOS-file to the diskette in drive B: 1st-source-blk# last-source-blk# 1st-dest-blk# SCOPY The source-media will be re-vectored to the default media, and the access-method will be returned to DOS-FILES. Media management: 03/25/87 GmK The access-methods and media currently supported are: Access Method Media Format Device ------------------------------ -------------------- --------- Forth-blocks, BIOS Int"13 Abs. blks (top 1st) Diskette BIOS-blocks, BIOS Int"13 Abs. blks (cylinder) Diskette (both the above) BIOS Int"13 Abs. blks (cylinder) Hard disk DOS-blocks, DOS Int"25/25 Abs. blks (cylinder) Both DOS-files, DOS Int"21 File-relative blocks Both DOS-files, DOS Int"21 Files (std. editors) Both (not DOS-files) CMOVEL RAM-relative blocks RAM General: 07/20/87 GmKThe following words are available to inspect the variables and buffers used by the Multi-Media system: .FILES shows the status of all of the F-DCB's (File Device Control Blocks). .MEDIA shows the media currently assigned to the media pointers ( >DFT >SRC >DFT ) .DEVICES shows the DCB's currently assigned to the logical devices ( A: B: C: R: ) .DCBS shows the names of the R/W and ERR routines used by the DCB's (Device Control Blocks) and DCB's that = F-DCB's..BUFS shows the status of the block buffers. .ACCESS shows the current access method. .DOS shows the status of the DOS error variables. Examples: 07/31/87 GmKWhen loaded the DOS version of PC-Forth normally defaults to DOS-FILES on the A drive. (The default access-method and device are selectable.) To open a file: USING C:\FORTH\ZZZ.SCR (full path name) To print a file: PRINTF (prints all of default file) To see file size: CAPACITY . (show default size in blocks) To copy from another: SOURCE A:XXX.SCR (prompt to create if notTo copy to another: DEST B:YYY.SCR (found, ask size in blk) 1st-source-scr last-source-scr 1st-dest-screen SCOPY (SCOPY aborts if screen range will not fit in the files)