Graphic2.zip by Kari Lammassaari (lammassa@grea-mail.great.fi) Graphic2.zip contains following files, procedures and functions: - vdpcmd.inc {This code contains variables and constants needed with graphic procedures} {READ IT to learn the names of the Colors, LogOps and Direction etc.} - screen.inc Screen(mode:byte); {Sets graphic screen.} {Uses ROM-bios.} - color.inc Color(ForeGroundColor,BackGroudColor,BorderColor:Byte); {Sets screen colors.} {Uses ROM-bios.} - setcolor.inc Procedure SetColor(color:Byte); {Sets drawing color.} {Uses ROM-bios.} - setpage.inc Procedure SetPage(ActivePage,DisplayPage:Byte); {Sets display and active page, where grapic operations occur.} {Uses ROM-bios} - 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 graphic block from any location in Vram anywhere in Vram.} {Direct code = accesses directly VDP registers.} {Needs vdpcmd.inc} {Fast, but NO logical operations} - copy_y.inc Procedure Copy_y (Source_x,Source_y:Integer;SourcePage:Byte; Destination_y,Number_y:Integer;DestinationPage:Byte; Direction:Byte); {Copies graphic block from any location in Vram UP or DOWN in Vram.} {Direct code = accesses directly VDP registers.} {Needs vdpcmd.inc} {Fast, but NO logical operations} - 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 graphic block from any location in Vram anywhere in Vram.} {Direct code = accesses directly VDP registers.} {Needs vdpcmd.inc} {Logical operations available.} - grpprint.inc Procedure GraphicPrint(Str:TPString;X,Y:Integer;Color:Byte;LogOp:Byte); {Writes text in any Graphic screen.} {You must define type TPString ec Type TPString = String[80]} {Uses ROM routines.} {Includes SetColor(DrawingColor:Byte) and Color(ForeGroundColor,BackGroudColor,BorderColor:Byte);} - line.inc Procedure Line(x1,y1,x2,y2:Integer;page,color,logop:Byte); {Draws a line anywhere in Vram.} {Direct code = accesses directly VDP registers.} {Needs vdpcmd.inc} {Logical operations available.} - lmmc.inc Procedure MoveDotToVram (SourceAddress :Integer; Destination_x,Destination_y:Integer;DestinationPage:Byte; Number_x,Number_y:Integer; LogicalOperation,Direction:Byte ); {In file LMMC.inc} {Direct code = accesses directly VDP registers.} {Needs vdpcmd.inc} {Logical operations available.} {Source is dot data, no screen bytes (except screen8 data.} - loadgrap.inc Procedure LoadGraphicBlock(FileName :StringType; x,y :Integer; Page :Byte; LogOp,Direction :Byte ); {For screens 5,6,7 nd 8. Screen mode read from SCRMOD #fcaf} {Direct code = accesses directly VDP registers.} {Needs vdpcmd.inc} {Needs msxdos2.inc !!!} {Logical operations available.} - box.inc Procedure Box(StartX,StartY,EndX,EndY:Integer;LogOp:Byte); {Draws a rectangle anywhere in VRAM. } {Uses ROM-bis.} {Logical operations available.} - paintbox.inc Procedure PaintBox (Destination_x,Destination_y:Integer;DestinationPage:Byte; Number_x,Number_y:Integer;Color,Direction:Byte); {Paints a filled rectangle with give color.} {Direct code.} {No logical operations.} - paintlog.inc Procedure PaintLog (Destination_x,Destination_y:Integer;DestinationPage:Byte; Number_x,Number_y:Integer; Color,LogicalOperation,Direction:Byte); {Paints a filled rectangle with give color.} {Direct code.} {Logical operations available.} - point.inc Function Point (Source_x,Source_y:Integer;SourcePage:Byte):Byte; {Returns the color of a point in any screen.} {Direct code } - pset.inc Procedure Pset (Destination_x,Destination_y:Integer;DestinationPage:Byte; Color,LogicalOperation:Byte); {Sets a point with required color on any graphic page.} {Direct code.} {Logical operations available.} - readvram.inc Procedure ReadVram(VramBlockUsed:Byte; VramAddr,RamAddr,ByteCount:Integer); { VramBlocUsed = 0 = first 64 Kb 1 = second 64 Kb 2 = Expansion Vram 64 Kb } {Reads a vram bloc to conventional ram.} {Direct code.} - wrtvram.inc Procedure WriteVram(VramBlockUsed:Byte; VramAddr,RamAddr,ByteCount:Integer); { VramBlocUsed = 0 = first 64 Kb 1 = second 64 Kb 2 = Expansion Vram 64 Kb } {Moves a RAM block to VRAM.} {Direct code} - wrtvdp.inc Procedure WrtVdp(VdpRegister,Value:Byte); {Writes value to any vdp register.} {There are both ROM-bios and Direct code available.} - sprite.inc Type Sprite8Type = Array[0..7] Of Byte; SpriteColorArrayType=Array[0..15] Of Byte; {These are some sprite shapes for testing purposes.} Const ArrowSprite :Sprite8Type = ($fe,$fc,$f0,$f8,$dc,$ce,$87,$03); ArrowSprite2:Sprite8Type = ($fe,$84,$88,$88,$b4,$ca,$85,$02); FingerSprite:Sprite8Type = ($06,$06,$06,$57,$7f,$7f,$7e,$3c); SquareSprite:Sprite8Type = (255,129,129,129,129,129,129,255); TimeGlassSprite:Sprite8Type =($7e,$7e,$3c,$18,$18,$3c,$7e,$7e); WhiteArray :SpriteColorArrayType = (15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15); (Use to create white sprite.) {Some color arrays for testing sprites.} YellowArray :SpriteColorArrayType = (10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10); RedArray :SpriteColorArrayType = (8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8); Procedure SetSpritePattern(PatternNumber:Byte;Var PatternArray:Sprite8Type); {Sets the shape of sprite.} {Direct code.} Procedure PutSprite(SpriteNum,SpritePatternNum,x,y:Byte); {Puts required sprite to required place in screen.} {Note that eg in screen 7 (512*212) the sprite coordinates are 0 -255.} {Direct code} Procedure SetSpriteColors(SpriteNum:Byte; AttributeA:SpriteColorArrayType); {Sets multicolour sprite with the colorsin array.} {Direct code.} Procedure ClearAllSprites; {I wonder, what this might do.} {Direct code.} Procedure _WriteVram(VramBlockUsed:Byte; VramAddr,RamAddr,ByteCount:Integer); (system used) Procedure _FillVram(VramBlockUsed:Byte; VramAddr:Integer;FillValue :Byte; (system used ) ByteCount:Integer); - font.inc {Font8*8.inc for screen 7} {This file needs vdpcmd.inc, copy_xy.inc copyl_xy.inc msxdos2.inc loadgrap.inc } {This file contains following definitions and procedures for SCREEN 7: - Type StringType = String[80]; - Procedure LoadFont(FontName:StringType); - Procedure FontWrite(St:StringType;x-coord,y-coord:Integer); - Pocdedure SetFontColour(ForegroudColor,BackgroundColor:Byte); - Procedure OperationMessage(Message:StringType); {The location of message is fixed.} FontFile is an ordinary bitmapfile created by BASIC copy command eg. 'quasar.fnt' . The pattern size = 8 * 8 ! If the patternsize is changed, all procedures need to be changed K.Lamassaari}