This file contains description about files in graphic.zip . 1. Stand alone (NO BIOS USED, fast as can be, relocateable ) Pascal routines, in later mentioned INC-files : GENERAL INFO All following files (exept Line.inc) need two definition files 'included' before them. - VDPCMD.INC defines vdp commands and the command array. in system ram. - GRAPHLOG.INC defines the logical operations needed in logical graphic operations. Most of the variable names are self explanatory, but you can obtain more information by reading VDPCMD.INC and GRAPHLOG.INC . Some helpful info: Number_x = rectangle width in pixels Number_y = rectangle height in pixels Direction = Copy directions for the ARG-register Copy_Right = 0; Copy_Down = 0; Copy_Left = 4; Copy_Up = 8; You can concatenate these directions (actually bits) by addition: Copy_Right+Copy_Up , Copy_Left+Copy_Down and so on ... } ExpansionVram = 32 ; Vram = 0 ; One of these two constants can be added to Direction (or _arg) so, that Copy-procedure knows where to/from to copy . Default is Vram (=0). COPY_XY.INC Procedure Copy_xy (Source_x,Source_y:Integer;SourcePage:Byte; Destination_x,Destination_y:Integer;DestinationPage:Byte; Number_x,Number_y:Integer;Direction:Byte); - Copies a rectangle area in yx-direction whithin the vram. COPY_Y.INC Procedure Copy_y (Source_x,Source_y:Integer;SourcePage:Byte; Destination_y,Number_y:Integer;DestinationPage:Byte; Direction:Byte); - Copies a rectangle area in y-direction within the vram COPYL_XY.INC Procedure CopyL_xy (Source_x,Source_y:Integer;SourcePage:Byte; Destination_x,Destination_y:Integer;DestinationPage:Byte; Number_x,Number_y:Integer; LogicalOperation,Direction:Byte); - Copies a rectangle area in xy-direction within the vram. A logical operation is possible between source and destination color. See GRAPHLOG.INC . LINE.INC Procedure Line(x1,y1,x2,y2:Integer;Page,Color,LogicalOperation:Byte); - Draws a line. A logical operation is possible between source and destination color. See GRAPHLOG.INC . PAINTLOG.INC Procedure PaintLog (Destination_x,Destination_y:Integer;DestinationPage:Byte; Number_x,Number_y:Integer; Color,LogicalOperation,Direction:Byte); - Paints a rectangle in vram. A logical operation is possible between source and destination color. See GRAPHLOG.INC . PAINTBOX.INC Procedure PaintBox (Destination_x,Destination_y:Integer;DestinationPage:Byte; Number_x,Number_y:Integer;Color,Direction:Byte); - Paint a box in vram. POINT.INC Function Point (Source_x,Source_y:Integer;SourcePage:Byte):Byte; - Returns the color (value) of the requested pixel (location) in vram. PSET.INC Procedure Pset (Destination_x,Destination_y:Integer;DestinationPage:Byte; Color,LogicalOperation:Byte); - Set a requested pixel (location in vram) with requested colour (value). READVRAM.INC Procedure ReadVram(VramblockUsed:Byte; VramAddr,RamAddr,ByteCount:Integer); - Moves contents of Vram to conventional Ram. - PS. You can use a variable to store the contents of vram using Addr-function. WRTVRAM.INC Procedure WriteVram(VramblockUsed:Byte; VramAddr,RamAddr,ByteCount:Integer); - Moves contents of the Ram to the Vram. * * * 2. Disk IO and other procedures, which USE BIOS ! BLINK.INC Blink.inc file contains following procedures and functions to be used in text mode 2 (screen 0 width 80). Column and Row define the starting point of the blinking area. BlinkLen defines how many chars will belong to blinking area (or area where the blinking will be erased). -Vpoke(Address,Byte); - WrtVdp(Register,Byte); - Blink(Column,Row,BlinkLen:Byte); - ClearBlink(Column,Row,BlinkLen:Byte); - ClearAllBlinks; - SetBlinkRate(OnTime,OffTime:Byte); Time values 0 - 15 - SetBlinkColors(ForeGroundColor,BackGroundColor:Byte); and function - Vpeek(Address):Byte; COPYWIND.INC Copywind.inc contains SLOW test procedures Procedure CopyWindow( SourceX,SourceY,DestX,DestY,Width,Height:Integer; SourcePage,DestPage,LogOp:Byte); Procedure ScrollWindow(x,y,Width,Height:Integer;Direction,Operation:Byte); DATETIME.INC DateTime contains procedures to set system time and date and funtions to read system date and time. Type TimeStr = String[8] Function GetTime:TimeStr ; Procedure SetTime ; (Use in text screen.) Type DateStr = String[22]; Function GetDate:DateStr; Procedure SetDate; GRAPHIC.INC Graphic.inc contains following procedures and functions, whic USE BIOS and therefore update system variables. - Screen(Mode:Byte); - Width(ScreenWidth:Byte); - Color(ForeGroundColor,BackGroudColor,BorderColor:Byte); - SetColor(color:Byte); ( Sets drawing color.); - GraphicPrint(Str:TPString;X,Y:Integer;Color:Byte;LogOp:Byte); - Box(StartX,StartY,EndX,EndY:Integer;LogOp:Byte); - Line2(StartX,StartY,EndX,EndY:Integer;Page,Color,LogOp:Byte); - SetPage(ActivePage,DisplayPage:Byte); LOADGRAP.INC LoadGrap.inc contains a procedure to load graphic blocks similar way the BASIC COPY command does. File format is the same. (First four bytes defines the width and the lenght of saved rectangular area and then comes the uncompressed graphic data.) {This procedure needs VdpCmd.inc - file } Type LoadScrStr = String[254]; Procedure LoadGraphicBlock (Filename:LoadScrStr; Destination_x,Destination_y:Integer; DestinationPage:Byte; Direction,LogicalOperation:Byte); See chapter 1 to get more informtion about used variables. SAVEGRAP.INC SaveGrap.inc contains procedure to save graphic blocks similar way the BASIC COPY command does. File format is the same. (First four bytes defines the width and the lenght of saved rectangular area and then comes the uncompressed graphic data.) {This code needs VdpCmd.inc - file } Type SaveScrStr = String[254]; Procedure SaveGraphicBlock (Filename:SaveScrStr; Source_x,Source_y:Integer;SourcePage:Byte; Number_x,Number_y:Integer); See chapter 1 to get more informtion about used variables. SETPAGE.INC SetPage.inc contais a procedure, similar to the command used in basic, to set active and display page on graphic screen. Procedure updates sytem variables. Procedure SetPage(ActivePage,DisplayPage:Byte); VRAM.INC This code contains procedures and a function (USING BIOS ROUTINES) - Procedure ReadVRAM (VRAMaddress: Integer;var RAMaddress;NumberOfBytes: Integer); - Procedure WriteVRAM (VRAMaddress: Integer;var RAMaddress;NumberOfBytes: Integer); - Procedure fillVRAM (VRAMaddress: Integer;NumberOfBytes: Integer;Value: Byte); - Procedure Vpoke (VRAMaddress: Integer;Value: Byte); - Function Vpeek (VRAMaddress: Integer): Byte; Rem ! Radvram.inc and Writevram.inc contain more flexible and faster routines to handle similar tasks. WRTVDP.INC WriteVdp.inc contains both BIOS and DIRECT routines to write registers of VDP. Default is BIOS routine , so if you want a direct routine, you have to edit this inc-file. Procedure WrtVdp(VdpRegister,Value:Byte); MSXDSKIO.INC This Inc-file contains following types, variables, procedures and functions: Type Fcb = Record Drive :Byte; FileName :Array[1..11] Of Char; CurBlock :Integer; RecSize :Integer; FileSizeLo :Integer; FileSizeHi :Integer; Date :Integer; Time :Integer; DeviceId :Byte; DirLoc :Byte; TopCluster :Integer; LastAccessd :Integer; RelLoc :Integer; CurRec :Integer; RanRecLo :Integer; RanRecHi :Integer; End; {Fcb} OpenString = String[255]; FcbPointerType = ^Fcb; Var FcbPointer :FcbPointerType; MSXIOResult :Byte; - Function MSXOpen(Filename:OpenString):FcbPointerType; - Procedure MSXClose(FcbPointer:FcbPointerType); - Procedure MSXWrite( FcbPointer:FcbPointerType;RecordSize,RecordCount,BufferAddr:Integer); - Procedure MSXRead( FcbPointer:FcbPointerType;RecordSize,RecordCount,BufferAddr:Integer); - MsxSeek(FcbPointer:FcbPointerType,RecNumberLo,RecNumberHi:Integer); The result of the IO-operation can be observed through the variable MSXIOResult. Zero indicates success and Non-zero indictes failure. !!! You can set the random record field (4 bytes in FCB) by setting FcbPointer^.RanRecLo and FcbPointer^.RanRecHi, if you want to read or write a specified reacord in a file. As you probly know, Turbo Pascal doesn't read (exept clumsy Blockread) MSXDOS files, because it expects, that there is a small header on the top of the file containing information about record lenght and number of records. These routines are made to overcome this problem. PS. You can read/write data directly to/from variables using Addr-function to provide BufferAddr and SizeOf-function to provide RecordSize. MOVEDATA.INC MoveData.inc contains a procedure to move data from normal workspace ram to any slot. Procedure uses BIOS routine #14, so access to page 3 will cause immediate system crash. Procedure MoveData( SourceAddr:Integer;DestinationSlotId:Byte;DestinationAddr, ByteCount:Integer); * * * These files were created for my son to make his experience with Turbo Pascal more colourful and visual. Any comments, proposals of any kind are welcome ! Kari Lammassaari (ACADEMY) Finland On Internet lammassa@on-line.midnight.fi