Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - madscijr

Pages: [1] 2 3 ... 20
1
QB64 Discussion / Re: QB64 Bounty List
« on: April 13, 2022, 10:07:49 am »
One wish list item I'd offer a bounty for (if it's within my modest means!) would be getting QB64 to read separate input from multiple USB mice plugged into the computer.

Preferably this would be cross-platform (I did research a while back and it looked like it was possible for PC, Linux and Mac using different methods, not sure about DOS) but at least for Windows.

Microsoft's RawInput API can do it, and I found a ton of examples, but alas this is just beyond my capabilities and/or free time :-( so to anyone who can get it done, what's it worth to ya? LoL

Here are the discussions about it with links to research findings / related libraries / sample code / etc.:

reading multiple mice input with _DEVICES and _DEVICE$, or RawInput ?:

https://qb64forum.alephc.xyz/index.php?topic=3348.0

reading multiple mice input revisited / external library question:

https://qb64forum.alephc.xyz/index.php?topic=3695.0

events and malloc in QB64?:

https://qb64forum.alephc.xyz/index.php?topic=3766.0

2
QB64 Discussion / Re: QB64 Bounty List
« on: April 11, 2022, 05:15:09 pm »
Petrol here in the UK works out at around $10.62 a gallon at current exchange rate.
If anything comes of this 'pay per fix' then I have got a few things I would like to see mainly concerning pdf files, barcodes and qrcodes.

Anything that makes qb64 more useful for business apps or practical day to day usefulness can't be bad!

3
QB64 Discussion / Re: QB64 Bounty List
« on: April 11, 2022, 01:46:33 pm »
So, that's when an idea came to me that sounds like a Win-Win for everyone involved:  A QB64 Bounty List!

This is actually a pretty interesting idea, and one I have thought about in the past for other software but like a million ideas got forgotten in the slipstream of busy life.

I'd have to give some thought to what missing features are bugging me or need fixing most, but I'll add that maybe in addition to cold hard $, some people can just barter stuff that a developer could use? Just an idea. As the economy feels the pinch, people might have a harder time coming up with extra dough, but also the busier we get the harder it becomes to find time to sell your stuff on ebay!

Another barter idea might be to barter _skills_. Maybe someone doesn't know C or how QB64 works under the hood, but they can help by writing functions in QB64 to help solve some of these problems - then someone who does know the lower level stuff can compile it, take the resulting C code, and optimize it? Just an idea.

Or barter non-programming skills - if a developer needs help with some other tool or task, to free up time to work on a given fix?

Anyway, interesting idea @SMcNeill !

4
QB64 Discussion / Re: Question regarding interacting with Excel files
« on: April 08, 2022, 01:42:52 pm »
From QB64 to XL, an other way could be using  _clipboard$ (for one value at time )

Ooooh, that's an interesting idea as an alternate way to get two EXEs on the same computer to talk to each other (other than using files).
What are some other methods we could use to get Excel to talk to QB64 - how about a network connection on the local machine??

5
QB64 Discussion / Re: Question regarding interacting with Excel files
« on: April 06, 2022, 04:01:16 pm »
When did XLS get obsoleted?  Did I miss something?  (As I said, I don't hardly ever use Excel or Power Point -- almost all my work is always in Word.)

Microsoft introduced XLSX with Office 2007, the main practical benefit of it being that it supports bigger workbooks (1 million rows to a sheet, 16384 columns, no more 255 character limit for a cell, etc.) and also I think it's more secure (the file can be loaded without autorunning the macros).

The xlsx and docx, etc. file format is also different in that they are really ZIP files that contain XML files with everything - try renaming your XLSX or DOCX adding file extension .ZIP at the end and double click the file. You will see a bunch of XML files that can be opened in your favorite editor. The only thing not included in that are the VBA macros and userforms which are still in some binary format. These can be exported from inside the VBE (the VBA macro editor) to .BAS, .CLS, .FRM, etc. But I digress.

Anyway, Microsoft released a free upgrade or add-on for the old Office 2003 that enables it to read/write the new Office file formats (not sure how well Excel 2003 plays with the larger sheet sizes, I think it just truncates anything past the old 64738 row / 255  column limit, etc.) - but it at least can access the newer file formats.

Don't ask me where to find that update anymore - MS is notorious for taking down drivers, installers and updates after a while, though they can usually be found with much searching, or on sketchy 3rd party sites, or archive.org.

Cheers

6
QB64 Discussion / Re: Question regarding interacting with Excel files
« on: April 06, 2022, 03:46:28 pm »
I am wondering whether anyone has looked into interacting with Excel files (reading and/or writing), preferably in the .xlsx format but .ods (OpenDocument Spreadsheet) format would be useful too.  I use CSV files a lot (readable and writable by Excel) but could really use a way to read and write directly to XLSX.

Has anyone tried this or does anyone have any suggestions or pointers to how it can be done?  I would be happy if I could get as far as just reading and writing data to cells. Accessing formatting and graphs and such is not as important.

Thanks in advance for any input.

LM

I haven't done it in QB64, but if you're in Windows and have Excel installed, it's easily done from vbscript by instantiating an Excel application object like this
Code: [Select]
' Write to Excel file from vbscript
Dim xlApplication ' As Excel.Application
Dim xlWorkbook ' As Excel.Workbook
Dim sFile ' As String

sFile = "C:\Temp\MyWorkbook.xlsx"
Set xlApplication = CreateObject("Excel.Application")
xlApplication.Visible = False

On Error Resume Next
Set xlWorkbook = xlApplication.Workbooks.Open(sFile)
If Err.Number <> 0 Then
    MsgBox "Error #" & CStr(Err.Number) & ": " & Err.Description
    Err.Clear
Else
    'manipulate file, like:
    xlApplication.Cells(1,2).Value = 255 ' Set row 1, column 2 to 255
    xlWorkbook.Save
    'etc.
End If
On Error Goto 0

xlApplication.Quit
xlWorkbook.Close False

Set xlWorkbook = Nothing
Set xlApplication = Nothing

I'm not sure how to do COM calls from QB64 (@SpriggsySpriggs is the API guru and might know) but alternately you could write a vbscript that reads & writes from/to Excel, which your QB64 can shell out to and pass command line params to and/or transfer parameters & data via a text or other file, and let the vbscript do the talking to Excel in its own native format.

Good luck!

7
Programs / Re: QBZerk
« on: April 05, 2022, 09:55:04 am »
@TerryRitchie @bplus
This is a great adaptation. I'm looking at modifying it to support 4 players simultaneously, where it's a shootout between the players (and the robots are optional). Kind of like the old Atari "Outlaw" game.
So far I edited the sprite PNG file to make the player transparent and need to modify the code to draw the player in a variable color. That part is not working yet, all I achieved is making the player invisible!
Also I moved the sound (.ogg) files into a "sounds" folder to make it easier to work with the files.
I will share updates if I get anywhere with this!

8
Programs / Re: Mover Bricks 2D and 3D
« on: April 01, 2022, 03:24:48 pm »
Hello !

The game is complete, it does not use external files. At start-up, the difficulty level can be adjusted (1-5).
I could still increase the design, but it wasn’t my goal with all this to make a design game, so I won’t deal with it anymore.
I was wondering how many of you make games. You make very good 2D games. I especially like walking games.A small change can be made from these games into a 3D game.

I love the idea of giving the user the option to play a game in 2-D, 2.5D or 3-D or switching between these views while they play. I'll definitely give this a look!

9
QB64 Discussion / Re: Time to bring in at least 150K new users to QB64
« on: April 01, 2022, 03:14:08 pm »
I don't know about increasing the QB64 user base, but if QB64 could ever be used to program the Pi or Arduino, then the user base for those platforms would be increased by at least 1 :-)

From what everyone is saying, you would need someone who knows C++, and a deep understanding of the target OS or platform, and has a lot of free time.

My best advice would be to appeal to tech students and/or retirees who might find this a worthwhile project!

Good Luck!

10
Chances are, this would take a registry approach. I have a library for interfacing with the registry.

Thanks, that's what I expect.

I just wouldn't know which keys to mess with.

Yep, there's the rub! I can keep looking on Windows admin type sites.

Thanks for your reply!

11
As another alternative, this might be achievable with a Windows API approach. Has @SpriggsySpriggs been around as of late?

That sounds more like what I was thinking... I haven't seen @SpriggsySpriggs but then again I myself have been a little busy. I would agree Spriggs is a SME who might have some interesting suggestions.

12
I haven't seen command switches capable of doing what you are asking. Switches like /select can be used in a SHELL statement to make Explorer highlight a file, for example. I suppose if those right-click to change also had a short-cut key, you could use QB64 _SENDKEY statements, with delays, to automate the process. My last resort would be to use _SCREENCLICK, because it would require the pane always open in the same desktop position and same size, so the mapping you made would always click on the appropriate pane header.

Thanks for your reply. I think I'm looking more for a way to directly manipulate Windows registry values - however / wherever those are that control this sort of thing. Simulating screen clicks and using sendkey would be kludgey.

I did find out that in Explorer, after selecting the columns, you can go to the [View] ribbon group & click [Options] > [Change folder and search options], then click the [View] tab, and click [Apply to Folders], and the columns should show up by default for all folders containing files of the related type (what they mean by "type" is a little fuzzy - does that mean the same file extension? Or does it refer to some broader Windows category such as text, video, pictures, music, etc.? No idea.)

Anyway, I don't know where Windows stores such settings, but was looking for a programmatic way to control some of that...

Thanks again

13
I'm looking for a way to automate selecting which file details (columns) Windows Explorer displays for a given path. (For example Frame Width, Frame Height, Frame Rate, Date Created, etc.)

The manual way to do this in Windows is to right-click the column header row in Explorer and click More, then scroll through the many options and check off each one you want to see, then click OK, and wait while Windows refreshes the Explorer window.

This method is quite unwieldy when working with files across many subdirectories and I'm wondering how this might be automated or scripted to accept a path as input, and the program either opens the path in an Explorer window showing the desired columns, or updates the system default for that path (in the registry or wherever it is that would need to be updated) so that when you do open it in Explorer, the desired columns are visible. (Bonus points for also programatically setting the column order!)

Any ideas on accomplishing this in QB64?

14
QB64 Discussion / Re: What's your philosophy about constants?
« on: March 26, 2022, 11:14:51 am »
Which is easier to type:
Const pi = 3.1415
or
Dim Shared pi as some type
pi = 3.1415

What I'm wondering is, which performs better?

Also, for color values, I've been using functions, like
Code: QB64: [Select]
  1. Function cRed~& ()
  2.     cRed = _RGB32(255, 0, 0)
because of some thread on here long since forgotten (I think function because it would be read only, and because constants were integer only and colors need to be unsigned long).

I am wondering if doing it as a shared value like
Code: QB64: [Select]
  1. dim shared cRed~& : cRed = _RGB32(255, 0, 0)
would perform better?

Similarly, I don't know where I read this, or even if it was qb64 or c64 basic, but somewhere I read that variables perform better than literals. For example something like
Code: QB64: [Select]
  1. x% = column% * 8
would run slower than
Code: QB64: [Select]
  1. dim shared tileSize% : tileSize% = 8
  2. ...
  3. x% = column% * tileSize%

Which would perform better, a literal or a variable?

15
...
The way I'd  go about doing something like this would be to make myself a custom SCREEN 0-style memory array.  Screen 0 stores all our information for each character in 2 bytes -- one for color, one for character.  I'd basically do the same, but with 3 bytes -- one for tile color, one for font color, one for character.

Let me toss a simple demo of this line of thinking for you:
...

OK, I started studying your example (see Sub TestCustomHardwareScreen2 on line 624) and I am a little confused about what exactly is happening.

You use the word "tile" and the word "font", and it seems like a tile is just a square block of color, whereas the font is what I would call the tile.

Is your code just creating a giant image with the tileset drawn in all possible combinations of foreground/background color?

Or is it actually drawing the tiles in hardware and changing the colors on the fly?

If it's the former (create a giant image for all possible color combinations) then I got that working (menu option 1, test #8 in below code) and it's pretty fast (13,433 refreshes).

Code: QB64: [Select]
  1. ' ################################################################################################################################################################
  2. ' Speed tests and demos of various methods draw a 2-color 8x8 tile
  3.  
  4. ' From thread:
  5. ' Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
  6. ' https://qb64forum.alephc.xyz/index.php?topic=4674.msg140904#msg140904
  7. ' ################################################################################################################################################################
  8.  
  9. ' ===============================================================================
  10. ' GLOBAL CONSTANTS
  11. ' ===============================================================================
  12. ' BOOLEAN VALUES
  13. Const FALSE = 0
  14. Const TRUE = Not FALSE
  15.  
  16. ' ===============================================================================
  17. ' USER DEFINED TYPES
  18. ' ===============================================================================
  19. ' UDT TO HOLD COORDINATES FOR DRAWING A RECTANGLE
  20. Type RectangleType
  21.     x1 As Integer ' start x
  22.     y1 As Integer ' start y
  23.     x2 As Integer ' end x
  24.     y2 As Integer ' end y
  25.     PixelCount As Integer
  26.     IsActive As Integer
  27. End Type ' RectangleType
  28.  
  29. Type DrawCompareType
  30.     IndexList As String
  31.     ShapeCount As Integer
  32.     PixelCount As Integer
  33.     IsActive As Integer
  34. End Type ' DrawCompareType
  35.  
  36. ' UDT FOR PRECALCULATED TILESHEET
  37. Type TileSheetMapType
  38.     xStart As Integer
  39.     xEnd As Integer
  40.     yStart As Integer
  41.     yEnd As Integer
  42.  
  43. ' UDT FOR PRECALCULATED TILE MAP
  44. Type TileMapType
  45.     xPos As Integer
  46.     yPos As Integer
  47.  
  48. ' ===============================================================================
  49. ' GLOBAL VARIABLES
  50. ' ===============================================================================
  51. Dim Shared m_bDebug As Integer: m_bDebug = TRUE ' ENABLES/DISABLES CONSOLE WINDOW AND DebugPrint
  52. Dim Shared m_ProgramPath$: m_ProgramPath$ = Left$(Command$(0), _InStrRev(Command$(0), "\"))
  53. Dim Shared m_ProgramName$: m_ProgramName$ = Mid$(Command$(0), _InStrRev(Command$(0), "\") + 1)
  54. Dim Shared m_arrLineTiles(0 To 255, 0 To 32) As RectangleType
  55.  
  56. ' Used for Steve's very different custom screen:
  57. Dim Shared m_TileHw As Long
  58. Dim Shared m_FontHw As Long
  59. Dim Shared m_ScreenArray(99, 74) As _Unsigned Long ' Here, I'm creating a screen array to hold the information of EVERY character I place onto the screen, and its tile
  60.  
  61. ' ===============================================================================
  62. ' LOCAL VARIABLES
  63. ' ===============================================================================
  64. Dim in$
  65.  
  66. ' ****************************************************************************************************************************************************************
  67. ' ACTIVATE DEBUGGING WINDOW
  68. If m_bDebug = TRUE Then
  69.     $Console
  70.     _Delay 4
  71.     _Console On
  72.     _Echo "Started " + m_ProgramName$
  73.     _Echo "Debugging on..."
  74. ' ****************************************************************************************************************************************************************
  75.  
  76. ' ===============================================================================
  77. ' START THE MAIN ROUTINE
  78. ' ===============================================================================
  79. main
  80.  
  81. ' ===============================================================================
  82. ' FINISH
  83. ' ===============================================================================
  84. Print m_ProgramName$ + " finished."
  85. Input "Press <ENTER> to continue", in$
  86. ' ****************************************************************************************************************************************************************
  87. ' DEACTIVATE DEBUGGING WINDOW
  88. If m_bDebug = TRUE Then
  89. ' ****************************************************************************************************************************************************************
  90. System ' return control to the operating system
  91.  
  92. ' ################################################################################################################################################################
  93. ' BEGIN MAIN MENU
  94. ' ################################################################################################################################################################
  95.  
  96. ' /////////////////////////////////////////////////////////////////////////////
  97.  
  98. Sub main
  99.     Dim RoutineName As String: RoutineName = "main"
  100.     Dim in$
  101.     Dim bFinished As Integer: bFinished = FALSE
  102.     Dim result$: result$ = ""
  103.     Do
  104.         Screen 0: _ScreenMove 0, 0
  105.         Cls
  106.         Print m_ProgramName$
  107.         Print
  108.         Print "RE: fastest way to draw a 2-color 8x8 tile (with variable colors)?"
  109.         Print
  110.  
  111.         Print "1) DrawingSpeedTest7"
  112.         Print
  113.         Print "2) HardwareImageDemo2"
  114.         Print
  115.         Print "3) GetAllPossibleShapesTest"
  116.         Print "4) FindOptimizedVectorTest - find minimum shapes to draw a tile"
  117.         Print "5) GetVectorTilesTest"
  118.         Print "6) MakePaletteImageTest"
  119.         Print "7) DrawVectorTilePutImageTest"
  120.         Print
  121.         Print "A) TestCustomHardwareScreen1"
  122.         Print "B) ^ instructions"
  123.         Print
  124.         Print "C) TestSoftwareScreen1"
  125.         Print "D) ^ instructions"
  126.  
  127.         Print "E) TestCustomHardwareScreen2"
  128.  
  129.         Print
  130.         Print "Q) Exit program"
  131.         Do
  132.             in$ = InKey$
  133.             If UCase$(in$) = "Q" Then
  134.                 bFinished = TRUE: Exit Do
  135.             ElseIf UCase$(in$) = "1" Then
  136.                 DrawingSpeedTest7: Exit Do
  137.             ElseIf UCase$(in$) = "2" Then
  138.                 HardwareImageDemo2: Exit Do
  139.             ElseIf UCase$(in$) = "3" Then
  140.                 GetAllPossibleShapesTest: Exit Do
  141.             ElseIf UCase$(in$) = "4" Then
  142.                 FindOptimizedVectorTest: Exit Do
  143.             ElseIf UCase$(in$) = "5" Then
  144.                 GetVectorTilesTest: Exit Do
  145.             ElseIf UCase$(in$) = "6" Then
  146.                 MakePaletteImageTest: Exit Do
  147.             ElseIf UCase$(in$) = "7" Then
  148.                 DrawVectorTilePutImageTest: Exit Do
  149.             ElseIf UCase$(in$) = "A" Then
  150.                 TestCustomHardwareScreen1: Exit Do
  151.             ElseIf UCase$(in$) = "B" Then
  152.                 ShowInstructions (GetInstructions1$): Exit Do
  153.             ElseIf UCase$(in$) = "C" Then
  154.                 TestSoftwareScreen1: Exit Do
  155.             ElseIf UCase$(in$) = "D" Then
  156.                 ShowInstructions (GetInstructions2$): Exit Do
  157.  
  158.             ElseIf UCase$(in$) = "E" Then
  159.                 TestCustomHardwareScreen2: Exit Do
  160.  
  161.             End If
  162.         Loop
  163.     Loop Until bFinished = TRUE
  164. End Sub ' main
  165.  
  166. ' ################################################################################################################################################################
  167. ' END MAIN MENU
  168. ' ################################################################################################################################################################
  169.  
  170. ' ################################################################################################################################################################
  171. ' BEGIN DRAWING SPEED TEST
  172. ' ################################################################################################################################################################
  173.  
  174. ' /////////////////////////////////////////////////////////////////////////////
  175.  
  176. Sub DrawingSpeedTest7
  177.     Dim sError As String: sError = ""
  178.     Dim imgScreen As Long ' the main display
  179.     Dim imgHardwareScreen As Long ' copy of the software screen, transformed into a hardware image
  180.     Dim imgTiles As Long ' original tileset, black on transparent
  181.     Dim imgHardwareTiles As Long ' copy of the tileset, tranformed into a hardware image
  182.     Dim imgTilesRed As Long ' colored tileset copy
  183.     Dim imgTilesGreen As Long ' colored tileset copy
  184.     Dim imgTilesBlue As Long ' colored tileset copy
  185.     Dim imgTilesYellow As Long ' colored tileset copy
  186.     Dim imgColorTiles As Long ' holds 4 copies of tileset in different colors (red, green, blue, yellow)
  187.     Dim imgTilesAllColorsSW As Long ' holds n copies of tileset in all combinations of specified foreground/background colors
  188.     Dim imgTilesAllColorsHW As Long ' copy of the tileset, tranformed into a hardware image
  189.  
  190.     Dim imgPalette As Long ' contains palette of colors
  191.     Dim imgPaletteHW As Long ' hardware image of palette of colors
  192.     Dim iTileNum As Integer
  193.     Dim iFgColorIndex As Integer: iFgColorIndex = 0
  194.     Dim iBgColorIndex As Integer: iBgColorIndex = 0
  195.     Dim iFirstColor As Integer: iFirstColor = 0
  196.     Dim iLastColor As Integer: iLastColor = 3
  197.     'Dim iCols As Integer
  198.     'Dim iRows As Integer
  199.     Dim iY As Integer
  200.     Dim iX As Integer
  201.     Dim fgColor As _Unsigned Long
  202.     Dim bgColor As _Unsigned Long
  203.     Dim iMinY As Integer
  204.     Dim iMaxY As Integer
  205.     Dim iMinX As Integer
  206.     Dim iMaxX As Integer
  207.     Dim iCount1 As Long
  208.     Dim iCount2 As Long
  209.     Dim iCount3 As Long
  210.     Dim iCount4 As Long
  211.     Dim iCount5 As Long
  212.     Dim iCount6 As Long
  213.     Dim iCount7 As Long
  214.     Dim iCount8 As Long
  215.     Dim t# ' for timer
  216.     Dim arrColor(0 To 5) As _Unsigned Long
  217.  
  218.     Dim arrColors(-1) As _Unsigned Long ' supported colors for COLORED TILESET COPIES v2
  219.     ReDim arrTileIndex(-1) As Long ' stores x positions for tiles (0-255) for COLORED TILESET COPIES v2
  220.     ReDim arrColorIndex(-1, -1) As Long ' stores y positions for (fgColorIndex, bgColorIndex) for COLORED TILESET COPIES v2
  221.     Dim iFirstColor2 As Integer
  222.     Dim iLastColor2 As Integer
  223.  
  224.     ' ================================================================================================================================================================
  225.     ' INIT SCREEN
  226.     ' ================================================================================================================================================================
  227.     imgScreen = _NewImage(1024, 768, 32): _ScreenMove 0, 0
  228.     Screen imgScreen
  229.     Cls , cGray
  230.  
  231.     'iCols = _Width(imgScreen) \ 8
  232.     'iRows = _Height(imgScreen) \ 8
  233.  
  234.     iMinX = 1: iMaxX = 16
  235.     iMinY = 3: iMaxY = 18
  236.  
  237.     ' ================================================================================================================================================================
  238.     ' INITIALIZE NEUTRAL COLOR GRAPHICS TILES (BLACK ON TRANSPARENT)
  239.     ' ================================================================================================================================================================
  240.     If Len(sError) = 0 Then
  241.         '' LOAD TILES (16 cols x 16 rows of 8x8 tiles) FROM FILE
  242.         'sFile$ = Left$(Command$(0), _InStrRev(Command$(0), "\")) + "Font_8x8_128x128_v3.png" ' 128x128 pixels, 16 rows x 16 columns of 8x8 tiles
  243.         'imgTiles = _LoadImage(sFile$, 32)
  244.  
  245.         ' LOAD TILES FROM TEXT DEFINITIONS IN Sub GetTileText
  246.         sError = GetTiles$(imgTiles, cBlack, cEmpty)
  247.     End If
  248.  
  249.     ' ================================================================================================================================================================
  250.     ' CREATE COLORED TILESET COPIES v1
  251.     ' ================================================================================================================================================================
  252.     If Len(sError) = 0 Then
  253.         MakeColoredTileset imgTiles, imgTilesRed, cRed, cBlack
  254.         MakeColoredTileset imgTiles, imgTilesGreen, cLime, cBlack
  255.         MakeColoredTileset imgTiles, imgTilesBlue, cBlue, cBlack
  256.         MakeColoredTileset imgTiles, imgTilesYellow, cYellow, cBlack
  257.  
  258.         ' Make one big tileset with all colors
  259.         imgColorTiles = _NewImage(512, 128, 32)
  260.         _PutImage (0, 0), imgTilesRed, imgColorTiles, (0, 0)-(128, 128)
  261.         _PutImage (128, 0), imgTilesGreen, imgColorTiles, (0, 0)-(128, 128)
  262.         _PutImage (256, 0), imgTilesBlue, imgColorTiles, (0, 0)-(128, 128)
  263.         _PutImage (384, 0), imgTilesYellow, imgColorTiles, (0, 0)-(128, 128)
  264.  
  265.         imgHardwareTiles = _CopyImage(imgColorTiles, 33) ' Copy tilesheet for hardware image
  266.     End If
  267.  
  268.     ' ================================================================================================================================================================
  269.     ' CREATE COLORED TILESET COPIES v2
  270.     ' ================================================================================================================================================================
  271.     If Len(sError) = 0 Then
  272.         'ReDim arrColors(0 To 4) As _UNSIGNED Long
  273.         'arrColors(0) = cRed
  274.         'arrColors(1) = cLime
  275.         'arrColors(2) = cBlue
  276.         'arrColors(3) = cYellow
  277.         'arrColors(4) = cBlack
  278.  
  279.         ReDim arrColors(0 To 39) As _Unsigned Long
  280.         arrColors(0) = cRed
  281.         arrColors(1) = cOrangeRed
  282.         arrColors(2) = cDarkOrange
  283.         arrColors(3) = cOrange
  284.         arrColors(4) = cGold
  285.         arrColors(5) = cYellow
  286.         arrColors(6) = cChartreuse
  287.         arrColors(7) = cOliveDrab1
  288.         arrColors(8) = cLime
  289.         arrColors(9) = cMediumSpringGreen
  290.         arrColors(10) = cCyan
  291.         arrColors(11) = cDeepSkyBlue
  292.         arrColors(12) = cDodgerBlue
  293.         arrColors(13) = cSeaBlue
  294.         arrColors(14) = cBlue
  295.         arrColors(15) = cBluePurple
  296.         arrColors(16) = cDeepPurple
  297.         arrColors(17) = cPurple
  298.         arrColors(18) = cPurpleRed
  299.         arrColors(19) = cDarkRed
  300.         arrColors(20) = cBrickRed
  301.         arrColors(21) = cDarkGreen
  302.         arrColors(22) = cGreen
  303.         arrColors(23) = cOliveDrab
  304.         arrColors(24) = cLightPink
  305.         arrColors(25) = cHotPink
  306.         arrColors(26) = cDeepPink
  307.         arrColors(27) = cMagenta
  308.         arrColors(28) = cBlack
  309.         arrColors(29) = cDimGray
  310.         arrColors(30) = cGray
  311.         arrColors(31) = cDarkGray
  312.         arrColors(32) = cSilver
  313.         arrColors(33) = cLightGray
  314.         arrColors(34) = cGainsboro
  315.         arrColors(35) = cWhiteSmoke
  316.         arrColors(36) = cWhite
  317.         arrColors(37) = cDarkBrown
  318.         arrColors(38) = cLightBrown
  319.         arrColors(39) = cKhaki
  320.         iFirstColor2 = LBound(arrColors)
  321.         iLastColor2 = UBound(arrColors)
  322.  
  323.         ' Make one big tileset with all possible foreground/background color combinations
  324.         MakeColoredTileset2 imgTiles, imgTilesAllColorsSW, arrColors(), arrTileIndex(), arrColorIndex()
  325.         imgTilesAllColorsHW = _CopyImage(imgTilesAllColorsSW, 33) ' Copy tilesheet for hardware image
  326.     End If
  327.  
  328.     ' ================================================================================================================================================================
  329.     ' VECTOR TILES SETUP
  330.     ' ================================================================================================================================================================
  331.     If Len(sError) = 0 Then
  332.         ' set up vector tiles
  333.         GetVectorTiles
  334.  
  335.         ' set up colors for vector HW tiles
  336.         arrColor(0) = cRed
  337.         arrColor(1) = cLime
  338.         arrColor(2) = cBlue
  339.         arrColor(3) = cYellow
  340.         arrColor(4) = cBlack
  341.         arrColor(5) = cEmpty
  342.         MakePaletteImage imgPalette, arrColor()
  343.         _Dest imgScreen&
  344.  
  345.         imgPaletteHW = _CopyImage(imgPalette, 33) ' Copy palette for hardware image
  346.     End If
  347.  
  348.     ' ================================================================================================================================================================
  349.     ' METHOD #1
  350.     ' _PUTIMAGE with SOFTWARE IMAGES
  351.     ' ================================================================================================================================================================
  352.     If Len(sError) = 0 Then
  353.         Cls , cGray
  354.         Color cWhite, cBlack: Locate 1, 1: Print "Test #1: DrawTile8 routine using 4 tilesets (1 per color) and regular _putimage using using SOFTWARE images..."
  355.  
  356.         iCount1 = 0
  357.         t# = Timer + 3
  358.         Do
  359.             iCount1 = iCount1 + 1
  360.             iFirstColor = iFirstColor Xor 1
  361.             iFgColorIndex = iFirstColor
  362.             iY = iMinY
  363.             iX = iMinX
  364.             For iTileNum = 0 To 255
  365.                 Select Case iFgColorIndex
  366.                     Case 0:
  367.                         DrawTile8 imgTilesRed, iTileNum, imgScreen, iX, iY
  368.                     Case 1:
  369.                         DrawTile8 imgTilesGreen, iTileNum, imgScreen, iX, iY
  370.                     Case 2:
  371.                         DrawTile8 imgTilesBlue, iTileNum, imgScreen, iX, iY
  372.                     Case Else:
  373.                         DrawTile8 imgTilesYellow, iTileNum, imgScreen, iX, iY
  374.                 End Select
  375.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  376.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  377.             Next iTileNum
  378.             _Display
  379.         Loop Until Timer > t#
  380.         _AutoDisplay
  381.     End If
  382.  
  383.     ' ================================================================================================================================================================
  384.     ' METHOD #2
  385.     ' COLOR SWAP with SOFTWARE IMAGES
  386.     ' ================================================================================================================================================================
  387.     If Len(sError) = 0 Then
  388.         Cls , cGray
  389.         Color cWhite, cBlack: Locate 1, 1: Print "Test #2: DrawColorTile routine using 1 tileset with DoColorSwap using SOFTWARE images...";
  390.  
  391.         iCount2 = 0
  392.         t# = Timer + 3
  393.         Do
  394.             iCount2 = iCount2 + 1
  395.             iFirstColor = iFirstColor Xor 1
  396.             iFgColorIndex = iFirstColor
  397.             iY = iMinY
  398.             iX = iMinX
  399.             For iTileNum = 0 To 255
  400.                 Select Case iFgColorIndex
  401.                     Case 0:
  402.                         fgColor = cRed: bgColor = cBlack
  403.                     Case 1:
  404.                         fgColor = cLime: bgColor = cBlack
  405.                     Case 2:
  406.                         fgColor = cBlue: bgColor = cBlack
  407.                     Case Else:
  408.                         fgColor = cYellow: bgColor = cBlack
  409.                 End Select
  410.                 DrawColorTile imgScreen, imgTiles, iTileNum, fgColor, bgColor, iX, iY
  411.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  412.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  413.             Next iTileNum
  414.             _Display
  415.         Loop Until Timer > t#
  416.         _AutoDisplay
  417.     End If
  418.  
  419.     ' ================================================================================================================================================================
  420.     ' METHOD #3
  421.     ' _PUTIMAGE with HARDWARE IMAGES
  422.     ' ================================================================================================================================================================
  423.     If Len(sError) = 0 Then
  424.         Cls , cGray
  425.         Color cWhite, cBlack: Locate 1, 1: Print "Test #3: DrawTileHw8 routine using 1 big multi-tileset and HARDWARE images...";
  426.  
  427.         imgHardwareScreen = _CopyImage(0, 33)
  428.  
  429.         iCount3 = 0
  430.         t# = Timer + 3
  431.         Do
  432.             iCount3 = iCount3 + 1
  433.             iFirstColor = iFirstColor Xor 1
  434.             iFgColorIndex = iFirstColor
  435.             iY = iMinY
  436.             iX = iMinX
  437.             _PutImage , imgHardwareScreen
  438.             For iTileNum = 0 To 255
  439.                 DrawTileHw8 imgHardwareTiles, iTileNum, imgScreen, iX, iY, iFgColorIndex
  440.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  441.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  442.             Next iTileNum
  443.             _Display
  444.         Loop Until Timer > t#
  445.         _AutoDisplay
  446.         If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  447.         If imgHardwareTiles < -1 Or imgHardwareTiles > 0 Then _FreeImage imgHardwareTiles ' FREE MEMORY
  448.     End If
  449.  
  450.     ' ================================================================================================================================================================
  451.     ' METHOD #4
  452.     ' VECTOR-BASED TILES USING LINE
  453.     ' ================================================================================================================================================================
  454.     If Len(sError) = 0 Then
  455.         Cls , cGray
  456.         Color cWhite, cBlack: Locate 1, 1: Print "Test #4: DrawVectorTileLine routine using 1 vector-based tileset drawn with Line shapes...";
  457.  
  458.         iCount4 = 0
  459.         t# = Timer + 3
  460.         Do
  461.             iCount4 = iCount4 + 1
  462.             iFirstColor = iFirstColor Xor 1
  463.             iFgColorIndex = iFirstColor
  464.             iY = iMinY
  465.             iX = iMinX
  466.             For iTileNum = 0 To 255
  467.                 Select Case iFgColorIndex
  468.                     Case 0:
  469.                         fgColor = cRed: bgColor = cBlack
  470.                     Case 1:
  471.                         fgColor = cLime: bgColor = cBlack
  472.                     Case 2:
  473.                         fgColor = cBlue: bgColor = cBlack
  474.                     Case Else:
  475.                         fgColor = cYellow: bgColor = cBlack
  476.                 End Select
  477.                 'DrawShape iTileNum, iX, iY, fgColor, bgColor
  478.                 DrawVectorTileLine iTileNum, iX * 8, iY * 8, fgColor, bgColor
  479.  
  480.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  481.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  482.             Next iTileNum
  483.             _Display
  484.         Loop Until Timer > t#
  485.         _AutoDisplay
  486.     End If
  487.  
  488.     ' ================================================================================================================================================================
  489.     ' METHOD #5
  490.     ' VECTOR-BASED TILES USING _PutImage
  491.     ' ================================================================================================================================================================
  492.     If Len(sError) = 0 Then
  493.         Cls , cGray
  494.         Color cWhite, cBlack: Locate 1, 1: Print "Test #5: DrawVectorTilePutImage routine using 1 vector-based tileset drawn with _PutImage...";
  495.  
  496.         iBgColorIndex = 4
  497.  
  498.         iCount5 = 0
  499.         t# = Timer + 3
  500.         Do
  501.             iCount5 = iCount5 + 1
  502.             iFirstColor = iFirstColor Xor 1
  503.             iFgColorIndex = iFirstColor
  504.             iY = iMinY
  505.             iX = iMinX
  506.             For iTileNum = 0 To 255
  507.                 'DrawVectorTileLine iTileNum, iX*8, iY*8, fgColor, bgColor
  508.                 DrawVectorTilePutImage _
  509.                     imgScreen, imgPalette, arrColor(), _
  510.                     iTileNum, iX, iY, _
  511.                     iFgColorIndex, iBgColorIndex
  512.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  513.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  514.             Next iTileNum
  515.             _Display
  516.         Loop Until Timer > t#
  517.         _AutoDisplay
  518.     End If
  519.  
  520.     ' ================================================================================================================================================================
  521.     ' METHOD #6
  522.     ' VECTOR-BASED TILES USING _PutImage with HARDWARE IMAGES
  523.     ' ================================================================================================================================================================
  524.     If Len(sError) = 0 Then
  525.         Cls , cGray
  526.         Color cWhite, cBlack: Locate 1, 1: Print "Test #6: DrawVectorTilePutImageHW routine using 1 vector-based tileset drawn with hardware images...";
  527.  
  528.         iBgColorIndex = 4
  529.         imgHardwareScreen = _CopyImage(0, 33)
  530.  
  531.         iCount6 = 0
  532.         t# = Timer + 3
  533.         Do
  534.             iCount6 = iCount6 + 1
  535.             iFirstColor = iFirstColor Xor 1
  536.             iFgColorIndex = iFirstColor
  537.             iY = iMinY
  538.             iX = iMinX
  539.             _PutImage , imgHardwareScreen
  540.             For iTileNum = 0 To 255
  541.                 'DrawVectorTileLine iTileNum, iX*8, iY*8, fgColor, bgColor
  542.                 DrawVectorTilePutImageHW _
  543.                     imgPaletteHW, arrColor(), _
  544.                     iTileNum, iX, iY, _
  545.                     iFgColorIndex, iBgColorIndex
  546.  
  547.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  548.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  549.             Next iTileNum
  550.             _Display
  551.         Loop Until Timer > t#
  552.         _AutoDisplay
  553.         If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  554.         If imgPaletteHW < -1 Or imgPaletteHW > 0 Then _FreeImage imgPaletteHW ' FREE MEMORY
  555.     End If
  556.  
  557.     ' ================================================================================================================================================================
  558.     ' METHOD #7
  559.     ' SOLID BOXES WITH LINE
  560.     ' ================================================================================================================================================================
  561.     If Len(sError) = 0 Then
  562.         Cls , cGray
  563.         Color cWhite, cBlack: Locate 1, 1: Print "Test #7: Solid boxes with Line...";
  564.  
  565.         iCount7 = 0
  566.         t# = Timer + 3
  567.         Do
  568.             _Display
  569.             iCount7 = iCount7 + 1
  570.             iFirstColor = iFirstColor Xor 1
  571.             iFgColorIndex = iFirstColor
  572.             iY = iMinY
  573.             iX = iMinX
  574.             For iTileNum = 0 To 255
  575.                 Select Case iFgColorIndex
  576.                     Case 0:
  577.                         fgColor = cRed: bgColor = cBlack
  578.                     Case 1:
  579.                         fgColor = cLime: bgColor = cBlack
  580.                     Case 2:
  581.                         fgColor = cBlue: bgColor = cBlack
  582.                     Case Else:
  583.                         fgColor = cYellow: bgColor = cBlack
  584.                 End Select
  585.  
  586.                 'DrawShape iTileNum, iX, iY, fgColor, bgColor
  587.                 'DrawVectorTileLine iTileNum, iX*8, iY*8, fgColor, bgColor
  588.                 Line (iX * 8, iY * 8)-((iX * 8) + 7, (iY * 8) + 7), fgColor, BF ' Draw a solid box
  589.  
  590.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  591.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  592.             Next iTileNum
  593.             _Display
  594.         Loop Until Timer > t#
  595.         _AutoDisplay
  596.     End If
  597.  
  598.  
  599.     ' ================================================================================================================================================================
  600.     ' METHOD #8
  601.     ' _PUTIMAGE with HARDWARE IMAGES v2 (ALL COLOR COMBINATIONS)
  602.     ' ================================================================================================================================================================
  603.     If Len(sError) = 0 Then
  604.         Cls , cGray
  605.         Color cWhite, cBlack: Locate 1, 1: Print "Test #8: DrawColorTileHw8 routine using 1 big multi-tileset and HARDWARE images...";
  606.  
  607.         ''_PutImage (xDest%, yDest%), imgTiles&, imgScreen&, (sx1%, sy1%)-(sx2%, sy2%)
  608.         '_PutImage (0, 0), imgTilesAllColorsSW, imgScreen
  609.         'sleep
  610.         'IF TRUE=FALSE THEN
  611.         imgHardwareScreen = _CopyImage(0, 33)
  612.  
  613.         iCount8 = 0
  614.         t# = Timer + 3
  615.         Do
  616.             iCount8 = iCount8 + 1
  617.             iFirstColor2 = iFirstColor2 Xor 1
  618.             iFgColorIndex = iFirstColor2
  619.             iBgColorIndex = iFgColorIndex + 1: If iBgColorIndex > iLastColor2 Then iBgColorIndex = iFirstColor2
  620.  
  621.             iY = iMinY
  622.             iX = iMinX
  623.             _PutImage , imgHardwareScreen
  624.             For iTileNum = 0 To 255
  625.                 DrawColorTileHw8 imgTilesAllColorsHW, iTileNum, imgScreen, iX, iY, iFgColorIndex, iBgColorIndex, arrTileIndex(), arrColorIndex()
  626.                 iFgColorIndex = iFgColorIndex + 1
  627.                 If iFgColorIndex > iLastColor2 Then
  628.                     iFgColorIndex = iFirstColor2
  629.                     iBgColorIndex = iBgColorIndex + 1
  630.                     If iBgColorIndex > iLastColor2 Then
  631.                         iBgColorIndex = iFirstColor2
  632.                     End If
  633.                 End If
  634.  
  635.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  636.             Next iTileNum
  637.             _Display
  638.         Loop Until Timer > t#
  639.         _AutoDisplay
  640.         If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  641.         'END IF
  642.         If imgTilesAllColorsHW < -1 Or imgTilesAllColorsHW > 0 Then _FreeImage imgTilesAllColorsHW ' FREE MEMORY
  643.     End If
  644.  
  645.  
  646.  
  647.     ' ================================================================================================================================================================
  648.     ' SHOW RESULTS
  649.     ' ================================================================================================================================================================
  650.     Cls , cGray
  651.     Color cWhite, cBlack: Locate 1, 1
  652.     Print ""
  653.     Print "RESULTS:"
  654.     Print Using "DrawTile8                ###,###,###,###,###,### refreshes in 3 seconds."; iCount1
  655.     Print Using "DrawColorTile            ###,###,###,###,###,### refreshes in 3 seconds."; iCount2
  656.     Print Using "DrawTileHw8              ###,###,###,###,###,### refreshes in 3 seconds."; iCount3
  657.     Print Using "DrawVectorTileLine       ###,###,###,###,###,### refreshes in 3 seconds."; iCount4
  658.     Print Using "DrawVectorTilePutImage   ###,###,###,###,###,### refreshes in 3 seconds."; iCount5
  659.     Print Using "DrawVectorTilePutImageHW ###,###,###,###,###,### refreshes in 3 seconds."; iCount6
  660.     Print Using "Solid boxes with Line    ###,###,###,###,###,### refreshes in 3 seconds."; iCount7
  661.     Print Using "DrawColorTileHw8         ###,###,###,###,###,### refreshes in 3 seconds."; iCount8
  662.     Print "PRESS ANY KEY TO CONTINUE"
  663.     Sleep
  664.  
  665.     ' ================================================================================================================================================================
  666.     ' CLEANUP AND EXIT
  667.     ' ================================================================================================================================================================
  668.     Screen 0 ' RETURN TO TEXT SCREEN
  669.     If imgScreen < -1 Or imgScreen > 0 Then _FreeImage imgScreen ' FREE MEMORY
  670.     'If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  671.     If imgTiles < -1 Or imgTiles > 0 Then _FreeImage imgTiles ' FREE MEMORY
  672.     'If imgHardwareTiles < -1 Or imgHardwareTiles > 0 Then _FreeImage imgHardwareTiles ' FREE MEMORY
  673.     If imgTilesRed < -1 Or imgTilesRed > 0 Then _FreeImage imgTilesRed ' FREE MEMORY
  674.     If imgTilesGreen < -1 Or imgTilesGreen > 0 Then _FreeImage imgTilesGreen ' FREE MEMORY
  675.     If imgTilesBlue < -1 Or imgTilesBlue > 0 Then _FreeImage imgTilesBlue ' FREE MEMORY
  676.     If imgTilesYellow < -1 Or imgTilesYellow > 0 Then _FreeImage imgTilesYellow ' FREE MEMORY
  677.     If imgColorTiles < -1 Or imgColorTiles > 0 Then _FreeImage imgColorTiles ' FREE MEMORY
  678.     If imgTilesAllColorsSW < -1 Or imgTilesAllColorsSW > 0 Then _FreeImage imgTilesAllColorsSW ' FREE MEMORY
  679.     'If imgTilesAllColorsHW < -1 Or imgTilesAllColorsHW > 0 Then _FreeImage imgTilesAllColorsHW ' FREE MEMORY
  680.     If imgPalette < -1 Or imgPalette > 0 Then _FreeImage imgPalette ' FREE MEMORY
  681.     'If imgPaletteHW < -1 Or imgPaletteHW > 0 Then _FreeImage imgPaletteHW ' FREE MEMORY
  682.  
  683. End Sub ' DrawingSpeedTest7
  684.  
  685. ' ################################################################################################################################################################
  686. ' END DRAWING SPEED TEST
  687. ' ################################################################################################################################################################
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729. ' ################################################################################################################################################################
  730. ' BEGIN Steve's very different custom screen
  731. ' ################################################################################################################################################################
  732.  
  733. ' /////////////////////////////////////////////////////////////////////////////
  734.  
  735. Sub TestCustomHardwareScreen2
  736.     Dim sError As String: sError = ""
  737.     Dim in$
  738.     Dim arrColors(255) As _Unsigned Long ' an array to hold all my color values
  739.     Dim imgDisplay As Long
  740.     Dim imgTile As Long
  741.     Dim imgFont As Long
  742.     Dim imgTempScreen256 As Long
  743.     Dim iLoop As Integer
  744.     Dim iColor As Integer
  745.     Dim iTile As Integer
  746.     Dim iX As Integer
  747.     Dim iY As Integer
  748.     Dim count&
  749.     Dim t## ' _FLOAT
  750.  
  751.  
  752.     imgDisplay = _NewImage(800, 600, 32) ' my main screenwich is 100 by 75 characters with 8x8 font.
  753.     imgTile = _NewImage(8 * 256, 8, 32) ' 8x8 tiles in 256 colors
  754.     imgFont = _NewImage(8 * 256, 8 * 256, 32) ' 256 characters of an 8x8 font, in all 256 possible colors.
  755.  
  756.     ' Set the main screen for starters so it'll go ahead
  757.     ' and create itself properly while I'm working on making my tiles and fonts
  758.     Screen imgDisplay
  759.  
  760.     ' very tiny 256 color screen, just to borrow the palette from
  761.     imgTempScreen256 = _NewImage(10, 10, 256)
  762.     ' 40 colors
  763.     For iLoop = 0 To 255
  764.         ' since I don't know your color palette, I'll just copy the QB64 256 color palette.  ;)
  765.         arrColors(iLoop) = _RGB32(_Red(iLoop, imgTempScreen256), _Green(iLoop, imgTempScreen256), _Blue(iLoop, imgTempScreen256))
  766.     Next iLoop
  767.     If imgTempScreen256 < -1 Or imgTempScreen256 > 0 Then _FreeImage imgTempScreen256 ' FREE MEMORY
  768.  
  769.     ' Create my software tiles of 256 colors
  770.     _Dest imgTile
  771.     For iLoop = 0 To 255 ' 256 tiles, one for each color
  772.         ' all drawn sequentially onto a sprite sheet
  773.         Line (iLoop * 8, 0)-Step(8, 8), arrColors(iLoop), BF
  774.     Next iLoop
  775.  
  776.     ' I'm just going to use the built in QB64 8x8 font for quick and easy sheet creation.
  777.     _Dest imgFont
  778.     _Font 8
  779.     For iColor = 0 To 255 ' 256 colors
  780.         Color arrColors(iColor), 0 ' make our font the proper color
  781.         For iTile = 0 To 255 ' 256 characters
  782.             ' print the characters row by row to the screen
  783.             _PrintString (iTile * 8, iColor * 8), Chr$(iTile)
  784.         Next iTile
  785.     Next iColor
  786.     _Dest imgDisplay
  787.  
  788.     'Sleep ' View the blank screen  until a key is hit
  789.  
  790.     Screen imgTile ' View the tiles
  791.     DebugPrint "Viewing the tiles (imgTile) - press any key to continue"
  792.     Sleep ' until a key is hit
  793.  
  794.     Screen imgFont ' view the fonts
  795.     DebugPrint "Viewing the fonts (imgFont) - press any key to continue"
  796.     Sleep ' until a key is hit
  797.  
  798.     Screen imgDisplay ' and back to the normal blank screen
  799.     _Delay .2 ' time to remove finger from key
  800.     'Dim Shared As Long m_TileHw, m_FontHw
  801.  
  802.     m_TileHw = _CopyImage(imgTile, 33) ' hardware copy of the tile image
  803.     m_FontHw = _CopyImage(imgFont, 33) ' hardware copy of the font image
  804.  
  805.     If imgTile < -1 Or imgTile > 0 Then _FreeImage imgTile ' FREE MEMORY 'free unused images when done with them
  806.     If imgFont < -1 Or imgFont > 0 Then _FreeImage imgFont ' FREE MEMORY 'free unused images when done with them
  807.  
  808.     ' From this point onwards, I'm *ONLY* going to use my hardware layer
  809.  
  810.     '' Here, I'm creating a screen array to hold the information
  811.     '' of EVERY character I place onto the screen, and its tile
  812.     'Dim Shared m_ScreenArray(99, 74) As _Unsigned Long
  813.  
  814.     ' To start with, let's put all 256 chracters on the screen,
  815.     ' on a color 40 tile (red), in a color 3 font (cyan)
  816.     iX = 0: iY = 0
  817.     For iLoop = 0 To 255
  818.         ' 40 tile color, 3 font color, iLoop is the character
  819.         iX = iX + 1: If iX > 99 Then iX = 0: iY = iY + 1
  820.         m_ScreenArray(iX, iY) = SetAll(40, 3, iLoop)
  821.     Next iLoop
  822.  
  823.     ' And then let's show these results on the screen.
  824.     ' Take a moment to open task manager and see how little resources we're using here.
  825.     DebugPrint "Viewing the whole screen full of these tiles + characters"
  826.     DebugPrint "press ENTER to continue"
  827.     Do
  828.         ' Draw a whole screen full of these tiles + characters
  829.         ScreenRender
  830.         _Limit 30
  831.     Loop Until _KeyDown(13) ' until we hit ENTER
  832.  
  833.     _Delay .2 ' time to lift up the key so we don't instantly blow past the next loop
  834.  
  835.     iX = 0: iY = 0
  836.     ' and here I'm going to set all these tiles to have incremental background tile colors
  837.     For iLoop = 0 To 255
  838.         ' from left to right, top to bottom
  839.         iX = iX + 1: If iX > 99 Then iX = 0: iY = iY + 1
  840.         SetArrayTile iX, iY, iLoop ' set each tile to become an ever increasing color value
  841.     Next iLoop
  842.  
  843.     ' And then let's show these results on the screen.
  844.     DebugPrint "Viewing the screen with incremental colors"
  845.     DebugPrint "press ENTER to continue"
  846.     Do
  847.         ' Draw a whole screen full of these tiles + characters
  848.         ScreenRender
  849.         _Limit 30
  850.     Loop Until _KeyDown(13) ' until we hit ENTER
  851.  
  852.     ' And to finish up, let's do a quick count of how many loops per second
  853.     ' we *could* process, with the whole screen being redrawn over and over like this
  854.     DebugPrint "Counting how many loops per second for 3 seconds..."
  855.     t## = Timer + 3
  856.     count& = 0
  857.     Do
  858.         count& = count& + 1
  859.         ScreenRender
  860.     Loop Until Timer > t##
  861.  
  862.     ' Return to normal software screen
  863.     DebugPrint "Returning to normal software screen"
  864.  
  865.     _KeyClear: _Delay 1 ' clear keyboard buffer
  866.  
  867.     Screen 0: Cls
  868.     Print "Whole screen rendering of color tile + color font = "; count&; " times in 3 seconds."
  869.     Print
  870.     Input "PRESS <ENTER> TO CONTINUE"; in$
  871.  
  872.     If imgDisplay < -1 Or imgDisplay > 0 Then _FreeImage imgDisplay ' FREE MEMORY
  873.  
  874. End Sub ' TestCustomHardwareScreen2
  875.  
  876. ' /////////////////////////////////////////////////////////////////////////////
  877.  
  878. Sub TestCustomHardwareScreen1
  879.     Dim sError As String: sError = ""
  880.     Dim in$
  881.     Dim arrColors(255) As _Unsigned Long ' an array to hold all my color values
  882.     Dim imgDisplay As Long
  883.     Dim imgTile As Long
  884.     Dim imgFont As Long
  885.     Dim imgTempScreen256 As Long
  886.     Dim iLoop As Integer
  887.     Dim iColor As Integer
  888.     Dim iTile As Integer
  889.     Dim iX As Integer
  890.     Dim iY As Integer
  891.     Dim count&
  892.     Dim t## ' _FLOAT
  893.  
  894.     Cls
  895.     Print "Custom hardware screen test. Press <ENTER> to proceed through each step."
  896.     Input "PRESS <ENTER> TO START"; in$
  897.  
  898.  
  899.     imgDisplay = _NewImage(800, 600, 32) ' my main screenwich is 100 by 75 characters with 8x8 font.
  900.     imgTile = _NewImage(8 * 256, 8, 32) ' 8x8 tiles in 256 colors
  901.     imgFont = _NewImage(8 * 256, 8 * 256, 32) ' 256 characters of an 8x8 font, in all 256 possible colors.
  902.  
  903.     ' Set the main screen for starters so it'll go ahead
  904.     ' and create itself properly while I'm working on making my tiles and fonts
  905.     Screen imgDisplay
  906.  
  907.     ' very tiny 256 color screen, just to borrow the palette from
  908.     imgTempScreen256 = _NewImage(10, 10, 256)
  909.     For iLoop = 0 To 255 ' 40 colors
  910.         ' since I don't know your color palette, I'll just copy the QB64 256 color palette.  ;)
  911.         arrColors(iLoop) = _RGB32(_Red(iLoop, imgTempScreen256), _Green(iLoop, imgTempScreen256), _Blue(iLoop, imgTempScreen256))
  912.     Next iLoop
  913.     If imgTempScreen256 < -1 Or imgTempScreen256 > 0 Then _FreeImage imgTempScreen256 ' FREE MEMORY
  914.  
  915.     ' Create my software tiles of 256 colors
  916.     _Dest imgTile
  917.     For iLoop = 0 To 255 ' 256 tiles, one for each color
  918.         Line (iLoop * 8, 0)-Step(8, 8), arrColors(iLoop), BF ' all drawn sequentially onto a sprite sheet
  919.     Next iLoop
  920.  
  921.     ' I'm just going to use the built in QB64 8x8 font for quick and easy sheet creation.
  922.     _Dest imgFont
  923.     _Font 8
  924.     For iColor = 0 To 255 ' 256 colors
  925.         Color arrColors(iColor), 0 ' make our font the proper color
  926.         For iTile = 0 To 255 ' 256 characters
  927.             _PrintString (iTile * 8, iColor * 8), Chr$(iTile) ' print the characters row by row to the screen
  928.         Next iTile
  929.     Next iColor
  930.     _Dest imgDisplay
  931.  
  932.     Sleep ' View the blank screen  until a key is hit
  933.  
  934.     Screen imgTile ' View the tiles
  935.     Sleep ' until a key is hit
  936.  
  937.     Screen imgFont ' view the fonts
  938.     Sleep ' until a key is hit
  939.  
  940.     Screen imgDisplay ' and back to the normal blank screen
  941.     _Delay .2 ' time to remove finger from key
  942.     'Dim Shared As Long m_TileHw, m_FontHw
  943.  
  944.     m_TileHw = _CopyImage(imgTile, 33) ' hardware copy of the tile image
  945.     m_FontHw = _CopyImage(imgFont, 33) ' hardware copy of the font image
  946.  
  947.     If imgTile < -1 Or imgTile > 0 Then _FreeImage imgTile ' FREE MEMORY 'free unused images when done with them
  948.     If imgFont < -1 Or imgFont > 0 Then _FreeImage imgFont ' FREE MEMORY 'free unused images when done with them
  949.  
  950.     ' From this point onwards, I'm *ONLY* going to use my hardware layer
  951.  
  952.     '' Here, I'm creating a screen array to hold the information
  953.     '' of EVERY character I place onto the screen, and its tile
  954.     'Dim Shared m_ScreenArray(99, 74) As _Unsigned Long
  955.  
  956.     ' To start with, let's put all 256 chracters on the screen,
  957.     ' on a color 40 tile (red), in a color 3 font (cyan)
  958.     iX = 0: iY = 0
  959.     For iLoop = 0 To 255
  960.         ' 40 tile color, 3 font color, iLoop is the character
  961.         iX = iX + 1: If iX > 99 Then iX = 0: iY = iY + 1
  962.         m_ScreenArray(iX, iY) = SetAll(40, 3, iLoop)
  963.     Next iLoop
  964.  
  965.     ' And then let's show these results on the screen.
  966.     ' Take a moment to open task manager and see how little resources we're using here.
  967.     Do
  968.         ' Draw a whole screen full of these tiles + characters
  969.         ScreenRender
  970.         _Limit 30
  971.     Loop Until _KeyDown(13) ' until we hit ENTER
  972.  
  973.     _Delay .2 ' time to lift up the key so we don't instantly blow past the next loop
  974.  
  975.     iX = 0: iY = 0
  976.     ' and here I'm going to set all these tiles to have incremental background tile colors
  977.     For iLoop = 0 To 255
  978.         ' from left to right, top to bottom
  979.         iX = iX + 1: If iX > 99 Then iX = 0: iY = iY + 1
  980.         SetArrayTile iX, iY, iLoop ' set each tile to become an ever increasing color value
  981.     Next iLoop
  982.  
  983.     ' And then let's show these results on the screen.
  984.     Do
  985.         ' Draw a whole screen full of these tiles + characters
  986.         ScreenRender
  987.         _Limit 30
  988.     Loop Until _KeyDown(13) ' until we hit ENTER
  989.  
  990.     ' And to finish up, let's do a quick count of how many loops per second
  991.     ' we *could* process, with the whole screen being redrawn over and over like this
  992.     t## = Timer + 3
  993.     count& = 0
  994.     Do
  995.         count& = count& + 1
  996.         ScreenRender
  997.     Loop Until Timer > t##
  998.  
  999.     ' Return to normal software screen
  1000.  
  1001.     _KeyClear: _Delay 1 ' clear keyboard buffer
  1002.  
  1003.     Screen 0: Cls
  1004.     Print "Whole screen rendering of color tile + color font = "; count&; " times in 3 seconds."
  1005.  
  1006.     Print
  1007.     Input "PRESS <ENTER> TO CONTINUE"; in$
  1008.  
  1009.     If imgDisplay < -1 Or imgDisplay > 0 Then _FreeImage imgDisplay ' FREE MEMORY
  1010.  
  1011. End Sub ' TestCustomHardwareScreen1
  1012.  
  1013. ' /////////////////////////////////////////////////////////////////////////////
  1014.  
  1015. Sub ScreenRender
  1016.     Dim tileColor As _Unsigned Long
  1017.     Dim fontColor As _Unsigned Long
  1018.     Dim character As _Unsigned Long
  1019.     Dim iX As Integer
  1020.     Dim iY As Integer
  1021.  
  1022.     For iX = 0 To 99
  1023.         For iY = 0 To 74
  1024.             tileColor = m_ScreenArray(iX, iY) \ (256 * 256)
  1025.             fontColor = (m_ScreenArray(iX, iY) - tileColor * 256 * 256) \ 256
  1026.             character = m_ScreenArray(iX, iY) Mod 256
  1027.             _PutImage (iX * 8, iY * 8)-Step(7, 7), m_TileHw, , (tileColor * 8, 0)-Step(7, 7)
  1028.             _PutImage (iX * 8, iY * 8)-Step(7, 7), m_FontHw, , (character * 8, fontColor * 8)-Step(7, 7)
  1029.         Next iY
  1030.     Next iX
  1031.     _Display
  1032. End Sub ' ScreenRender
  1033.  
  1034. ' /////////////////////////////////////////////////////////////////////////////
  1035.  
  1036. Function SetAll&& (tile, fontcolor, character)
  1037.     SetAll&& = tile * 256 * 256 + fontcolor * 256 + character
  1038. End Function ' SetAll&&
  1039.  
  1040. ' /////////////////////////////////////////////////////////////////////////////
  1041.  
  1042. Sub SetArrayTile (iX, iY, newTileColor)
  1043.     Dim temp&&
  1044.     Dim oldTile&&
  1045.  
  1046.     temp&& = m_ScreenArray(iX, iY)
  1047.     oldTile&& = temp&& \ (256 * 256)
  1048.     m_ScreenArray(iX, iY) = temp&& - oldTile&& + newTileColor * 256 * 256
  1049. End Sub ' SetArrayTile
  1050.  
  1051. ' /////////////////////////////////////////////////////////////////////////////
  1052.  
  1053. Sub SetArrayFontColor (iX, iY, newFontColor)
  1054.     Dim temp&&
  1055.     Dim oldTile&&
  1056.     Dim oldFont&&
  1057.  
  1058.     temp&& = m_ScreenArray(iX, iY)
  1059.     oldTile&& = temp&& \ (256 * 256)
  1060.     oldFont&& = (temp&& - oldTile&&) \ 256
  1061.     m_ScreenArray(iX, iY) = temp&& - oldFont&& + newFontColor * 256
  1062. End Sub ' SetArrayFontColor
  1063.  
  1064. ' /////////////////////////////////////////////////////////////////////////////
  1065.  
  1066. Sub SetArrayCharacter (iX, iY, newCharacter)
  1067.     Dim temp&&
  1068.     Dim oldCharacter&&
  1069.  
  1070.     temp&& = m_ScreenArray(iX, iY)
  1071.     oldCharacter&& = temp&& Mod 256
  1072.     m_ScreenArray(iX, iY) = temp&& - oldCharacter&& + newCharacter
  1073. End Sub ' SetArrayCharacter
  1074.  
  1075. ' ################################################################################################################################################################
  1076.  
  1077. ' Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
  1078. ' https://qb64forum.alephc.xyz/index.php?topic=4674.msg140904#msg140904
  1079.  
  1080. ' SMcNeill, QB64 Developer
  1081. ' Reply #18 on: Yesterday at 05:08:58 pm
  1082. '
  1083. ' One thing that would be *very* different with all hardware images vs what
  1084. ' you're doing currently, is the fact that you have to remember:
  1085. ' Hardware images display once and then flush themselves from the GPU buffer.
  1086. '
  1087. ' You can't just print to a tile, and then read the information for the color of
  1088. ' that tile, and instantly turn that color into another one.  You have write
  1089. ' access to hardware images, but not read access -- and the images aren't
  1090. ' persistent like the software images are.
  1091. '
  1092. ' For something like this to work for a whole screen in hardware image mode,
  1093. ' you'd have to sort out some sort of way to store your screen's info and then
  1094. ' constantly redraw everything over and over again to keep it refreshed on the
  1095. ' display.
  1096. '
  1097. ' The way I'd go about doing something like this would be to make myself a
  1098. ' custom SCREEN 0-style memory array.  Screen 0 stores all our information for
  1099. ' each character in 2 bytes -- one for color, one for character.  I'd basically
  1100. ' do the same, but with 3 bytes -- one for tile color, one for font color, one
  1101. ' for character.
  1102. '
  1103. ' Let me toss a simple demo of this line of thinking for you:
  1104. ' (TestCustomHardwareScreen1)
  1105. '
  1106. ' I tried to comment the heck out of the code to help explain what it's doing
  1107. ' from line to line, so I hope this isn't too hard to sort out and understand.
  1108. '
  1109. ' The beginning is nothing more than initializing things and making 2 different
  1110. ' sprite sheets that I'll make use of later -- one for the tiles and one for the
  1111. ' characters.
  1112. '
  1113. ' Then there's the mid section where you can SLEEP step through and view the
  1114. ' various resource sheets.
  1115. '
  1116. ' Then an example of all the characters in a cyan font, resting atop a red tile.
  1117. ' (You have to hit ENTER to move on from this screen.)
  1118. '
  1119. ' Then an example of all those tiles that go under the characters being replaced
  1120. ' with sequential colored tiles.  (A lot of these tiles are simply BLACK, but
  1121. ' that's the nature of the 256 color palette as those multiple blacks are there
  1122. ' to be replaced with custom color values instead.)
  1123. '
  1124. ' Once more, you'll have to hit ENTER to continue.
  1125. '
  1126. ' And then I do a quick time loop to count how many times we can redraw the whole
  1127. ' screen of tiles + characters in 3 seconds.
  1128. '
  1129. ' For an 800x600 screen (100 x 75 characters and tiles), my laptop does a max of
  1130. ' about 1800 refreshes in that time.  That's around 600 FPS, which would be more
  1131. ' than enough for any sort of game display or use that I think I could come up
  1132. ' with, and that's without me trying to optimize math or any such things to
  1133. ' reduce calculations and speed the process up any more.  (Keep in mind, this is
  1134. ' 1800 full pages of a 800x600 screen -- if your screen has a lower overall
  1135. ' resolution, then you'd draw more loops with less to process, but a higher
  1136. ' resolution screen would draw fewer loops with more to process.)
  1137. '
  1138. ' No _MEM access.  No optimization work.  Just 600 FPS rendering of a whole page
  1139. ' of tiles and colored characters.  (And, YES, it is a whole page being rendered
  1140. ' repeatedly -- even if I didn't bother to fill in the vast majority of that page
  1141. ' with anything more than black tiles, black fonts, and chr$(0) blank spaces...)
  1142. '
  1143. ' It's a completely different approach to displaying stuff than what you've been
  1144. ' doing, but it seems as if what you've been doing isn't working as it must be
  1145. ' running too slow for you.  You wouldn't be able to use the normal PRINT
  1146. ' statements to display to the faux screen memory array I've created; you'd have
  1147. ' to write your own.
  1148. '
  1149. ' For a quick speed comparison, here's the same type process ran using PRINT
  1150. ' and a software screen of the same size:
  1151. ' (TestSoftwareScreen1)
  1152.  
  1153. ' ################################################################################################################################################################
  1154.  
  1155. ' /////////////////////////////////////////////////////////////////////////////
  1156.  
  1157. Function GetInstructions1$
  1158.     Dim in$
  1159.     in$ = ""
  1160.     in$ = in$ + "Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?" + Chr$(13)
  1161.     in$ = in$ + "https://qb64forum.alephc.xyz/index.php?topic=4674.msg140904#msg140904" + Chr$(13)
  1162.     in$ = in$ + " " + Chr$(13)
  1163.     in$ = in$ + "SMcNeill, QB64 Developer" + Chr$(13)
  1164.     in$ = in$ + "Reply #18 on: Yesterday at 05:08:58 pm" + Chr$(13)
  1165.     in$ = in$ + " " + Chr$(13)
  1166.     in$ = in$ + "One thing that would be *very* different with all hardware images vs what " + Chr$(13)
  1167.     in$ = in$ + "you're doing currently, is the fact that you have to remember:  " + Chr$(13)
  1168.     in$ = in$ + "Hardware images display once and then flush themselves from the GPU buffer. " + Chr$(13)
  1169.     in$ = in$ + " " + Chr$(13)
  1170.     in$ = in$ + "You can't just print to a tile, and then read the information for the color of " + Chr$(13)
  1171.     in$ = in$ + "that tile, and instantly turn that color into another one.  You have write " + Chr$(13)
  1172.     in$ = in$ + "access to hardware images, but not read access -- and the images aren't " + Chr$(13)
  1173.     in$ = in$ + "persistent like the software images are." + Chr$(13)
  1174.     in$ = in$ + " " + Chr$(13)
  1175.     in$ = in$ + "For something like this to work for a whole screen in hardware image mode, " + Chr$(13)
  1176.     in$ = in$ + "you'd have to sort out some sort of way to store your screen's info and then " + Chr$(13)
  1177.     in$ = in$ + "constantly redraw everything over and over again to keep it refreshed on the " + Chr$(13)
  1178.     in$ = in$ + "display." + Chr$(13)
  1179.     in$ = in$ + " " + Chr$(13)
  1180.     in$ = in$ + "The way I'd go about doing something like this would be to make myself a " + Chr$(13)
  1181.     in$ = in$ + "custom SCREEN 0-style memory array.  Screen 0 stores all our information for " + Chr$(13)
  1182.     in$ = in$ + "each character in 2 bytes -- one for color, one for character.  I'd basically " + Chr$(13)
  1183.     in$ = in$ + "do the same, but with 3 bytes -- one for tile color, one for font color, one " + Chr$(13)
  1184.     in$ = in$ + "for character." + Chr$(13)
  1185.     in$ = in$ + " " + Chr$(13)
  1186.     in$ = in$ + "Let me toss a simple demo of this line of thinking for you:" + Chr$(13)
  1187.     in$ = in$ + " " + Chr$(13)
  1188.     in$ = in$ + "I tried to comment the heck out of the code to help explain what it's doing " + Chr$(13)
  1189.     in$ = in$ + "from line to line, so I hope this isn't too hard to sort out and understand." + Chr$(13)
  1190.     in$ = in$ + " " + Chr$(13)
  1191.     in$ = in$ + "The beginning is nothing more than initializing things and making 2 different " + Chr$(13)
  1192.     in$ = in$ + "sprite sheets that I'll make use of later -- one for the tiles and one for the " + Chr$(13)
  1193.     in$ = in$ + "characters." + Chr$(13)
  1194.     in$ = in$ + " " + Chr$(13)
  1195.     in$ = in$ + "Then there's the mid section where you can SLEEP step through and view the " + Chr$(13)
  1196.     in$ = in$ + "various resource sheets." + Chr$(13)
  1197.     in$ = in$ + " " + Chr$(13)
  1198.     in$ = in$ + "Then an example of all the characters in a cyan font, resting atop a red tile.  " + Chr$(13)
  1199.     in$ = in$ + "(You have to hit ENTER to move on from this screen.)" + Chr$(13)
  1200.     in$ = in$ + " " + Chr$(13)
  1201.     in$ = in$ + "Then an example of all those tiles that go under the characters being replaced " + Chr$(13)
  1202.     in$ = in$ + "with sequential colored tiles.  (A lot of these tiles are simply BLACK, but " + Chr$(13)
  1203.     in$ = in$ + "that's the nature of the 256 color palette as those multiple blacks are there " + Chr$(13)
  1204.     in$ = in$ + "to be replaced with custom color values instead.)" + Chr$(13)
  1205.     in$ = in$ + " " + Chr$(13)
  1206.     in$ = in$ + "Once more, you'll have to hit ENTER to continue." + Chr$(13)
  1207.     in$ = in$ + " " + Chr$(13)
  1208.     in$ = in$ + "And then I do a quick time loop to count how many times we can redraw the whole " + Chr$(13)
  1209.     in$ = in$ + "screen of tiles + characters in 3 seconds." + Chr$(13)
  1210.     in$ = in$ + " " + Chr$(13)
  1211.     in$ = in$ + "For an 800x600 screen (100 x 75 characters and tiles), my laptop does a max of " + Chr$(13)
  1212.     in$ = in$ + "about 1800 refreshes in that time.  That's around 600 FPS, which would be more " + Chr$(13)
  1213.     in$ = in$ + "than enough for any sort of game display or use that I think I could come up " + Chr$(13)
  1214.     in$ = in$ + "with, and that's without me trying to optimize math or any such things to " + Chr$(13)
  1215.     in$ = in$ + "reduce calculations and speed the process up any more.  (Keep in mind, this is " + Chr$(13)
  1216.     in$ = in$ + "1800 full pages of a 800x600 screen -- if your screen has a lower overall " + Chr$(13)
  1217.     in$ = in$ + "resolution, then you'd draw more loops with less to process, but a higher " + Chr$(13)
  1218.     in$ = in$ + "resolution screen would draw fewer loops with more to process.)" + Chr$(13)
  1219.     in$ = in$ + " " + Chr$(13)
  1220.     in$ = in$ + "No _MEM access.  No optimization work.  Just 600 FPS rendering of a whole page " + Chr$(13)
  1221.     in$ = in$ + "of tiles and colored characters.  (And, YES, it is a whole page being rendered " + Chr$(13)
  1222.     in$ = in$ + "repeatedly -- even if I didn't bother to fill in the vast majority of that page " + Chr$(13)
  1223.     in$ = in$ + "with anything more than black tiles, black fonts, and chr$(0) blank spaces...)" + Chr$(13)
  1224.     in$ = in$ + " " + Chr$(13)
  1225.     in$ = in$ + "It's a completely different approach to displaying stuff than what you've been " + Chr$(13)
  1226.     in$ = in$ + "doing, but it seems as if what you've been doing isn't working as it must be " + Chr$(13)
  1227.     in$ = in$ + "running too slow for you.  You wouldn't be able to use the normal PRINT " + Chr$(13)
  1228.     in$ = in$ + "statements to display to the faux screen memory array I've created; you'd have " + Chr$(13)
  1229.     in$ = in$ + "to write your own." + Chr$(13)
  1230.     GetInstructions1$ = in$
  1231. End Function ' GetInstructions1$
  1232.  
  1233. ' /////////////////////////////////////////////////////////////////////////////
  1234.  
  1235. Function GetInstructions2$
  1236.     Dim in$
  1237.     in$ = ""
  1238.     in$ = in$ + "Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?" + Chr$(13)
  1239.     in$ = in$ + "https://qb64forum.alephc.xyz/index.php?topic=4674.msg140904#msg140904" + Chr$(13)
  1240.     in$ = in$ + " " + Chr$(13)
  1241.     in$ = in$ + "SMcNeill, QB64 Developer" + Chr$(13)
  1242.     in$ = in$ + "Reply #18 on: Yesterday at 05:08:58 pm" + Chr$(13)
  1243.     in$ = in$ + " " + Chr$(13)
  1244.     in$ = in$ + "For a quick speed comparison, here's the same type process ran using PRINT " + Chr$(13)
  1245.     in$ = in$ + "and a software screen of the same size:" + Chr$(13)
  1246.     GetInstructions2$ = in$
  1247. End Function ' GetInstructions2$
  1248.  
  1249. ' ################################################################################################################################################################
  1250.  
  1251. ' /////////////////////////////////////////////////////////////////////////////
  1252.  
  1253. Sub TestSoftwareScreen1
  1254.     Dim in$
  1255.     Dim t## ' _FLOAT
  1256.     Dim count As Integer
  1257.     Dim iX As Integer
  1258.     Dim iY As Integer
  1259.     Dim iTile As Integer
  1260.  
  1261.     Screen _NewImage(800, 600, 32)
  1262.  
  1263.     _Font 8
  1264.     t## = Timer + 3
  1265.     count = 0
  1266.     Do
  1267.         count = count + 1
  1268.         For iX = 1 To 100
  1269.             For iY = 1 To 75
  1270.                 iTile = (iTile + 1) Mod 256
  1271.                 Color _RGB32(Rnd * 255, Rnd * 255, Rnd * 255), _RGB32(Rnd * 255, Rnd * 255, Rnd * 255)
  1272.                 Locate iY, iX: Print Chr$(iTile);
  1273.             Next iY
  1274.         Next iX
  1275.     Loop Until Timer > t##
  1276.  
  1277.     _KeyClear: _Delay 1
  1278.     Screen 0: Cls
  1279.     Print count; "total screen replacements in 3 seconds."
  1280.     Print
  1281.     Input "PRESS <ENTER> TO CONTINUE"; in$
  1282. End Sub ' TestSoftwareScreen1
  1283.  
  1284. ' ################################################################################################################################################################
  1285. ' END Steve's very different custom screen
  1286. ' ################################################################################################################################################################
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356. ' ################################################################################################################################################################
  1357. ' BEGIN VECTOR-BASED TILE ROUTINES
  1358. ' ################################################################################################################################################################
  1359.  
  1360. ' /////////////////////////////////////////////////////////////////////////////
  1361.  
  1362. Sub DrawVectorTilePutImageTest
  1363.     Dim imgPalette As Long ' contains palette of colors
  1364.     Dim imgScreen As Long ' the main display
  1365.     Dim MyString As String
  1366.     Dim iLoop As Integer
  1367.     Dim iTileNum As Integer
  1368.     Dim arrColor(0 To 8) As _Unsigned Long
  1369.     Dim arrColorNames(0 To 8) As String
  1370.     Dim iMinFgColorIndex As Integer: iMinFgColorIndex = 0
  1371.     Dim iMaxFgColorIndex As Integer: iMaxFgColorIndex = 7
  1372.     Dim iMinBgColorIndex As Integer: iMinBgColorIndex = 0
  1373.     Dim iMaxBgColorIndex As Integer: iMaxBgColorIndex = 8
  1374.     Dim iFgColorIndex As Integer: iFgColorIndex = iMinFgColorIndex
  1375.     Dim iBgColorIndex As Integer: iBgColorIndex = iMinBgColorIndex
  1376.     Dim iX As Integer
  1377.     Dim iY As Integer
  1378.     Dim iMinX As Integer
  1379.     Dim iMaxX As Integer
  1380.     Dim iMinY As Integer
  1381.     Dim iMaxY As Integer
  1382.  
  1383.     ' Initialize colors
  1384.     arrColor(0) = cBlack
  1385.     arrColor(1) = cRed
  1386.     arrColor(2) = cYellow
  1387.     arrColor(3) = cLime
  1388.     arrColor(4) = cCyan
  1389.     arrColor(5) = cBlue
  1390.     arrColor(6) = cPurple
  1391.     arrColor(7) = cMagenta
  1392.     arrColor(8) = cEmpty
  1393.  
  1394.     ' Initialize color names (for test output)
  1395.     arrColorNames(0) = "cBlack"
  1396.     arrColorNames(1) = "cRed"
  1397.     arrColorNames(2) = "cYellow"
  1398.     arrColorNames(3) = "cLime"
  1399.     arrColorNames(4) = "cCyan"
  1400.     arrColorNames(5) = "cBlue"
  1401.     arrColorNames(6) = "cPurple"
  1402.     arrColorNames(7) = "cMagenta"
  1403.     arrColorNames(8) = "cEmpty"
  1404.  
  1405.     ' Set up screen
  1406.     imgScreen = _NewImage(1024, 768, 32): _ScreenMove 0, 0
  1407.     Screen imgScreen
  1408.     Cls , cGray
  1409.  
  1410.     ' Generate color palette
  1411.     MakePaletteImage imgPalette, arrColor()
  1412.  
  1413.     '' Draw palette on screen:
  1414.     ''_PutImage (xDest%, yDest%), imgSource&, imgDest&, (sx1%, sy1%)-(sx2%, sy2%)
  1415.     '_PutImage (400, 300), imgPalette, imgScreen, (0,0)-(_WIDTH(imgPalette), _HEIGHT(imgPalette))
  1416.  
  1417.     ' Set up tiles
  1418.     GetVectorTiles
  1419.  
  1420.     ' Set up screen boundaries, initial colors, etc.
  1421.     iMinX = 0: iMaxX = _Width(0) \ 8
  1422.     iMinY = 0: iMaxY = _Height(0) \ 8
  1423.     DebugPrint "iMaxX = _Width(0) = " + cstr$(iMaxX)
  1424.     DebugPrint "iMaxY = _Height(0) = " + cstr$(iMaxY)
  1425.  
  1426.     iFgColorIndex = iMinFgColorIndex - 1
  1427.  
  1428.     ' Freeze dislay
  1429.     _Display
  1430.  
  1431.     ' Test text
  1432.     'MyString = "#"
  1433.     'MyString = "BOO!"
  1434.     MyString = "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  1435.         "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  1436.         "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  1437.         "THIS IS A TEST!"
  1438.  
  1439.     iY = 5
  1440.     iX = 5
  1441.     For iLoop = 1 To Len(MyString)
  1442.         iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iMaxFgColorIndex Then iFgColorIndex = iMinFgColorIndex
  1443.         iBgColorIndex = iBgColorIndex + 1: If iBgColorIndex > iMaxBgColorIndex Then iBgColorIndex = iMinBgColorIndex
  1444.         iTileNum = Asc(Mid$(MyString, iLoop, 1))
  1445.         If iTileNum = 13 Then
  1446.             ' Linebreak = go to a new line
  1447.             iX = iMinX: iY = iY + 1: If iY > iMaxY Then iY = iMinY
  1448.         Else
  1449.             DrawVectorTilePutImage _
  1450.                 imgScreen, imgPalette, arrColor(), _
  1451.                 iTileNum, iX, iY, _
  1452.                 iFgColorIndex, iBgColorIndex
  1453.             iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then iY = iMinY
  1454.             'iX = iX + 1: iY = iY + 1
  1455.             If iX > iMaxX Then iX = iMinX
  1456.             If iY > iMaxY Then iY = iMinY
  1457.         End If
  1458.     Next iLoop
  1459.  
  1460.     ' Resume display
  1461.     _Display
  1462.  
  1463.     ' Promput user
  1464.     Color cWhite, cBlack: Locate 22, 1
  1465.     Print "Press any key to continue";
  1466.     Sleep
  1467.  
  1468.     Screen 0 ' RETURN TO TEXT SCREEN
  1469.     If imgScreen < -1 Or imgScreen > 0 Then _FreeImage imgScreen ' FREE MEMORY
  1470. End Sub ' DrawVectorTilePutImageTest
  1471.  
  1472. ' /////////////////////////////////////////////////////////////////////////////
  1473. ' Draw the shape with _PutImage commands using hardware images:
  1474.  
  1475. ' Requires that this global shared variable be declared:
  1476. '     Dim Shared m_arrLineTiles(0 To 255, 0 To 32) As RectangleType
  1477. ' containing
  1478. '     m_arrLineTiles({iTileNum}, {iShapeNum})
  1479. ' where for each tile, dimension 2 index 0:
  1480. '     m_arrLineTiles({iTileNum}, 0).PixelCount
  1481. ' holds the last used {iShapeNum} index.
  1482.  
  1483. ' Receives:
  1484. ' imgScreen& = image handle of the screen to draw to
  1485. ' imgPalette& = image handle of the palette containing 8x8 squares each with the desired color
  1486. ' arrColor() = array containing _UNSIGNED Long RGB color values
  1487. ' iTileNum% = 0-255, number of the tile in m_arrLineTiles to draw
  1488. ' iX, iY = x/y position to draw 8x8 tile to (multiplied by 8 to get screen position)
  1489. ' fgColor, bgColor = index for foreground/background color in arrColor (which contains the actual RGB values)
  1490.  
  1491. Sub DrawVectorTilePutImage( _
  1492.     imgScreen&, imgPalette&, arrColor() as _UNSIGNED Long, _
  1493.     iTileNum As Integer, iX As Integer, iY As Integer, _
  1494.     fgColorIndex As Integer, bgColorIndex As Integer)
  1495.  
  1496.     Dim iLoop As Integer
  1497.  
  1498.     Dim sc% ' source column on tile sheet
  1499.     Dim sr% ' source row on tile sheet
  1500.     Dim sx1% ' source start x
  1501.     Dim sx2% ' source end x
  1502.     Dim sy1% ' source start y
  1503.     Dim sy2% ' source end y
  1504.     Dim xDest% ' destination x
  1505.     Dim yDest% ' destination y
  1506.  
  1507.     ' Copy from palette
  1508.     _Source imgPalette&
  1509.  
  1510.     ' Draw to screen
  1511.     _Dest imgScreen&
  1512.  
  1513.     ' GET THE ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  1514.     sr% = 0 ' TileNum% \ rows%
  1515.  
  1516.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  1517.     sy1% = sr% * 8
  1518.  
  1519.     ' draw background if not transparent
  1520.     If bgColorIndex >= LBound(arrColor) Then
  1521.         If bgColorIndex <= UBound(arrColor) Then
  1522.             If arrColor(bgColorIndex) <> cEmpty Then
  1523.                 ' GET THE COLUMN OF TILE # TileNum% ON THE SOURCE TILE SHEET
  1524.                 sc% = bgColorIndex ' TileNum% Mod rows%
  1525.  
  1526.                 ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  1527.                 sx1% = sc% * 8
  1528.  
  1529.                 ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  1530.                 sx2% = sx1% + 7
  1531.  
  1532.                 ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  1533.                 sy2% = sy1% + 7
  1534.  
  1535.                 ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  1536.                 xDest% = iX * 8 ' dx% * 8
  1537.  
  1538.                 ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  1539.                 yDest% = iY * 8 ' (dy% * 8) '+ yOffset%
  1540.  
  1541.                 ' Copy portion of source to the top-left corner of the destination page
  1542.                 _PutImage (xDest%, yDest%), _
  1543.                     imgPalette&, imgScreen&, _
  1544.                     (sx1%, sy1%)-(sx2%, sy2%)
  1545.             End If
  1546.         End If
  1547.     End If
  1548.  
  1549.     If fgColorIndex >= LBound(arrColor) Then
  1550.         If fgColorIndex <= UBound(arrColor) Then
  1551.             For iLoop = 1 To m_arrLineTiles(iTileNum, 0).PixelCount
  1552.                 ' GET THE COLUMN OF TILE # TileNum% ON THE SOURCE TILE SHEET
  1553.                 sc% = fgColorIndex ' TileNum% Mod rows%
  1554.  
  1555.                 ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  1556.                 sx1% = sc% * 8
  1557.  
  1558.                 ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  1559.                 'sx2% = sx1% + 7
  1560.                 sx2% = sx1% + (m_arrLineTiles(iTileNum, iLoop).x2 - m_arrLineTiles(iTileNum, iLoop).x1)
  1561.  
  1562.                 ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  1563.                 'sy2% = sy1% + 7
  1564.                 sy2% = sy1% + (m_arrLineTiles(iTileNum, iLoop).y2 - m_arrLineTiles(iTileNum, iLoop).y1)
  1565.  
  1566.                 ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  1567.                 xDest% = (iX * 8) + m_arrLineTiles(iTileNum, iLoop).x1 ' dx% * 8
  1568.  
  1569.                 ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  1570.                 yDest% = (iY * 8) + m_arrLineTiles(iTileNum, iLoop).y1 ' (dy% * 8) '+ yOffset%
  1571.  
  1572.                 ' Copy portion of source to the top-left corner of the destination page
  1573.                 _PutImage (xDest%, yDest%), _
  1574.                     imgPalette&, imgScreen&, _
  1575.                     (sx1%, sy1%)-(sx2%, sy2%)
  1576.  
  1577.             Next iLoop
  1578.         End If
  1579.     End If
  1580. End Sub ' DrawVectorTilePutImage
  1581.  
  1582. ' /////////////////////////////////////////////////////////////////////////////
  1583. ' (Same as DrawVectorTilePutImage but uses hardware images.)
  1584.  
  1585. ' Draw the shape with _PutImage commands using hardware images:
  1586.  
  1587. ' Requires that this global shared variable be declared:
  1588. '     Dim Shared m_arrLineTiles(0 To 255, 0 To 32) As RectangleType
  1589. ' containing
  1590. '     m_arrLineTiles({iTileNum}, {iShapeNum})
  1591. ' where for each tile, dimension 2 index 0:
  1592. '     m_arrLineTiles({iTileNum}, 0).PixelCount
  1593. ' holds the last used {iShapeNum} index.
  1594.  
  1595. ' Receives:
  1596. ' imgScreen& = image handle of hardware image for the screen to draw to
  1597. ' imgPalette& = image handle of hardware image for palette containing 8x8 squares each with the desired color
  1598. ' arrColor() = array containing _UNSIGNED Long RGB color values
  1599. ' iTileNum% = 0-255, number of the tile in m_arrLineTiles to draw
  1600. ' iX, iY = x/y position to draw 8x8 tile to (multiplied by 8 to get screen position)
  1601. ' fgColor, bgColor = index for foreground/background color in arrColor (which contains the actual RGB values)
  1602.  
  1603. Sub DrawVectorTilePutImageHW( _
  1604.     imgPalette&, arrColor() as _UNSIGNED Long, _
  1605.     iTileNum As Integer, iX As Integer, iY As Integer, _
  1606.     fgColorIndex As Integer, bgColorIndex As Integer)
  1607.  
  1608.     Dim iLoop As Integer
  1609.     Dim sc% ' source column on tile sheet
  1610.     Dim sr% ' source row on tile sheet
  1611.     Dim sx1% ' source start x
  1612.     Dim sx2% ' source end x
  1613.     Dim sy1% ' source start y
  1614.     Dim sy2% ' source end y
  1615.     Dim xDest% ' destination x
  1616.     Dim yDest% ' destination y
  1617.  
  1618.     ' GET THE ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  1619.     sr% = 0 ' TileNum% \ rows%
  1620.  
  1621.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  1622.     sy1% = sr% * 8
  1623.  
  1624.     ' draw background if not transparent
  1625.     If bgColorIndex >= LBound(arrColor) Then
  1626.         If bgColorIndex <= UBound(arrColor) Then
  1627.             If arrColor(bgColorIndex) <> cEmpty Then
  1628.                 ' GET THE COLUMN OF TILE # TileNum% ON THE SOURCE TILE SHEET
  1629.                 sc% = bgColorIndex ' TileNum% Mod rows%
  1630.  
  1631.                 ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  1632.                 sx1% = sc% * 8
  1633.  
  1634.                 ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  1635.                 sx2% = sx1% + 7
  1636.  
  1637.                 ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  1638.                 sy2% = sy1% + 7
  1639.  
  1640.                 ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  1641.                 xDest% = iX * 8
  1642.  
  1643.                 ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  1644.                 yDest% = iY * 8
  1645.  
  1646.                 ' Copy portion of source to the top-left corner of the destination page
  1647.                 _PutImage (xDest%, yDest%), _
  1648.                     imgPalette&, , _
  1649.                     (sx1%, sy1%)-(sx2%, sy2%)
  1650.             End If
  1651.         End If
  1652.     End If
  1653.  
  1654.     If fgColorIndex >= LBound(arrColor) Then
  1655.         If fgColorIndex <= UBound(arrColor) Then
  1656.             For iLoop = 1 To m_arrLineTiles(iTileNum, 0).PixelCount
  1657.                 ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  1658.                 sc% = fgColorIndex ' TileNum% Mod rows%
  1659.  
  1660.                 ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  1661.                 sx1% = sc% * 8
  1662.  
  1663.                 ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  1664.                 sx2% = sx1% + (m_arrLineTiles(iTileNum, iLoop).x2 - m_arrLineTiles(iTileNum, iLoop).x1)
  1665.  
  1666.                 ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  1667.                 sy2% = sy1% + (m_arrLineTiles(iTileNum, iLoop).y2 - m_arrLineTiles(iTileNum, iLoop).y1)
  1668.  
  1669.                 ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  1670.                 xDest% = (iX * 8) + m_arrLineTiles(iTileNum, iLoop).x1
  1671.  
  1672.                 ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  1673.                 yDest% = (iY * 8) + m_arrLineTiles(iTileNum, iLoop).y1
  1674.  
  1675.                 ' Copy portion of source to the top-left corner of the destination page
  1676.                 _PutImage (xDest%, yDest%), _
  1677.                     imgPalette&, , _
  1678.                     (sx1%, sy1%)-(sx2%, sy2%)
  1679.             Next iLoop
  1680.         End If
  1681.     End If
  1682. End Sub ' DrawVectorTilePutImageHW
  1683.  
  1684. ' /////////////////////////////////////////////////////////////////////////////
  1685. ' Receives an array of _Unsigned Long RGB color values
  1686. ' and returns a new image imgNew
  1687. ' containing 8x8 squares with each color
  1688.  
  1689. ' Usage:
  1690. ' MakePaletteImage imgNew, arrColorRGB()
  1691.  
  1692. Sub MakePaletteImage (imgNew As Long, arrColorRGB() As _Unsigned Long)
  1693.     Dim tw% ' width/height of tile
  1694.     Dim iCount As Integer
  1695.     Dim iY As Integer
  1696.     Dim iX As Integer
  1697.     Dim iLoop1 As Integer
  1698.  
  1699.     tw% = 8 ' SIZE OF TILE
  1700.  
  1701.     If imgNew < -1 Or imgNew > 0 Then _FreeImage imgNew ' FREE MEMORY
  1702.  
  1703.     iY = tw%
  1704.     iX = ((UBound(arrColorRGB) - LBound(arrColorRGB)) + 1) * tw%
  1705.     If iX > 0 Then
  1706.         imgNew = _NewImage(iX, iY, 32)
  1707.         _Dest imgNew&
  1708.  
  1709.         iY = 0
  1710.         iCount = -1
  1711.         For iLoop1 = LBound(arrColorRGB) To UBound(arrColorRGB)
  1712.             iCount = iCount + 1
  1713.             iX = iCount * tw%
  1714.             Line (iX, iY)-(iX + 7, iY + 7), arrColorRGB(iCount), BF
  1715.         Next iLoop1
  1716.     End If
  1717. End Sub ' MakePaletteImage
  1718.  
  1719. ' /////////////////////////////////////////////////////////////////////////////
  1720.  
  1721. Sub MakePaletteImageTest
  1722.     Dim arrColor(0 To 7) As _Unsigned Long
  1723.     Dim imgPalette As Long ' contains palette of colors
  1724.     Dim imgScreen As Long ' the main display
  1725.  
  1726.     arrColor(0) = cBlack
  1727.     arrColor(1) = cRed
  1728.     arrColor(2) = cYellow
  1729.     arrColor(3) = cLime
  1730.     arrColor(4) = cCyan
  1731.     arrColor(5) = cBlue
  1732.     arrColor(6) = cPurple
  1733.     arrColor(7) = cMagenta
  1734.     'arrColor(8) = cEmpty
  1735.  
  1736.     imgScreen = _NewImage(1024, 768, 32): _ScreenMove 0, 0
  1737.     Screen imgScreen
  1738.     Cls , cGray
  1739.  
  1740.     MakePaletteImage imgPalette, arrColor()
  1741.  
  1742.     ' Draw palette on screen:
  1743.     '_PutImage (xDest%, yDest%), imgSource&, imgDest&, (sx1%, sy1%)-(sx2%, sy2%)
  1744.     _PutImage (400, 300), imgPalette, imgScreen, (0, 0)-(_Width(imgPalette), _Height(imgPalette))
  1745.  
  1746.     ' Promput user
  1747.     _Dest imgScreen
  1748.     Color cWhite, cBlack
  1749.     'PrintString1 15, 1, "Press any key to continue"
  1750.     Locate 15, 1: Print "Press any key to continue";
  1751.     Sleep
  1752.  
  1753.     Screen 0 ' RETURN TO TEXT SCREEN
  1754.     If imgScreen < -1 Or imgScreen > 0 Then _FreeImage imgScreen ' FREE MEMORY
  1755.  
  1756. End Sub ' MakePaletteImage
  1757.  
  1758. ' /////////////////////////////////////////////////////////////////////////////
  1759. ' Draw the shape with Line commands:
  1760.  
  1761. ' Requires that this global shared variable be declared:
  1762. '     Dim Shared m_arrLineTiles(0 To 255, 0 To 32) As RectangleType
  1763. ' containing
  1764. '     m_arrLineTiles({iTileNum}, {iShapeNum})
  1765. ' where for each tile, dimension 2 index 0:
  1766. '     m_arrLineTiles({iTileNum}, 0).PixelCount
  1767. ' holds the last used {iShapeNum} index.
  1768.  
  1769. Sub DrawVectorTileLine (iTileNum As Integer, iX As Integer, iY As Integer, fgColor As _Unsigned Long, bgColor As _Unsigned Long)
  1770.     If bgColor <> cEmpty Then
  1771.         Line (iX, iY)-(iX + 7, iY + 7), bgColor, BF
  1772.     End If
  1773.     Dim iLoop As Integer
  1774.     For iLoop = 1 To m_arrLineTiles(iTileNum, 0).PixelCount
  1775.         Line (iX+m_arrLineTiles(iTileNum, iLoop).x1, _
  1776.             iY+m_arrLineTiles(iTileNum, iLoop).y1 _
  1777.             )-(iX+m_arrLineTiles(iTileNum, iLoop).x2, _
  1778.             iY+m_arrLineTiles(iTileNum, iLoop).y2), _
  1779.             fgColor, BF
  1780.     Next iLoop
  1781. End Sub ' DrawVectorTileLine
  1782.  
  1783. ' /////////////////////////////////////////////////////////////////////////////
  1784. ' Get line drawing coordinates for 8x8 tileset.
  1785.  
  1786. ' Requires that this global shared variable be declared:
  1787. '     Dim Shared m_arrLineTiles(0 To 255, 0 To 32) As RectangleType
  1788. ' containing
  1789. '     m_arrLineTiles({iTileNum}, {iShapeNum})
  1790. ' where for each tile, dimension 2 index 0:
  1791. '     m_arrLineTiles({iTileNum}, 0).PixelCount
  1792. ' holds the last used {iShapeNum} index.
  1793.  
  1794. ' VECTOR TILE DRAWING EXPERIMENT
  1795.  
  1796. ' Translates an 8x8 raster tileset into a set of (hopefully)
  1797. ' optimized rectangle coordinates that can be quickly drawn to
  1798. ' the screen with Line.
  1799.  
  1800. ' GOAL: Optimize for each shape by determining how to draw it with the
  1801. ' minimum number of line commands.
  1802. '
  1803. ' For example this:
  1804. '     ' DRAW WITH HORIZONTAL LINES
  1805. '     Line (iX + 6, iY + 3)-(iX + 6, iY + 3), fgColor
  1806. '     Line (iX + 6, iY + 4)-(iX + 6, iY + 4), fgColor
  1807. ' could be replaced with:
  1808. '     ' DRAW WITH VERTICAL LINES
  1809. '     Line (iX + 6, iY + 3)-(iX + 6, iY + 4), fgColor
  1810.  
  1811. ' For each tile, we store a list of line coordinates (x1,y1,x2,y2)
  1812. ' in a 2D array, and draw using a simple drawing routine that
  1813. ' receives the list of coordinates, fgColor and bgColor,
  1814. ' and draws all shapes (solid rectangles) with Line.
  1815. ' If bgColor is not transparent and if we want a background color
  1816. ' then we first draw an 8x8 bgColor rectangle first and then
  1817. ' draw the shape on top of that.
  1818.  
  1819. ' Rather than compute this on the fly, we could precompute it and
  1820. ' for each given tile, store the list of those rectangle coordinates
  1821. ' (x1,y1,x2,y2) for drawing it indexed by the tile's definition in
  1822. ' hexidecimal where 16-bits (0-F) defines the bit pattern for each
  1823. ' row in the tile, therefore a tile's definition can be stored by
  1824. ' 8 characters (or less if we use base 64). Perhaps build a utility
  1825. ' that will compute the optimal drawing pattern for every possible
  1826. ' combination of an 8x8 grid, and index them all by the tile's 8-byte
  1827. ' hexidecimal definition. It might take a while to run, but once it
  1828. ' does, we will have a database of every possible tile's optimized
  1829. ' drawing instructions that can be quickly looked up.
  1830. ' Then we only pull out those definitions for the tiles that our
  1831. ' given program uses, so the data would be relatively small
  1832. ' (even smaller if we encode it with base-64).
  1833.  
  1834. ' TODO: maybe optimize with linked list?
  1835.  
  1836. Sub GetVectorTiles
  1837.     Dim RoutineName As String: RoutineName = "GetVectorTiles"
  1838.     ReDim arrTileText(0 To 255) As String
  1839.     ReDim arrShapes1(-1) As RectangleType
  1840.     Dim iTileNum As Integer
  1841.     Dim iLoop1 As Integer
  1842.     Dim sLine As String
  1843.     Dim iLen As Integer
  1844.  
  1845.     '' DEBUG
  1846.     'Dim sStartTime As String : sStartTime = "TBD"
  1847.     'Dim sEndTime As String : sEndTime = "TBD"
  1848.     'sStartTime = CurrentDateTime$
  1849.     'DebugPrint CurrentDateTime$ + " started " + RoutineName
  1850.  
  1851.     ' Get raster tiles as a string array
  1852.     GetTileText arrTileText()
  1853.  
  1854.     ' Get minimum set of Line coordinates for each tile
  1855.     For iTileNum = 0 To 255
  1856.         FindOptimizedVector arrTileText(iTileNum), arrShapes1()
  1857.  
  1858.         ' If we have coordinates, add it to the database
  1859.         If UBound(arrShapes1) > -1 Then
  1860.  
  1861.             'DebugPrint "#   x1   y1   x2   y2   Pixels    IsActive"
  1862.             'for iLoop1 = lbound(arrShapes1) to ubound(arrShapes1)
  1863.             '    sLine = ""
  1864.             '    sLine = sLine + left$(cstr$(iLoop1) + String$(4, " "), 4)
  1865.             '    sLine = sLine + left$(cstr$(arrShapes1(iLoop1).x1) + String$(2, " "), 2) + "   "
  1866.             '    sLine = sLine + left$(cstr$(arrShapes1(iLoop1).y1) + String$(2, " "), 2) + "   "
  1867.             '    sLine = sLine + left$(cstr$(arrShapes1(iLoop1).x2) + String$(2, " "), 2) + "   "
  1868.             '    sLine = sLine + left$(cstr$(arrShapes1(iLoop1).y2) + String$(2, " "), 2) + "   "
  1869.             '    sLine = sLine + left$(cstr$(arrShapes1(iLoop1).PixelCount) + String$(7, " "), 7) + "   "
  1870.             '    sLine = sLine + TrueFalse$(arrShapes1(iLoop1).IsActive)
  1871.             '    DebugPrint sLine
  1872.             'next iLoop1
  1873.  
  1874.             ' SAVE SHAPES TO TILE
  1875.             iLen = 0
  1876.             For iLoop1 = LBound(arrShapes1) To UBound(arrShapes1)
  1877.                 If arrShapes1(iLoop1).IsActive = TRUE Then
  1878.                     iLen = iLen + 1
  1879.  
  1880.                     ' NOTE: we do -1 because FindOptimizedVector does it 1-based,
  1881.                     '       don't ask me why, i was confused and don't want to
  1882.                     '       spend time right now to fix it,
  1883.                     '       but it saves math later to do 0-based
  1884.                     m_arrLineTiles(iTileNum, iLen).x1 = arrShapes1(iLoop1).x1 - 1
  1885.                     m_arrLineTiles(iTileNum, iLen).y1 = arrShapes1(iLoop1).y1 - 1
  1886.                     m_arrLineTiles(iTileNum, iLen).x2 = arrShapes1(iLoop1).x2 - 1
  1887.                     m_arrLineTiles(iTileNum, iLen).y2 = arrShapes1(iLoop1).y2 - 1
  1888.  
  1889.                     m_arrLineTiles(iTileNum, iLen).PixelCount = arrShapes1(iLoop1).PixelCount
  1890.                     m_arrLineTiles(iTileNum, iLen).IsActive = arrShapes1(iLoop1).IsActive
  1891.                 End If
  1892.             Next iLoop1
  1893.  
  1894.             ' MARK TILE (ubound 2, index 0) AS HAVING SHAPES + SAVE COUNT
  1895.             m_arrLineTiles(iTileNum, 0).IsActive = TRUE
  1896.             m_arrLineTiles(iTileNum, 0).PixelCount = iLen ' (iTileNum, 0).PixelCount stores the # of shapes
  1897.  
  1898.             ' DISABLE ANY REMAINING ENTRIES
  1899.             For iLoop1 = (iLen + 1) To UBound(m_arrLineTiles, 2)
  1900.                 m_arrLineTiles(iTileNum, iLoop1).IsActive = FALSE
  1901.             Next iLoop1
  1902.  
  1903.         Else
  1904.             ' This tile must have been blank
  1905.             'DebugPrint "*** NO SHAPES TO DRAW THIS TILE ***"
  1906.  
  1907.             ' MARK THIS TILE AS HAVING NO SHAPES
  1908.             m_arrLineTiles(iTileNum, 0).IsActive = FALSE
  1909.             m_arrLineTiles(iTileNum, 0).PixelCount = 0 ' (iTileNum, 0).PixelCount stores the # of shapes
  1910.         End If
  1911.     Next iTileNum
  1912.  
  1913.     '' DEBUG
  1914.     'sEndTime = CurrentDateTime$
  1915.     'DebugPrint RoutineName + " finished:"
  1916.     'DebugPrint "    started  at: " + sStartTime
  1917.     'DebugPrint "    finished at: " + sEndTime
  1918. End Sub ' GetVectorTiles
  1919.  
  1920. ' /////////////////////////////////////////////////////////////////////////////
  1921. ' 254 solid
  1922. ' 253 empty
  1923. ' 252 shaded
  1924. ' 241 bricks
  1925. ' 191 checker
  1926. ' 194 - 197 arrows u/d/l/r
  1927. ' 169 top left corner
  1928. ' 154 diamond
  1929. ' 155 +
  1930. ' 151 empty circle
  1931. ' 145 solid circle
  1932. ' 147 heart
  1933.  
  1934. Sub GetVectorTilesTest
  1935.     Dim imgScreen As Long ' the main display
  1936.     Dim MyString As String
  1937.     Dim iLoop As Integer
  1938.     Dim iTileNum As Integer
  1939.     Dim arrColor(0 To 8) As _Unsigned Long
  1940.     Dim iMinFgColorIndex As Integer: iMinFgColorIndex = 0
  1941.     Dim iMaxFgColorIndex As Integer: iMaxFgColorIndex = 7
  1942.     Dim iMinBgColorIndex As Integer: iMinBgColorIndex = 0
  1943.     Dim iMaxBgColorIndex As Integer: iMaxBgColorIndex = 8
  1944.     Dim iFgColorIndex As Integer: iFgColorIndex = iMinFgColorIndex
  1945.     Dim iBgColorIndex As Integer: iBgColorIndex = iMinBgColorIndex
  1946.     Dim iX As Integer
  1947.     Dim iY As Integer
  1948.     Dim iMinX As Integer
  1949.     Dim iMaxX As Integer
  1950.     Dim iMinY As Integer
  1951.     Dim iMaxY As Integer
  1952.  
  1953.     ' Initialize colors
  1954.     arrColor(0) = cBlack
  1955.     arrColor(1) = cRed
  1956.     arrColor(2) = cYellow
  1957.     arrColor(3) = cLime
  1958.     arrColor(4) = cCyan
  1959.     arrColor(5) = cBlue
  1960.     arrColor(6) = cPurple
  1961.     arrColor(7) = cMagenta
  1962.     arrColor(8) = cEmpty
  1963.  
  1964.     ' Set up screen
  1965.     imgScreen = _NewImage(1024, 768, 32): _ScreenMove 0, 0
  1966.     Screen imgScreen
  1967.     Cls , cGray
  1968.  
  1969.     ' Set up tiles
  1970.     GetVectorTiles
  1971.  
  1972.     ' Test text
  1973.     MyString = "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  1974.         "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  1975.         "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  1976.         "THIS IS A TEST!"
  1977.  
  1978.     ' Set up screen boundaries, initial colors, etc.
  1979.     iMinX = 0: iMaxX = _Width(0) \ 8
  1980.     iMinY = 0: iMaxY = _Height(0) \ 8
  1981.     iFgColorIndex = iMinFgColorIndex - 1
  1982.     iY = 5
  1983.     iX = 5
  1984.     For iLoop = 1 To Len(MyString)
  1985.         iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iMaxFgColorIndex Then iFgColorIndex = iMinFgColorIndex
  1986.         iBgColorIndex = iBgColorIndex + 1: If iBgColorIndex > iMaxBgColorIndex Then iBgColorIndex = iMinBgColorIndex
  1987.  
  1988.         iTileNum = Asc(Mid$(MyString, iLoop, 1))
  1989.         If iTileNum = 13 Then
  1990.             ' Linebreak = go to a new line
  1991.             iX = iMinX: iY = iY + 1: If iY > iMaxY Then iY = iMinY
  1992.         Else
  1993.             'DrawVectorTileLine iTileNum, iX*8, iY*8, arrColor(iFgColorIndex), cEmpty
  1994.             DrawVectorTileLine iTileNum, iX * 8, iY * 8, arrColor(iFgColorIndex), arrColor(iBgColorIndex)
  1995.             iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then iY = iMinY
  1996.         End If
  1997.  
  1998.     Next iLoop
  1999.  
  2000.     ' Promput user
  2001.     Color cWhite, cBlack: Locate 22, 1
  2002.     Print "Press any key to continue";
  2003.     Sleep
  2004.  
  2005.     Screen 0 ' RETURN TO TEXT SCREEN
  2006.     If imgScreen < -1 Or imgScreen > 0 Then _FreeImage imgScreen ' FREE MEMORY
  2007. End Sub ' GetVectorTilesTest
  2008.  
  2009. ' /////////////////////////////////////////////////////////////////////////////
  2010. ' Calculates and returns the coordinates for every possible rectangle shape
  2011. ' from 1-8 pixels high, and 1-8 pixels wide.
  2012.  
  2013. Sub GetAllPossibleShapes (arrShapes1() As RectangleType)
  2014.     ReDim arrShapes1(-1) As RectangleType
  2015.     Dim iLoopRows As Integer
  2016.     Dim iLoopCols As Integer
  2017.     Dim iIndex As Integer
  2018.     Dim iLoopY As Integer
  2019.     Dim iLoopX As Integer
  2020.  
  2021.     For iLoopRows = 1 To 8
  2022.         For iLoopCols = 1 To 8
  2023.             ' Add next shape to array
  2024.             iIndex = UBound(arrShapes1) + 1
  2025.             ReDim _Preserve arrShapes1(0 To iIndex) As RectangleType
  2026.  
  2027.             ' Save coordinates
  2028.             arrShapes1(iIndex).x1 = 1
  2029.             arrShapes1(iIndex).y1 = 1
  2030.             arrShapes1(iIndex).x2 = iLoopCols
  2031.             arrShapes1(iIndex).y2 = iLoopRows
  2032.             arrShapes1(UBound(arrShapes1)).PixelCount = 0
  2033.  
  2034.             ' Count Pixels
  2035.             For iLoopY = 1 To 8
  2036.                 For iLoopX = 1 To 8
  2037.                     if _
  2038.                         iLoopY >= arrShapes1(iIndex).y1 _
  2039.                         and _
  2040.                         iLoopY <= arrShapes1(iIndex).y2 _
  2041.                         and _
  2042.                         iLoopX >= arrShapes1(iIndex).x1 _
  2043.                         and _
  2044.                         iLoopX <= arrShapes1(iIndex).x2 _
  2045.                         then
  2046.  
  2047.                         'sLine = sLine + "#"
  2048.                         arrShapes1(UBound(arrShapes1)).PixelCount = arrShapes1(UBound(arrShapes1)).PixelCount + 1
  2049.                     Else
  2050.                         'sLine = sLine + "."
  2051.                     End If
  2052.                 Next iLoopX
  2053.                 'DebugPrint sLine
  2054.             Next iLoopY
  2055.  
  2056.         Next iLoopCols
  2057.     Next iLoopRows
  2058. End Sub ' GetAllPossibleShapes
  2059.  
  2060. ' /////////////////////////////////////////////////////////////////////////////
  2061. ' Tests GetAllPossibleShapes to retrieve the coordinates for every possible
  2062. ' rectangle shape from 1-8 pixels high, and 1-8 pixels wide,
  2063. ' and uses Line to draw them on the screen.
  2064.  
  2065. Sub GetAllPossibleShapesTest
  2066.     ReDim arrShapes1(-1) As RectangleType
  2067.     Dim arrColor(0 To 7) As _Unsigned Long
  2068.     Dim iLoopShape As Integer
  2069.     Dim iOffsetY As Integer
  2070.     Dim iOffsetX As Integer
  2071.     Dim iColorIndex As Integer
  2072.     Dim iMinColorIndex As Integer: iMinColorIndex = 1
  2073.     Dim iMaxColorIndex As Integer: iMaxColorIndex = 7
  2074.     Dim in$
  2075.     Dim iX As Integer
  2076.     Dim iY As Integer
  2077.     Dim iSizeW As Integer
  2078.     Dim iSizeH As Integer
  2079.     Dim fgColor As _Unsigned Long
  2080.     Dim iMinX As Integer
  2081.     Dim iMinY As Integer
  2082.     Dim iMaxX As Integer
  2083.     Dim iMaxY As Integer
  2084.  
  2085.     Screen _NewImage(1280, 1024, 32): _ScreenMove 0, 0
  2086.     iMinX = 0
  2087.     iMinY = 17
  2088.     iMaxX = (_Width(0) / 8) ' iMaxX = _Width(0) - 16
  2089.     iMaxY = _Height(0) - 16
  2090.     iOffsetY = iMinY
  2091.     iOffsetX = iMinX
  2092.  
  2093.     arrColor(0) = cBlack
  2094.     arrColor(1) = cRed
  2095.     arrColor(2) = cYellow
  2096.     arrColor(3) = cLime
  2097.     arrColor(4) = cCyan
  2098.     arrColor(5) = cBlue
  2099.     arrColor(6) = cPurple
  2100.     arrColor(7) = cMagenta
  2101.  
  2102.     GetAllPossibleShapes arrShapes1()
  2103.  
  2104.     iColorIndex = iMinColorIndex
  2105.     For iLoopShape = 0 To UBound(arrShapes1)
  2106.         DebugPrint _
  2107.             "(" + cstr$(arrShapes1(iLoopShape).x1) + ", " + cstr$(arrShapes1(iLoopShape).y1) + ")-" + _
  2108.             "(" + cstr$(arrShapes1(iLoopShape).x2) + ", " + cstr$(arrShapes1(iLoopShape).y2) + ") " + _
  2109.             cstr$(arrShapes1(iLoopShape).PixelCount) + " pixels"
  2110.  
  2111.         iX = arrShapes1(iLoopShape).x1 + iOffsetX
  2112.         iY = arrShapes1(iLoopShape).y1 + iOffsetY
  2113.         iSizeW = (arrShapes1(iLoopShape).x2 - arrShapes1(iLoopShape).x1) + 1
  2114.         iSizeH = (arrShapes1(iLoopShape).y2 - arrShapes1(iLoopShape).y1) + 1
  2115.         fgColor = arrColor(iColorIndex)
  2116.         DrawRectSolid iX, iY, iSizeW, iSizeH, fgColor
  2117.  
  2118.         iOffsetX = iOffsetX + 16: If iOffsetX > iMaxX Then iOffsetX = iMinX: iOffsetY = iOffsetY + 16: If iOffsetY > iMaxY Then iOffsetY = iMinY
  2119.         iColorIndex = iColorIndex + 1: If iColorIndex > iMaxColorIndex Then iColorIndex = iMinColorIndex
  2120.     Next iLoopShape
  2121.  
  2122.     Locate 1, 1
  2123.     Color cWhite, cBlack
  2124.     Input "PRESS <ENTER> TO CONTINUE"; in$
  2125.     Screen 0
  2126. End Sub ' GetAllPossibleShapes
  2127.  
  2128. ' /////////////////////////////////////////////////////////////////////////////
  2129.  
  2130. Sub DumpNextShape (oShape As RectangleType, sVarName As String)
  2131.     Dim iLoopY As Integer
  2132.     Dim iLoopX As Integer
  2133.     Dim sLine As String
  2134.  
  2135.     If Len(sVarName) > 0 Then
  2136.         DebugPrint sVarName + ":"
  2137.     Else
  2138.         DebugPrint "RectangleType:"
  2139.     End If
  2140.  
  2141.     DebugPrint _
  2142.         "(" + cstr$(oShape.x1) + ", " + cstr$(oShape.y1) + ")-" + _
  2143.         "(" + cstr$(oShape.x2) + ", " + cstr$(oShape.y2) + ") " + _
  2144.         cstr$(oShape.PixelCount) + " pixels, " + _
  2145.         "IsActive=" + TrueFalse$(oShape.IsActive)
  2146.  
  2147.     For iLoopY = 1 To 8
  2148.         sLine = ""
  2149.         For iLoopX = 1 To 8
  2150.             if _
  2151.                 iLoopY >= oShape.y1 _
  2152.                 and _
  2153.                 iLoopY <= oShape.y2 _
  2154.                 and _
  2155.                 iLoopX >= oShape.x1 _
  2156.                 and _
  2157.                 iLoopX <= oShape.x2 _
  2158.                 then
  2159.  
  2160.                 sLine = sLine + "#"
  2161.             Else
  2162.                 sLine = sLine + "."
  2163.             End If
  2164.         Next iLoopX
  2165.         DebugPrint sLine
  2166.     Next iLoopY
  2167.     DebugPrint ""
  2168. End Sub ' DumpNextShape
  2169.  
  2170. ' /////////////////////////////////////////////////////////////////////////////
  2171. ' Dump all shapes in array.
  2172.  
  2173. ' {i} in sVarName is replaced by array index
  2174.  
  2175. Sub DumpShapeList (arrShapes() As RectangleType, sVarName As String)
  2176.     Dim iLoop1 As Integer
  2177.     Dim sNextVarName As String
  2178.  
  2179.     For iLoop1 = 0 To UBound(arrShapes3)
  2180.         sNextVarName = Replace$(sVarName, "{i}", cstr$(iLoop1))
  2181.         DumpNextShape arrShapes(iLoop1), sVarName
  2182.     Next iLoop1
  2183. End Sub ' DumpShapeList
  2184.  
  2185. ' /////////////////////////////////////////////////////////////////////////////
  2186. ' Receives an array of shapes
  2187. '
  2188. Sub GetActiveShapes (arrShapes2() As RectangleType, arrShapes3() As RectangleType)
  2189.     Dim iLoopShape As Integer
  2190.     Dim iIndex As Integer
  2191.     ReDim arrShapes3(-1) As RectangleType
  2192.     For iLoopShape = 0 To UBound(arrShapes2)
  2193.         If arrShapes2(iLoopShape).IsActive = TRUE Then
  2194.             iIndex = UBound(arrShapes3) + 1
  2195.             ReDim _Preserve arrShapes3(0 To iIndex) As RectangleType
  2196.             arrShapes3(iIndex).y1 = arrShapes2(iLoopShape).y1
  2197.             arrShapes3(iIndex).x1 = arrShapes2(iLoopShape).x1
  2198.             arrShapes3(iIndex).y2 = arrShapes2(iLoopShape).y2
  2199.             arrShapes3(iIndex).x2 = arrShapes2(iLoopShape).x2
  2200.             arrShapes3(iIndex).PixelCount = arrShapes2(iLoopShape).PixelCount
  2201.             arrShapes3(iIndex).IsActive = arrShapes2(iLoopShape).IsActive
  2202.         End If
  2203.     Next iLoopShape
  2204. End Sub ' GetActiveShapes
  2205.  
  2206. ' /////////////////////////////////////////////////////////////////////////////
  2207.  
  2208. Function DelimIntegerListsAreEqual% (sList1 As String, sList2 As String, sDelim As String)
  2209.     Dim bResult As Integer: bResult = FALSE
  2210.     Dim arrList1(-1) As Integer
  2211.     Dim arrList2(-1) As Integer
  2212.     Dim iLoop1 As Integer
  2213.     Dim iLoop2 As Integer
  2214.     Dim bFound As Integer
  2215.  
  2216.     ' Convert delimited lists into integer arrays
  2217.     GetIntegerArrayFromDelimList sList1, sDelim, 0, arrList1()
  2218.     GetIntegerArrayFromDelimList sList2, sDelim, 0, arrList2()
  2219.  
  2220.     ' Are lists same size?
  2221.     If UBound(arrList1) = UBound(arrList2) Then
  2222.         bResult = TRUE
  2223.     End If
  2224.  
  2225.     ' Check list #2 against list #1
  2226.     If bResult = TRUE Then
  2227.         ' Are all items in list #1 in list #2?
  2228.         For iLoop1 = LBound(arrList1) To UBound(arrList1)
  2229.             bFound = FALSE
  2230.             For iLoop2 = LBound(arrList2) To UBound(arrList2)
  2231.                 If arrList2(iLoop2) = arrList1(iLoop1) Then
  2232.                     bFound = TRUE
  2233.                     Exit For
  2234.                 End If
  2235.             Next iLoop2
  2236.             If bFound = FALSE Then
  2237.                 ' not found, lists not equal
  2238.                 bResult = FALSE
  2239.                 Exit For
  2240.             End If
  2241.         Next iLoop1
  2242.     End If
  2243.  
  2244.     ' Check list #1 against list #2
  2245.     If bResult = TRUE Then
  2246.         For iLoop1 = LBound(arrList2) To UBound(arrList2)
  2247.             bFound = FALSE
  2248.             For iLoop2 = LBound(arrList1) To UBound(arrList1)
  2249.                 If arrList1(iLoop2) = arrList2(iLoop1) Then
  2250.                     bFound = TRUE
  2251.                     Exit For
  2252.                 End If
  2253.             Next iLoop2
  2254.             If bFound = FALSE Then
  2255.                 ' not found, lists not equal
  2256.                 bResult = FALSE
  2257.                 Exit For
  2258.             End If
  2259.         Next iLoop1
  2260.     End If
  2261.  
  2262.     ' Return results
  2263.     DelimIntegerListsAreEqual% = bResult
  2264. End Function ' DelimIntegerListsAreEqual%
  2265.  
  2266. ' /////////////////////////////////////////////////////////////////////////////
  2267.  
  2268. ' DumpTileFromShapes arrShapes1(), bIncludeInactive, bShowRowsAndColumns
  2269.  
  2270. Sub DumpTileFromShapes (arrShapes1() As RectangleType, bIncludeInactive As Integer, bShowRowsAndColumns As Integer)
  2271.     ReDim arrTile1(1 To 8, 1 To 8) As String
  2272.     Dim iDestY As Integer
  2273.     Dim iDestX As Integer
  2274.     Dim iLoop1 As Integer
  2275.     Dim sLine As String
  2276.  
  2277.     ' Initialize next tile
  2278.     For iDestY = 1 To 8: For iDestX = 1 To 8: arrTile1(iDestY, iDestX) = ".": Next iDestX: Next iDestY
  2279.  
  2280.     ' Draw all (active) shapes onto tile
  2281.     For iLoop1 = LBound(arrShapes1) To UBound(arrShapes1)
  2282.         If arrShapes1(iLoop1).IsActive = TRUE Or bIncludeInactive = TRUE Then
  2283.             For iDestY = 1 To 8
  2284.                 For iDestX = 1 To 8
  2285.                     If iDestY >= arrShapes1(iLoop1).y1 Then
  2286.                         If iDestY <= arrShapes1(iLoop1).y2 Then
  2287.                             If iDestX >= arrShapes1(iLoop1).x1 Then
  2288.                                 If iDestX <= arrShapes1(iLoop1).x2 Then
  2289.                                     arrTile1(iDestY, iDestX) = "#"
  2290.                                 End If
  2291.                             End If
  2292.                         End If
  2293.                     End If
  2294.                 Next iDestX
  2295.             Next iDestY
  2296.         End If
  2297.     Next iLoop1
  2298.  
  2299.     ' Output the shape
  2300.     If bShowRowsAndColumns = TRUE Then DebugPrint " 12345678"
  2301.     For iDestY = 1 To 8
  2302.         sLine = ""
  2303.         If bShowRowsAndColumns = TRUE Then sLine = sLine + cstr$(iDestY)
  2304.         For iDestX = 1 To 8
  2305.             sLine = sLine + arrTile1(iDestY, iDestX)
  2306.         Next iDestX
  2307.         If bShowRowsAndColumns = TRUE Then sLine = sLine + cstr$(iDestY)
  2308.         DebugPrint sLine
  2309.     Next iDestY
  2310.     If bShowRowsAndColumns = TRUE Then DebugPrint " 12345678"
  2311.  
  2312. End Sub ' DumpTileFromShapes
  2313.  
  2314. ' /////////////////////////////////////////////////////////////////////////////
  2315.  
  2316. ' DumpTile arrTile1(), bShowRowsAndColumns
  2317.  
  2318. Sub DumpTile (arrTile1( 1 To 8 , 1 To 8) As String, bShowRowsAndColumns As Integer)
  2319.     Dim iDestY As Integer
  2320.     Dim iDestX As Integer
  2321.     Dim sLine As String
  2322.  
  2323.     ' Output the tile
  2324.     If bShowRowsAndColumns = TRUE Then DebugPrint " 12345678"
  2325.     For iDestY = 1 To 8
  2326.         sLine = ""
  2327.         If bShowRowsAndColumns = TRUE Then sLine = sLine + cstr$(iDestY)
  2328.         For iDestX = 1 To 8
  2329.             sLine = sLine + arrTile1(iDestY, iDestX)
  2330.         Next iDestX
  2331.         If bShowRowsAndColumns = TRUE Then sLine = sLine + cstr$(iDestY)
  2332.         DebugPrint sLine
  2333.     Next iDestY
  2334.     If bShowRowsAndColumns = TRUE Then DebugPrint " 12345678"
  2335. End Sub ' DumpTile
  2336.  
  2337. ' /////////////////////////////////////////////////////////////////////////////
  2338. ' Receives an 8x8 raster tile definition and returns a list of coordinates
  2339. ' for the minimum number of rectangles to draw that tile.
  2340.  
  2341. ' This version uses a brute force method, ie draw every size rectangle
  2342. ' from 1x1 up to 8x8 (which can themselves be precalculated) in every
  2343. ' available location in the 8x8 grid (where no part of any rectangle falls
  2344. ' off the grid), then tries every combination of those rectangles to find
  2345. ' the combination where the the minimum number of rectangles cover all
  2346. ' points (or if 2 combinations have the same # of rectangles, the one that
  2347. ' covers the lesser total points).
  2348.  
  2349. ' (You can try searching for "rectangular decomposition of binary images"
  2350. ' and similar to find a better algorithm.)
  2351.  
  2352. ' Receives:
  2353. ' TileString (String) = contains 8x8 raster tile definition as a string, where
  2354. '                       empty space represended by ".",
  2355. '                       pixel represented by any non-whitespace character,
  2356. '                       each row separated by chr$(13).
  2357. ' Returns (byref):
  2358. ' arrOptimizedShapes (array of RectangleType) = array of rectangle coordinates
  2359. '                       defining the shapes that will draw the tile.
  2360. '
  2361. ' Return value = empty string if successful, error message if not.
  2362.  
  2363. Sub FindOptimizedVector (TileString As String, arrShapes1() As RectangleType)
  2364.     Dim RoutineName As String: RoutineName = "FindOptimizedVector"
  2365.     Dim bContinue As Integer: bContinue = TRUE
  2366.     ReDim arrTile1(1 To 8, 1 To 8) As String
  2367.     ReDim arrTile2(1 To 8, 1 To 8) As String
  2368.     ReDim arrShapes2(-1) As RectangleType
  2369.     ReDim arrCompare(-1) As DrawCompareType
  2370.     Dim oShapeSet As DrawCompareType
  2371.     Dim iLoopY As Integer
  2372.     Dim iLoopX As Integer
  2373.     Dim iDestY As Integer
  2374.     Dim iDestX As Integer
  2375.     Dim iSizeY As Integer
  2376.     Dim iSizeX As Integer
  2377.     Dim iEndY As Integer
  2378.     Dim iEndX As Integer
  2379.     Dim iTestY As Integer
  2380.     Dim iTestX As Integer
  2381.     Dim bShapeFits As Integer
  2382.     Dim iLoop1 As Integer
  2383.     Dim iLoop2 As Integer
  2384.     Dim iIndex As Integer
  2385.     Dim sItemList As String
  2386.     Dim iShapeCount As Integer
  2387.     Dim iPixelCount As Integer
  2388.     Dim bFinished As Integer
  2389.     Dim sCompare As String
  2390.     ReDim arrTestIndex(-1) As Integer
  2391.     Dim iShapeIndex As Integer
  2392.     Dim iRound As Integer
  2393.     Dim sLine As String
  2394.  
  2395.     '' ****************************************************************************************************************************************************************
  2396.     '' DEBUG:
  2397.     'Dim sStartTime As String : sStartTime = CurrentDateTime$
  2398.     'Dim sEndTime As String : sEndTime = ""
  2399.     'DebugPrint sStartTime + " started " + RoutineName
  2400.     '' ****************************************************************************************************************************************************************
  2401.  
  2402.     ' =============================================================================
  2403.     ' INITIALIZE
  2404.     If bContinue = TRUE Then
  2405.         ' -----------------------------------------------------------------------------
  2406.         ' Init results
  2407.         ReDim arrShapes1(-1) As RectangleType
  2408.  
  2409.         ' -----------------------------------------------------------------------------
  2410.         ' Turn tile into 2D array
  2411.         StringTo2dArray arrTile1(), TileString
  2412.  
  2413.         ' -----------------------------------------------------------------------------
  2414.         ' Count pixels
  2415.         iPixelCount = 0
  2416.         For iLoopY = LBound(arrTile1, 1) To UBound(arrTile1, 1)
  2417.             For iLoopX = LBound(arrTile1, 2) To UBound(arrTile1, 2)
  2418.                 If arrTile1(iLoopY, iLoopX) <> "." Then
  2419.                     iPixelCount = iPixelCount + 1
  2420.                 End If
  2421.             Next iLoopX
  2422.         Next iLoopY
  2423.  
  2424.         ' If shape is blank no need to continue looking
  2425.         ' we can just return an empty array
  2426.         If iPixelCount = 0 Then
  2427.             bContinue = FALSE
  2428.         End If
  2429.     End If
  2430.  
  2431.     ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  2432.     ' BEGIN LOOK FOR MINIMUM COMBINATION OF SHAPES TO DRAW TILE
  2433.     If bContinue = TRUE Then
  2434.         ' =============================================================================
  2435.         ' Get a set of every size shape (rectangle) from 1x1 up to 8x8
  2436.         GetAllPossibleShapes arrShapes1()
  2437.         'DebugPrint "ALL POSSIBLE SHAPES:"
  2438.         'DumpShapeList arrShapes1(), "arrShapes1{i}"
  2439.  
  2440.         ' =============================================================================
  2441.         ' Try each shape in every location on the tile, to see which fit
  2442.         For iLoop1 = 0 To UBound(arrShapes1)
  2443.             ' Try plotting next shape in every position
  2444.             For iDestY = 1 To 8
  2445.                 For iDestX = 1 To 8
  2446.                     ' Track whether shape is fully on the tile at this position
  2447.                     bShapeFits = FALSE
  2448.  
  2449.                     ' Does shape fit at this Y position?
  2450.                     iSizeY = arrShapes1(iLoop1).y2 - arrShapes1(iLoop1).y1
  2451.                     iEndY = iDestY + iSizeY
  2452.                     If iEndY < 9 Then
  2453.                         ' Does shape fit at this X position?
  2454.                         iSizeX = arrShapes1(iLoop1).x2 - arrShapes1(iLoop1).x1
  2455.                         iEndX = iDestX + iSizeX
  2456.                         If iEndX < 9 Then
  2457.                             ' The shape is fully on the tile here
  2458.                             bShapeFits = TRUE
  2459.  
  2460.                             ' Now see if any of shape's pixels fall outside of tile's pixels?
  2461.                             For iTestY = iDestY To iEndY
  2462.                                 For iTestX = iDestX To iEndX
  2463.                                     If arrTile1(iTestY, iTestX) = "." Then
  2464.                                         ' No pixel here, shape fails
  2465.                                         bShapeFits = FALSE
  2466.                                         Exit For
  2467.                                     End If
  2468.                                 Next iTestX
  2469.                                 If bShapeFits = FALSE Then Exit For
  2470.                             Next iTestY
  2471.                         End If
  2472.                     End If
  2473.  
  2474.                     ' If shape fits, add it to the list of shapes/positions that work for the tile
  2475.                     If bShapeFits = TRUE Then
  2476.                         iIndex = UBound(arrShapes2) + 1
  2477.                         ReDim _Preserve arrShapes2(0 To iIndex) As RectangleType
  2478.                         arrShapes2(iIndex).y1 = iDestY
  2479.                         arrShapes2(iIndex).x1 = iDestX
  2480.                         arrShapes2(iIndex).y2 = iEndY
  2481.                         arrShapes2(iIndex).x2 = iEndX
  2482.                         arrShapes2(iIndex).PixelCount = arrShapes1(iLoop1).PixelCount
  2483.                         arrShapes2(iIndex).IsActive = TRUE
  2484.                     End If
  2485.                 Next iDestX
  2486.             Next iDestY
  2487.         Next iLoop1
  2488.  
  2489.         ' Eliminate non-active shapes
  2490.         GetActiveShapes arrShapes2(), arrShapes1()
  2491.  
  2492.         'DebugPrint "ALL SHAPES/LOCATIONS THAT MATCHED + FIT:"
  2493.         'DumpShapeList arrShapes2(), "arrShapes2{i}"
  2494.  
  2495.         ' =============================================================================
  2496.         ' Remove redundant shapes (any where another shape covers more points)
  2497.  
  2498.         For iLoop1 = 0 To UBound(arrShapes1)
  2499.             ' make sure shape #1 was not eliminated
  2500.             If arrShapes1(iLoop1).IsActive = TRUE Then
  2501.                 ' compare shape #1 against all other shapes
  2502.                 For iLoop2 = 0 To UBound(arrShapes1)
  2503.                     ' don't compare against itself
  2504.                     If iLoop2 <> iLoop1 Then
  2505.                         ' make sure shape #2 was not eliminated
  2506.                         If arrShapes1(iLoop2).IsActive = TRUE Then
  2507.                             ' can shape #2 do what shape #1 can do? (covers all points shape #1 does)
  2508.                             if _
  2509.                                 arrShapes1(iLoop1).y1 >= arrShapes1(iLoop2).y1 _
  2510.                                 and _
  2511.                                 arrShapes1(iLoop1).y2 <= arrShapes1(iLoop2).y2 _
  2512.                                 and _
  2513.                                 arrShapes1(iLoop1).x1 >= arrShapes1(iLoop2).x1 _
  2514.                                 and _
  2515.                                 arrShapes1(iLoop1).x2 <= arrShapes1(iLoop2).x2 _
  2516.                                 then
  2517.  
  2518.                                 ' does shape #2 do it better? (cover more points than shape #1)
  2519.                                 If arrShapes1(iLoop2).PixelCount >= arrShapes1(iLoop1).PixelCount Then
  2520.                                     ' Remove shape #1
  2521.                                     arrShapes1(iLoop1).IsActive = FALSE
  2522.                                 End If
  2523.                             End If
  2524.                         End If
  2525.                     End If
  2526.                 Next iLoop2
  2527.             End If
  2528.         Next iLoop1
  2529.  
  2530.         ' Eliminate non-active shapes
  2531.         GetActiveShapes arrShapes1(), arrShapes2()
  2532.  
  2533.         'DebugPrint "SHAPES THAT MATCHED + FIT, NON-REDUNDANT LEVEL 1:"
  2534.         'DumpShapeList arrShapes2(), "arrShapes2{i}"
  2535.  
  2536.     End If
  2537.  
  2538.     ' =============================================================================
  2539.     ' Can we do without any?
  2540.     ' Compare all combinations subtractively:
  2541.  
  2542.     ' 1. Count enabled shapes + total pixels for full list of shapes "set A".
  2543.     ' 2. Save "set A" to the "contender list",
  2544.     '    with the shape count and total pixel count.
  2545.     ' 3. For each shape "x":
  2546.     '    a) see if full tile can still be drawn without "x"
  2547.     '       (where the set of shapes minus "x" is "set y").
  2548.     '    b) If full tile can be drawn, save "set y" to the "contender list"
  2549.     '       with the shape count and total pixel count.
  2550.     ' 4. When done, identify the winner "set z" that can draw the full tile
  2551.     '    using the minimum shape coverage.
  2552.     '    a) The set with the smallest tile count wins.
  2553.     '    b) In the event of a tie, the set with the least total pixel count wins.
  2554.     '    c) In the event of another tie, just use the first finalist.
  2555.     ' 5. Disable all shapes NOT in the winning "set z".
  2556.     ' 6. Save list of enabled shapes to "last winner".
  2557.     ' 7. Repeat steps 1-5 until, comparing the list of enabled shapes to
  2558.     '    the list "last winner". When the list stops changing (lists are equal),
  2559.     '    we have gone as far as we can go.
  2560.     ' 8. Return shapes in "last winner" as final result.
  2561.  
  2562.     If bContinue = TRUE Then
  2563.  
  2564.         ' -----------------------------------------------------------------------------
  2565.         ' Start with all
  2566.         ' 1. Count enabled shapes + total pixels for full list of shapes "set A".
  2567.         ' 2. Save "set A" to the "contender list",
  2568.         '    with the shape count and total pixel count.
  2569.         sItemList = ""
  2570.         iShapeCount = 0
  2571.         iPixelCount = 0
  2572.         For iLoop1 = LBound(arrShapes2) To UBound(arrShapes2)
  2573.             sItemList = sItemList + IIFSTR$(Len(sItemList) = 0, "", ",") + cstr$(iLoop1)
  2574.             iShapeCount = iShapeCount + 1
  2575.             iPixelCount = iPixelCount + arrShapes2(iLoop1).PixelCount
  2576.         Next iLoop1
  2577.  
  2578.         oShapeSet.IndexList = sItemList
  2579.         oShapeSet.ShapeCount = iShapeCount
  2580.         oShapeSet.PixelCount = iPixelCount
  2581.         oShapeSet.IsActive = TRUE
  2582.  
  2583.         ' -----------------------------------------------------------------------------
  2584.         ' Now see which combinations can draw the tile
  2585.  
  2586.         iRound = 0
  2587.         bFinished = FALSE
  2588.         Do
  2589.             ' At the top of the loop, oShapeSet contains the latest set of shapes
  2590.             iRound = iRound + 1
  2591.  
  2592.             ' Get the list of shapes (indexes pointing to each shape in arrShapes2)
  2593.             ' All this packing and unpacking probably wastes cycles
  2594.             ' It might not be necessary if we had arrays inside of types!
  2595.             GetIntegerArrayFromDelimList oShapeSet.IndexList, ",", 0, arrTestIndex()
  2596.  
  2597.             ' Clear the list of contenders
  2598.             ReDim arrCompare(-1) As DrawCompareType
  2599.  
  2600.             '' ****************************************************************************************************************************************************************
  2601.             'DebugPrint "################################################################################################################################################################"
  2602.             'DebugPrint "Round " + cstr$(iRound) + " shapes to dedupe:"
  2603.             'for iLoop2 = lbound(arrTestIndex) to ubound(arrTestIndex)
  2604.             '    iIndex = arrTestIndex(iLoop2)
  2605.             '    DumpNextShape arrShapes2(iIndex), "Shape " + cstr$(iIndex) + " round " + cstr$(iRound) + ""
  2606.             '    DebugPrint ""
  2607.             'Next iLoop2
  2608.             'DebugPrint "################################################################################################################################################################"
  2609.             '' ****************************************************************************************************************************************************************
  2610.  
  2611.             ' 3. For each shape "x":
  2612.             '    a) see if full tile can still be drawn without "x"
  2613.             '       (where the set of shapes minus "x" is "set y").
  2614.             '    b) If full tile can be drawn, save "set y" to the "contender list"
  2615.             '       with the shape count and total pixel count.
  2616.             For iLoop1 = LBound(arrTestIndex) To UBound(arrTestIndex)
  2617.  
  2618.                 ''DEBUG:
  2619.                 'DebugPrint "????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????"
  2620.                 'DebugPrint "Can we eliminate " + cstr$(iLoop1) ' this shape?"
  2621.                 'DumpNextShape arrShapes2(iLoop1), "arrShapes2(" + cstr$(iLoop1) + ")"
  2622.                 'DebugPrint "????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????"
  2623.                 'DebugPrint ""
  2624.  
  2625.                 ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2626.                 ' Clear test tile
  2627.                 ReDim arrTile2(1 To 8, 1 To 8) As String
  2628.                 For iDestY = 1 To 8
  2629.                     For iDestX = 1 To 8
  2630.                         arrTile2(iDestY, iDestX) = "."
  2631.                     Next iDestX
  2632.                 Next iDestY
  2633.  
  2634.                 ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2635.                 ' Try drawing next combination of shapes in the test tile
  2636.                 sItemList = ""
  2637.                 iShapeCount = 0
  2638.                 iPixelCount = 0
  2639.                 For iLoop2 = LBound(arrTestIndex) To UBound(arrTestIndex)
  2640.  
  2641.                     ' Make sure it's not shape "x"
  2642.                     If iLoop2 <> iLoop1 Then
  2643.                         iIndex = arrTestIndex(iLoop2)
  2644.  
  2645.                         sItemList = sItemList + IIFSTR$(Len(sItemList) = 0, "", ",") + cstr$(iIndex)
  2646.                         iShapeCount = iShapeCount + 1
  2647.                         iPixelCount = iPixelCount + arrShapes2(iIndex).PixelCount
  2648.  
  2649.                         For iDestY = 1 To 8
  2650.                             For iDestX = 1 To 8
  2651.                                 If iDestY >= arrShapes2(iIndex).y1 Then
  2652.                                     If iDestY <= arrShapes2(iIndex).y2 Then
  2653.                                         If iDestX >= arrShapes2(iIndex).x1 Then
  2654.                                             If iDestX <= arrShapes2(iIndex).x2 Then
  2655.                                                 arrTile2(iDestY, iDestX) = "#"
  2656.                                             End If
  2657.                                         End If
  2658.                                     End If
  2659.                                 End If
  2660.                             Next iDestX
  2661.                         Next iDestY
  2662.                     End If
  2663.                 Next iLoop2
  2664.  
  2665.                 ''DebugPrint "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
  2666.                 ''DebugPrint "Attempted drawing tile without " + cstr$(iLoop1) ' item #" + cstr$(iLoop1)
  2667.                 ''DumpTile arrTile2(), TRUE
  2668.                 'DebugPrint "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
  2669.                 'DebugPrint ""
  2670.                 'DebugPrint "RESULT$:"
  2671.                 iShapeIndex = arrTestIndex(iLoop1)
  2672.  
  2673.                 ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2674.                 ' Does the test tile match the real tile?
  2675.                 sCompare = TilesAreEqual$(arrTile1(), arrTile2())
  2676.                 If Len(sCompare) = 0 Then
  2677.                     ' Add to the list of contenders
  2678.                     iIndex = UBound(arrCompare) + 1
  2679.                     ReDim _Preserve arrCompare(0 To iIndex) As DrawCompareType
  2680.                     arrCompare(iIndex).IndexList = sItemList
  2681.                     arrCompare(iIndex).ShapeCount = iShapeCount
  2682.                     arrCompare(iIndex).PixelCount = iPixelCount
  2683.                     arrCompare(iIndex).IsActive = TRUE
  2684.  
  2685.                     'DebugPrint "*******************************************************************************"
  2686.                     'DebugPrint "YES: Tile can be drawn without shape " + cstr$(iShapeIndex) + " round " + cstr$(iRound)
  2687.                     'DebugPrint "arrCompare(" + cstr$(iIndex) + ").IndexList  = " + sItemList
  2688.                     'DebugPrint "arrCompare(" + cstr$(iIndex) + ").ShapeCount = " + cstr$(iShapeCount)
  2689.                     'DebugPrint "arrCompare(" + cstr$(iIndex) + ").PixelCount = " + cstr$(PixelCount)
  2690.                     'DebugPrint "*******************************************************************************"
  2691.  
  2692.                     'else
  2693.                     'DebugPrint "*******************************************************************************"
  2694.                     'DebugPrint "NOPE: Tile cannot be drawn without shape " + cstr$(iShapeIndex) + " round " + cstr$(iRound)
  2695.                     'DebugPrint sCompare
  2696.                     'DebugPrint "Attempted with:"
  2697.                     'DebugPrint ".IndexList  = " + sItemList
  2698.                     'DebugPrint ".ShapeCount = " + cstr$(iShapeCount)
  2699.                     'DebugPrint ".PixelCount = " + cstr$(PixelCount)
  2700.                     'DebugPrint "*******************************************************************************"
  2701.                 End If
  2702.  
  2703.             Next iLoop1
  2704.  
  2705.             ' =============================================================================
  2706.             ' Identify the best combination that uses the least # of shapes + pixels
  2707.  
  2708.             ' DEDUPE IF THERE ARE >1 GROUPS
  2709.             If UBound(arrCompare) > LBound(arrCompare) Then
  2710.  
  2711.                 '' ****************************************************************************************************************************************************************
  2712.                 ''DEBUG:
  2713.                 'DebugPrint "RESULTS BEFORE DEDUPE:"
  2714.                 'sLine = ","
  2715.                 'for iLoop2 = lbound(arrCompare) to ubound(arrCompare)
  2716.                 '    if arrCompare(iLoop2).IsActive = TRUE then
  2717.                 '        sLine = sLine + cstr$(iLoop2) + ","
  2718.                 '        DebugPrint "-------------------------------------------------------------------------------"
  2719.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").IndexList  = " + arrCompare(iLoop2).IndexList
  2720.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").ShapeCount = " + cstr$(arrCompare(iLoop2).ShapeCount)
  2721.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").PixelCount = " + cstr$(arrCompare(iLoop2).PixelCount)
  2722.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").IsActive   = " + TrueFalse$(arrCompare(iLoop2).IsActive)
  2723.                 '    end if
  2724.                 'next iLoop2
  2725.                 'DebugPrint ""
  2726.                 '' ****************************************************************************************************************************************************************
  2727.  
  2728.                 For iLoop1 = LBound(arrCompare) To UBound(arrCompare)
  2729.                     For iLoop2 = LBound(arrCompare) To UBound(arrCompare)
  2730.                         If iLoop1 <> iLoop2 Then
  2731.                             If arrCompare(iLoop1).IsActive = TRUE Then
  2732.                                 If arrCompare(iLoop2).IsActive = TRUE Then
  2733.                                     If arrCompare(iLoop2).ShapeCount < arrCompare(iLoop1).ShapeCount Then
  2734.                                         arrCompare(iLoop1).IsActive = FALSE
  2735.                                     ElseIf arrCompare(iLoop2).ShapeCount > arrCompare(iLoop1).ShapeCount Then
  2736.                                         arrCompare(iLoop2).IsActive = FALSE
  2737.                                     Else
  2738.                                         If arrCompare(iLoop2).PixelCount < arrCompare(iLoop1).PixelCount Then
  2739.                                             arrCompare(iLoop1).IsActive = FALSE
  2740.                                         ElseIf arrCompare(iLoop2).PixelCount > arrCompare(iLoop1).PixelCount Then
  2741.                                             arrCompare(iLoop2).IsActive = FALSE
  2742.                                         Else
  2743.                                             arrCompare(iLoop2).IsActive = FALSE
  2744.                                         End If
  2745.                                     End If
  2746.                                 End If
  2747.                             End If
  2748.                         End If
  2749.                     Next iLoop2
  2750.                 Next iLoop1
  2751.  
  2752.                 '' ****************************************************************************************************************************************************************
  2753.                 ''DEBUG:
  2754.                 'DebugPrint "RESULTS AFTER DEDUPE:"
  2755.                 'for iLoop2 = lbound(arrCompare) to ubound(arrCompare)
  2756.                 '    if InStr(1, sLine, "," + cstr$(iLoop2) + ",") > 0 then
  2757.                 '        DebugPrint "-------------------------------------------------------------------------------"
  2758.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").IndexList  = " + arrCompare(iLoop2).IndexList
  2759.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").ShapeCount = " + cstr$(arrCompare(iLoop2).ShapeCount)
  2760.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").PixelCount = " + cstr$(arrCompare(iLoop2).PixelCount)
  2761.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").IsActive   = " + TrueFalse$(arrCompare(iLoop2).IsActive)
  2762.                 '    end if
  2763.                 'next iLoop2
  2764.                 'DebugPrint ""
  2765.                 '' ****************************************************************************************************************************************************************
  2766.  
  2767.             End If
  2768.  
  2769.             ' =============================================================================
  2770.             ' Identify the winner!
  2771.             ' Look at the list of indexes that make up the winning shape combination,
  2772.             ' and pick the first one.
  2773.  
  2774.             'DebugPrint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
  2775.             'DebugPrint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
  2776.             'DebugPrint "LOOK FOR THE WINNER, END ROUND " + cstr$(iRound)
  2777.             'DebugPrint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
  2778.             'DebugPrint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
  2779.             iIndex = -1
  2780.  
  2781.             'DebugPrint "arrCompare(" + cstr$(lbound(arrCompare)) + " To " + cstr$(ubound(arrCompare)) + ")"
  2782.             'DebugPrint ""
  2783.  
  2784.             'DebugPrint "Group   Status"
  2785.             'DebugPrint "-----   ----------"
  2786.             For iLoop1 = LBound(arrCompare) To UBound(arrCompare)
  2787.                 If arrCompare(iLoop1).IsActive = TRUE Then
  2788.                     If iIndex = -1 Then
  2789.                         iIndex = iLoop1
  2790.                         Exit For
  2791.                         '            DebugPrint left$(cstr$(iLoop1) + "     ", 5) + "   " + "IsActive WINNER"
  2792.                         '        else
  2793.                         '            DebugPrint left$(cstr$(iLoop1) + "     ", 5) + "   " + "IsActive"
  2794.                     End If
  2795.                     '    else
  2796.                     '        DebugPrint left$(cstr$(iLoop1) + "     ", 5) + "   " + "(disabled)"
  2797.                 End If
  2798.             Next iLoop1
  2799.             'DebugPrint ""
  2800.  
  2801.             ' =============================================================================
  2802.             ' Has it changed from the last round?
  2803.             'DebugPrint "////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////"
  2804.             'DebugPrint "Has it changed from the last round?"
  2805.             'DebugPrint "iIndex=" + cstr$(iIndex)
  2806.             'DebugPrint "////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////"
  2807.             'DebugPrint ""
  2808.  
  2809.             If iIndex > -1 Then
  2810.                 'DebugPrint "Comparing arrCompare(" + cstr$(iIndex) + ").IndexList: " + arrCompare(iIndex).IndexList
  2811.                 'DebugPrint "       to oShapeSet.IndexList: " + oShapeSet.IndexList
  2812.                 'DebugPrint ""
  2813.  
  2814.                 If DelimIntegerListsAreEqual%(arrCompare(iIndex).IndexList, oShapeSet.IndexList, ",") = TRUE Then
  2815.                     'DebugPrint "DelimIntegerListsAreEqual% returns TRUE"
  2816.                     'DebugPrint "FOUND WINNER (Group #" + cstr$(iIndex) + ") exiting..."
  2817.                     ' no change, we have reduced as much as possible, exit
  2818.                     bFinished = TRUE
  2819.                 Else
  2820.                     'DebugPrint "DelimIntegerListsAreEqual% returns FALSE"
  2821.                     'DebugPrint "None yet, try next data"
  2822.                     'DebugPrint "Replacing old best set: "
  2823.                     'DebugPrint "    IndexList=" + oShapeSet.IndexList
  2824.                     'DebugPrint "    ShapeCount=" + cstr$(oShapeSet.ShapeCount)
  2825.                     'DebugPrint "    PixelCount=" + cstr$(oShapeSet.PixelCount)
  2826.                     'DebugPrint "    IsActive  =" + TrueFalse$(oShapeSet.IsActive)
  2827.                     'DebugPrint "with arrCompare(" + cstr$(iIndex) + ")"
  2828.                     'DebugPrint "    IndexList=" + arrCompare(iIndex).IndexList
  2829.                     'DebugPrint "    ShapeCount=" + cstr$(arrCompare(iIndex).ShapeCount)
  2830.                     'DebugPrint "    PixelCount=" + cstr$(arrCompare(iIndex).PixelCount)
  2831.                     'DebugPrint "    IsActive  =" + TrueFalse$(arrCompare(iIndex).IsActive)
  2832.                     'DebugPrint "and continuing to compare..."
  2833.  
  2834.                     ' Continue reducing with the latest set
  2835.                     oShapeSet.IndexList = arrCompare(iIndex).IndexList
  2836.                     oShapeSet.ShapeCount = arrCompare(iIndex).ShapeCount
  2837.                     oShapeSet.PixelCount = arrCompare(iIndex).PixelCount
  2838.                     oShapeSet.IsActive = TRUE
  2839.                 End If
  2840.             Else
  2841.                 'DebugPrint "(NONE FOUND THAT WORKED, USE THE EXISTING oShapeSet)"
  2842.                 'DebugPrint "Replacing old best set: "
  2843.                 'DebugPrint "    oShapeSet.IndexList=" + oShapeSet.IndexList
  2844.                 'DebugPrint "    oShapeSet.ShapeCount=" + cstr$(oShapeSet.ShapeCount)
  2845.                 'DebugPrint "    oShapeSet.PixelCount=" + cstr$(oShapeSet.PixelCount)
  2846.                 'DebugPrint "    oShapeSet.IsActive  =" + TrueFalse$(oShapeSet.IsActive)
  2847.                 ' none found that works, exit
  2848.                 bFinished = TRUE
  2849.             End If
  2850.  
  2851.         Loop Until bFinished = TRUE
  2852.  
  2853.         ' =============================================================================
  2854.         ' Build results
  2855.  
  2856.         ' Get the list of shapes (indexes pointing to each shape in arrShapes1)
  2857.         GetIntegerArrayFromDelimList oShapeSet.IndexList, ",", 0, arrTestIndex()
  2858.  
  2859.         ' Initialize the final output
  2860.         ReDim arrShapes1(-1) As RectangleType
  2861.  
  2862.         ' Add the shapes to the final list
  2863.         For iLoop2 = LBound(arrTestIndex) To UBound(arrTestIndex)
  2864.             iShapeIndex = arrTestIndex(iLoop2)
  2865.  
  2866.             iIndex = UBound(arrShapes1) + 1
  2867.             ReDim _Preserve arrShapes1(0 To iIndex) As RectangleType
  2868.  
  2869.             'DebugPrint "Copying arrShapes2(" + cstr$(iShapeIndex) + ") to arrShapes1(" + cstr$(iIndex) + "):"
  2870.  
  2871.             If arrShapes2(iShapeIndex).IsActive = TRUE Then
  2872.                 arrShapes1(iIndex).x1 = arrShapes2(iShapeIndex).x1
  2873.                 arrShapes1(iIndex).y1 = arrShapes2(iShapeIndex).y1
  2874.                 arrShapes1(iIndex).x2 = arrShapes2(iShapeIndex).x2
  2875.                 arrShapes1(iIndex).y2 = arrShapes2(iShapeIndex).y2
  2876.                 arrShapes1(iIndex).PixelCount = arrShapes2(iShapeIndex).PixelCount
  2877.                 arrShapes1(iIndex).IsActive = arrShapes2(iShapeIndex).IsActive
  2878.  
  2879.                 ''DEBUG:
  2880.                 'DumpNextShape arrShapes1(iIndex), "arrShapes1(" + cstr$(iIndex) + ")"
  2881.  
  2882.             End If
  2883.         Next iLoop2
  2884.  
  2885.     End If
  2886.     ' END LOOK FOR MINIMUM COMBINATION OF SHAPES TO DRAW TILE
  2887.     ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  2888.  
  2889.     '' ****************************************************************************************************************************************************************
  2890.     '' DEBUG:
  2891.     'DumpTileFromShapes arrShapes1(), FALSE, TRUE
  2892.     '
  2893.     'sEndTime = CurrentDateTime$
  2894.     'DebugPrint RoutineName + " finished:"
  2895.     'DebugPrint "    started  at: " + sStartTime
  2896.     'DebugPrint "    finished at: " + sEndTime
  2897.     '' ****************************************************************************************************************************************************************
  2898.  
  2899. End Sub ' FindOptimizedVector
  2900.  
  2901. ' /////////////////////////////////////////////////////////////////////////////
  2902. ' Test routine for the FindOptimizedVector routine.
  2903.  
  2904. Sub FindOptimizedVectorTest
  2905.     Dim RoutineName As String: RoutineName = "FindOptimizedVectorTest"
  2906.     Dim sError As String: sError = ""
  2907.     Dim in$
  2908.     ReDim arrTileText(0 To 255) As String
  2909.     Dim sTestList As String
  2910.     ReDim arrTestIndex(-1) As Integer
  2911.     Dim iLoop1 As Integer
  2912.     Dim iLoop2 As Integer
  2913.     Dim iIndex As Integer
  2914.     ReDim arrOptimizedShapes(-1) As RectangleType
  2915.     Dim sLine As String
  2916.  
  2917.     ' Start output
  2918.     DebugPrint "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
  2919.     DebugPrint "Testing tiles: " + sTestList
  2920.     DebugPrint ""
  2921.  
  2922.     ' Get raster tiles as a string array
  2923.     GetTileText arrTileText()
  2924.  
  2925.     ' List of tiles to test
  2926.     'sTestList = "254,253,247,32,238,241,225,233,213,214,212,203,194,193,192,169,154,151,145,147,129,115,114,84,65,46,44,35,252"
  2927.     'sTestList = "46,35"
  2928.     'sTestList = "84,253,192,151,147,114,65"
  2929.     'sTestList = "43,44,45,46"
  2930.     'sTestList = "60,62" ' 84 + 192 work, the rest don't
  2931.     'sTestList = "254,252"
  2932.     sTestList = "84,60,62,75,141,142,150,207,217,252,192" ' 84 + 192 work, the rest don't
  2933.     'sTestList = "60,62,75,141,142,150,207,217,252" ' 84 + 192 work, the rest don't
  2934.     'sTestList="75"
  2935.     'DebugPrint "GETTING LIST OF TILES..."
  2936.     GetIntegerArrayFromDelimList sTestList, ",", 0, arrTestIndex()
  2937.  
  2938.     ' Test tiles
  2939.     For iIndex = 0 To 255
  2940.         'for iLoop1 = lbound(arrTestIndex) to ubound(arrTestIndex)
  2941.         '    iIndex = arrTestIndex(iLoop1)
  2942.         DebugPrint "----------------------------------------------------------------------------------------------------------------------------------------------------------------"
  2943.         DebugPrint "Tile #" + cstr$(iIndex) + ":"
  2944.         DebugPrint arrTileText(iIndex)
  2945.         DebugPrint ""
  2946.  
  2947.         ' Process next tile and generate line drawing routines
  2948.         FindOptimizedVector arrTileText(iIndex), arrOptimizedShapes()
  2949.  
  2950.         If Len(sError) = 0 Then
  2951.             If UBound(arrOptimizedShapes) > -1 Then
  2952.                 DebugPrint "#   x1   y1   x2   y2   Pixels    IsActive"
  2953.                 For iLoop2 = LBound(arrOptimizedShapes) To UBound(arrOptimizedShapes)
  2954.                     sLine = ""
  2955.                     sLine = sLine + Left$(cstr$(iLoop2) + String$(4, " "), 4)
  2956.                     sLine = sLine + Left$(cstr$(arrOptimizedShapes(iLoop2).x1) + String$(2, " "), 2) + "   "
  2957.                     sLine = sLine + Left$(cstr$(arrOptimizedShapes(iLoop2).y1) + String$(2, " "), 2) + "   "
  2958.                     sLine = sLine + Left$(cstr$(arrOptimizedShapes(iLoop2).x2) + String$(2, " "), 2) + "   "
  2959.                     sLine = sLine + Left$(cstr$(arrOptimizedShapes(iLoop2).y2) + String$(2, " "), 2) + "   "
  2960.                     sLine = sLine + Left$(cstr$(arrOptimizedShapes(iLoop2).PixelCount) + String$(7, " "), 7) + "   "
  2961.                     sLine = sLine + TrueFalse$(arrOptimizedShapes(iLoop2).IsActive)
  2962.                     DebugPrint sLine
  2963.                 Next iLoop2
  2964.             Else
  2965.                 DebugPrint "*** NO SHAPES TO DRAW THIS TILE ***"
  2966.             End If
  2967.         Else
  2968.             DebugPrint "ERROR FOR TILE #" + cstr$(iIndex) + ": " + sError
  2969.         End If
  2970.         DebugPrint ""
  2971.         'next iLoop1
  2972.     Next iIndex
  2973.  
  2974.     ' DONE
  2975.     DebugPrint RoutineName + " finished."
  2976.     'Input "PRESS <ENTER> TO CONTINUE";in$
  2977. End Sub ' FindOptimizedVectorTest
  2978.  
  2979. ' /////////////////////////////////////////////////////////////////////////////
  2980. ' Receives two 2D string arrays and compares the dimensions
  2981. ' and makes sure that the any blank pixel value "." matches
  2982. ' (any other non-whitespace characters are considered a pixel
  2983. ' as long as they are not "." they are considered a match).
  2984. ' Returns empty string if they match, else returns a difference report.
  2985.  
  2986. Function TilesAreEqual$ (arrTile1() As String, arrTile2() As String)
  2987.     Dim sResult As String: sResult = ""
  2988.     Dim iLoopY As Integer
  2989.     Dim iLoopX As Integer
  2990.     Dim sTemp As String
  2991.     Dim bMatch As Integer
  2992.     Dim iY As Integer
  2993.  
  2994.     If LBound(arrTile1, 1) = LBound(arrTile2, 1) Then
  2995.         If UBound(arrTile1, 1) = UBound(arrTile2, 1) Then
  2996.             If LBound(arrTile1, 2) = LBound(arrTile2, 2) Then
  2997.                 If UBound(arrTile1, 2) = UBound(arrTile2, 2) Then
  2998.                     bMatch = TRUE
  2999.                     sTemp = " 12345678 " + Chr$(13)
  3000.                     iY = 0
  3001.                     For iLoopY = LBound(arrTile1, 1) To UBound(arrTile1, 1)
  3002.                         iY = iY + 1
  3003.                         sTemp = sTemp + cstr$(iY)
  3004.                         For iLoopX = LBound(arrTile1, 2) To UBound(arrTile1, 2)
  3005.                             If arrTile1(iLoopY, iLoopX) = "." And arrTile2(iLoopY, iLoopX) <> "." Then
  3006.                                 bMatch = FALSE
  3007.                                 sTemp = sTemp + "?"
  3008.                             ElseIf arrTile1(iLoopY, iLoopX) <> "." And arrTile2(iLoopY, iLoopX) = "." Then
  3009.                                 bMatch = FALSE
  3010.                                 sTemp = sTemp + "?"
  3011.                             Else
  3012.                                 sTemp = sTemp + arrTile1(iLoopY, iLoopX)
  3013.                             End If
  3014.                         Next iLoopX
  3015.                         sTemp = sTemp + cstr$(iY) + Chr$(13)
  3016.                     Next iLoopY
  3017.                     sTemp = sTemp + " 12345678 " + Chr$(13)
  3018.                     If bMatch = FALSE Then
  3019.                         sResult = sTemp
  3020.                     End If
  3021.                 Else
  3022.                     sResult = "ubound(arrTile1, 2)=" + cstr$(ubound(arrTile1, 2)) + _
  3023.                         " <> " + _
  3024.                         "ubound(arrTile2, 2)=" + cstr$(ubound(arrTile2, 2))
  3025.                 End If
  3026.             Else
  3027.                 sResult = "lbound(arrTile1, 2)=" + cstr$(lbound(arrTile1, 2)) + _
  3028.                     " <> " + _
  3029.                     "lbound(arrTile2, 2)=" + cstr$(lbound(arrTile2, 2))
  3030.  
  3031.             End If
  3032.         Else
  3033.             sResult = "ubound(arrTile1, 1)=" + cstr$(ubound(arrTile1, 1)) + _
  3034.                 " <> " + _
  3035.                 "ubound(arrTile2, 1)=" + cstr$(ubound(arrTile2, 1))
  3036.         End If
  3037.     Else
  3038.         sResult = "lbound(arrTile1, 1)=" + cstr$(lbound(arrTile1, 1)) + _
  3039.             " <> " + _
  3040.             "lbound(arrTile2, 1)=" + cstr$(lbound(arrTile2, 1))
  3041.     End If
  3042.     TilesAreEqual$ = sResult
  3043. End Function ' TilesAreEqual$
  3044.  
  3045. ' ################################################################################################################################################################
  3046. ' END VECTOR-BASED TILE ROUTINES
  3047. ' ################################################################################################################################################################
  3048.  
  3049. ' ################################################################################################################################################################
  3050. ' BEGIN BOX DRAWING ROUTINES
  3051. ' ################################################################################################################################################################
  3052.  
  3053. ' /////////////////////////////////////////////////////////////////////////////
  3054. ' DRAW A 2-D BOX (OUTLINE)
  3055. ' https://www.qb64.org/wiki/LINE
  3056.  
  3057. Sub DrawBoxOutline (iX As Integer, iY As Integer, iSize As Integer, fgColor As _Unsigned Long)
  3058.     Line (iX, iY)-(iX + (iSize - 1), iY + (iSize - 1)), fgColor, B ' Draw box outline
  3059. End Sub ' DrawBoxOutline
  3060.  
  3061. ' /////////////////////////////////////////////////////////////////////////////
  3062. ' DRAW A 2-D BOX (SOLID)
  3063. ' https://www.qb64.org/wiki/LINE
  3064.  
  3065. ' Renamed DrawBox/DrawBoxLine to DrawSolidBox
  3066.  
  3067. Sub DrawBoxSolid (iX As Integer, iY As Integer, iSize As Integer, fgColor As _Unsigned Long)
  3068.     Line (iX, iY)-(iX + (iSize - 1), iY + (iSize - 1)), fgColor, BF ' Draw a solid box
  3069. End Sub ' DrawBoxSolid
  3070.  
  3071. ' /////////////////////////////////////////////////////////////////////////////
  3072. ' DRAW A 2-D RECTANGLE (OUTLINE)
  3073.  
  3074. Sub DrawRectOutline (iX As Integer, iY As Integer, iSizeW As Integer, iSizeH As Integer, fgColor As _Unsigned Long)
  3075.     Line (iX, iY)-(iX + (iSizeW - 1), iY + (iSizeH - 1)), fgColor, B ' Draw rectangle outline
  3076. End Sub ' DrawRectOutline
  3077.  
  3078. ' /////////////////////////////////////////////////////////////////////////////
  3079. ' DRAW A 2-D RECTANGLE (SOLID)
  3080.  
  3081. Sub DrawRectSolid (iX As Integer, iY As Integer, iSizeW As Integer, iSizeH As Integer, fgColor As _Unsigned Long)
  3082.     Line (iX, iY)-(iX + (iSizeW - 1), iY + (iSizeH - 1)), fgColor, BF ' Draw a solid rectangle
  3083. End Sub ' DrawRectSolid
  3084.  
  3085. ' /////////////////////////////////////////////////////////////////////////////
  3086. ' DRAW A 2-D BOX (OUTLINE)
  3087. ' https://www.qb64.org/wiki/LINE
  3088.  
  3089. ' The style parameter 0-255 doesn't seem to have a solid line?
  3090. ' For that, use DrawOutlineBox.
  3091.  
  3092. ' LINE [STEP] [(column1, row1)]-[STEP] (column2, row2), color[, [{B|BF}], style%]
  3093. ' B creates a box outline with each side parallel to the program screen sides. BF creates a filled box.
  3094. ' The style% signed INTEGER value sets a dotted pattern to draw the line or rectangle outline.
  3095.  
  3096. Sub DrawStyledOutlineBox (iX%, iY%, iSize%, iColor~&, iStyle%)
  3097.     Line (iX%, iY%)-(iX% + (iSize% - 1), iY% + (iSize% - 1)), iColor~&, B , iStyle%
  3098. End Sub ' DrawStyledOutlineBox
  3099.  
  3100. ' /////////////////////////////////////////////////////////////////////////////
  3101. ' DRAW A 2-D BOX (OUTLINE) WITH A SOLID LINE
  3102.  
  3103. Sub DrawOutlineBox (iX%, iY%, iSize2%, iColor~&, iWeight2%)
  3104.     Dim iFromX%
  3105.     Dim iFromY%
  3106.     Dim iToX%
  3107.     Dim iToY%
  3108.     iSize% = iSize2% - 1
  3109.     iWeight% = iWeight2% - 1
  3110.     If iWeight% = 0 Then
  3111.         ' TOP LINE
  3112.         iFromX% = iX%
  3113.         iFromY% = iY%
  3114.         iToX% = iX% + iSize%
  3115.         iToY% = iY%
  3116.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3117.  
  3118.         ' BOTTOM LINE
  3119.         iFromX% = iX%
  3120.         iFromY% = iY% + iSize%
  3121.         iToX% = iX% + iSize%
  3122.         iToY% = iY% + iSize%
  3123.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3124.  
  3125.         ' LEFT LINE
  3126.         iFromX% = iX%
  3127.         iFromY% = iY%
  3128.         iToX% = iX%
  3129.         iToY% = iY% + iSize%
  3130.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3131.  
  3132.         ' RIGHT LINE
  3133.         iFromX% = iX% + iSize%
  3134.         iFromY% = iY%
  3135.         iToX% = iX% + iSize%
  3136.         iToY% = iY% + iSize%
  3137.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3138.     ElseIf iWeight% > 0 Then
  3139.         ' TOP LINE
  3140.         For iFromY% = iY% To (iY% + iWeight%)
  3141.             iFromX% = iX%
  3142.             'iFromY% = iY%
  3143.             iToX% = iX% + iSize%
  3144.             iToY% = iFromY%
  3145.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3146.         Next iFromY%
  3147.  
  3148.         ' BOTTOM LINE
  3149.         For iFromY% = ((iY% + iSize%) - iWeight%) To (iY% + iSize%)
  3150.             iFromX% = iX%
  3151.             'iFromY% = iY% + iSize%
  3152.             iToX% = iX% + iSize%
  3153.             iToY% = iFromY%
  3154.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3155.         Next iFromY%
  3156.  
  3157.         ' LEFT LINE
  3158.         For iFromX% = iX% To (iX% + iWeight%)
  3159.             'iFromX% = iX%
  3160.             iFromY% = iY%
  3161.             iToX% = iFromX%
  3162.             iToY% = iY% + iSize%
  3163.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3164.         Next iFromX%
  3165.  
  3166.         ' RIGHT LINE
  3167.         For iFromX% = ((iX% + iSize%) - iWeight%) To (iX% + iSize%)
  3168.             'iFromX% = iX% + iSize%
  3169.             iFromY% = iY%
  3170.             iToX% = iFromX%
  3171.             iToY% = iY% + iSize%
  3172.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3173.         Next iFromX%
  3174.     End If
  3175. End Sub ' DrawOutlineBox
  3176.  
  3177. ' ################################################################################################################################################################
  3178. ' END BOX DRAWING ROUTINES
  3179. ' ################################################################################################################################################################
  3180.  
  3181. ' ################################################################################################################################################################
  3182. ' BEGIN DRAW TILES, COLOR SWAP with HARDWARE IMAGES
  3183. ' ################################################################################################################################################################
  3184.  
  3185. ' /////////////////////////////////////////////////////////////////////////////
  3186. ' Same as DrawColorTile but using hardware images.
  3187.  
  3188. ' Receives:
  3189. ' imgTiles& = handle to 16x16 tile sheet of 16x16 pixel tiles colored black (256 tiles)
  3190. ' TileNum% = ordinal number of tile on tile sheet to draw (0-255)
  3191. ' TileColor~& = color to use for tile
  3192. ' imgScreen& = handle to screen to draw tile on
  3193. ' dx% = column # to draw tile at (where each column is 16 pixels wide)
  3194. ' dy% = row # to draw tile at (where each row is 16 pixels high)
  3195. ' xOffset% = offset tile this many columns over
  3196. ' yOffset% = offset tile this many rows down
  3197.  
  3198. Sub DrawColorTileHW ( _
  3199.     imgHardwareScreen As Long, _
  3200.     imgTiles As Long, _
  3201.     iTileNum As Integer, _
  3202.     fgColor As _UNSIGNED Long, _
  3203.     bgColor As _UNSIGNED Long, _
  3204.     dx As Integer, _
  3205.     dy As Integer)
  3206.  
  3207.     Dim cols%
  3208.     Dim rows%
  3209.     Dim sc%
  3210.     Dim sr%
  3211.     Dim sx1%
  3212.     Dim sy1%
  3213.     Dim sx2%
  3214.     Dim sy2%
  3215.     Dim xDest%
  3216.     Dim yDest%
  3217.     Dim imgColorSprite As Long
  3218.     Dim imgUniversalSprite As Long
  3219.     Dim imgColorSpriteHW As Long
  3220.     Dim imgUniversalSpriteHW As Long
  3221.  
  3222.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  3223.     cols% = 16
  3224.     rows% = 16
  3225.  
  3226.     ' GET THE COLUMN/ROW OF TILE # iTileNum ON THE SOURCE TILE SHEET
  3227.     sc% = iTileNum Mod rows%
  3228.     sr% = iTileNum \ rows%
  3229.  
  3230.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  3231.     sx1% = sc% * 8
  3232.  
  3233.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  3234.     sy1% = sr% * 8
  3235.  
  3236.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  3237.     sx2% = sx1% + 7
  3238.  
  3239.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  3240.     sy2% = sy1% + 7
  3241.  
  3242.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  3243.     xDest% = dx * 8
  3244.  
  3245.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  3246.     yDest% = dy * 8
  3247.  
  3248.     ' IS THERE A BACKGROUND COLOR?
  3249.     If bgColor <> cEmpty Then
  3250.         imgColorSprite = _NewImage(8, 8, 32)
  3251.         imgColorSpriteHW = _CopyImage(imgColorSprite, 33) ' Copy for hardware image
  3252.         '_Dest imgColorSprite
  3253.         _Dest imgColorSpriteHW
  3254.         Cls , bgColor
  3255.  
  3256.         ' COPY THE TEMPORARY TILE TO THE SCREEN imgHardwareScreen
  3257.         '_Source imgColorSprite
  3258.         _Source imgColorSpriteHW
  3259.         _Dest imgHardwareScreen
  3260.  
  3261.         'SOFTWARE IMAGE:
  3262.         '_PutImage (xDest%, yDest%), imgColorSprite, imgHardwareScreen, (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  3263.  
  3264.         'HARDWARE IMAGE:
  3265.         _PutImage (xDest%, yDest%), imgColorSpriteHW, , (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  3266.     End If
  3267.  
  3268.     ' CREATE A TEMPORARY TILE TO COLOR
  3269.     imgUniversalSprite = _NewImage(8, 8, 32)
  3270.  
  3271.     ' COPY THE TILE TO THE TEMPORARY ONE
  3272.     _Source imgHardwareTiles
  3273.     _Dest imgUniversalSprite
  3274.     'SOFTWARE IMAGE:
  3275.     '_PutImage (0, 0), imgTiles, imgUniversalSprite, (sx1%, sy1%)-(sx2%, sy2%)
  3276.  
  3277.     'HARDWARE IMAGE:
  3278.     _PutImage (0, 0), imgHardwareTiles, , (sx1%, sy1%)-(sx2%, sy2%)
  3279.  
  3280.     ' COLOR IN THE TEMPORARY TILE
  3281.     ' REPLACING BLACK (THE SOURCE COLOR) WITH THE TILE COLOR
  3282.  
  3283.     'SOFTWARE IMAGE:
  3284.     'IF imgColorSprite < -1 OR imgColorSprite > 0 THEN _FreeImage imgColorSprite
  3285.     'DoColorSwap imgUniversalSprite, cBlack, fgColor, imgColorSprite
  3286.  
  3287.     'HARDWARE IMAGE:
  3288.     DoColorSwapHW imgUniversalSpriteHW, cBlack, fgColor, imgColorSpriteHW
  3289.  
  3290.     ' COPY THE TEMPORARY TILE TO THE SCREEN imgHardwareScreen
  3291.     _Source imgColorSpriteHW
  3292.     _Dest imgHardwareScreen
  3293.  
  3294.     'SOFTWARE IMAGE:
  3295.     '_PutImage (xDest%, yDest%), imgColorSprite, , (0, 0)-(7, 7)
  3296.  
  3297.     'HARDWARE IMAGE:
  3298.     _PutImage (xDest%, yDest%), imgColorSprite, , (0, 0)-(7, 7)
  3299.  
  3300.     ' ADDED PER FellipeHeitor
  3301.     If imgHardwareTiles < -1 Or imgHardwareTiles > 0 Then _FreeImage imgHardwareTiles
  3302.     If imgColorSprite < -1 Or imgColorSprite > 0 Then _FreeImage imgColorSprite
  3303.     If imgColorSpriteHW < -1 Or imgColorSpriteHW > 0 Then _FreeImage imgColorSpriteHW
  3304.     If imgUniversalSprite < -1 Or imgUniversalSprite > 0 Then _FreeImage imgUniversalSprite
  3305.     If imgUniversalSpriteHW < -1 Or imgUniversalSpriteHW > 0 Then _FreeImage imgUniversalSpriteHW
  3306.  
  3307. End Sub ' DrawColorTileHW
  3308.  
  3309. ' /////////////////////////////////////////////////////////////////////////////
  3310. ' Same as DoColorSwap but using hardware images.
  3311.  
  3312. ' Latest version with NOVARSEG's changes.
  3313. ' Based on code from:
  3314. ' Image color swap?
  3315. ' https://www.qb64.org/forum/index.php?topic=2312.0
  3316.  
  3317. ' Like Function swapcolor& except returns new image in a parameter
  3318. ' in case being a function causes a memory leak?
  3319.  
  3320. Sub DoColorSwapHW ( _
  3321.     imgOriginalHW As Long, _
  3322.     oldColor As _UNSIGNED Long, _
  3323.     newColor As _UNSIGNED Long, _
  3324.     imgNewHW As Long)
  3325.  
  3326.     Dim m As _MEM
  3327.     Dim a As _Offset
  3328.     Dim imgNew As Long
  3329.  
  3330.     a = 0
  3331.     imgNew = _CopyImage(imgOriginalHW, 32)
  3332.     m = _MemImage(imgNewHW)
  3333.     Do Until a = m.SIZE - 4
  3334.         a = a + 4
  3335.         c = _MemGet(m, m.OFFSET + a, _Unsigned Long)
  3336.         If c = oldColor Then
  3337.             _MemPut m, m.OFFSET + a, newColor
  3338.         End If
  3339.     Loop
  3340.     _MemFree m
  3341. End Sub ' DoColorSwapHW
  3342.  
  3343. ' ################################################################################################################################################################
  3344. ' END DRAW TILES, COLOR SWAP with HARDWARE IMAGES
  3345. ' ################################################################################################################################################################
  3346.  
  3347. ' ################################################################################################################################################################
  3348. ' BEGIN DRAW TILES, COLOR SWAP with SOFTWARE IMAGES
  3349. ' ################################################################################################################################################################
  3350.  
  3351. ' /////////////////////////////////////////////////////////////////////////////
  3352. ' Simple version which calculates coordinates on tile sheet and destination
  3353. ' screen every time. For a faster version uses precalculated coordinates,
  3354. ' see DrawColorTileFast. This version does not support offsetX, offsetY.
  3355.  
  3356. ' Receives:
  3357. ' imgScreen& = handle to screen to draw tile on
  3358. ' imgTiles& = handle to 16x16 tile sheet of 8x8 pixel tiles colored black (256 tiles)
  3359. ' TileNum% = ordinal number of tile on tile sheet to draw (0-255)
  3360. ' TileColor~& = foreground color to use for tile
  3361. ' BackColor~& = background color to use for tile
  3362. ' dx% = column # to draw tile at (where each column is 8 pixels wide)
  3363. ' dy% = row # to draw tile at (where each row is 8 pixels high)
  3364.  
  3365. ' Usage:
  3366. ' DrawColorTile imgScreen&, imgTiles&, TileNum%, TileColor~&, BackColor~&, dx%, dy%
  3367.  
  3368. Sub DrawColorTile (imgScreen&, imgTiles&, TileNum%, TileColor~&, BackColor~&, dx%, dy%)
  3369.     Dim cols%
  3370.     Dim rows%
  3371.     Dim sc%
  3372.     Dim sr%
  3373.     Dim sx1%
  3374.     Dim sy1%
  3375.     Dim sx2%
  3376.     Dim sy2%
  3377.     Dim xDest%
  3378.     Dim yDest%
  3379.     Dim ColorSprite&
  3380.     Dim UniversalSprite&
  3381.  
  3382.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  3383.     cols% = 16
  3384.     rows% = 16
  3385.  
  3386.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  3387.     sc% = TileNum% Mod rows%
  3388.     sr% = TileNum% \ rows%
  3389.  
  3390.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  3391.     sx1% = sc% * 8
  3392.  
  3393.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  3394.     sy1% = sr% * 8
  3395.  
  3396.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  3397.     sx2% = sx1% + 7
  3398.  
  3399.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  3400.     sy2% = sy1% + 7
  3401.  
  3402.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  3403.     xDest% = dx% * 8
  3404.  
  3405.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  3406.     yDest% = dy% * 8
  3407.  
  3408.     ' IS THERE A BACKGROUND COLOR?
  3409.     If BackColor~& <> cEmpty Then
  3410.         ColorSprite& = _NewImage(8, 8, 32)
  3411.         _Dest ColorSprite&
  3412.         Cls , BackColor~&
  3413.  
  3414.         ' COPY THE TEMPORARY TILE TO THE SCREEN imgScreen&
  3415.         _Source ColorSprite&
  3416.         _Dest imgScreen&
  3417.         _PutImage (xDest%, yDest%), ColorSprite&, imgScreen&, (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  3418.     End If
  3419.  
  3420.     ' CREATE A TEMPORARY TILE TO COLOR
  3421.     UniversalSprite& = _NewImage(8, 8, 32)
  3422.  
  3423.     ' COPY THE TILE TO THE TEMPORARY ONE
  3424.     _Source imgTiles&
  3425.     _Dest UniversalSprite&
  3426.     _PutImage (0, 0), imgTiles&, UniversalSprite&, (sx1%, sy1%)-(sx2%, sy2%)
  3427.  
  3428.     ' COLOR IN THE TEMPORARY TILE
  3429.     ' REPLACING BLACK (THE SOURCE COLOR) WITH THE TILE COLOR
  3430.     If ColorSprite& < -1 Or ColorSprite& > 0 Then _FreeImage ColorSprite&
  3431.     DoColorSwap UniversalSprite&, cBlack, TileColor~&, ColorSprite&
  3432.  
  3433.     ' COPY THE TEMPORARY TILE TO THE SCREEN imgScreen&
  3434.     _Source ColorSprite&
  3435.     _Dest imgScreen&
  3436.     _PutImage (xDest%, yDest%), ColorSprite&, imgScreen&, (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  3437.  
  3438.     ' ADDED PER FellipeHeitor
  3439.     If ColorSprite& < -1 Or ColorSprite& > 0 Then _FreeImage ColorSprite&
  3440.     If UniversalSprite& < -1 Or UniversalSprite& > 0 Then _FreeImage UniversalSprite&
  3441. End Sub ' DrawColorTile
  3442.  
  3443. ' /////////////////////////////////////////////////////////////////////////////
  3444. ' Latest version with NOVARSEG's changes.
  3445.  
  3446. ' Based on code from:
  3447.  
  3448. ' Image color swap?
  3449. ' https://www.qb64.org/forum/index.php?topic=2312.0
  3450.  
  3451. ' Like Function swapcolor& except returns new image in a parameter
  3452. ' in case being a function causes a memory leak?
  3453.  
  3454. Sub DoColorSwap (imgOriginal&, oldcolor~&, newcolor~&, imgNew&)
  3455.     Dim m As _MEM
  3456.     Dim a As _Offset
  3457.     a = 0
  3458.     imgNew& = _CopyImage(imgOriginal&, 32)
  3459.     m = _MemImage(imgNew&)
  3460.     Do Until a = m.SIZE - 4
  3461.         a = a + 4
  3462.         c = _MemGet(m, m.OFFSET + a, _Unsigned Long)
  3463.         If c = oldcolor~& Then
  3464.             _MemPut m, m.OFFSET + a, newcolor~&
  3465.         End If
  3466.     Loop
  3467.     _MemFree m
  3468. End Sub ' DoColorSwap&
  3469.  
  3470. ' ################################################################################################################################################################
  3471. ' END DRAW TILES, COLOR SWAP with SOFTWARE IMAGES
  3472. ' ################################################################################################################################################################
  3473.  
  3474. ' ################################################################################################################################################################
  3475. ' BEGIN DRAW TILES, _PUTIMAGE with SOFTWARE IMAGES
  3476. ' ################################################################################################################################################################
  3477.  
  3478. ' /////////////////////////////////////////////////////////////////////////////
  3479. ' Draws an 8x8 tile at the specified column/row dx%, dy%
  3480.  
  3481. ' Original version which calculates coordinates on tile sheet and destination
  3482. ' screen every time. For a faster version uses precalculated coordinates,
  3483. ' see DrawTileFast.
  3484.  
  3485. ' tw% = tile width/height (in pixels)
  3486.  
  3487. ' DIV and MOD:
  3488. ' c% = a% \ b% ' DIV (INTEGER DIVISION)
  3489. ' d% = a% MOD b% ' MODULO (DIVISION REMAINDER)
  3490.  
  3491. '_PUTIMAGE (0, 0), i ' places image at upper left corner of window w/o stretching it
  3492. '_PUTIMAGE (dx1, dy1), sourceHandle&, destHandle&, (sx1, sy1)-(sx2, sy2) ' portion of source to the top-left corner of the destination page
  3493. '_PUTIMAGE (64,  128), imgTiles&,      imgScreen&,   (128, 128)-(164, 164) ' portion of source to the top-left corner of the destination page
  3494. '_PutImage (64, 128), imgTiles&, imgScreen&, (128, 128)-(164, 164) ' portion of source to the top-left corner of the destination page
  3495.  
  3496. Sub DrawTile8 (imgTiles&, TileNum%, imgScreen&, dx%, dy%)
  3497.     Dim tw% ' width/height of tile
  3498.     Dim tw_minus1% ' width/height of tile -1
  3499.     Dim cols% ' # tiles across on tile sheet
  3500.     Dim rows% ' # tile rows on tile sheet
  3501.     Dim sc% ' source column on tile sheet
  3502.     Dim sr% ' source row on tile sheet
  3503.     Dim sx1% ' source start x
  3504.     Dim sx2% ' source end x
  3505.     Dim sy1% ' source start y
  3506.     Dim sy2% ' source end y
  3507.     Dim xDest% ' destination x
  3508.     Dim yDest% ' destination y
  3509.  
  3510.     ' SIZE OF TILE
  3511.     tw% = 8
  3512.     tw_minus1% = 7
  3513.  
  3514.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  3515.     cols% = 16
  3516.     rows% = 16
  3517.  
  3518.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  3519.     sc% = TileNum% Mod rows%
  3520.     sr% = TileNum% \ rows%
  3521.  
  3522.     'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  3523.  
  3524.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  3525.     sx1% = sc% * tw%
  3526.  
  3527.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  3528.     sy1% = sr% * tw%
  3529.  
  3530.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  3531.     sx2% = sx1% + tw_minus1%
  3532.  
  3533.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  3534.     sy2% = sy1% + tw_minus1%
  3535.  
  3536.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  3537.     xDest% = dx% * tw%
  3538.  
  3539.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  3540.     yDest% = (dy% * tw%) '+ yOffset%
  3541.  
  3542.     'Print "Tile#" + cstr$(TileNum%) + _
  3543.     '    " at r" + cstr$(sr%) + "c" + cstr$(sc%) + _
  3544.     '    " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + _
  3545.     '    " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  3546.  
  3547.     _Dest imgScreen&
  3548.  
  3549.     ' portion of source to the top-left corner of the destination page
  3550.     _PutImage (xDest%, yDest%), imgTiles&, imgScreen&, (sx1%, sy1%)-(sx2%, sy2%)
  3551.  
  3552. End Sub ' DrawTile8
  3553.  
  3554. ' ################################################################################################################################################################
  3555. ' END DRAW TILES, _PUTIMAGE with SOFTWARE IMAGES
  3556. ' ################################################################################################################################################################
  3557.  
  3558. ' ################################################################################################################################################################
  3559. ' BEGIN DRAW TILES, _PUTIMAGE with HARDWARE IMAGES
  3560. ' ################################################################################################################################################################
  3561.  
  3562. ' /////////////////////////////////////////////////////////////////////////////
  3563. ' Draws an 8x8 tile at the specified column/row dx%, dy%
  3564. ' using hardware images
  3565.  
  3566. ' Usage:
  3567. ' Dim imgHardwareTiles As Long ' the hardware image copy of the tileset
  3568. ' imgHardwareTiles = _CopyImage(imgTiles, 33) ' Copy tilesheet for hardware image
  3569. ' DrawTileHw8 imgHardwareTiles, iTileNum, imgScreen, iColumn, iRow, iSubTileset
  3570.  
  3571. ' where iSubTileset% = iFgColorIndex
  3572.  
  3573. Sub DrawTileHw8 (imgHardwareTiles&, TileNum%, imgScreen&, dx%, dy%, iSubTileset%)
  3574.     Dim tw% ' width/height of tile
  3575.     Dim tw_minus1% ' width/height of tile -1
  3576.     Dim cols% ' # tiles across on tile sheet
  3577.     Dim rows% ' # tile rows on tile sheet
  3578.     Dim sc% ' source column on tile sheet
  3579.     Dim sr% ' source row on tile sheet
  3580.     Dim sx1% ' source start x
  3581.     Dim sx2% ' source end x
  3582.     Dim sy1% ' source start y
  3583.     Dim sy2% ' source end y
  3584.     Dim xDest% ' destination x
  3585.     Dim yDest% ' destination y
  3586.     Dim xOffset%
  3587.  
  3588.     ' CALCULATE OFFSET
  3589.     xOffset% = 128 * iSubTileset%
  3590.  
  3591.     ' SIZE OF TILE
  3592.     tw% = 8
  3593.     tw_minus1% = 7
  3594.  
  3595.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  3596.     cols% = 16
  3597.     rows% = 16
  3598.  
  3599.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  3600.     sc% = TileNum% Mod rows%
  3601.     sr% = TileNum% \ rows%
  3602.  
  3603.     'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  3604.  
  3605.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  3606.     sx1% = (sc% * tw%) + xOffset%
  3607.  
  3608.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  3609.     sy1% = sr% * tw%
  3610.  
  3611.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  3612.     sx2% = sx1% + tw_minus1%
  3613.  
  3614.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  3615.     sy2% = sy1% + tw_minus1%
  3616.  
  3617.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  3618.     xDest% = dx% * tw%
  3619.  
  3620.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  3621.     yDest% = (dy% * tw%) '+ yOffset%
  3622.  
  3623.     'Print "Tile#" + cstr$(TileNum%) + _
  3624.     '    " at r" + cstr$(sr%) + "c" + cstr$(sc%) + _
  3625.     '    " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + _
  3626.     '    " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  3627.  
  3628.     _Dest imgScreen&
  3629.  
  3630.     ' portion of source to the top-left corner of the destination page
  3631.     '_PutImage (xDest%, yDest%), imgHardwareTiles&, imgScreen&, (sx1%, sy1%)-(sx2%, sy2%)
  3632.     '_PutImage (200, 100)-Step(100, 100), imgHardwareTiles&, , (0, 0)-(40, 40)
  3633.     _PutImage (xDest%, yDest%), imgHardwareTiles&, , (sx1%, sy1%)-(sx2%, sy2%)
  3634.  
  3635. End Sub ' DrawTileHw8
  3636.  
  3637. ' /////////////////////////////////////////////////////////////////////////////
  3638. ' Receives an image imgTiles of 8x8 tiles
  3639. ' colored black on transparent background
  3640. ' and returns a new image imgNew
  3641. ' copied from the tiles in imgTiles,
  3642. ' except colored to foreground color fgColor,
  3643. ' and background color bgColor
  3644.  
  3645. ' Usage:
  3646. ' MakeColoredTileset imgTiles, imgNew, fgColor, bgColor
  3647.  
  3648. Sub MakeColoredTileset (imgTiles As Long, imgNew As Long, fgColor As _Unsigned Long, bgColor As _Unsigned Long)
  3649.     Dim iTileNum As Integer
  3650.     Dim iY As Integer
  3651.     Dim iX As Integer
  3652.     If imgNew < -1 Or imgNew > 0 Then _FreeImage imgNew ' FREE MEMORY
  3653.     imgNew = _NewImage(_Width(imgTiles), _Height(imgTiles), 32)
  3654.     iTileNum = 0
  3655.     For iY = 0 To (_Height(imgTiles) \ 8) - 1
  3656.         For iX = 0 To (_Width(imgTiles) \ 8) - 1
  3657.             DrawColorTile imgNew, imgTiles, iTileNum, fgColor, bgColor, iX, iY
  3658.             iTileNum = iTileNum + 1
  3659.             If iTileNum > 255 Then Exit For
  3660.         Next iX
  3661.         If iTileNum > 255 Then Exit For
  3662.     Next iY
  3663. End Sub ' MakeColoredTileset
  3664.  
  3665. ' /////////////////////////////////////////////////////////////////////////////
  3666. ' Receives an image imgTiles of 8x8 tiles
  3667. ' colored black on transparent background
  3668. ' and an array of colors,
  3669. ' and returns a new image imgNew
  3670. ' copied from the tiles in imgTiles,
  3671. ' with every combination of the colors in the array
  3672. ' as the foreground/background color.
  3673.  
  3674. ' Usage:
  3675. ' MakeColoredTileset2 imgTiles, imgNew, arrColor(), arrTileIndex(), arrColorIndex()
  3676.  
  3677. ' Input: iTileNum, bgColor, fgColor
  3678. ' X Index: arrTileIndex(iTileNum) = returns x position for iTileNum
  3679. ' Y Index: arrColorIndex(fgColor, bgColor) = returns y position for fgColor, bgColor
  3680.  
  3681. Sub MakeColoredTileset2 ( _
  3682.     imgTiles As Long, _
  3683.     imgNew As Long, _
  3684.     arrColor() As _Unsigned Long, _
  3685.     arrTileIndex() As Long, _
  3686.     arrColorIndex() As Long)
  3687.  
  3688.     Dim iTileNum As Integer
  3689.     Dim iY As Integer
  3690.     Dim iX As Integer
  3691.     Dim iFG As Integer
  3692.     Dim iBG As Integer
  3693.     Dim iWidth As Long
  3694.     Dim iHeight As Long
  3695.     Dim iColorCount As Long
  3696.     Dim iDestX As Long
  3697.     Dim iDestY As Long
  3698.     Dim fgColor As _Unsigned Long
  3699.     Dim bgColor As _Unsigned Long
  3700.  
  3701.     If imgNew < -1 Or imgNew > 0 Then _FreeImage imgNew ' FREE MEMORY
  3702.  
  3703.     ' FIGURE OUT SIZE OF TARGET IMAGE
  3704.     iColorCount = (UBound(arrColor) - LBound(arrColor)) + 1
  3705.     iHeight = (iColorCount * iColorCount) * 8
  3706.     iWidth = 256 * 8
  3707.  
  3708.     ' CREATE TARGET IMAGE
  3709.     'imgNew = _NewImage(_Width(imgTiles), _Height(imgTiles), 32)
  3710.     imgNew = _NewImage(iWidth, iHeight, 32)
  3711.  
  3712.     ' INITIALIZE X POSITION INDEX
  3713.     ReDim arrTileIndex(0 To 255) As Long
  3714.  
  3715.     ' INITIALIZE Y POSITION INDEX
  3716.     ReDim arrColorIndex(LBound(arrColor) To UBound(arrColor), LBound(arrColor) To UBound(arrColor)) As Long
  3717.  
  3718.     ' POPULATE X POSITION INDEX
  3719.     iX = 0
  3720.     For iTileNum = 0 To 255
  3721.         arrTileIndex(iTileNum) = iX
  3722.         iX = iX + 8
  3723.     Next iTileNum
  3724.  
  3725.     ' CREATE TILE MAP FOR ALL COMBINATIONS OF FOREGROUND + BACKGROUND COLORS
  3726.     ' AND POPULATE Y POSITION INDEX
  3727.     iY = 0
  3728.     For iFG = LBound(arrColor) To UBound(arrColor)
  3729.         For iBG = LBound(arrColor) To UBound(arrColor)
  3730.             For iTileNum = 0 To 255
  3731.                 iX = arrTileIndex(iTileNum)
  3732.                 fgColor = arrColor(iFG)
  3733.                 bgColor = arrColor(iBG)
  3734.                 DrawColorTile imgNew, imgTiles, iTileNum, fgColor, bgColor, iX \ 8, iY \ 8
  3735.                 arrColorIndex(iFG, iBG) = iY
  3736.             Next iTileNum
  3737.             iY = iY + 8
  3738.         Next iBG
  3739.     Next iFG
  3740.  
  3741. End Sub ' MakeColoredTileset2
  3742.  
  3743. ' /////////////////////////////////////////////////////////////////////////////
  3744. ' Draws an 8x8 tile at the specified column/row dx%, dy%
  3745. ' in the specified foreground/background color
  3746. ' using hardware images.
  3747.  
  3748. ' Usage:
  3749. ' Dim imgHardwareTiles As Long ' the hardware image copy of the tileset
  3750. ' imgHardwareTiles = _CopyImage(imgTiles, 33) ' Copy tilesheet for hardware image
  3751. ' DrawTileHw8 imgHardwareTiles, iTileNum, imgScreen, iColumn, iRow, iSubTileset
  3752.  
  3753. ' THIS:
  3754. ' DrawColorTileHw8 imgTilesAllColorsHW, iTileNum, imgScreen, iX, iY, iFgColorIndex, iBgColorIndex, arrTileIndex(), arrColorIndex()
  3755.  
  3756. Sub DrawColorTileHw8 (imgHardwareTiles&, TileNum%, imgScreen&, dx%, dy%, _
  3757.     iFgColorIndex As Integer, _
  3758.     iBgColorIndex As Integer, _
  3759.     arrTileIndex() As Long, _
  3760.     arrColorIndex() As Long)
  3761.  
  3762.     Dim tw% ' width/height of tile
  3763.     Dim tw_minus1% ' width/height of tile -1
  3764.     Dim cols% ' # tiles across on tile sheet
  3765.     Dim rows% ' # tile rows on tile sheet
  3766.     Dim sc% ' source column on tile sheet
  3767.     Dim sr% ' source row on tile sheet
  3768.     Dim sx1% ' source start x
  3769.     Dim sx2% ' source end x
  3770.     Dim sy1% ' source start y
  3771.     Dim sy2% ' source end y
  3772.     Dim xDest% ' destination x
  3773.     Dim yDest% ' destination y
  3774.     Dim xOffset%
  3775.  
  3776.     '' CALCULATE OFFSET
  3777.     'xOffset% = 128 * iSubTileset%
  3778.  
  3779.     ' SIZE OF TILE
  3780.     tw% = 8
  3781.     tw_minus1% = 7
  3782.  
  3783.     '' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  3784.     'cols% = 16
  3785.     'rows% = 16
  3786.  
  3787.     '' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  3788.     'sc% = TileNum% Mod rows%
  3789.     'sr% = TileNum% \ rows%
  3790.  
  3791.     'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  3792.  
  3793.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  3794.     'sx1% = (sc% * tw%) + xOffset%
  3795.     sx1% = arrTileIndex(TileNum%)
  3796.  
  3797.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  3798.     'sy1% = sr% * tw%
  3799.     sy1% = arrColorIndex(iFgColorIndex, iBgColorIndex)
  3800.  
  3801.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  3802.     sx2% = sx1% + tw_minus1%
  3803.  
  3804.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  3805.     sy2% = sy1% + tw_minus1%
  3806.  
  3807.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  3808.     xDest% = dx% * tw%
  3809.  
  3810.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  3811.     yDest% = (dy% * tw%) '+ yOffset%
  3812.  
  3813.     'Print "Tile#" + cstr$(TileNum%) + _
  3814.     '    " at r" + cstr$(sr%) + "c" + cstr$(sc%) + _
  3815.     '    " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + _
  3816.     '    " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  3817.  
  3818.     _Dest imgScreen&
  3819.  
  3820.     ' portion of source to the top-left corner of the destination page
  3821.     '_PutImage (xDest%, yDest%), imgHardwareTiles&, imgScreen&, (sx1%, sy1%)-(sx2%, sy2%)
  3822.     '_PutImage (200, 100)-Step(100, 100), imgHardwareTiles&, , (0, 0)-(40, 40)
  3823.     _PutImage (xDest%, yDest%), imgHardwareTiles&, , (sx1%, sy1%)-(sx2%, sy2%)
  3824.  
  3825. End Sub ' DrawColorTileHw8
  3826.  
  3827. ' ################################################################################################################################################################
  3828. ' END DRAW TILES, _PUTIMAGE with HARDWARE IMAGES
  3829. ' ################################################################################################################################################################
  3830.  
  3831. ' ################################################################################################################################################################
  3832. ' BEGIN TILE PRECALCULATION UTILITIES
  3833. ' ################################################################################################################################################################
  3834.  
  3835. ' /////////////////////////////////////////////////////////////////////////////
  3836. ' Precalculates the tile locations ahead of time to save time copying them
  3837. ' to the screen.
  3838.  
  3839. ' Requires the following types be declared:
  3840. '
  3841. '     Type TileSheetMapType ' UDT FOR PRECALCULATED TILESHEET
  3842. '         xStart As Integer
  3843. '         xEnd As Integer
  3844. '         yStart As Integer
  3845. '         yEnd As Integer
  3846. '     End Type
  3847. '     Type TileMapType ' UDT FOR PRECALCULATED TILE MAP
  3848. '         xPos As Integer
  3849. '         yPos As Integer
  3850. '     End Type
  3851. '
  3852. ' EXAMPLE USAGE:
  3853. '
  3854. '     Dim TileCount%
  3855. '     Dim TilesheetCols%
  3856. '     Dim TilesheetRows%
  3857. '     Dim tileHeightPx%
  3858. '     Dim tileWidthPx%
  3859. '     Dim xOffset%
  3860. '     Dim yOffset%
  3861. '     Dim numTilesX%
  3862. '     Dim numTilesY%
  3863. '     REDIM arrTileSheetMap(255) AS TileSheetMapType
  3864. '     REDIM arrTileMap(20, 20) AS TileMapType
  3865. '     TileCount% = 256 ' TOTAL # OF TILES
  3866. '     TilesheetCols% = 16 ' # OF COLUMNS ON SOURCE TILE SHEET
  3867. '     TilesheetRows% = 16 ' # OF ROWS    ON SOURCE TILE SHEET
  3868. '     tileHeightPx% = 32 ' TILE HEIGHT
  3869. '     tileWidthPx% = 32 ' TILE WIDTH
  3870. '     xOffset% = 0 ' SCREEN OFFSET X
  3871. '     yOffset% = 64 ' SCREEN OFFSET Y
  3872. '     numTilesX% = 20 ' HOW MANY TILES ACROSS (ON DESTINATION)
  3873. '     numTilesY% = 20 ' HOW MANY TILES UP/DOWN (ON DESTINATION)
  3874. '     ComputeTileLocations arrTileSheetMap(), arrTileMap(), TileCount%, _
  3875. '         TilesheetCols%, TilesheetRows%, tileWidthPx%, tileHeightPx%, _
  3876. '         xOffset%, yOffset%, numTilesX%, numTilesY%
  3877.  
  3878. ' TODO: this can be simplified & optimized:
  3879. '       - we don't need x/y offsets
  3880. '       - tile height/width can be hardcoded
  3881. '       - etc.
  3882.  
  3883. Sub ComputeTileLocations (arrTileSheetMap() As TileSheetMapType, arrTileMap() As TileMapType, TileCount%, TilesheetCols%, TilesheetRows%, tileWidthPx%, tileHeightPx%, xOffset%, yOffset%, numTilesX%, numTilesY%)
  3884.     Dim TileNum%
  3885.     Dim sc%
  3886.     Dim sr%
  3887.     Dim sx1%
  3888.     Dim sx2%
  3889.     Dim sy1%
  3890.     Dim sy2%
  3891.  
  3892.     Dim dx%
  3893.     Dim dy%
  3894.     Dim xDest%
  3895.     Dim yDest%
  3896.  
  3897.     ' -----------------------------------------------------------------------------
  3898.     ' CALCULATE TILE SHEET COORDINATES FOR TILES 0-255
  3899.  
  3900.     For TileNum% = 0 To (TileCount% - 1)
  3901.  
  3902.         ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  3903.         sc% = TileNum% Mod TilesheetCols%
  3904.         sr% = TileNum% \ TilesheetRows%
  3905.  
  3906.         'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  3907.  
  3908.         ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  3909.         'sx1% = sc% * tw%
  3910.         sx1% = sc% * tileWidthPx%
  3911.  
  3912.         ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  3913.         'sy1% = sr% * tw%
  3914.         sy1% = sr% * tileHeightPx%
  3915.  
  3916.         ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  3917.         'sx2% = sx1% + (tw% - 1)
  3918.         sx2% = sx1% + (tileWidthPx% - 1)
  3919.  
  3920.         ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  3921.         'sy2% = sy1% + (tw% - 1)
  3922.         sy2% = sy1% + (tileHeightPx% - 1)
  3923.  
  3924.         ' SAVE THE COORDINATES FOR TileNum% IN THE ARRAY
  3925.         arrTileSheetMap(TileNum%).xStart = sx1%
  3926.         arrTileSheetMap(TileNum%).xEnd = sx2%
  3927.         arrTileSheetMap(TileNum%).yStart = sy1%
  3928.         arrTileSheetMap(TileNum%).yEnd = sy2%
  3929.  
  3930.     Next TileNum%
  3931.  
  3932.     ' -----------------------------------------------------------------------------
  3933.     ' CALCULATE SCREEN COORDINATES FOR TILES
  3934.  
  3935.     For dx% = 0 To (numTilesX% - 1)
  3936.         For dy% = 0 To (numTilesY% - 1)
  3937.  
  3938.             ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  3939.             'xDest% = dx% * tw%
  3940.             xDest% = (dx% * tileWidthPx%) + xOffset%
  3941.  
  3942.             ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  3943.             'yDest% = (dy% * tw%) + 64
  3944.             yDest% = (dy% * tileHeightPx%) + yOffset%
  3945.  
  3946.             'Print "Tile#" + cstr$(TileNum%) + " at r" + cstr$(sr%) + "c" + cstr$(sc%) + " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  3947.  
  3948.             ' SAVE THE SCREEN PIXEL COORDINATES FOR dx%, dy% IN THE ARRAY
  3949.             ' WHERE dx% and dy% ARE 1-BASED
  3950.             arrTileMap(dx% + 1, dy% + 1).xPos = xDest%
  3951.             arrTileMap(dx% + 1, dy% + 1).yPos = yDest%
  3952.  
  3953.         Next dy%
  3954.     Next dx%
  3955.  
  3956. End Sub ' ComputeTileLocations
  3957.  
  3958. ' ################################################################################################################################################################
  3959. ' END TILE PRECALCULATION UTILITIES
  3960. ' ################################################################################################################################################################
  3961.  
  3962. ' ################################################################################################################################################################
  3963. ' BEGIN TILE TO IMAGE ROUTINES
  3964. ' ################################################################################################################################################################
  3965.  
  3966. ' /////////////////////////////////////////////////////////////////////////////
  3967. ' Loads tileset of 256 8x8 tiles into a 128x128 image (16 columns x 16 rows)
  3968. ' where tiles are a single color.
  3969.  
  3970. ' Parameters:
  3971. ' imgTiles& = contains the resulting tileset image
  3972. ' fgColor = tile color
  3973. ' bgColor = tile background color
  3974.  
  3975. Function GetTiles$ (imgTiles&, fgColor As _Unsigned Long, bgColor As _Unsigned Long)
  3976.     Dim RoutineName As String: RoutineName = "GetTiles$"
  3977.     Dim sResult As String: sResult = ""
  3978.     ReDim arrTileText(0 To 255) As String
  3979.  
  3980.     Dim iTileNum As Integer
  3981.  
  3982.     ReDim arrLines(-1) As String
  3983.     Dim iFromX As Integer
  3984.     Dim iFromY As Integer
  3985.     Dim sLine As String
  3986.     Dim sChar As String
  3987.  
  3988.     Dim iTileX As Integer
  3989.     Dim iTileY As Integer
  3990.     Dim iToX As Integer
  3991.     Dim iToY As Integer
  3992.     Dim pixelColor As _Unsigned Long
  3993.     Dim bFinished As Integer
  3994.  
  3995.     ' Do not try to free image handles currently being used as the active SCREEN. Change screen modes first.
  3996.     ' _DISPLAY turns off the auto refresh screen default _AUTODISPLAY behavior. Prevents screen flickering.
  3997.     If imgTiles& < -1 Or imgTiles& > 0 Then _FreeImage imgTiles&
  3998.     imgTiles& = _NewImage(128, 128, 32)
  3999.     '    Cls , cEmpty ' set the background color as transparent
  4000.  
  4001.     'Screen imgTiles&
  4002.     'Cls , bgColor ' set the background color as transparent
  4003.     _Dest imgTiles&
  4004.     'DrawRect 0, 0, 128, 128, cEmpty
  4005.     'DrawBox 0, 0, 128, cWhite
  4006.     Cls , cEmpty ' set the background color as transparent
  4007.  
  4008.     GetTileText arrTileText()
  4009.     iTileX = 0
  4010.     iTileY = 0
  4011.     bFinished = FALSE
  4012.     For iTileNum = 0 To 255
  4013.         split arrTileText(iTileNum), Chr$(13), arrLines()
  4014.         iToY = iTileY * 8
  4015.         If (iToY > _Height(imgTiles&)) Then
  4016.             sResult = "iToY value " + cstr$(iToY) + " " + _
  4017.                 "exceeded image height " + cstr$(_Height(imgTiles&)) + ". " + _
  4018.                 "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  4019.             bFinished = TRUE
  4020.             Exit For
  4021.         End If
  4022.  
  4023.         For iFromY = LBound(arrLines) To UBound(arrLines)
  4024.             sLine = arrLines(iFromY)
  4025.             If Len(sLine) > 0 Then
  4026.                 iToX = iTileX * 8
  4027.                 For iFromX = 1 To Len(sLine)
  4028.                     sChar = Mid$(sLine, iFromX, 1)
  4029.                     If sChar = "." Then
  4030.                         pixelColor = bgColor ' cEmpty ' POINT(iFromX, iFromY)
  4031.                     Else
  4032.                         pixelColor = fgColor ' cBlack
  4033.                     End If
  4034.                     PSet (iToX, iToY), pixelColor
  4035.                     iToX = iToX + 1
  4036.                     If (iToX > _Width(imgTiles&)) Then
  4037.                         sResult = "iToX value " + cstr$(iToX) + " " + _
  4038.                             "exceeded image width " + cstr$(_Width(imgTiles&)) + ". " + _
  4039.                             "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  4040.                         bFinished = TRUE
  4041.                         Exit For
  4042.                     End If
  4043.                 Next iFromX
  4044.                 iToY = iToY + 1
  4045.                 If bFinished = TRUE Then Exit For
  4046.             End If
  4047.         Next iFromY
  4048.         If bFinished = TRUE Then Exit For
  4049.  
  4050.         iTileX = iTileX + 1
  4051.         If iTileX > 15 Then
  4052.             iTileX = 0
  4053.             iTileY = iTileY + 1
  4054.             'if iTileY > 15 then
  4055.             '    sResult = "Exceeded max 16 rows of tiles." + _
  4056.             '        "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  4057.             '    bFinished = TRUE
  4058.             '    exit for
  4059.             'end if
  4060.         End If
  4061.     Next iTileNum
  4062.  
  4063.     GetTiles$ = sResult
  4064. End Function ' GetTiles$
  4065.  
  4066. ' /////////////////////////////////////////////////////////////////////////////
  4067. ' Loads tileset of 256 8x8 tiles into a 2048 x 8 image
  4068. ' (256 8x8 pixel tiles organized left to right)
  4069. ' where tiles are a single color.
  4070.  
  4071. ' Parameters:
  4072. ' imgTiles& = contains the resulting tileset image
  4073. ' fgColor = tile color
  4074. ' bgColor = tile background color
  4075.  
  4076. Function GetTiles2$ (imgTiles&, fgColor As _Unsigned Long, bgColor As _Unsigned Long)
  4077.     Dim RoutineName As String: RoutineName = "GetTiles2$"
  4078.     Dim sResult As String: sResult = ""
  4079.     ReDim arrTileText(0 To 255) As String
  4080.  
  4081.     Dim iTileNum As Integer
  4082.  
  4083.     ReDim arrLines(-1) As String
  4084.     Dim iFromX As Integer
  4085.     Dim iFromY As Integer
  4086.     Dim sLine As String
  4087.     Dim sChar As String
  4088.  
  4089.     Dim iTileX As Integer
  4090.     Dim iTileY As Integer
  4091.     Dim iToX As Integer
  4092.     Dim iToY As Integer
  4093.     Dim pixelColor As _Unsigned Long
  4094.     Dim bFinished As Integer
  4095.  
  4096.     ' Do not try to free image handles currently being used as the active SCREEN. Change screen modes first.
  4097.     ' _DISPLAY turns off the auto refresh screen default _AUTODISPLAY behavior. Prevents screen flickering.
  4098.     If imgTiles& < -1 Or imgTiles& > 0 Then _FreeImage imgTiles&
  4099.     imgTiles& = _NewImage(2048, 8, 32)
  4100.     '    Cls , cEmpty ' set the background color as transparent
  4101.  
  4102.     'Screen imgTiles&
  4103.     'Cls , bgColor ' set the background color as transparent
  4104.     _Dest imgTiles&
  4105.     'DrawRect 0, 0, 128, 128, cEmpty
  4106.     'DrawBox 0, 0, 128, cWhite
  4107.     Cls , cEmpty ' set the background color as transparent
  4108.  
  4109.     GetTileText arrTileText()
  4110.     iTileX = 0
  4111.     iTileY = 0
  4112.     iToY = 0
  4113.     bFinished = FALSE
  4114.     For iTileNum = 0 To 255
  4115.         split arrTileText(iTileNum), Chr$(13), arrLines()
  4116.         iToY = iTileY * 8
  4117.         If (iToY > _Height(imgTiles&)) Then
  4118.             sResult = "iToY value " + cstr$(iToY) + " " + _
  4119.                 "exceeded image height " + cstr$(_Height(imgTiles&)) + ". " + _
  4120.                 "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  4121.             bFinished = TRUE
  4122.             Exit For
  4123.         End If
  4124.  
  4125.         For iFromY = LBound(arrLines) To UBound(arrLines)
  4126.             sLine = arrLines(iFromY)
  4127.             If Len(sLine) > 0 Then
  4128.                 iToX = iTileX * 8
  4129.                 For iFromX = 1 To Len(sLine)
  4130.                     sChar = Mid$(sLine, iFromX, 1)
  4131.                     If sChar = "." Then
  4132.                         pixelColor = bgColor ' cEmpty ' POINT(iFromX, iFromY)
  4133.                     Else
  4134.                         pixelColor = fgColor ' cBlack
  4135.                     End If
  4136.                     PSet (iToX, iToY), pixelColor
  4137.                     iToX = iToX + 1
  4138.                     If (iToX > _Width(imgTiles&)) Then
  4139.                         sResult = "iToX value " + cstr$(iToX) + " " + _
  4140.                             "exceeded image width " + cstr$(_Width(imgTiles&)) + ". " + _
  4141.                             "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  4142.                         bFinished = TRUE
  4143.                         Exit For
  4144.                     End If
  4145.                 Next iFromX
  4146.                 iToY = iToY + 1
  4147.                 If bFinished = TRUE Then Exit For
  4148.             End If
  4149.         Next iFromY
  4150.         If bFinished = TRUE Then Exit For
  4151.  
  4152.         iTileX = iTileX + 1
  4153.         'If iTileX > 15 Then
  4154.         '    iTileX = 0
  4155.         '    iTileY = iTileY + 1
  4156.         'End If
  4157.     Next iTileNum
  4158.  
  4159.     GetTiles2$ = sResult
  4160. End Function ' GetTiles2$
  4161.  
  4162. ' ################################################################################################################################################################
  4163. ' END TILE TO IMAGE ROUTINES
  4164. ' ################################################################################################################################################################
  4165.  
  4166. ' ################################################################################################################################################################
  4167. ' BEGIN TILE DEFINITIONS
  4168. ' ################################################################################################################################################################
  4169.  
  4170. ' /////////////////////////////////////////////////////////////////////////////
  4171. ' Returns an array of 256 8x8 tiles defined in text
  4172. ' where each tile is defined by "." as blank and anything else is a pixel
  4173. ' and each row is delimited by chr$(13)
  4174.  
  4175. Sub GetTileText (arrTileText() As String)
  4176.     ReDim arrTileText(0 To 255) As String
  4177.  
  4178.     m$ = ""
  4179.     m$ = m$ + "22....22" + Chr$(13)
  4180.     m$ = m$ + "2..22..2" + Chr$(13)
  4181.     m$ = m$ + "2..2...2" + Chr$(13)
  4182.     m$ = m$ + "2...2..2" + Chr$(13)
  4183.     m$ = m$ + "2..22..2" + Chr$(13)
  4184.     m$ = m$ + "2..22..2" + Chr$(13)
  4185.     m$ = m$ + "22....22" + Chr$(13)
  4186.     m$ = m$ + "22222222" + Chr$(13)
  4187.     arrTileText(0) = m$
  4188.  
  4189.     m$ = ""
  4190.     m$ = m$ + "........" + Chr$(13)
  4191.     m$ = m$ + "........" + Chr$(13)
  4192.     m$ = m$ + "........" + Chr$(13)
  4193.     m$ = m$ + "........" + Chr$(13)
  4194.     m$ = m$ + "........" + Chr$(13)
  4195.     m$ = m$ + "........" + Chr$(13)
  4196.     m$ = m$ + "........" + Chr$(13)
  4197.     m$ = m$ + "........" + Chr$(13)
  4198.     arrTileText(1) = m$
  4199.  
  4200.     m$ = ""
  4201.     m$ = m$ + "........" + Chr$(13)
  4202.     m$ = m$ + "........" + Chr$(13)
  4203.     m$ = m$ + "........" + Chr$(13)
  4204.     m$ = m$ + "........" + Chr$(13)
  4205.     m$ = m$ + "........" + Chr$(13)
  4206.     m$ = m$ + "........" + Chr$(13)
  4207.     m$ = m$ + "........" + Chr$(13)
  4208.     m$ = m$ + "........" + Chr$(13)
  4209.     arrTileText(2) = m$
  4210.  
  4211.     m$ = ""
  4212.     m$ = m$ + "........" + Chr$(13)
  4213.     m$ = m$ + "........" + Chr$(13)
  4214.     m$ = m$ + "........" + Chr$(13)
  4215.     m$ = m$ + "........" + Chr$(13)
  4216.     m$ = m$ + "........" + Chr$(13)
  4217.     m$ = m$ + "........" + Chr$(13)
  4218.     m$ = m$ + "........" + Chr$(13)
  4219.     m$ = m$ + "........" + Chr$(13)
  4220.     arrTileText(3) = m$
  4221.  
  4222.     m$ = ""
  4223.     m$ = m$ + "........" + Chr$(13)
  4224.     m$ = m$ + "........" + Chr$(13)
  4225.     m$ = m$ + "........" + Chr$(13)
  4226.     m$ = m$ + "........" + Chr$(13)
  4227.     m$ = m$ + "........" + Chr$(13)
  4228.     m$ = m$ + "........" + Chr$(13)
  4229.     m$ = m$ + "........" + Chr$(13)
  4230.     m$ = m$ + "........" + Chr$(13)
  4231.     arrTileText(4) = m$
  4232.  
  4233.     m$ = ""
  4234.     m$ = m$ + "........" + Chr$(13)
  4235.     m$ = m$ + "........" + Chr$(13)
  4236.     m$ = m$ + "........" + Chr$(13)
  4237.     m$ = m$ + "........" + Chr$(13)
  4238.     m$ = m$ + "........" + Chr$(13)
  4239.     m$ = m$ + "........" + Chr$(13)
  4240.     m$ = m$ + "........" + Chr$(13)
  4241.     m$ = m$ + "........" + Chr$(13)
  4242.     arrTileText(5) = m$
  4243.  
  4244.     m$ = ""
  4245.     m$ = m$ + "........" + Chr$(13)
  4246.     m$ = m$ + "........" + Chr$(13)
  4247.     m$ = m$ + "........" + Chr$(13)
  4248.     m$ = m$ + "........" + Chr$(13)
  4249.     m$ = m$ + "........" + Chr$(13)
  4250.     m$ = m$ + "........" + Chr$(13)
  4251.     m$ = m$ + "........" + Chr$(13)
  4252.     m$ = m$ + "........" + Chr$(13)
  4253.     arrTileText(6) = m$
  4254.  
  4255.     m$ = ""
  4256.     m$ = m$ + "........" + Chr$(13)
  4257.     m$ = m$ + "........" + Chr$(13)
  4258.     m$ = m$ + "........" + Chr$(13)
  4259.     m$ = m$ + "........" + Chr$(13)
  4260.     m$ = m$ + "........" + Chr$(13)
  4261.     m$ = m$ + "........" + Chr$(13)
  4262.     m$ = m$ + "........" + Chr$(13)
  4263.     m$ = m$ + "........" + Chr$(13)
  4264.     arrTileText(7) = m$
  4265.  
  4266.     m$ = ""
  4267.     m$ = m$ + "........" + Chr$(13)
  4268.     m$ = m$ + "........" + Chr$(13)
  4269.     m$ = m$ + "........" + Chr$(13)
  4270.     m$ = m$ + "........" + Chr$(13)
  4271.     m$ = m$ + "........" + Chr$(13)
  4272.     m$ = m$ + "........" + Chr$(13)
  4273.     m$ = m$ + "........" + Chr$(13)
  4274.     m$ = m$ + "........" + Chr$(13)
  4275.     arrTileText(8) = m$
  4276.  
  4277.     m$ = ""
  4278.     m$ = m$ + "........" + Chr$(13)
  4279.     m$ = m$ + "........" + Chr$(13)
  4280.     m$ = m$ + "........" + Chr$(13)
  4281.     m$ = m$ + "........" + Chr$(13)
  4282.     m$ = m$ + "........" + Chr$(13)
  4283.     m$ = m$ + "........" + Chr$(13)
  4284.     m$ = m$ + "........" + Chr$(13)
  4285.     m$ = m$ + "........" + Chr$(13)
  4286.     arrTileText(9) = m$
  4287.  
  4288.     m$ = ""
  4289.     m$ = m$ + "........" + Chr$(13)
  4290.     m$ = m$ + "........" + Chr$(13)
  4291.     m$ = m$ + "........" + Chr$(13)
  4292.     m$ = m$ + "........" + Chr$(13)
  4293.     m$ = m$ + "........" + Chr$(13)
  4294.     m$ = m$ + "........" + Chr$(13)
  4295.     m$ = m$ + "........" + Chr$(13)
  4296.     m$ = m$ + "........" + Chr$(13)
  4297.     arrTileText(10) = m$
  4298.  
  4299.     m$ = ""
  4300.     m$ = m$ + "........" + Chr$(13)
  4301.     m$ = m$ + "........" + Chr$(13)
  4302.     m$ = m$ + "........" + Chr$(13)
  4303.     m$ = m$ + "........" + Chr$(13)
  4304.     m$ = m$ + "........" + Chr$(13)
  4305.     m$ = m$ + "........" + Chr$(13)
  4306.     m$ = m$ + "........" + Chr$(13)
  4307.     m$ = m$ + "........" + Chr$(13)
  4308.     arrTileText(11) = m$
  4309.  
  4310.     m$ = ""
  4311.     m$ = m$ + "........" + Chr$(13)
  4312.     m$ = m$ + "........" + Chr$(13)
  4313.     m$ = m$ + "........" + Chr$(13)
  4314.     m$ = m$ + "........" + Chr$(13)
  4315.     m$ = m$ + "........" + Chr$(13)
  4316.     m$ = m$ + "........" + Chr$(13)
  4317.     m$ = m$ + "........" + Chr$(13)
  4318.     m$ = m$ + "........" + Chr$(13)
  4319.     arrTileText(12) = m$
  4320.  
  4321.     m$ = ""
  4322.     m$ = m$ + "........" + Chr$(13)
  4323.     m$ = m$ + "........" + Chr$(13)
  4324.     m$ = m$ + "........" + Chr$(13)
  4325.     m$ = m$ + "........" + Chr$(13)
  4326.     m$ = m$ + "........" + Chr$(13)
  4327.     m$ = m$ + "........" + Chr$(13)
  4328.     m$ = m$ + "........" + Chr$(13)
  4329.     m$ = m$ + "........" + Chr$(13)
  4330.     arrTileText(13) = m$
  4331.  
  4332.     m$ = ""
  4333.     m$ = m$ + "........" + Chr$(13)
  4334.     m$ = m$ + "........" + Chr$(13)
  4335.     m$ = m$ + "........" + Chr$(13)
  4336.     m$ = m$ + "........" + Chr$(13)
  4337.     m$ = m$ + "........" + Chr$(13)
  4338.     m$ = m$ + "........" + Chr$(13)
  4339.     m$ = m$ + "........" + Chr$(13)
  4340.     m$ = m$ + "........" + Chr$(13)
  4341.     arrTileText(14) = m$
  4342.  
  4343.     m$ = ""
  4344.     m$ = m$ + "........" + Chr$(13)
  4345.     m$ = m$ + "........" + Chr$(13)
  4346.     m$ = m$ + "........" + Chr$(13)
  4347.     m$ = m$ + "........" + Chr$(13)
  4348.     m$ = m$ + "........" + Chr$(13)
  4349.     m$ = m$ + "........" + Chr$(13)
  4350.     m$ = m$ + "........" + Chr$(13)
  4351.     m$ = m$ + "........" + Chr$(13)
  4352.     arrTileText(15) = m$
  4353.  
  4354.     m$ = ""
  4355.     m$ = m$ + "........" + Chr$(13)
  4356.     m$ = m$ + "........" + Chr$(13)
  4357.     m$ = m$ + "........" + Chr$(13)
  4358.     m$ = m$ + "........" + Chr$(13)
  4359.     m$ = m$ + "........" + Chr$(13)
  4360.     m$ = m$ + "........" + Chr$(13)
  4361.     m$ = m$ + "........" + Chr$(13)
  4362.     m$ = m$ + "........" + Chr$(13)
  4363.     arrTileText(16) = m$
  4364.  
  4365.     m$ = ""
  4366.     m$ = m$ + "........" + Chr$(13)
  4367.     m$ = m$ + "........" + Chr$(13)
  4368.     m$ = m$ + "........" + Chr$(13)
  4369.     m$ = m$ + "........" + Chr$(13)
  4370.     m$ = m$ + "........" + Chr$(13)
  4371.     m$ = m$ + "........" + Chr$(13)
  4372.     m$ = m$ + "........" + Chr$(13)
  4373.     m$ = m$ + "........" + Chr$(13)
  4374.     arrTileText(17) = m$
  4375.  
  4376.     m$ = ""
  4377.     m$ = m$ + "........" + Chr$(13)
  4378.     m$ = m$ + "........" + Chr$(13)
  4379.     m$ = m$ + "........" + Chr$(13)
  4380.     m$ = m$ + "........" + Chr$(13)
  4381.     m$ = m$ + "........" + Chr$(13)
  4382.     m$ = m$ + "........" + Chr$(13)
  4383.     m$ = m$ + "........" + Chr$(13)
  4384.     m$ = m$ + "........" + Chr$(13)
  4385.     arrTileText(18) = m$
  4386.  
  4387.     m$ = ""
  4388.     m$ = m$ + "........" + Chr$(13)
  4389.     m$ = m$ + "........" + Chr$(13)
  4390.     m$ = m$ + "........" + Chr$(13)
  4391.     m$ = m$ + "........" + Chr$(13)
  4392.     m$ = m$ + "........" + Chr$(13)
  4393.     m$ = m$ + "........" + Chr$(13)
  4394.     m$ = m$ + "........" + Chr$(13)
  4395.     m$ = m$ + "........" + Chr$(13)
  4396.     arrTileText(19) = m$
  4397.  
  4398.     m$ = ""
  4399.     m$ = m$ + "........" + Chr$(13)
  4400.     m$ = m$ + "........" + Chr$(13)
  4401.     m$ = m$ + "........" + Chr$(13)
  4402.     m$ = m$ + "........" + Chr$(13)
  4403.     m$ = m$ + "........" + Chr$(13)
  4404.     m$ = m$ + "........" + Chr$(13)
  4405.     m$ = m$ + "........" + Chr$(13)
  4406.     m$ = m$ + "........" + Chr$(13)
  4407.     arrTileText(20) = m$
  4408.  
  4409.     m$ = ""
  4410.     m$ = m$ + "........" + Chr$(13)
  4411.     m$ = m$ + "........" + Chr$(13)
  4412.     m$ = m$ + "........" + Chr$(13)
  4413.     m$ = m$ + "........" + Chr$(13)
  4414.     m$ = m$ + "........" + Chr$(13)
  4415.     m$ = m$ + "........" + Chr$(13)
  4416.     m$ = m$ + "........" + Chr$(13)
  4417.     m$ = m$ + "........" + Chr$(13)
  4418.     arrTileText(21) = m$
  4419.  
  4420.     m$ = ""
  4421.     m$ = m$ + "........" + Chr$(13)
  4422.     m$ = m$ + "........" + Chr$(13)
  4423.     m$ = m$ + "........" + Chr$(13)
  4424.     m$ = m$ + "........" + Chr$(13)
  4425.     m$ = m$ + "........" + Chr$(13)
  4426.     m$ = m$ + "........" + Chr$(13)
  4427.     m$ = m$ + "........" + Chr$(13)
  4428.     m$ = m$ + "........" + Chr$(13)
  4429.     arrTileText(22) = m$
  4430.  
  4431.     m$ = ""
  4432.     m$ = m$ + "........" + Chr$(13)
  4433.     m$ = m$ + "........" + Chr$(13)
  4434.     m$ = m$ + "........" + Chr$(13)
  4435.     m$ = m$ + "........" + Chr$(13)
  4436.     m$ = m$ + "........" + Chr$(13)
  4437.     m$ = m$ + "........" + Chr$(13)
  4438.     m$ = m$ + "........" + Chr$(13)
  4439.     m$ = m$ + "........" + Chr$(13)
  4440.     arrTileText(23) = m$
  4441.  
  4442.     m$ = ""
  4443.     m$ = m$ + "........" + Chr$(13)
  4444.     m$ = m$ + "........" + Chr$(13)
  4445.     m$ = m$ + "........" + Chr$(13)
  4446.     m$ = m$ + "........" + Chr$(13)
  4447.     m$ = m$ + "........" + Chr$(13)
  4448.     m$ = m$ + "........" + Chr$(13)
  4449.     m$ = m$ + "........" + Chr$(13)
  4450.     m$ = m$ + "........" + Chr$(13)
  4451.     arrTileText(24) = m$
  4452.  
  4453.     m$ = ""
  4454.     m$ = m$ + "........" + Chr$(13)
  4455.     m$ = m$ + "........" + Chr$(13)
  4456.     m$ = m$ + "........" + Chr$(13)
  4457.     m$ = m$ + "........" + Chr$(13)
  4458.     m$ = m$ + "........" + Chr$(13)
  4459.     m$ = m$ + "........" + Chr$(13)
  4460.     m$ = m$ + "........" + Chr$(13)
  4461.     m$ = m$ + "........" + Chr$(13)
  4462.     arrTileText(25) = m$
  4463.  
  4464.     m$ = ""
  4465.     m$ = m$ + "........" + Chr$(13)
  4466.     m$ = m$ + "........" + Chr$(13)
  4467.     m$ = m$ + "........" + Chr$(13)
  4468.     m$ = m$ + "........" + Chr$(13)
  4469.     m$ = m$ + "........" + Chr$(13)
  4470.     m$ = m$ + "........" + Chr$(13)
  4471.     m$ = m$ + "........" + Chr$(13)
  4472.     m$ = m$ + "........" + Chr$(13)
  4473.     arrTileText(26) = m$
  4474.  
  4475.     m$ = ""
  4476.     m$ = m$ + "........" + Chr$(13)
  4477.     m$ = m$ + "........" + Chr$(13)
  4478.     m$ = m$ + "........" + Chr$(13)
  4479.     m$ = m$ + "........" + Chr$(13)
  4480.     m$ = m$ + "........" + Chr$(13)
  4481.     m$ = m$ + "........" + Chr$(13)
  4482.     m$ = m$ + "........" + Chr$(13)
  4483.     m$ = m$ + "........" + Chr$(13)
  4484.     arrTileText(27) = m$
  4485.  
  4486.     m$ = ""
  4487.     m$ = m$ + "........" + Chr$(13)
  4488.     m$ = m$ + "........" + Chr$(13)
  4489.     m$ = m$ + "........" + Chr$(13)
  4490.     m$ = m$ + "........" + Chr$(13)
  4491.     m$ = m$ + "........" + Chr$(13)
  4492.     m$ = m$ + "........" + Chr$(13)
  4493.     m$ = m$ + "........" + Chr$(13)
  4494.     m$ = m$ + "........" + Chr$(13)
  4495.     arrTileText(28) = m$
  4496.  
  4497.     m$ = ""
  4498.     m$ = m$ + "........" + Chr$(13)
  4499.     m$ = m$ + "........" + Chr$(13)
  4500.     m$ = m$ + "........" + Chr$(13)
  4501.     m$ = m$ + "........" + Chr$(13)
  4502.     m$ = m$ + "........" + Chr$(13)
  4503.     m$ = m$ + "........" + Chr$(13)
  4504.     m$ = m$ + "........" + Chr$(13)
  4505.     m$ = m$ + "........" + Chr$(13)
  4506.     arrTileText(29) = m$
  4507.  
  4508.     m$ = ""
  4509.     m$ = m$ + "........" + Chr$(13)
  4510.     m$ = m$ + "........" + Chr$(13)
  4511.     m$ = m$ + "........" + Chr$(13)
  4512.     m$ = m$ + "........" + Chr$(13)
  4513.     m$ = m$ + "........" + Chr$(13)
  4514.     m$ = m$ + "........" + Chr$(13)
  4515.     m$ = m$ + "........" + Chr$(13)
  4516.     m$ = m$ + "........" + Chr$(13)
  4517.     arrTileText(30) = m$
  4518.  
  4519.     m$ = ""
  4520.     m$ = m$ + "........" + Chr$(13)
  4521.     m$ = m$ + "........" + Chr$(13)
  4522.     m$ = m$ + "........" + Chr$(13)
  4523.     m$ = m$ + "........" + Chr$(13)
  4524.     m$ = m$ + "........" + Chr$(13)
  4525.     m$ = m$ + "........" + Chr$(13)
  4526.     m$ = m$ + "........" + Chr$(13)
  4527.     m$ = m$ + "........" + Chr$(13)
  4528.     arrTileText(31) = m$
  4529.  
  4530.     m$ = ""
  4531.     m$ = m$ + "........" + Chr$(13)
  4532.     m$ = m$ + "........" + Chr$(13)
  4533.     m$ = m$ + "........" + Chr$(13)
  4534.     m$ = m$ + "........" + Chr$(13)
  4535.     m$ = m$ + "........" + Chr$(13)
  4536.     m$ = m$ + "........" + Chr$(13)
  4537.     m$ = m$ + "........" + Chr$(13)
  4538.     m$ = m$ + "........" + Chr$(13)
  4539.     arrTileText(32) = m$
  4540.  
  4541.     m$ = ""
  4542.     m$ = m$ + "...22..." + Chr$(13)
  4543.     m$ = m$ + "...22..." + Chr$(13)
  4544.     m$ = m$ + "...22..." + Chr$(13)
  4545.     m$ = m$ + "...22..." + Chr$(13)
  4546.     m$ = m$ + "........" + Chr$(13)
  4547.     m$ = m$ + "........" + Chr$(13)
  4548.     m$ = m$ + "...22..." + Chr$(13)
  4549.     m$ = m$ + "........" + Chr$(13)
  4550.     arrTileText(33) = m$
  4551.  
  4552.     m$ = ""
  4553.     m$ = m$ + ".22..22." + Chr$(13)
  4554.     m$ = m$ + ".22..22." + Chr$(13)
  4555.     m$ = m$ + ".22..22." + Chr$(13)
  4556.     m$ = m$ + "........" + Chr$(13)
  4557.     m$ = m$ + "........" + Chr$(13)
  4558.     m$ = m$ + "........" + Chr$(13)
  4559.     m$ = m$ + "........" + Chr$(13)
  4560.     m$ = m$ + "........" + Chr$(13)
  4561.     arrTileText(34) = m$
  4562.  
  4563.     m$ = ""
  4564.     m$ = m$ + ".22..22." + Chr$(13)
  4565.     m$ = m$ + ".22..22." + Chr$(13)
  4566.     m$ = m$ + "22222222" + Chr$(13)
  4567.     m$ = m$ + ".22..22." + Chr$(13)
  4568.     m$ = m$ + "22222222" + Chr$(13)
  4569.     m$ = m$ + ".22..22." + Chr$(13)
  4570.     m$ = m$ + ".22..22." + Chr$(13)
  4571.     m$ = m$ + "........" + Chr$(13)
  4572.     arrTileText(35) = m$
  4573.  
  4574.     m$ = ""
  4575.     m$ = m$ + "...22..." + Chr$(13)
  4576.     m$ = m$ + "..22222." + Chr$(13)
  4577.     m$ = m$ + ".22....." + Chr$(13)
  4578.     m$ = m$ + "..2222.." + Chr$(13)
  4579.     m$ = m$ + ".....22." + Chr$(13)
  4580.     m$ = m$ + ".22222.." + Chr$(13)
  4581.     m$ = m$ + "...22..." + Chr$(13)
  4582.     m$ = m$ + "........" + Chr$(13)
  4583.     arrTileText(36) = m$
  4584.  
  4585.     m$ = ""
  4586.     m$ = m$ + ".22...2." + Chr$(13)
  4587.     m$ = m$ + ".22..22." + Chr$(13)
  4588.     m$ = m$ + "....22.." + Chr$(13)
  4589.     m$ = m$ + "...22..." + Chr$(13)
  4590.     m$ = m$ + "..22...." + Chr$(13)
  4591.     m$ = m$ + ".22..22." + Chr$(13)
  4592.     m$ = m$ + ".2...22." + Chr$(13)
  4593.     m$ = m$ + "........" + Chr$(13)
  4594.     arrTileText(37) = m$
  4595.  
  4596.     m$ = ""
  4597.     m$ = m$ + "..2222.." + Chr$(13)
  4598.     m$ = m$ + ".22..22." + Chr$(13)
  4599.     m$ = m$ + "..2222.." + Chr$(13)
  4600.     m$ = m$ + "..222..." + Chr$(13)
  4601.     m$ = m$ + ".22..222" + Chr$(13)
  4602.     m$ = m$ + ".22..22." + Chr$(13)
  4603.     m$ = m$ + "..222222" + Chr$(13)
  4604.     m$ = m$ + "........" + Chr$(13)
  4605.     arrTileText(38) = m$
  4606.  
  4607.     m$ = ""
  4608.     m$ = m$ + ".....22." + Chr$(13)
  4609.     m$ = m$ + "....22.." + Chr$(13)
  4610.     m$ = m$ + "...22..." + Chr$(13)
  4611.     m$ = m$ + "........" + Chr$(13)
  4612.     m$ = m$ + "........" + Chr$(13)
  4613.     m$ = m$ + "........" + Chr$(13)
  4614.     m$ = m$ + "........" + Chr$(13)
  4615.     m$ = m$ + "........" + Chr$(13)
  4616.     arrTileText(39) = m$
  4617.  
  4618.     m$ = ""
  4619.     m$ = m$ + "....22.." + Chr$(13)
  4620.     m$ = m$ + "...22..." + Chr$(13)
  4621.     m$ = m$ + "..22...." + Chr$(13)
  4622.     m$ = m$ + "..22...." + Chr$(13)
  4623.     m$ = m$ + "..22...." + Chr$(13)
  4624.     m$ = m$ + "...22..." + Chr$(13)
  4625.     m$ = m$ + "....22.." + Chr$(13)
  4626.     m$ = m$ + "........" + Chr$(13)
  4627.     arrTileText(40) = m$
  4628.  
  4629.     m$ = ""
  4630.     m$ = m$ + "..22...." + Chr$(13)
  4631.     m$ = m$ + "...22..." + Chr$(13)
  4632.     m$ = m$ + "....22.." + Chr$(13)
  4633.     m$ = m$ + "....22.." + Chr$(13)
  4634.     m$ = m$ + "....22.." + Chr$(13)
  4635.     m$ = m$ + "...22..." + Chr$(13)
  4636.     m$ = m$ + "..22...." + Chr$(13)
  4637.     m$ = m$ + "........" + Chr$(13)
  4638.     arrTileText(41) = m$
  4639.  
  4640.     m$ = ""
  4641.     m$ = m$ + "........" + Chr$(13)
  4642.     m$ = m$ + ".22..22." + Chr$(13)
  4643.     m$ = m$ + "..2222.." + Chr$(13)
  4644.     m$ = m$ + "22222222" + Chr$(13)
  4645.     m$ = m$ + "..2222.." + Chr$(13)
  4646.     m$ = m$ + ".22..22." + Chr$(13)
  4647.     m$ = m$ + "........" + Chr$(13)
  4648.     m$ = m$ + "........" + Chr$(13)
  4649.     arrTileText(42) = m$
  4650.  
  4651.     m$ = ""
  4652.     m$ = m$ + "........" + Chr$(13)
  4653.     m$ = m$ + "...22..." + Chr$(13)
  4654.     m$ = m$ + "...22..." + Chr$(13)
  4655.     m$ = m$ + ".222222." + Chr$(13)
  4656.     m$ = m$ + "...22..." + Chr$(13)
  4657.     m$ = m$ + "...22..." + Chr$(13)
  4658.     m$ = m$ + "........" + Chr$(13)
  4659.     m$ = m$ + "........" + Chr$(13)
  4660.     arrTileText(43) = m$
  4661.  
  4662.     m$ = ""
  4663.     m$ = m$ + "........" + Chr$(13)
  4664.     m$ = m$ + "........" + Chr$(13)
  4665.     m$ = m$ + "........" + Chr$(13)
  4666.     m$ = m$ + "........" + Chr$(13)
  4667.     m$ = m$ + "........" + Chr$(13)
  4668.     m$ = m$ + "...22..." + Chr$(13)
  4669.     m$ = m$ + "...22..." + Chr$(13)
  4670.     m$ = m$ + "..22...." + Chr$(13)
  4671.     arrTileText(44) = m$
  4672.  
  4673.     m$ = ""
  4674.     m$ = m$ + "........" + Chr$(13)
  4675.     m$ = m$ + "........" + Chr$(13)
  4676.     m$ = m$ + "........" + Chr$(13)
  4677.     m$ = m$ + ".222222." + Chr$(13)
  4678.     m$ = m$ + "........" + Chr$(13)
  4679.     m$ = m$ + "........" + Chr$(13)
  4680.     m$ = m$ + "........" + Chr$(13)
  4681.     m$ = m$ + "........" + Chr$(13)
  4682.     arrTileText(45) = m$
  4683.  
  4684.     m$ = ""
  4685.     m$ = m$ + "........" + Chr$(13)
  4686.     m$ = m$ + "........" + Chr$(13)
  4687.     m$ = m$ + "........" + Chr$(13)
  4688.     m$ = m$ + "........" + Chr$(13)
  4689.     m$ = m$ + "........" + Chr$(13)
  4690.     m$ = m$ + "...22..." + Chr$(13)
  4691.     m$ = m$ + "...22..." + Chr$(13)
  4692.     m$ = m$ + "........" + Chr$(13)
  4693.     arrTileText(46) = m$
  4694.  
  4695.     m$ = ""
  4696.     m$ = m$ + "........" + Chr$(13)
  4697.     m$ = m$ + "......22" + Chr$(13)
  4698.     m$ = m$ + ".....22." + Chr$(13)
  4699.     m$ = m$ + "....22.." + Chr$(13)
  4700.     m$ = m$ + "...22..." + Chr$(13)
  4701.     m$ = m$ + "..22...." + Chr$(13)
  4702.     m$ = m$ + ".22....." + Chr$(13)
  4703.     m$ = m$ + "........" + Chr$(13)
  4704.     arrTileText(47) = m$
  4705.  
  4706.     m$ = ""
  4707.     m$ = m$ + "..2222.." + Chr$(13)
  4708.     m$ = m$ + ".22..22." + Chr$(13)
  4709.     m$ = m$ + ".22.222." + Chr$(13)
  4710.     m$ = m$ + ".222.22." + Chr$(13)
  4711.     m$ = m$ + ".22..22." + Chr$(13)
  4712.     m$ = m$ + ".22..22." + Chr$(13)
  4713.     m$ = m$ + "..2222.." + Chr$(13)
  4714.     m$ = m$ + "........" + Chr$(13)
  4715.     arrTileText(48) = m$
  4716.  
  4717.     m$ = ""
  4718.     m$ = m$ + "...22..." + Chr$(13)
  4719.     m$ = m$ + "...22..." + Chr$(13)
  4720.     m$ = m$ + "..222..." + Chr$(13)
  4721.     m$ = m$ + "...22..." + Chr$(13)
  4722.     m$ = m$ + "...22..." + Chr$(13)
  4723.     m$ = m$ + "...22..." + Chr$(13)
  4724.     m$ = m$ + ".222222." + Chr$(13)
  4725.     m$ = m$ + "........" + Chr$(13)
  4726.     arrTileText(49) = m$
  4727.  
  4728.     m$ = ""
  4729.     m$ = m$ + "..2222.." + Chr$(13)
  4730.     m$ = m$ + ".22..22." + Chr$(13)
  4731.     m$ = m$ + ".....22." + Chr$(13)
  4732.     m$ = m$ + "....22.." + Chr$(13)
  4733.     m$ = m$ + "..22...." + Chr$(13)
  4734.     m$ = m$ + ".22....." + Chr$(13)
  4735.     m$ = m$ + ".222222." + Chr$(13)
  4736.     m$ = m$ + "........" + Chr$(13)
  4737.     arrTileText(50) = m$
  4738.  
  4739.     m$ = ""
  4740.     m$ = m$ + "..2222.." + Chr$(13)
  4741.     m$ = m$ + ".22..22." + Chr$(13)
  4742.     m$ = m$ + ".....22." + Chr$(13)
  4743.     m$ = m$ + "...222.." + Chr$(13)
  4744.     m$ = m$ + ".....22." + Chr$(13)
  4745.     m$ = m$ + ".22..22." + Chr$(13)
  4746.     m$ = m$ + "..2222.." + Chr$(13)
  4747.     m$ = m$ + "........" + Chr$(13)
  4748.     arrTileText(51) = m$
  4749.  
  4750.     m$ = ""
  4751.     m$ = m$ + ".....22." + Chr$(13)
  4752.     m$ = m$ + "....222." + Chr$(13)
  4753.     m$ = m$ + "...2222." + Chr$(13)
  4754.     m$ = m$ + ".22..22." + Chr$(13)
  4755.     m$ = m$ + ".2222222" + Chr$(13)
  4756.     m$ = m$ + ".....22." + Chr$(13)
  4757.     m$ = m$ + ".....22." + Chr$(13)
  4758.     m$ = m$ + "........" + Chr$(13)
  4759.     arrTileText(52) = m$
  4760.  
  4761.     m$ = ""
  4762.     m$ = m$ + ".222222." + Chr$(13)
  4763.     m$ = m$ + ".22....." + Chr$(13)
  4764.     m$ = m$ + ".22222.." + Chr$(13)
  4765.     m$ = m$ + ".....22." + Chr$(13)
  4766.     m$ = m$ + ".....22." + Chr$(13)
  4767.     m$ = m$ + ".22..22." + Chr$(13)
  4768.     m$ = m$ + "..2222.." + Chr$(13)
  4769.     m$ = m$ + "........" + Chr$(13)
  4770.     arrTileText(53) = m$
  4771.  
  4772.     m$ = ""
  4773.     m$ = m$ + "..2222.." + Chr$(13)
  4774.     m$ = m$ + ".22..22." + Chr$(13)
  4775.     m$ = m$ + ".22....." + Chr$(13)
  4776.     m$ = m$ + ".22222.." + Chr$(13)
  4777.     m$ = m$ + ".22..22." + Chr$(13)
  4778.     m$ = m$ + ".22..22." + Chr$(13)
  4779.     m$ = m$ + "..2222.." + Chr$(13)
  4780.     m$ = m$ + "........" + Chr$(13)
  4781.     arrTileText(54) = m$
  4782.  
  4783.     m$ = ""
  4784.     m$ = m$ + ".222222." + Chr$(13)
  4785.     m$ = m$ + ".22..22." + Chr$(13)
  4786.     m$ = m$ + "....22.." + Chr$(13)
  4787.     m$ = m$ + "...22..." + Chr$(13)
  4788.     m$ = m$ + "...22..." + Chr$(13)
  4789.     m$ = m$ + "...22..." + Chr$(13)
  4790.     m$ = m$ + "...22..." + Chr$(13)
  4791.     m$ = m$ + "........" + Chr$(13)
  4792.     arrTileText(55) = m$
  4793.  
  4794.     m$ = ""
  4795.     m$ = m$ + "..2222.." + Chr$(13)
  4796.     m$ = m$ + ".22..22." + Chr$(13)
  4797.     m$ = m$ + ".22..22." + Chr$(13)
  4798.     m$ = m$ + "..2222.." + Chr$(13)
  4799.     m$ = m$ + ".22..22." + Chr$(13)
  4800.     m$ = m$ + ".22..22." + Chr$(13)
  4801.     m$ = m$ + "..2222.." + Chr$(13)
  4802.     m$ = m$ + "........" + Chr$(13)
  4803.     arrTileText(56) = m$
  4804.  
  4805.     m$ = ""
  4806.     m$ = m$ + "..2222.." + Chr$(13)
  4807.     m$ = m$ + ".22..22." + Chr$(13)
  4808.     m$ = m$ + ".22..22." + Chr$(13)
  4809.     m$ = m$ + "..22222." + Chr$(13)
  4810.     m$ = m$ + ".....22." + Chr$(13)
  4811.     m$ = m$ + ".22..22." + Chr$(13)
  4812.     m$ = m$ + "..2222.." + Chr$(13)
  4813.     m$ = m$ + "........" + Chr$(13)
  4814.     arrTileText(57) = m$
  4815.  
  4816.     m$ = ""
  4817.     m$ = m$ + "........" + Chr$(13)
  4818.     m$ = m$ + "........" + Chr$(13)
  4819.     m$ = m$ + "...22..." + Chr$(13)
  4820.     m$ = m$ + "........" + Chr$(13)
  4821.     m$ = m$ + "........" + Chr$(13)
  4822.     m$ = m$ + "...22..." + Chr$(13)
  4823.     m$ = m$ + "........" + Chr$(13)
  4824.     m$ = m$ + "........" + Chr$(13)
  4825.     arrTileText(58) = m$
  4826.  
  4827.     m$ = ""
  4828.     m$ = m$ + "........" + Chr$(13)
  4829.     m$ = m$ + "........" + Chr$(13)
  4830.     m$ = m$ + "...22..." + Chr$(13)
  4831.     m$ = m$ + "........" + Chr$(13)
  4832.     m$ = m$ + "........" + Chr$(13)
  4833.     m$ = m$ + "...22..." + Chr$(13)
  4834.     m$ = m$ + "...22..." + Chr$(13)
  4835.     m$ = m$ + "..22...." + Chr$(13)
  4836.     arrTileText(59) = m$
  4837.  
  4838.     m$ = ""
  4839.     m$ = m$ + "....222." + Chr$(13)
  4840.     m$ = m$ + "...22..." + Chr$(13)
  4841.     m$ = m$ + "..22...." + Chr$(13)
  4842.     m$ = m$ + ".22....." + Chr$(13)
  4843.     m$ = m$ + "..22...." + Chr$(13)
  4844.     m$ = m$ + "...22..." + Chr$(13)
  4845.     m$ = m$ + "....222." + Chr$(13)
  4846.     m$ = m$ + "........" + Chr$(13)
  4847.     arrTileText(60) = m$
  4848.  
  4849.     m$ = ""
  4850.     m$ = m$ + "........" + Chr$(13)
  4851.     m$ = m$ + "........" + Chr$(13)
  4852.     m$ = m$ + ".222222." + Chr$(13)
  4853.     m$ = m$ + "........" + Chr$(13)
  4854.     m$ = m$ + ".222222." + Chr$(13)
  4855.     m$ = m$ + "........" + Chr$(13)
  4856.     m$ = m$ + "........" + Chr$(13)
  4857.     m$ = m$ + "........" + Chr$(13)
  4858.     arrTileText(61) = m$
  4859.  
  4860.     m$ = ""
  4861.     m$ = m$ + ".222...." + Chr$(13)
  4862.     m$ = m$ + "...22..." + Chr$(13)
  4863.     m$ = m$ + "....22.." + Chr$(13)
  4864.     m$ = m$ + ".....22." + Chr$(13)
  4865.     m$ = m$ + "....22.." + Chr$(13)
  4866.     m$ = m$ + "...22..." + Chr$(13)
  4867.     m$ = m$ + ".222...." + Chr$(13)
  4868.     m$ = m$ + "........" + Chr$(13)
  4869.     arrTileText(62) = m$
  4870.  
  4871.     m$ = ""
  4872.     m$ = m$ + "..2222.." + Chr$(13)
  4873.     m$ = m$ + ".22..22." + Chr$(13)
  4874.     m$ = m$ + ".....22." + Chr$(13)
  4875.     m$ = m$ + "....22.." + Chr$(13)
  4876.     m$ = m$ + "...22..." + Chr$(13)
  4877.     m$ = m$ + "........" + Chr$(13)
  4878.     m$ = m$ + "...22..." + Chr$(13)
  4879.     m$ = m$ + "........" + Chr$(13)
  4880.     arrTileText(63) = m$
  4881.  
  4882.     m$ = ""
  4883.     m$ = m$ + "..2222.." + Chr$(13)
  4884.     m$ = m$ + ".22..22." + Chr$(13)
  4885.     m$ = m$ + ".22.222." + Chr$(13)
  4886.     m$ = m$ + ".22.222." + Chr$(13)
  4887.     m$ = m$ + ".22....." + Chr$(13)
  4888.     m$ = m$ + ".22...2." + Chr$(13)
  4889.     m$ = m$ + "..2222.." + Chr$(13)
  4890.     m$ = m$ + "........" + Chr$(13)
  4891.     arrTileText(64) = m$
  4892.  
  4893.     m$ = ""
  4894.     m$ = m$ + "...22..." + Chr$(13)
  4895.     m$ = m$ + "..2222.." + Chr$(13)
  4896.     m$ = m$ + ".22..22." + Chr$(13)
  4897.     m$ = m$ + ".222222." + Chr$(13)
  4898.     m$ = m$ + ".22..22." + Chr$(13)
  4899.     m$ = m$ + ".22..22." + Chr$(13)
  4900.     m$ = m$ + ".22..22." + Chr$(13)
  4901.     m$ = m$ + "........" + Chr$(13)
  4902.     arrTileText(65) = m$
  4903.  
  4904.     m$ = ""
  4905.     m$ = m$ + ".22222.." + Chr$(13)
  4906.     m$ = m$ + ".22..22." + Chr$(13)
  4907.     m$ = m$ + ".22..22." + Chr$(13)
  4908.     m$ = m$ + ".22222.." + Chr$(13)
  4909.     m$ = m$ + ".22..22." + Chr$(13)
  4910.     m$ = m$ + ".22..22." + Chr$(13)
  4911.     m$ = m$ + ".22222.." + Chr$(13)
  4912.     m$ = m$ + "........" + Chr$(13)
  4913.     arrTileText(66) = m$
  4914.  
  4915.     m$ = ""
  4916.     m$ = m$ + "..2222.." + Chr$(13)
  4917.     m$ = m$ + ".22..22." + Chr$(13)
  4918.     m$ = m$ + ".22....." + Chr$(13)
  4919.     m$ = m$ + ".22....." + Chr$(13)
  4920.     m$ = m$ + ".22....." + Chr$(13)
  4921.     m$ = m$ + ".22..22." + Chr$(13)
  4922.     m$ = m$ + "..2222.." + Chr$(13)
  4923.     m$ = m$ + "........" + Chr$(13)
  4924.     arrTileText(67) = m$
  4925.  
  4926.     m$ = ""
  4927.     m$ = m$ + ".2222..." + Chr$(13)
  4928.     m$ = m$ + ".22.22.." + Chr$(13)
  4929.     m$ = m$ + ".22..22." + Chr$(13)
  4930.     m$ = m$ + ".22..22." + Chr$(13)
  4931.     m$ = m$ + ".22..22." + Chr$(13)
  4932.     m$ = m$ + ".22.22.." + Chr$(13)
  4933.     m$ = m$ + ".2222..." + Chr$(13)
  4934.     m$ = m$ + "........" + Chr$(13)
  4935.     arrTileText(68) = m$
  4936.  
  4937.     m$ = ""
  4938.     m$ = m$ + ".222222." + Chr$(13)
  4939.     m$ = m$ + ".22....." + Chr$(13)
  4940.     m$ = m$ + ".22....." + Chr$(13)
  4941.     m$ = m$ + ".2222..." + Chr$(13)
  4942.     m$ = m$ + ".22....." + Chr$(13)
  4943.     m$ = m$ + ".22....." + Chr$(13)
  4944.     m$ = m$ + ".222222." + Chr$(13)
  4945.     m$ = m$ + "........" + Chr$(13)
  4946.     arrTileText(69) = m$
  4947.  
  4948.     m$ = ""
  4949.     m$ = m$ + ".222222." + Chr$(13)
  4950.     m$ = m$ + ".22....." + Chr$(13)
  4951.     m$ = m$ + ".22....." + Chr$(13)
  4952.     m$ = m$ + ".2222..." + Chr$(13)
  4953.     m$ = m$ + ".22....." + Chr$(13)
  4954.     m$ = m$ + ".22....." + Chr$(13)
  4955.     m$ = m$ + ".22....." + Chr$(13)
  4956.     m$ = m$ + "........" + Chr$(13)
  4957.     arrTileText(70) = m$
  4958.  
  4959.     m$ = ""
  4960.     m$ = m$ + "..2222.." + Chr$(13)
  4961.     m$ = m$ + ".22..22." + Chr$(13)
  4962.     m$ = m$ + ".22....." + Chr$(13)
  4963.     m$ = m$ + ".22.222." + Chr$(13)
  4964.     m$ = m$ + ".22..22." + Chr$(13)
  4965.     m$ = m$ + ".22..22." + Chr$(13)
  4966.     m$ = m$ + "..2222.." + Chr$(13)
  4967.     m$ = m$ + "........" + Chr$(13)
  4968.     arrTileText(71) = m$
  4969.  
  4970.     m$ = ""
  4971.     m$ = m$ + ".22..22." + Chr$(13)
  4972.     m$ = m$ + ".22..22." + Chr$(13)
  4973.     m$ = m$ + ".22..22." + Chr$(13)
  4974.     m$ = m$ + ".222222." + Chr$(13)
  4975.     m$ = m$ + ".22..22." + Chr$(13)
  4976.     m$ = m$ + ".22..22." + Chr$(13)
  4977.     m$ = m$ + ".22..22." + Chr$(13)
  4978.     m$ = m$ + "........" + Chr$(13)
  4979.     arrTileText(72) = m$
  4980.  
  4981.     m$ = ""
  4982.     m$ = m$ + "..2222.." + Chr$(13)
  4983.     m$ = m$ + "...22..." + Chr$(13)
  4984.     m$ = m$ + "...22..." + Chr$(13)
  4985.     m$ = m$ + "...22..." + Chr$(13)
  4986.     m$ = m$ + "...22..." + Chr$(13)
  4987.     m$ = m$ + "...22..." + Chr$(13)
  4988.     m$ = m$ + "..2222.." + Chr$(13)
  4989.     m$ = m$ + "........" + Chr$(13)
  4990.     arrTileText(73) = m$
  4991.  
  4992.     m$ = ""
  4993.     m$ = m$ + "...2222." + Chr$(13)
  4994.     m$ = m$ + "....22.." + Chr$(13)
  4995.     m$ = m$ + "....22.." + Chr$(13)
  4996.     m$ = m$ + "....22.." + Chr$(13)
  4997.     m$ = m$ + "....22.." + Chr$(13)
  4998.     m$ = m$ + ".22.22.." + Chr$(13)
  4999.     m$ = m$ + "..222..." + Chr$(13)
  5000.     m$ = m$ + "........" + Chr$(13)
  5001.     arrTileText(74) = m$
  5002.  
  5003.     m$ = ""
  5004.     m$ = m$ + ".22..22." + Chr$(13)
  5005.     m$ = m$ + ".22.22.." + Chr$(13)
  5006.     m$ = m$ + ".2222..." + Chr$(13)
  5007.     m$ = m$ + ".222...." + Chr$(13)
  5008.     m$ = m$ + ".2222..." + Chr$(13)
  5009.     m$ = m$ + ".22.22.." + Chr$(13)
  5010.     m$ = m$ + ".22..22." + Chr$(13)
  5011.     m$ = m$ + "........" + Chr$(13)
  5012.     arrTileText(75) = m$
  5013.  
  5014.     m$ = ""
  5015.     m$ = m$ + ".22....." + Chr$(13)
  5016.     m$ = m$ + ".22....." + Chr$(13)
  5017.     m$ = m$ + ".22....." + Chr$(13)
  5018.     m$ = m$ + ".22....." + Chr$(13)
  5019.     m$ = m$ + ".22....." + Chr$(13)
  5020.     m$ = m$ + ".22....." + Chr$(13)
  5021.     m$ = m$ + ".222222." + Chr$(13)
  5022.     m$ = m$ + "........" + Chr$(13)
  5023.     arrTileText(76) = m$
  5024.  
  5025.     m$ = ""
  5026.     m$ = m$ + ".22...22" + Chr$(13)
  5027.     m$ = m$ + ".222.222" + Chr$(13)
  5028.     m$ = m$ + ".2222222" + Chr$(13)
  5029.     m$ = m$ + ".22.2.22" + Chr$(13)
  5030.     m$ = m$ + ".22...22" + Chr$(13)
  5031.     m$ = m$ + ".22...22" + Chr$(13)
  5032.     m$ = m$ + ".22...22" + Chr$(13)
  5033.     m$ = m$ + "........" + Chr$(13)
  5034.     arrTileText(77) = m$
  5035.  
  5036.     m$ = ""
  5037.     m$ = m$ + ".22..22." + Chr$(13)
  5038.     m$ = m$ + ".222.22." + Chr$(13)
  5039.     m$ = m$ + ".222222." + Chr$(13)
  5040.     m$ = m$ + ".222222." + Chr$(13)
  5041.     m$ = m$ + ".22.222." + Chr$(13)
  5042.     m$ = m$ + ".22..22." + Chr$(13)
  5043.     m$ = m$ + ".22..22." + Chr$(13)
  5044.     m$ = m$ + "........" + Chr$(13)
  5045.     arrTileText(78) = m$
  5046.  
  5047.     m$ = ""
  5048.     m$ = m$ + "..2222.." + Chr$(13)
  5049.     m$ = m$ + ".22..22." + Chr$(13)
  5050.     m$ = m$ + ".22..22." + Chr$(13)
  5051.     m$ = m$ + ".22..22." + Chr$(13)
  5052.     m$ = m$ + ".22..22." + Chr$(13)
  5053.     m$ = m$ + ".22..22." + Chr$(13)
  5054.     m$ = m$ + "..2222.." + Chr$(13)
  5055.     m$ = m$ + "........" + Chr$(13)
  5056.     arrTileText(79) = m$
  5057.  
  5058.     m$ = ""
  5059.     m$ = m$ + ".22222.." + Chr$(13)
  5060.     m$ = m$ + ".22..22." + Chr$(13)
  5061.     m$ = m$ + ".22..22." + Chr$(13)
  5062.     m$ = m$ + ".22222.." + Chr$(13)
  5063.     m$ = m$ + ".22....." + Chr$(13)
  5064.     m$ = m$ + ".22....." + Chr$(13)
  5065.     m$ = m$ + ".22....." + Chr$(13)
  5066.     m$ = m$ + "........" + Chr$(13)
  5067.     arrTileText(80) = m$
  5068.  
  5069.     m$ = ""
  5070.     m$ = m$ + "..2222.." + Chr$(13)
  5071.     m$ = m$ + ".22..22." + Chr$(13)
  5072.     m$ = m$ + ".22..22." + Chr$(13)
  5073.     m$ = m$ + ".22..22." + Chr$(13)
  5074.     m$ = m$ + ".22..22." + Chr$(13)
  5075.     m$ = m$ + "..2222.." + Chr$(13)
  5076.     m$ = m$ + "....222." + Chr$(13)
  5077.     m$ = m$ + "........" + Chr$(13)
  5078.     arrTileText(81) = m$
  5079.  
  5080.     m$ = ""
  5081.     m$ = m$ + ".22222.." + Chr$(13)
  5082.     m$ = m$ + ".22..22." + Chr$(13)
  5083.     m$ = m$ + ".22..22." + Chr$(13)
  5084.     m$ = m$ + ".22222.." + Chr$(13)
  5085.     m$ = m$ + ".2222..." + Chr$(13)
  5086.     m$ = m$ + ".22.22.." + Chr$(13)
  5087.     m$ = m$ + ".22..22." + Chr$(13)
  5088.     m$ = m$ + "........" + Chr$(13)
  5089.     arrTileText(82) = m$
  5090.  
  5091.     m$ = ""
  5092.     m$ = m$ + "..2222.." + Chr$(13)
  5093.     m$ = m$ + ".22..22." + Chr$(13)
  5094.     m$ = m$ + ".22....." + Chr$(13)
  5095.     m$ = m$ + "..2222.." + Chr$(13)
  5096.     m$ = m$ + ".....22." + Chr$(13)
  5097.     m$ = m$ + ".22..22." + Chr$(13)
  5098.     m$ = m$ + "..2222.." + Chr$(13)
  5099.     m$ = m$ + "........" + Chr$(13)
  5100.     arrTileText(83) = m$
  5101.  
  5102.     m$ = ""
  5103.     m$ = m$ + ".222222." + Chr$(13)
  5104.     m$ = m$ + "...22..." + Chr$(13)
  5105.     m$ = m$ + "...22..." + Chr$(13)
  5106.     m$ = m$ + "...22..." + Chr$(13)
  5107.     m$ = m$ + "...22..." + Chr$(13)
  5108.     m$ = m$ + "...22..." + Chr$(13)
  5109.     m$ = m$ + "...22..." + Chr$(13)
  5110.     m$ = m$ + "........" + Chr$(13)
  5111.     arrTileText(84) = m$
  5112.  
  5113.     m$ = ""
  5114.     m$ = m$ + ".22..22." + Chr$(13)
  5115.     m$ = m$ + ".22..22." + Chr$(13)
  5116.     m$ = m$ + ".22..22." + Chr$(13)
  5117.     m$ = m$ + ".22..22." + Chr$(13)
  5118.     m$ = m$ + ".22..22." + Chr$(13)
  5119.     m$ = m$ + ".22..22." + Chr$(13)
  5120.     m$ = m$ + "..2222.." + Chr$(13)
  5121.     m$ = m$ + "........" + Chr$(13)
  5122.     arrTileText(85) = m$
  5123.  
  5124.     m$ = ""
  5125.     m$ = m$ + ".22..22." + Chr$(13)
  5126.     m$ = m$ + ".22..22." + Chr$(13)
  5127.     m$ = m$ + ".22..22." + Chr$(13)
  5128.     m$ = m$ + ".22..22." + Chr$(13)
  5129.     m$ = m$ + ".22..22." + Chr$(13)
  5130.     m$ = m$ + "..2222.." + Chr$(13)
  5131.     m$ = m$ + "...22..." + Chr$(13)
  5132.     m$ = m$ + "........" + Chr$(13)
  5133.     arrTileText(86) = m$
  5134.  
  5135.     m$ = ""
  5136.     m$ = m$ + ".22...22" + Chr$(13)
  5137.     m$ = m$ + ".22...22" + Chr$(13)
  5138.     m$ = m$ + ".22...22" + Chr$(13)
  5139.     m$ = m$ + ".22.2.22" + Chr$(13)
  5140.     m$ = m$ + ".2222222" + Chr$(13)
  5141.     m$ = m$ + ".222.222" + Chr$(13)
  5142.     m$ = m$ + ".22...22" + Chr$(13)
  5143.     m$ = m$ + "........" + Chr$(13)
  5144.     arrTileText(87) = m$
  5145.  
  5146.     m$ = ""
  5147.     m$ = m$ + ".22..22." + Chr$(13)
  5148.     m$ = m$ + ".22..22." + Chr$(13)
  5149.     m$ = m$ + "..2222.." + Chr$(13)
  5150.     m$ = m$ + "...22..." + Chr$(13)
  5151.     m$ = m$ + "..2222.." + Chr$(13)
  5152.     m$ = m$ + ".22..22." + Chr$(13)
  5153.     m$ = m$ + ".22..22." + Chr$(13)
  5154.     m$ = m$ + "........" + Chr$(13)
  5155.     arrTileText(88) = m$
  5156.  
  5157.     m$ = ""
  5158.     m$ = m$ + ".22..22." + Chr$(13)
  5159.     m$ = m$ + ".22..22." + Chr$(13)
  5160.     m$ = m$ + ".22..22." + Chr$(13)
  5161.     m$ = m$ + "..2222.." + Chr$(13)
  5162.     m$ = m$ + "...22..." + Chr$(13)
  5163.     m$ = m$ + "...22..." + Chr$(13)
  5164.     m$ = m$ + "...22..." + Chr$(13)
  5165.     m$ = m$ + "........" + Chr$(13)
  5166.     arrTileText(89) = m$
  5167.  
  5168.     m$ = ""
  5169.     m$ = m$ + ".222222." + Chr$(13)
  5170.     m$ = m$ + ".....22." + Chr$(13)
  5171.     m$ = m$ + "....22.." + Chr$(13)
  5172.     m$ = m$ + "...22..." + Chr$(13)
  5173.     m$ = m$ + "..22...." + Chr$(13)
  5174.     m$ = m$ + ".22....." + Chr$(13)
  5175.     m$ = m$ + ".222222." + Chr$(13)
  5176.     m$ = m$ + "........" + Chr$(13)
  5177.     arrTileText(90) = m$
  5178.  
  5179.     m$ = ""
  5180.     m$ = m$ + "..2222.." + Chr$(13)
  5181.     m$ = m$ + "..22...." + Chr$(13)
  5182.     m$ = m$ + "..22...." + Chr$(13)
  5183.     m$ = m$ + "..22...." + Chr$(13)
  5184.     m$ = m$ + "..22...." + Chr$(13)
  5185.     m$ = m$ + "..22...." + Chr$(13)
  5186.     m$ = m$ + "..2222.." + Chr$(13)
  5187.     m$ = m$ + "........" + Chr$(13)
  5188.     arrTileText(91) = m$
  5189.  
  5190.     m$ = ""
  5191.     m$ = m$ + "........" + Chr$(13)
  5192.     m$ = m$ + ".22....." + Chr$(13)
  5193.     m$ = m$ + "..22...." + Chr$(13)
  5194.     m$ = m$ + "...22..." + Chr$(13)
  5195.     m$ = m$ + "....22.." + Chr$(13)
  5196.     m$ = m$ + ".....22." + Chr$(13)
  5197.     m$ = m$ + "......22" + Chr$(13)
  5198.     m$ = m$ + "........" + Chr$(13)
  5199.     arrTileText(92) = m$
  5200.  
  5201.     m$ = ""
  5202.     m$ = m$ + "..2222.." + Chr$(13)
  5203.     m$ = m$ + "....22.." + Chr$(13)
  5204.     m$ = m$ + "....22.." + Chr$(13)
  5205.     m$ = m$ + "....22.." + Chr$(13)
  5206.     m$ = m$ + "....22.." + Chr$(13)
  5207.     m$ = m$ + "....22.." + Chr$(13)
  5208.     m$ = m$ + "..2222.." + Chr$(13)
  5209.     m$ = m$ + "........" + Chr$(13)
  5210.     arrTileText(93) = m$
  5211.  
  5212.     m$ = ""
  5213.     m$ = m$ + "...22..." + Chr$(13)
  5214.     m$ = m$ + "..2222.." + Chr$(13)
  5215.     m$ = m$ + ".22..22." + Chr$(13)
  5216.     m$ = m$ + "........" + Chr$(13)
  5217.     m$ = m$ + "........" + Chr$(13)
  5218.     m$ = m$ + "........" + Chr$(13)
  5219.     m$ = m$ + "........" + Chr$(13)
  5220.     m$ = m$ + "........" + Chr$(13)
  5221.     arrTileText(94) = m$
  5222.  
  5223.     m$ = ""
  5224.     m$ = m$ + "........" + Chr$(13)
  5225.     m$ = m$ + "........" + Chr$(13)
  5226.     m$ = m$ + "........" + Chr$(13)
  5227.     m$ = m$ + "........" + Chr$(13)
  5228.     m$ = m$ + "........" + Chr$(13)
  5229.     m$ = m$ + ".222222." + Chr$(13)
  5230.     m$ = m$ + "........" + Chr$(13)
  5231.     m$ = m$ + "........" + Chr$(13)
  5232.     arrTileText(95) = m$
  5233.  
  5234.     m$ = ""
  5235.     m$ = m$ + "........" + Chr$(13)
  5236.     m$ = m$ + "........" + Chr$(13)
  5237.     m$ = m$ + "........" + Chr$(13)
  5238.     m$ = m$ + "........" + Chr$(13)
  5239.     m$ = m$ + "........" + Chr$(13)
  5240.     m$ = m$ + "........" + Chr$(13)
  5241.     m$ = m$ + "........" + Chr$(13)
  5242.     m$ = m$ + "........" + Chr$(13)
  5243.     arrTileText(96) = m$
  5244.  
  5245.     m$ = ""
  5246.     m$ = m$ + "........" + Chr$(13)
  5247.     m$ = m$ + "..2222.." + Chr$(13)
  5248.     m$ = m$ + ".....22." + Chr$(13)
  5249.     m$ = m$ + "..22222." + Chr$(13)
  5250.     m$ = m$ + ".22..22." + Chr$(13)
  5251.     m$ = m$ + "..22222." + Chr$(13)
  5252.     m$ = m$ + "........" + Chr$(13)
  5253.     m$ = m$ + "........" + Chr$(13)
  5254.     arrTileText(97) = m$
  5255.  
  5256.     m$ = ""
  5257.     m$ = m$ + ".22....." + Chr$(13)
  5258.     m$ = m$ + ".22....." + Chr$(13)
  5259.     m$ = m$ + ".22222.." + Chr$(13)
  5260.     m$ = m$ + ".22..22." + Chr$(13)
  5261.     m$ = m$ + ".22..22." + Chr$(13)
  5262.     m$ = m$ + ".22222.." + Chr$(13)
  5263.     m$ = m$ + "........" + Chr$(13)
  5264.     m$ = m$ + "........" + Chr$(13)
  5265.     arrTileText(98) = m$
  5266.  
  5267.     m$ = ""
  5268.     m$ = m$ + "........" + Chr$(13)
  5269.     m$ = m$ + "..2222.." + Chr$(13)
  5270.     m$ = m$ + ".22....." + Chr$(13)
  5271.     m$ = m$ + ".22....." + Chr$(13)
  5272.     m$ = m$ + ".22....." + Chr$(13)
  5273.     m$ = m$ + "..2222.." + Chr$(13)
  5274.     m$ = m$ + "........" + Chr$(13)
  5275.     m$ = m$ + "........" + Chr$(13)
  5276.     arrTileText(99) = m$
  5277.  
  5278.     m$ = ""
  5279.     m$ = m$ + ".....22." + Chr$(13)
  5280.     m$ = m$ + ".....22." + Chr$(13)
  5281.     m$ = m$ + "..22222." + Chr$(13)
  5282.     m$ = m$ + ".22..22." + Chr$(13)
  5283.     m$ = m$ + ".22..22." + Chr$(13)
  5284.     m$ = m$ + "..22222." + Chr$(13)
  5285.     m$ = m$ + "........" + Chr$(13)
  5286.     m$ = m$ + "........" + Chr$(13)
  5287.     arrTileText(100) = m$
  5288.  
  5289.     m$ = ""
  5290.     m$ = m$ + "........" + Chr$(13)
  5291.     m$ = m$ + "..2222.." + Chr$(13)
  5292.     m$ = m$ + ".22..22." + Chr$(13)
  5293.     m$ = m$ + ".222222." + Chr$(13)
  5294.     m$ = m$ + ".22....." + Chr$(13)
  5295.     m$ = m$ + "..2222.." + Chr$(13)
  5296.     m$ = m$ + "........" + Chr$(13)
  5297.     m$ = m$ + "........" + Chr$(13)
  5298.     arrTileText(101) = m$
  5299.  
  5300.     m$ = ""
  5301.     m$ = m$ + "....222." + Chr$(13)
  5302.     m$ = m$ + "...22..." + Chr$(13)
  5303.     m$ = m$ + "..22222." + Chr$(13)
  5304.     m$ = m$ + "...22..." + Chr$(13)
  5305.     m$ = m$ + "...22..." + Chr$(13)
  5306.     m$ = m$ + "...22..." + Chr$(13)
  5307.     m$ = m$ + "........" + Chr$(13)
  5308.     m$ = m$ + "........" + Chr$(13)
  5309.     arrTileText(102) = m$
  5310.  
  5311.     m$ = ""
  5312.     m$ = m$ + "........" + Chr$(13)
  5313.     m$ = m$ + "..22222." + Chr$(13)
  5314.     m$ = m$ + ".22..22." + Chr$(13)
  5315.     m$ = m$ + ".22..22." + Chr$(13)
  5316.     m$ = m$ + "..22222." + Chr$(13)
  5317.     m$ = m$ + ".....22." + Chr$(13)
  5318.     m$ = m$ + ".22222.." + Chr$(13)
  5319.     m$ = m$ + "........" + Chr$(13)
  5320.     arrTileText(103) = m$
  5321.  
  5322.     m$ = ""
  5323.     m$ = m$ + ".22....." + Chr$(13)
  5324.     m$ = m$ + ".22....." + Chr$(13)
  5325.     m$ = m$ + ".22222.." + Chr$(13)
  5326.     m$ = m$ + ".22..22." + Chr$(13)
  5327.     m$ = m$ + ".22..22." + Chr$(13)
  5328.     m$ = m$ + ".22..22." + Chr$(13)
  5329.     m$ = m$ + "........" + Chr$(13)
  5330.     m$ = m$ + "........" + Chr$(13)
  5331.     arrTileText(104) = m$
  5332.  
  5333.     m$ = ""
  5334.     m$ = m$ + "...22..." + Chr$(13)
  5335.     m$ = m$ + "........" + Chr$(13)
  5336.     m$ = m$ + "..222..." + Chr$(13)
  5337.     m$ = m$ + "...22..." + Chr$(13)
  5338.     m$ = m$ + "...22..." + Chr$(13)
  5339.     m$ = m$ + "..2222.." + Chr$(13)
  5340.     m$ = m$ + "........" + Chr$(13)
  5341.     m$ = m$ + "........" + Chr$(13)
  5342.     arrTileText(105) = m$
  5343.  
  5344.     m$ = ""
  5345.     m$ = m$ + ".....22." + Chr$(13)
  5346.     m$ = m$ + "........" + Chr$(13)
  5347.     m$ = m$ + ".....22." + Chr$(13)
  5348.     m$ = m$ + ".....22." + Chr$(13)
  5349.     m$ = m$ + ".....22." + Chr$(13)
  5350.     m$ = m$ + ".....22." + Chr$(13)
  5351.     m$ = m$ + "..2222.." + Chr$(13)
  5352.     m$ = m$ + "........" + Chr$(13)
  5353.     arrTileText(106) = m$
  5354.  
  5355.     m$ = ""
  5356.     m$ = m$ + ".22....." + Chr$(13)
  5357.     m$ = m$ + ".22....." + Chr$(13)
  5358.     m$ = m$ + ".22.22.." + Chr$(13)
  5359.     m$ = m$ + ".2222..." + Chr$(13)
  5360.     m$ = m$ + ".22.22.." + Chr$(13)
  5361.     m$ = m$ + ".22..22." + Chr$(13)
  5362.     m$ = m$ + "........" + Chr$(13)
  5363.     m$ = m$ + "........" + Chr$(13)
  5364.     arrTileText(107) = m$
  5365.  
  5366.     m$ = ""
  5367.     m$ = m$ + "..222..." + Chr$(13)
  5368.     m$ = m$ + "...22..." + Chr$(13)
  5369.     m$ = m$ + "...22..." + Chr$(13)
  5370.     m$ = m$ + "...22..." + Chr$(13)
  5371.     m$ = m$ + "...22..." + Chr$(13)
  5372.     m$ = m$ + "..2222.." + Chr$(13)
  5373.     m$ = m$ + "........" + Chr$(13)
  5374.     m$ = m$ + "........" + Chr$(13)
  5375.     arrTileText(108) = m$
  5376.  
  5377.     m$ = ""
  5378.     m$ = m$ + "........" + Chr$(13)
  5379.     m$ = m$ + ".22..22." + Chr$(13)
  5380.     m$ = m$ + ".2222222" + Chr$(13)
  5381.     m$ = m$ + ".2222222" + Chr$(13)
  5382.     m$ = m$ + ".22.2.22" + Chr$(13)
  5383.     m$ = m$ + ".22...22" + Chr$(13)
  5384.     m$ = m$ + "........" + Chr$(13)
  5385.     m$ = m$ + "........" + Chr$(13)
  5386.     arrTileText(109) = m$
  5387.  
  5388.     m$ = ""
  5389.     m$ = m$ + "........" + Chr$(13)
  5390.     m$ = m$ + ".22222.." + Chr$(13)
  5391.     m$ = m$ + ".22..22." + Chr$(13)
  5392.     m$ = m$ + ".22..22." + Chr$(13)
  5393.     m$ = m$ + ".22..22." + Chr$(13)
  5394.     m$ = m$ + ".22..22." + Chr$(13)
  5395.     m$ = m$ + "........" + Chr$(13)
  5396.     m$ = m$ + "........" + Chr$(13)
  5397.     arrTileText(110) = m$
  5398.  
  5399.     m$ = ""
  5400.     m$ = m$ + "........" + Chr$(13)
  5401.     m$ = m$ + "..2222.." + Chr$(13)
  5402.     m$ = m$ + ".22..22." + Chr$(13)
  5403.     m$ = m$ + ".22..22." + Chr$(13)
  5404.     m$ = m$ + ".22..22." + Chr$(13)
  5405.     m$ = m$ + "..2222.." + Chr$(13)
  5406.     m$ = m$ + "........" + Chr$(13)
  5407.     m$ = m$ + "........" + Chr$(13)
  5408.     arrTileText(111) = m$
  5409.  
  5410.     m$ = ""
  5411.     m$ = m$ + "........" + Chr$(13)
  5412.     m$ = m$ + ".22222.." + Chr$(13)
  5413.     m$ = m$ + ".22..22." + Chr$(13)
  5414.     m$ = m$ + ".22..22." + Chr$(13)
  5415.     m$ = m$ + ".22222.." + Chr$(13)
  5416.     m$ = m$ + ".22....." + Chr$(13)
  5417.     m$ = m$ + ".22....." + Chr$(13)
  5418.     m$ = m$ + "........" + Chr$(13)
  5419.     arrTileText(112) = m$
  5420.  
  5421.     m$ = ""
  5422.     m$ = m$ + "........" + Chr$(13)
  5423.     m$ = m$ + "..22222." + Chr$(13)
  5424.     m$ = m$ + ".22..22." + Chr$(13)
  5425.     m$ = m$ + ".22..22." + Chr$(13)
  5426.     m$ = m$ + "..22222." + Chr$(13)
  5427.     m$ = m$ + ".....22." + Chr$(13)
  5428.     m$ = m$ + ".....22." + Chr$(13)
  5429.     m$ = m$ + "........" + Chr$(13)
  5430.     arrTileText(113) = m$
  5431.  
  5432.     m$ = ""
  5433.     m$ = m$ + "........" + Chr$(13)
  5434.     m$ = m$ + ".22222.." + Chr$(13)
  5435.     m$ = m$ + ".22..22." + Chr$(13)
  5436.     m$ = m$ + ".22....." + Chr$(13)
  5437.     m$ = m$ + ".22....." + Chr$(13)
  5438.     m$ = m$ + ".22....." + Chr$(13)
  5439.     m$ = m$ + "........" + Chr$(13)
  5440.     m$ = m$ + "........" + Chr$(13)
  5441.     arrTileText(114) = m$
  5442.  
  5443.     m$ = ""
  5444.     m$ = m$ + "........" + Chr$(13)
  5445.     m$ = m$ + "..22222." + Chr$(13)
  5446.     m$ = m$ + ".22....." + Chr$(13)
  5447.     m$ = m$ + "..2222.." + Chr$(13)
  5448.     m$ = m$ + ".....22." + Chr$(13)
  5449.     m$ = m$ + ".22222.." + Chr$(13)
  5450.     m$ = m$ + "........" + Chr$(13)
  5451.     m$ = m$ + "........" + Chr$(13)
  5452.     arrTileText(115) = m$
  5453.  
  5454.     m$ = ""
  5455.     m$ = m$ + "...22..." + Chr$(13)
  5456.     m$ = m$ + ".222222." + Chr$(13)
  5457.     m$ = m$ + "...22..." + Chr$(13)
  5458.     m$ = m$ + "...22..." + Chr$(13)
  5459.     m$ = m$ + "...22..." + Chr$(13)
  5460.     m$ = m$ + "....222." + Chr$(13)
  5461.     m$ = m$ + "........" + Chr$(13)
  5462.     m$ = m$ + "........" + Chr$(13)
  5463.     arrTileText(116) = m$
  5464.  
  5465.     m$ = ""
  5466.     m$ = m$ + "........" + Chr$(13)
  5467.     m$ = m$ + ".22..22." + Chr$(13)
  5468.     m$ = m$ + ".22..22." + Chr$(13)
  5469.     m$ = m$ + ".22..22." + Chr$(13)
  5470.     m$ = m$ + ".22..22." + Chr$(13)
  5471.     m$ = m$ + "..22222." + Chr$(13)
  5472.     m$ = m$ + "........" + Chr$(13)
  5473.     m$ = m$ + "........" + Chr$(13)
  5474.     arrTileText(117) = m$
  5475.  
  5476.     m$ = ""
  5477.     m$ = m$ + "........" + Chr$(13)
  5478.     m$ = m$ + ".22..22." + Chr$(13)
  5479.     m$ = m$ + ".22..22." + Chr$(13)
  5480.     m$ = m$ + ".22..22." + Chr$(13)
  5481.     m$ = m$ + "..2222.." + Chr$(13)
  5482.     m$ = m$ + "...22..." + Chr$(13)
  5483.     m$ = m$ + "........" + Chr$(13)
  5484.     m$ = m$ + "........" + Chr$(13)
  5485.     arrTileText(118) = m$
  5486.  
  5487.     m$ = ""
  5488.     m$ = m$ + "........" + Chr$(13)
  5489.     m$ = m$ + ".22...22" + Chr$(13)
  5490.     m$ = m$ + ".22.2.22" + Chr$(13)
  5491.     m$ = m$ + ".2222222" + Chr$(13)
  5492.     m$ = m$ + "..22222." + Chr$(13)
  5493.     m$ = m$ + "..22.22." + Chr$(13)
  5494.     m$ = m$ + "........" + Chr$(13)
  5495.     m$ = m$ + "........" + Chr$(13)
  5496.     arrTileText(119) = m$
  5497.  
  5498.     m$ = ""
  5499.     m$ = m$ + "........" + Chr$(13)
  5500.     m$ = m$ + ".22..22." + Chr$(13)
  5501.     m$ = m$ + "..2222.." + Chr$(13)
  5502.     m$ = m$ + "...22..." + Chr$(13)
  5503.     m$ = m$ + "..2222.." + Chr$(13)
  5504.     m$ = m$ + ".22..22." + Chr$(13)
  5505.     m$ = m$ + "........" + Chr$(13)
  5506.     m$ = m$ + "........" + Chr$(13)
  5507.     arrTileText(120) = m$
  5508.  
  5509.     m$ = ""
  5510.     m$ = m$ + "........" + Chr$(13)
  5511.     m$ = m$ + ".22..22." + Chr$(13)
  5512.     m$ = m$ + ".22..22." + Chr$(13)
  5513.     m$ = m$ + ".22..22." + Chr$(13)
  5514.     m$ = m$ + "..22222." + Chr$(13)
  5515.     m$ = m$ + "....22.." + Chr$(13)
  5516.     m$ = m$ + ".2222..." + Chr$(13)
  5517.     m$ = m$ + "........" + Chr$(13)
  5518.     arrTileText(121) = m$
  5519.  
  5520.     m$ = ""
  5521.     m$ = m$ + "........" + Chr$(13)
  5522.     m$ = m$ + ".222222." + Chr$(13)
  5523.     m$ = m$ + "....22.." + Chr$(13)
  5524.     m$ = m$ + "...22..." + Chr$(13)
  5525.     m$ = m$ + "..22...." + Chr$(13)
  5526.     m$ = m$ + ".222222." + Chr$(13)
  5527.     m$ = m$ + "........" + Chr$(13)
  5528.     m$ = m$ + "........" + Chr$(13)
  5529.     arrTileText(122) = m$
  5530.  
  5531.     m$ = ""
  5532.     m$ = m$ + "...222.." + Chr$(13)
  5533.     m$ = m$ + "..22...." + Chr$(13)
  5534.     m$ = m$ + "..2....." + Chr$(13)
  5535.     m$ = m$ + ".22....." + Chr$(13)
  5536.     m$ = m$ + "..2....." + Chr$(13)
  5537.     m$ = m$ + "..22...." + Chr$(13)
  5538.     m$ = m$ + "...222.." + Chr$(13)
  5539.     m$ = m$ + "........" + Chr$(13)
  5540.     arrTileText(123) = m$
  5541.  
  5542.     m$ = ""
  5543.     m$ = m$ + "....2..." + Chr$(13)
  5544.     m$ = m$ + "....2..." + Chr$(13)
  5545.     m$ = m$ + "....2..." + Chr$(13)
  5546.     m$ = m$ + "....2..." + Chr$(13)
  5547.     m$ = m$ + "....2..." + Chr$(13)
  5548.     m$ = m$ + "....2..." + Chr$(13)
  5549.     m$ = m$ + "....2..." + Chr$(13)
  5550.     m$ = m$ + "........" + Chr$(13)
  5551.     arrTileText(124) = m$
  5552.  
  5553.     m$ = ""
  5554.     m$ = m$ + "..222..." + Chr$(13)
  5555.     m$ = m$ + "....22.." + Chr$(13)
  5556.     m$ = m$ + ".....2.." + Chr$(13)
  5557.     m$ = m$ + ".....22." + Chr$(13)
  5558.     m$ = m$ + ".....2.." + Chr$(13)
  5559.     m$ = m$ + "....22.." + Chr$(13)
  5560.     m$ = m$ + "..222..." + Chr$(13)
  5561.     m$ = m$ + "........" + Chr$(13)
  5562.     arrTileText(125) = m$
  5563.  
  5564.     m$ = ""
  5565.     m$ = m$ + "........" + Chr$(13)
  5566.     m$ = m$ + ".22....2" + Chr$(13)
  5567.     m$ = m$ + "2..2..2." + Chr$(13)
  5568.     m$ = m$ + "....22.." + Chr$(13)
  5569.     m$ = m$ + "........" + Chr$(13)
  5570.     m$ = m$ + "........" + Chr$(13)
  5571.     m$ = m$ + "........" + Chr$(13)
  5572.     m$ = m$ + "........" + Chr$(13)
  5573.     arrTileText(126) = m$
  5574.  
  5575.     m$ = ""
  5576.     m$ = m$ + "........" + Chr$(13)
  5577.     m$ = m$ + "........" + Chr$(13)
  5578.     m$ = m$ + "........" + Chr$(13)
  5579.     m$ = m$ + "........" + Chr$(13)
  5580.     m$ = m$ + "........" + Chr$(13)
  5581.     m$ = m$ + "........" + Chr$(13)
  5582.     m$ = m$ + "........" + Chr$(13)
  5583.     m$ = m$ + "........" + Chr$(13)
  5584.     arrTileText(127) = m$
  5585.  
  5586.     m$ = ""
  5587.     m$ = m$ + "........" + Chr$(13)
  5588.     m$ = m$ + "........" + Chr$(13)
  5589.     m$ = m$ + "........" + Chr$(13)
  5590.     m$ = m$ + "22222222" + Chr$(13)
  5591.     m$ = m$ + "22222222" + Chr$(13)
  5592.     m$ = m$ + "........" + Chr$(13)
  5593.     m$ = m$ + "........" + Chr$(13)
  5594.     m$ = m$ + "........" + Chr$(13)
  5595.     arrTileText(128) = m$
  5596.  
  5597.     m$ = ""
  5598.     m$ = m$ + "....2..." + Chr$(13)
  5599.     m$ = m$ + "...222.." + Chr$(13)
  5600.     m$ = m$ + "..22222." + Chr$(13)
  5601.     m$ = m$ + ".2222222" + Chr$(13)
  5602.     m$ = m$ + ".2222222" + Chr$(13)
  5603.     m$ = m$ + "...222.." + Chr$(13)
  5604.     m$ = m$ + "..22222." + Chr$(13)
  5605.     m$ = m$ + "........" + Chr$(13)
  5606.     arrTileText(129) = m$
  5607.  
  5608.     m$ = ""
  5609.     m$ = m$ + "...22..." + Chr$(13)
  5610.     m$ = m$ + "...22..." + Chr$(13)
  5611.     m$ = m$ + "...22..." + Chr$(13)
  5612.     m$ = m$ + "...22..." + Chr$(13)
  5613.     m$ = m$ + "...22..." + Chr$(13)
  5614.     m$ = m$ + "...22..." + Chr$(13)
  5615.     m$ = m$ + "...22..." + Chr$(13)
  5616.     m$ = m$ + "...22..." + Chr$(13)
  5617.     arrTileText(130) = m$
  5618.  
  5619.     m$ = ""
  5620.     m$ = m$ + "........" + Chr$(13)
  5621.     m$ = m$ + "........" + Chr$(13)
  5622.     m$ = m$ + "........" + Chr$(13)
  5623.     m$ = m$ + "22222222" + Chr$(13)
  5624.     m$ = m$ + "22222222" + Chr$(13)
  5625.     m$ = m$ + "........" + Chr$(13)
  5626.     m$ = m$ + "........" + Chr$(13)
  5627.     m$ = m$ + "........" + Chr$(13)
  5628.     arrTileText(131) = m$
  5629.  
  5630.     m$ = ""
  5631.     m$ = m$ + "........" + Chr$(13)
  5632.     m$ = m$ + "........" + Chr$(13)
  5633.     m$ = m$ + "22222222" + Chr$(13)
  5634.     m$ = m$ + "22222222" + Chr$(13)
  5635.     m$ = m$ + "........" + Chr$(13)
  5636.     m$ = m$ + "........" + Chr$(13)
  5637.     m$ = m$ + "........" + Chr$(13)
  5638.     m$ = m$ + "........" + Chr$(13)
  5639.     arrTileText(132) = m$
  5640.  
  5641.     m$ = ""
  5642.     m$ = m$ + "........" + Chr$(13)
  5643.     m$ = m$ + "22222222" + Chr$(13)
  5644.     m$ = m$ + "22222222" + Chr$(13)
  5645.     m$ = m$ + "........" + Chr$(13)
  5646.     m$ = m$ + "........" + Chr$(13)
  5647.     m$ = m$ + "........" + Chr$(13)
  5648.     m$ = m$ + "........" + Chr$(13)
  5649.     m$ = m$ + "........" + Chr$(13)
  5650.     arrTileText(133) = m$
  5651.  
  5652.     m$ = ""
  5653.     m$ = m$ + "........" + Chr$(13)
  5654.     m$ = m$ + "........" + Chr$(13)
  5655.     m$ = m$ + "........" + Chr$(13)
  5656.     m$ = m$ + "........" + Chr$(13)
  5657.     m$ = m$ + "22222222" + Chr$(13)
  5658.     m$ = m$ + "22222222" + Chr$(13)
  5659.     m$ = m$ + "........" + Chr$(13)
  5660.     m$ = m$ + "........" + Chr$(13)
  5661.     arrTileText(134) = m$
  5662.  
  5663.     m$ = ""
  5664.     m$ = m$ + "..22...." + Chr$(13)
  5665.     m$ = m$ + "..22...." + Chr$(13)
  5666.     m$ = m$ + "..22...." + Chr$(13)
  5667.     m$ = m$ + "..22...." + Chr$(13)
  5668.     m$ = m$ + "..22...." + Chr$(13)
  5669.     m$ = m$ + "..22...." + Chr$(13)
  5670.     m$ = m$ + "..22...." + Chr$(13)
  5671.     m$ = m$ + "..22...." + Chr$(13)
  5672.     arrTileText(135) = m$
  5673.  
  5674.     m$ = ""
  5675.     m$ = m$ + "....22.." + Chr$(13)
  5676.     m$ = m$ + "....22.." + Chr$(13)
  5677.     m$ = m$ + "....22.." + Chr$(13)
  5678.     m$ = m$ + "....22.." + Chr$(13)
  5679.     m$ = m$ + "....22.." + Chr$(13)
  5680.     m$ = m$ + "....22.." + Chr$(13)
  5681.     m$ = m$ + "....22.." + Chr$(13)
  5682.     m$ = m$ + "....22.." + Chr$(13)
  5683.     arrTileText(136) = m$
  5684.  
  5685.     m$ = ""
  5686.     m$ = m$ + "........" + Chr$(13)
  5687.     m$ = m$ + "........" + Chr$(13)
  5688.     m$ = m$ + "........" + Chr$(13)
  5689.     m$ = m$ + "222....." + Chr$(13)
  5690.     m$ = m$ + "2222...." + Chr$(13)
  5691.     m$ = m$ + "..222..." + Chr$(13)
  5692.     m$ = m$ + "...22..." + Chr$(13)
  5693.     m$ = m$ + "...22..." + Chr$(13)
  5694.     arrTileText(137) = m$
  5695.  
  5696.     m$ = ""
  5697.     m$ = m$ + "...22..." + Chr$(13)
  5698.     m$ = m$ + "...22..." + Chr$(13)
  5699.     m$ = m$ + "...222.." + Chr$(13)
  5700.     m$ = m$ + "....2222" + Chr$(13)
  5701.     m$ = m$ + ".....222" + Chr$(13)
  5702.     m$ = m$ + "........" + Chr$(13)
  5703.     m$ = m$ + "........" + Chr$(13)
  5704.     m$ = m$ + "........" + Chr$(13)
  5705.     arrTileText(138) = m$
  5706.  
  5707.     m$ = ""
  5708.     m$ = m$ + "...22..." + Chr$(13)
  5709.     m$ = m$ + "...22..." + Chr$(13)
  5710.     m$ = m$ + "..222..." + Chr$(13)
  5711.     m$ = m$ + "2222...." + Chr$(13)
  5712.     m$ = m$ + "222....." + Chr$(13)
  5713.     m$ = m$ + "........" + Chr$(13)
  5714.     m$ = m$ + "........" + Chr$(13)
  5715.     m$ = m$ + "........" + Chr$(13)
  5716.     arrTileText(139) = m$
  5717.  
  5718.     m$ = ""
  5719.     m$ = m$ + "22......" + Chr$(13)
  5720.     m$ = m$ + "22......" + Chr$(13)
  5721.     m$ = m$ + "22......" + Chr$(13)
  5722.     m$ = m$ + "22......" + Chr$(13)
  5723.     m$ = m$ + "22......" + Chr$(13)
  5724.     m$ = m$ + "22......" + Chr$(13)
  5725.     m$ = m$ + "22222222" + Chr$(13)
  5726.     m$ = m$ + "22222222" + Chr$(13)
  5727.     arrTileText(140) = m$
  5728.  
  5729.     m$ = ""
  5730.     m$ = m$ + "22......" + Chr$(13)
  5731.     m$ = m$ + "222....." + Chr$(13)
  5732.     m$ = m$ + ".222...." + Chr$(13)
  5733.     m$ = m$ + "..222..." + Chr$(13)
  5734.     m$ = m$ + "...222.." + Chr$(13)
  5735.     m$ = m$ + "....222." + Chr$(13)
  5736.     m$ = m$ + ".....222" + Chr$(13)
  5737.     m$ = m$ + "......22" + Chr$(13)
  5738.     arrTileText(141) = m$
  5739.  
  5740.     m$ = ""
  5741.     m$ = m$ + "......22" + Chr$(13)
  5742.     m$ = m$ + ".....222" + Chr$(13)
  5743.     m$ = m$ + "....222." + Chr$(13)
  5744.     m$ = m$ + "...222.." + Chr$(13)
  5745.     m$ = m$ + "..222..." + Chr$(13)
  5746.     m$ = m$ + ".222...." + Chr$(13)
  5747.     m$ = m$ + "222....." + Chr$(13)
  5748.     m$ = m$ + "22......" + Chr$(13)
  5749.     arrTileText(142) = m$
  5750.  
  5751.     m$ = ""
  5752.     m$ = m$ + "22222222" + Chr$(13)
  5753.     m$ = m$ + "22222222" + Chr$(13)
  5754.     m$ = m$ + "22......" + Chr$(13)
  5755.     m$ = m$ + "22......" + Chr$(13)
  5756.     m$ = m$ + "22......" + Chr$(13)
  5757.     m$ = m$ + "22......" + Chr$(13)
  5758.     m$ = m$ + "22......" + Chr$(13)
  5759.     m$ = m$ + "22......" + Chr$(13)
  5760.     arrTileText(143) = m$
  5761.  
  5762.     m$ = ""
  5763.     m$ = m$ + "22222222" + Chr$(13)
  5764.     m$ = m$ + "22222222" + Chr$(13)
  5765.     m$ = m$ + "......22" + Chr$(13)
  5766.     m$ = m$ + "......22" + Chr$(13)
  5767.     m$ = m$ + "......22" + Chr$(13)
  5768.     m$ = m$ + "......22" + Chr$(13)
  5769.     m$ = m$ + "......22" + Chr$(13)
  5770.     m$ = m$ + "......22" + Chr$(13)
  5771.     arrTileText(144) = m$
  5772.  
  5773.     m$ = ""
  5774.     m$ = m$ + "........" + Chr$(13)
  5775.     m$ = m$ + "..2222.." + Chr$(13)
  5776.     m$ = m$ + ".222222." + Chr$(13)
  5777.     m$ = m$ + ".222222." + Chr$(13)
  5778.     m$ = m$ + ".222222." + Chr$(13)
  5779.     m$ = m$ + ".222222." + Chr$(13)
  5780.     m$ = m$ + "..2222.." + Chr$(13)
  5781.     m$ = m$ + "........" + Chr$(13)
  5782.     arrTileText(145) = m$
  5783.  
  5784.     m$ = ""
  5785.     m$ = m$ + "........" + Chr$(13)
  5786.     m$ = m$ + "........" + Chr$(13)
  5787.     m$ = m$ + "........" + Chr$(13)
  5788.     m$ = m$ + "........" + Chr$(13)
  5789.     m$ = m$ + "........" + Chr$(13)
  5790.     m$ = m$ + "22222222" + Chr$(13)
  5791.     m$ = m$ + "22222222" + Chr$(13)
  5792.     m$ = m$ + "........" + Chr$(13)
  5793.     arrTileText(146) = m$
  5794.  
  5795.     m$ = ""
  5796.     m$ = m$ + "..22.22." + Chr$(13)
  5797.     m$ = m$ + ".2222222" + Chr$(13)
  5798.     m$ = m$ + ".2222222" + Chr$(13)
  5799.     m$ = m$ + ".2222222" + Chr$(13)
  5800.     m$ = m$ + "..22222." + Chr$(13)
  5801.     m$ = m$ + "...222.." + Chr$(13)
  5802.     m$ = m$ + "....2..." + Chr$(13)
  5803.     m$ = m$ + "........" + Chr$(13)
  5804.     arrTileText(147) = m$
  5805.  
  5806.     m$ = ""
  5807.     m$ = m$ + ".22....." + Chr$(13)
  5808.     m$ = m$ + ".22....." + Chr$(13)
  5809.     m$ = m$ + ".22....." + Chr$(13)
  5810.     m$ = m$ + ".22....." + Chr$(13)
  5811.     m$ = m$ + ".22....." + Chr$(13)
  5812.     m$ = m$ + ".22....." + Chr$(13)
  5813.     m$ = m$ + ".22....." + Chr$(13)
  5814.     m$ = m$ + ".22....." + Chr$(13)
  5815.     arrTileText(148) = m$
  5816.  
  5817.     m$ = ""
  5818.     m$ = m$ + "........" + Chr$(13)
  5819.     m$ = m$ + "........" + Chr$(13)
  5820.     m$ = m$ + "........" + Chr$(13)
  5821.     m$ = m$ + ".....222" + Chr$(13)
  5822.     m$ = m$ + "....2222" + Chr$(13)
  5823.     m$ = m$ + "...222.." + Chr$(13)
  5824.     m$ = m$ + "...22..." + Chr$(13)
  5825.     m$ = m$ + "...22..." + Chr$(13)
  5826.     arrTileText(149) = m$
  5827.  
  5828.     m$ = ""
  5829.     m$ = m$ + "22....22" + Chr$(13)
  5830.     m$ = m$ + "222..222" + Chr$(13)
  5831.     m$ = m$ + ".222222." + Chr$(13)
  5832.     m$ = m$ + "..2222.." + Chr$(13)
  5833.     m$ = m$ + "..2222.." + Chr$(13)
  5834.     m$ = m$ + ".222222." + Chr$(13)
  5835.     m$ = m$ + "222..222" + Chr$(13)
  5836.     m$ = m$ + "22....22" + Chr$(13)
  5837.     arrTileText(150) = m$
  5838.  
  5839.     m$ = ""
  5840.     m$ = m$ + "........" + Chr$(13)
  5841.     m$ = m$ + "..2222.." + Chr$(13)
  5842.     m$ = m$ + ".222222." + Chr$(13)
  5843.     m$ = m$ + ".22..22." + Chr$(13)
  5844.     m$ = m$ + ".22..22." + Chr$(13)
  5845.     m$ = m$ + ".222222." + Chr$(13)
  5846.     m$ = m$ + "..2222.." + Chr$(13)
  5847.     m$ = m$ + "........" + Chr$(13)
  5848.     arrTileText(151) = m$
  5849.  
  5850.     m$ = ""
  5851.     m$ = m$ + "...22..." + Chr$(13)
  5852.     m$ = m$ + "...22..." + Chr$(13)
  5853.     m$ = m$ + ".22..22." + Chr$(13)
  5854.     m$ = m$ + ".22..22." + Chr$(13)
  5855.     m$ = m$ + "...22..." + Chr$(13)
  5856.     m$ = m$ + "...22..." + Chr$(13)
  5857.     m$ = m$ + "..2222.." + Chr$(13)
  5858.     m$ = m$ + "........" + Chr$(13)
  5859.     arrTileText(152) = m$
  5860.  
  5861.     m$ = ""
  5862.     m$ = m$ + ".....22." + Chr$(13)
  5863.     m$ = m$ + ".....22." + Chr$(13)
  5864.     m$ = m$ + ".....22." + Chr$(13)
  5865.     m$ = m$ + ".....22." + Chr$(13)
  5866.     m$ = m$ + ".....22." + Chr$(13)
  5867.     m$ = m$ + ".....22." + Chr$(13)
  5868.     m$ = m$ + ".....22." + Chr$(13)
  5869.     m$ = m$ + ".....22." + Chr$(13)
  5870.     arrTileText(153) = m$
  5871.  
  5872.     m$ = ""
  5873.     m$ = m$ + "....2..." + Chr$(13)
  5874.     m$ = m$ + "...222.." + Chr$(13)
  5875.     m$ = m$ + "..22222." + Chr$(13)
  5876.     m$ = m$ + ".2222222" + Chr$(13)
  5877.     m$ = m$ + "..22222." + Chr$(13)
  5878.     m$ = m$ + "...222.." + Chr$(13)
  5879.     m$ = m$ + "....2..." + Chr$(13)
  5880.     m$ = m$ + "........" + Chr$(13)
  5881.     arrTileText(154) = m$
  5882.  
  5883.     m$ = ""
  5884.     m$ = m$ + "...22..." + Chr$(13)
  5885.     m$ = m$ + "...22..." + Chr$(13)
  5886.     m$ = m$ + "...22..." + Chr$(13)
  5887.     m$ = m$ + "22222222" + Chr$(13)
  5888.     m$ = m$ + "22222222" + Chr$(13)
  5889.     m$ = m$ + "...22..." + Chr$(13)
  5890.     m$ = m$ + "...22..." + Chr$(13)
  5891.     m$ = m$ + "...22..." + Chr$(13)
  5892.     arrTileText(155) = m$
  5893.  
  5894.     m$ = ""
  5895.     m$ = m$ + "22......" + Chr$(13)
  5896.     m$ = m$ + "22......" + Chr$(13)
  5897.     m$ = m$ + "..22...." + Chr$(13)
  5898.     m$ = m$ + "..22...." + Chr$(13)
  5899.     m$ = m$ + "22......" + Chr$(13)
  5900.     m$ = m$ + "22......" + Chr$(13)
  5901.     m$ = m$ + "..22...." + Chr$(13)
  5902.     m$ = m$ + "..22...." + Chr$(13)
  5903.     arrTileText(156) = m$
  5904.  
  5905.     m$ = ""
  5906.     m$ = m$ + "...22..." + Chr$(13)
  5907.     m$ = m$ + "...22..." + Chr$(13)
  5908.     m$ = m$ + "...22..." + Chr$(13)
  5909.     m$ = m$ + "...22..." + Chr$(13)
  5910.     m$ = m$ + "...22..." + Chr$(13)
  5911.     m$ = m$ + "...22..." + Chr$(13)
  5912.     m$ = m$ + "...22..." + Chr$(13)
  5913.     m$ = m$ + "...22..." + Chr$(13)
  5914.     arrTileText(157) = m$
  5915.  
  5916.     m$ = ""
  5917.     m$ = m$ + "........" + Chr$(13)
  5918.     m$ = m$ + "........" + Chr$(13)
  5919.     m$ = m$ + "......22" + Chr$(13)
  5920.     m$ = m$ + "..22222." + Chr$(13)
  5921.     m$ = m$ + ".222.22." + Chr$(13)
  5922.     m$ = m$ + "..22.22." + Chr$(13)
  5923.     m$ = m$ + "..22.22." + Chr$(13)
  5924.     m$ = m$ + "........" + Chr$(13)
  5925.     arrTileText(158) = m$
  5926.  
  5927.     m$ = ""
  5928.     m$ = m$ + "22222222" + Chr$(13)
  5929.     m$ = m$ + ".2222222" + Chr$(13)
  5930.     m$ = m$ + "..222222" + Chr$(13)
  5931.     m$ = m$ + "...22222" + Chr$(13)
  5932.     m$ = m$ + "....2222" + Chr$(13)
  5933.     m$ = m$ + ".....222" + Chr$(13)
  5934.     m$ = m$ + "......22" + Chr$(13)
  5935.     m$ = m$ + ".......2" + Chr$(13)
  5936.     arrTileText(159) = m$
  5937.  
  5938.     m$ = ""
  5939.     m$ = m$ + "........" + Chr$(13)
  5940.     m$ = m$ + "........" + Chr$(13)
  5941.     m$ = m$ + "........" + Chr$(13)
  5942.     m$ = m$ + "........" + Chr$(13)
  5943.     m$ = m$ + "........" + Chr$(13)
  5944.     m$ = m$ + "........" + Chr$(13)
  5945.     m$ = m$ + "........" + Chr$(13)
  5946.     m$ = m$ + "........" + Chr$(13)
  5947.     arrTileText(160) = m$
  5948.  
  5949.     m$ = ""
  5950.     m$ = m$ + "2222...." + Chr$(13)
  5951.     m$ = m$ + "2222...." + Chr$(13)
  5952.     m$ = m$ + "2222...." + Chr$(13)
  5953.     m$ = m$ + "2222...." + Chr$(13)
  5954.     m$ = m$ + "2222...." + Chr$(13)
  5955.     m$ = m$ + "2222...." + Chr$(13)
  5956.     m$ = m$ + "2222...." + Chr$(13)
  5957.     m$ = m$ + "2222...." + Chr$(13)
  5958.     arrTileText(161) = m$
  5959.  
  5960.     m$ = ""
  5961.     m$ = m$ + "........" + Chr$(13)
  5962.     m$ = m$ + "........" + Chr$(13)
  5963.     m$ = m$ + "........" + Chr$(13)
  5964.     m$ = m$ + "........" + Chr$(13)
  5965.     m$ = m$ + "22222222" + Chr$(13)
  5966.     m$ = m$ + "22222222" + Chr$(13)
  5967.     m$ = m$ + "22222222" + Chr$(13)
  5968.     m$ = m$ + "22222222" + Chr$(13)
  5969.     arrTileText(162) = m$
  5970.  
  5971.     m$ = ""
  5972.     m$ = m$ + "22222222" + Chr$(13)
  5973.     m$ = m$ + "........" + Chr$(13)
  5974.     m$ = m$ + "........" + Chr$(13)
  5975.     m$ = m$ + "........" + Chr$(13)
  5976.     m$ = m$ + "........" + Chr$(13)
  5977.     m$ = m$ + "........" + Chr$(13)
  5978.     m$ = m$ + "........" + Chr$(13)
  5979.     m$ = m$ + "........" + Chr$(13)
  5980.     arrTileText(163) = m$
  5981.  
  5982.     m$ = ""
  5983.     m$ = m$ + "........" + Chr$(13)
  5984.     m$ = m$ + "........" + Chr$(13)
  5985.     m$ = m$ + "........" + Chr$(13)
  5986.     m$ = m$ + "........" + Chr$(13)
  5987.     m$ = m$ + "........" + Chr$(13)
  5988.     m$ = m$ + "........" + Chr$(13)
  5989.     m$ = m$ + "........" + Chr$(13)
  5990.     m$ = m$ + "22222222" + Chr$(13)
  5991.     arrTileText(164) = m$
  5992.  
  5993.     m$ = ""
  5994.     m$ = m$ + "22......" + Chr$(13)
  5995.     m$ = m$ + "22......" + Chr$(13)
  5996.     m$ = m$ + "22......" + Chr$(13)
  5997.     m$ = m$ + "22......" + Chr$(13)
  5998.     m$ = m$ + "22......" + Chr$(13)
  5999.     m$ = m$ + "22......" + Chr$(13)
  6000.     m$ = m$ + "22......" + Chr$(13)
  6001.     m$ = m$ + "22......" + Chr$(13)
  6002.     arrTileText(165) = m$
  6003.  
  6004.     m$ = ""
  6005.     m$ = m$ + "22..22.." + Chr$(13)
  6006.     m$ = m$ + "22..22.." + Chr$(13)
  6007.     m$ = m$ + "..22..22" + Chr$(13)
  6008.     m$ = m$ + "..22..22" + Chr$(13)
  6009.     m$ = m$ + "22..22.." + Chr$(13)
  6010.     m$ = m$ + "22..22.." + Chr$(13)
  6011.     m$ = m$ + "..22..22" + Chr$(13)
  6012.     m$ = m$ + "..22..22" + Chr$(13)
  6013.     arrTileText(166) = m$
  6014.  
  6015.     m$ = ""
  6016.     m$ = m$ + "......22" + Chr$(13)
  6017.     m$ = m$ + "......22" + Chr$(13)
  6018.     m$ = m$ + "......22" + Chr$(13)
  6019.     m$ = m$ + "......22" + Chr$(13)
  6020.     m$ = m$ + "......22" + Chr$(13)
  6021.     m$ = m$ + "......22" + Chr$(13)
  6022.     m$ = m$ + "......22" + Chr$(13)
  6023.     m$ = m$ + "......22" + Chr$(13)
  6024.     arrTileText(167) = m$
  6025.  
  6026.     m$ = ""
  6027.     m$ = m$ + "........" + Chr$(13)
  6028.     m$ = m$ + "........" + Chr$(13)
  6029.     m$ = m$ + "........" + Chr$(13)
  6030.     m$ = m$ + "........" + Chr$(13)
  6031.     m$ = m$ + "22..22.." + Chr$(13)
  6032.     m$ = m$ + "22..22.." + Chr$(13)
  6033.     m$ = m$ + "..22..22" + Chr$(13)
  6034.     m$ = m$ + "..22..22" + Chr$(13)
  6035.     arrTileText(168) = m$
  6036.  
  6037.     m$ = ""
  6038.     m$ = m$ + "22222222" + Chr$(13)
  6039.     m$ = m$ + "2222222." + Chr$(13)
  6040.     m$ = m$ + "222222.." + Chr$(13)
  6041.     m$ = m$ + "22222..." + Chr$(13)
  6042.     m$ = m$ + "2222...." + Chr$(13)
  6043.     m$ = m$ + "222....." + Chr$(13)
  6044.     m$ = m$ + "22......" + Chr$(13)
  6045.     m$ = m$ + "2......." + Chr$(13)
  6046.     arrTileText(169) = m$
  6047.  
  6048.     m$ = ""
  6049.     m$ = m$ + "......22" + Chr$(13)
  6050.     m$ = m$ + "......22" + Chr$(13)
  6051.     m$ = m$ + "......22" + Chr$(13)
  6052.     m$ = m$ + "......22" + Chr$(13)
  6053.     m$ = m$ + "......22" + Chr$(13)
  6054.     m$ = m$ + "......22" + Chr$(13)
  6055.     m$ = m$ + "......22" + Chr$(13)
  6056.     m$ = m$ + "......22" + Chr$(13)
  6057.     arrTileText(170) = m$
  6058.  
  6059.     m$ = ""
  6060.     m$ = m$ + "...22..." + Chr$(13)
  6061.     m$ = m$ + "...22..." + Chr$(13)
  6062.     m$ = m$ + "...22..." + Chr$(13)
  6063.     m$ = m$ + "...22222" + Chr$(13)
  6064.     m$ = m$ + "...22222" + Chr$(13)
  6065.     m$ = m$ + "...22..." + Chr$(13)
  6066.     m$ = m$ + "...22..." + Chr$(13)
  6067.     m$ = m$ + "...22..." + Chr$(13)
  6068.     arrTileText(171) = m$
  6069.  
  6070.     m$ = ""
  6071.     m$ = m$ + "........" + Chr$(13)
  6072.     m$ = m$ + "........" + Chr$(13)
  6073.     m$ = m$ + "........" + Chr$(13)
  6074.     m$ = m$ + "........" + Chr$(13)
  6075.     m$ = m$ + "....2222" + Chr$(13)
  6076.     m$ = m$ + "....2222" + Chr$(13)
  6077.     m$ = m$ + "....2222" + Chr$(13)
  6078.     m$ = m$ + "....2222" + Chr$(13)
  6079.     arrTileText(172) = m$
  6080.  
  6081.     m$ = ""
  6082.     m$ = m$ + "...22..." + Chr$(13)
  6083.     m$ = m$ + "...22..." + Chr$(13)
  6084.     m$ = m$ + "...22..." + Chr$(13)
  6085.     m$ = m$ + "...22222" + Chr$(13)
  6086.     m$ = m$ + "...22222" + Chr$(13)
  6087.     m$ = m$ + "........" + Chr$(13)
  6088.     m$ = m$ + "........" + Chr$(13)
  6089.     m$ = m$ + "........" + Chr$(13)
  6090.     arrTileText(173) = m$
  6091.  
  6092.     m$ = ""
  6093.     m$ = m$ + "........" + Chr$(13)
  6094.     m$ = m$ + "........" + Chr$(13)
  6095.     m$ = m$ + "........" + Chr$(13)
  6096.     m$ = m$ + "22222..." + Chr$(13)
  6097.     m$ = m$ + "22222..." + Chr$(13)
  6098.     m$ = m$ + "...22..." + Chr$(13)
  6099.     m$ = m$ + "...22..." + Chr$(13)
  6100.     m$ = m$ + "...22..." + Chr$(13)
  6101.     arrTileText(174) = m$
  6102.  
  6103.     m$ = ""
  6104.     m$ = m$ + "........" + Chr$(13)
  6105.     m$ = m$ + "........" + Chr$(13)
  6106.     m$ = m$ + "........" + Chr$(13)
  6107.     m$ = m$ + "........" + Chr$(13)
  6108.     m$ = m$ + "........" + Chr$(13)
  6109.     m$ = m$ + "........" + Chr$(13)
  6110.     m$ = m$ + "22222222" + Chr$(13)
  6111.     m$ = m$ + "22222222" + Chr$(13)
  6112.     arrTileText(175) = m$
  6113.  
  6114.     m$ = ""
  6115.     m$ = m$ + "........" + Chr$(13)
  6116.     m$ = m$ + "........" + Chr$(13)
  6117.     m$ = m$ + "........" + Chr$(13)
  6118.     m$ = m$ + "...22222" + Chr$(13)
  6119.     m$ = m$ + "...22222" + Chr$(13)
  6120.     m$ = m$ + "...22..." + Chr$(13)
  6121.     m$ = m$ + "...22..." + Chr$(13)
  6122.     m$ = m$ + "...22..." + Chr$(13)
  6123.     arrTileText(176) = m$
  6124.  
  6125.     m$ = ""
  6126.     m$ = m$ + "...22..." + Chr$(13)
  6127.     m$ = m$ + "...22..." + Chr$(13)
  6128.     m$ = m$ + "...22..." + Chr$(13)
  6129.     m$ = m$ + "22222222" + Chr$(13)
  6130.     m$ = m$ + "22222222" + Chr$(13)
  6131.     m$ = m$ + "........" + Chr$(13)
  6132.     m$ = m$ + "........" + Chr$(13)
  6133.     m$ = m$ + "........" + Chr$(13)
  6134.     arrTileText(177) = m$
  6135.  
  6136.     m$ = ""
  6137.     m$ = m$ + "........" + Chr$(13)
  6138.     m$ = m$ + "........" + Chr$(13)
  6139.     m$ = m$ + "........" + Chr$(13)
  6140.     m$ = m$ + "22222222" + Chr$(13)
  6141.     m$ = m$ + "22222222" + Chr$(13)
  6142.     m$ = m$ + "...22..." + Chr$(13)
  6143.     m$ = m$ + "...22..." + Chr$(13)
  6144.     m$ = m$ + "...22..." + Chr$(13)
  6145.     arrTileText(178) = m$
  6146.  
  6147.     m$ = ""
  6148.     m$ = m$ + "...22..." + Chr$(13)
  6149.     m$ = m$ + "...22..." + Chr$(13)
  6150.     m$ = m$ + "...22..." + Chr$(13)
  6151.     m$ = m$ + "22222..." + Chr$(13)
  6152.     m$ = m$ + "22222..." + Chr$(13)
  6153.     m$ = m$ + "...22..." + Chr$(13)
  6154.     m$ = m$ + "...22..." + Chr$(13)
  6155.     m$ = m$ + "...22..." + Chr$(13)
  6156.     arrTileText(179) = m$
  6157.  
  6158.     m$ = ""
  6159.     m$ = m$ + "22......" + Chr$(13)
  6160.     m$ = m$ + "22......" + Chr$(13)
  6161.     m$ = m$ + "22......" + Chr$(13)
  6162.     m$ = m$ + "22......" + Chr$(13)
  6163.     m$ = m$ + "22......" + Chr$(13)
  6164.     m$ = m$ + "22......" + Chr$(13)
  6165.     m$ = m$ + "22......" + Chr$(13)
  6166.     m$ = m$ + "22......" + Chr$(13)
  6167.     arrTileText(180) = m$
  6168.  
  6169.     m$ = ""
  6170.     m$ = m$ + "222....." + Chr$(13)
  6171.     m$ = m$ + "222....." + Chr$(13)
  6172.     m$ = m$ + "222....." + Chr$(13)
  6173.     m$ = m$ + "222....." + Chr$(13)
  6174.     m$ = m$ + "222....." + Chr$(13)
  6175.     m$ = m$ + "222....." + Chr$(13)
  6176.     m$ = m$ + "222....." + Chr$(13)
  6177.     m$ = m$ + "222....." + Chr$(13)
  6178.     arrTileText(181) = m$
  6179.  
  6180.     m$ = ""
  6181.     m$ = m$ + ".....222" + Chr$(13)
  6182.     m$ = m$ + ".....222" + Chr$(13)
  6183.     m$ = m$ + ".....222" + Chr$(13)
  6184.     m$ = m$ + ".....222" + Chr$(13)
  6185.     m$ = m$ + ".....222" + Chr$(13)
  6186.     m$ = m$ + ".....222" + Chr$(13)
  6187.     m$ = m$ + ".....222" + Chr$(13)
  6188.     m$ = m$ + ".....222" + Chr$(13)
  6189.     arrTileText(182) = m$
  6190.  
  6191.     m$ = ""
  6192.     m$ = m$ + "22222222" + Chr$(13)
  6193.     m$ = m$ + "22222222" + Chr$(13)
  6194.     m$ = m$ + "........" + Chr$(13)
  6195.     m$ = m$ + "........" + Chr$(13)
  6196.     m$ = m$ + "........" + Chr$(13)
  6197.     m$ = m$ + "........" + Chr$(13)
  6198.     m$ = m$ + "........" + Chr$(13)
  6199.     m$ = m$ + "........" + Chr$(13)
  6200.     arrTileText(183) = m$
  6201.  
  6202.     m$ = ""
  6203.     m$ = m$ + "22222222" + Chr$(13)
  6204.     m$ = m$ + "22222222" + Chr$(13)
  6205.     m$ = m$ + "22222222" + Chr$(13)
  6206.     m$ = m$ + "........" + Chr$(13)
  6207.     m$ = m$ + "........" + Chr$(13)
  6208.     m$ = m$ + "........" + Chr$(13)
  6209.     m$ = m$ + "........" + Chr$(13)
  6210.     m$ = m$ + "........" + Chr$(13)
  6211.     arrTileText(184) = m$
  6212.  
  6213.     m$ = ""
  6214.     m$ = m$ + "........" + Chr$(13)
  6215.     m$ = m$ + "........" + Chr$(13)
  6216.     m$ = m$ + "........" + Chr$(13)
  6217.     m$ = m$ + "........" + Chr$(13)
  6218.     m$ = m$ + "........" + Chr$(13)
  6219.     m$ = m$ + "22222222" + Chr$(13)
  6220.     m$ = m$ + "22222222" + Chr$(13)
  6221.     m$ = m$ + "22222222" + Chr$(13)
  6222.     arrTileText(185) = m$
  6223.  
  6224.     m$ = ""
  6225.     m$ = m$ + "......22" + Chr$(13)
  6226.     m$ = m$ + "......22" + Chr$(13)
  6227.     m$ = m$ + "......22" + Chr$(13)
  6228.     m$ = m$ + "......22" + Chr$(13)
  6229.     m$ = m$ + "......22" + Chr$(13)
  6230.     m$ = m$ + "......22" + Chr$(13)
  6231.     m$ = m$ + "22222222" + Chr$(13)
  6232.     m$ = m$ + "22222222" + Chr$(13)
  6233.     arrTileText(186) = m$
  6234.  
  6235.     m$ = ""
  6236.     m$ = m$ + "........" + Chr$(13)
  6237.     m$ = m$ + "........" + Chr$(13)
  6238.     m$ = m$ + "........" + Chr$(13)
  6239.     m$ = m$ + "........" + Chr$(13)
  6240.     m$ = m$ + "2222...." + Chr$(13)
  6241.     m$ = m$ + "2222...." + Chr$(13)
  6242.     m$ = m$ + "2222...." + Chr$(13)
  6243.     m$ = m$ + "2222...." + Chr$(13)
  6244.     arrTileText(187) = m$
  6245.  
  6246.     m$ = ""
  6247.     m$ = m$ + "....2222" + Chr$(13)
  6248.     m$ = m$ + "....2222" + Chr$(13)
  6249.     m$ = m$ + "....2222" + Chr$(13)
  6250.     m$ = m$ + "....2222" + Chr$(13)
  6251.     m$ = m$ + "........" + Chr$(13)
  6252.     m$ = m$ + "........" + Chr$(13)
  6253.     m$ = m$ + "........" + Chr$(13)
  6254.     m$ = m$ + "........" + Chr$(13)
  6255.     arrTileText(188) = m$
  6256.  
  6257.     m$ = ""
  6258.     m$ = m$ + "...22..." + Chr$(13)
  6259.     m$ = m$ + "...22..." + Chr$(13)
  6260.     m$ = m$ + "...22..." + Chr$(13)
  6261.     m$ = m$ + "22222..." + Chr$(13)
  6262.     m$ = m$ + "22222..." + Chr$(13)
  6263.     m$ = m$ + "........" + Chr$(13)
  6264.     m$ = m$ + "........" + Chr$(13)
  6265.     m$ = m$ + "........" + Chr$(13)
  6266.     arrTileText(189) = m$
  6267.  
  6268.     m$ = ""
  6269.     m$ = m$ + "2222...." + Chr$(13)
  6270.     m$ = m$ + "2222...." + Chr$(13)
  6271.     m$ = m$ + "2222...." + Chr$(13)
  6272.     m$ = m$ + "2222...." + Chr$(13)
  6273.     m$ = m$ + "........" + Chr$(13)
  6274.     m$ = m$ + "........" + Chr$(13)
  6275.     m$ = m$ + "........" + Chr$(13)
  6276.     m$ = m$ + "........" + Chr$(13)
  6277.     arrTileText(190) = m$
  6278.  
  6279.     m$ = ""
  6280.     m$ = m$ + "2222...." + Chr$(13)
  6281.     m$ = m$ + "2222...." + Chr$(13)
  6282.     m$ = m$ + "2222...." + Chr$(13)
  6283.     m$ = m$ + "2222...." + Chr$(13)
  6284.     m$ = m$ + "....2222" + Chr$(13)
  6285.     m$ = m$ + "....2222" + Chr$(13)
  6286.     m$ = m$ + "....2222" + Chr$(13)
  6287.     m$ = m$ + "....2222" + Chr$(13)
  6288.     arrTileText(191) = m$
  6289.  
  6290.     m$ = ""
  6291.     m$ = m$ + "........" + Chr$(13)
  6292.     m$ = m$ + ".2222222" + Chr$(13)
  6293.     m$ = m$ + ".2.....2" + Chr$(13)
  6294.     m$ = m$ + ".2.....2" + Chr$(13)
  6295.     m$ = m$ + ".2.....2" + Chr$(13)
  6296.     m$ = m$ + ".2.....2" + Chr$(13)
  6297.     m$ = m$ + ".2.....2" + Chr$(13)
  6298.     m$ = m$ + ".2222222" + Chr$(13)
  6299.     arrTileText(192) = m$
  6300.  
  6301.     m$ = ""
  6302.     m$ = m$ + "........" + Chr$(13)
  6303.     m$ = m$ + ".2222222" + Chr$(13)
  6304.     m$ = m$ + ".2222222" + Chr$(13)
  6305.     m$ = m$ + ".2222222" + Chr$(13)
  6306.     m$ = m$ + ".2222222" + Chr$(13)
  6307.     m$ = m$ + ".2222222" + Chr$(13)
  6308.     m$ = m$ + ".2222222" + Chr$(13)
  6309.     m$ = m$ + ".2222222" + Chr$(13)
  6310.     arrTileText(193) = m$
  6311.  
  6312.     m$ = ""
  6313.     m$ = m$ + "........" + Chr$(13)
  6314.     m$ = m$ + "...22..." + Chr$(13)
  6315.     m$ = m$ + "..2222.." + Chr$(13)
  6316.     m$ = m$ + ".222222." + Chr$(13)
  6317.     m$ = m$ + "...22..." + Chr$(13)
  6318.     m$ = m$ + "...22..." + Chr$(13)
  6319.     m$ = m$ + "...22..." + Chr$(13)
  6320.     m$ = m$ + "...22..." + Chr$(13)
  6321.     arrTileText(194) = m$
  6322.  
  6323.     m$ = ""
  6324.     m$ = m$ + "........" + Chr$(13)
  6325.     m$ = m$ + "...22..." + Chr$(13)
  6326.     m$ = m$ + "...22..." + Chr$(13)
  6327.     m$ = m$ + "...22..." + Chr$(13)
  6328.     m$ = m$ + "...22..." + Chr$(13)
  6329.     m$ = m$ + ".222222." + Chr$(13)
  6330.     m$ = m$ + "..2222.." + Chr$(13)
  6331.     m$ = m$ + "...22..." + Chr$(13)
  6332.     arrTileText(195) = m$
  6333.  
  6334.     m$ = ""
  6335.     m$ = m$ + "........" + Chr$(13)
  6336.     m$ = m$ + "...2...." + Chr$(13)
  6337.     m$ = m$ + "..22...." + Chr$(13)
  6338.     m$ = m$ + ".2222222" + Chr$(13)
  6339.     m$ = m$ + ".2222222" + Chr$(13)
  6340.     m$ = m$ + "..22...." + Chr$(13)
  6341.     m$ = m$ + "...2...." + Chr$(13)
  6342.     m$ = m$ + "........" + Chr$(13)
  6343.     arrTileText(196) = m$
  6344.  
  6345.     m$ = ""
  6346.     m$ = m$ + "........" + Chr$(13)
  6347.     m$ = m$ + ".....2.." + Chr$(13)
  6348.     m$ = m$ + ".....22." + Chr$(13)
  6349.     m$ = m$ + ".2222222" + Chr$(13)
  6350.     m$ = m$ + ".2222222" + Chr$(13)
  6351.     m$ = m$ + ".....22." + Chr$(13)
  6352.     m$ = m$ + ".....2.." + Chr$(13)
  6353.     m$ = m$ + "........" + Chr$(13)
  6354.     arrTileText(197) = m$
  6355.  
  6356.     m$ = ""
  6357.     m$ = m$ + "........" + Chr$(13)
  6358.     m$ = m$ + "........" + Chr$(13)
  6359.     m$ = m$ + "........" + Chr$(13)
  6360.     m$ = m$ + "........" + Chr$(13)
  6361.     m$ = m$ + "........" + Chr$(13)
  6362.     m$ = m$ + "........" + Chr$(13)
  6363.     m$ = m$ + "........" + Chr$(13)
  6364.     m$ = m$ + "........" + Chr$(13)
  6365.     arrTileText(198) = m$
  6366.  
  6367.     m$ = ""
  6368.     m$ = m$ + ".222222." + Chr$(13)
  6369.     m$ = m$ + "2......2" + Chr$(13)
  6370.     m$ = m$ + "2.2..2.2" + Chr$(13)
  6371.     m$ = m$ + "2......2" + Chr$(13)
  6372.     m$ = m$ + "2.2..2.2" + Chr$(13)
  6373.     m$ = m$ + "2.2222.2" + Chr$(13)
  6374.     m$ = m$ + "2......2" + Chr$(13)
  6375.     m$ = m$ + ".222222." + Chr$(13)
  6376.     arrTileText(199) = m$
  6377.  
  6378.     m$ = ""
  6379.     m$ = m$ + ".222222." + Chr$(13)
  6380.     m$ = m$ + "2......2" + Chr$(13)
  6381.     m$ = m$ + "2.2..2.2" + Chr$(13)
  6382.     m$ = m$ + "2......2" + Chr$(13)
  6383.     m$ = m$ + "2.2222.2" + Chr$(13)
  6384.     m$ = m$ + "2.2..2.2" + Chr$(13)
  6385.     m$ = m$ + "2......2" + Chr$(13)
  6386.     m$ = m$ + ".222222." + Chr$(13)
  6387.     arrTileText(200) = m$
  6388.  
  6389.     m$ = ""
  6390.     m$ = m$ + "........" + Chr$(13)
  6391.     m$ = m$ + "........" + Chr$(13)
  6392.     m$ = m$ + "........" + Chr$(13)
  6393.     m$ = m$ + "........" + Chr$(13)
  6394.     m$ = m$ + "........" + Chr$(13)
  6395.     m$ = m$ + "........" + Chr$(13)
  6396.     m$ = m$ + "........" + Chr$(13)
  6397.     m$ = m$ + "........" + Chr$(13)
  6398.     arrTileText(201) = m$
  6399.  
  6400.     m$ = ""
  6401.     m$ = m$ + ".222222." + Chr$(13)
  6402.     m$ = m$ + ".....22." + Chr$(13)
  6403.     m$ = m$ + "....22.." + Chr$(13)
  6404.     m$ = m$ + "...22..." + Chr$(13)
  6405.     m$ = m$ + "..22...." + Chr$(13)
  6406.     m$ = m$ + ".22....." + Chr$(13)
  6407.     m$ = m$ + ".222222." + Chr$(13)
  6408.     m$ = m$ + "........" + Chr$(13)
  6409.     arrTileText(202) = m$
  6410.  
  6411.     m$ = ""
  6412.     m$ = m$ + "...22..." + Chr$(13)
  6413.     m$ = m$ + "...22..." + Chr$(13)
  6414.     m$ = m$ + "...22..." + Chr$(13)
  6415.     m$ = m$ + "22222222" + Chr$(13)
  6416.     m$ = m$ + "22222222" + Chr$(13)
  6417.     m$ = m$ + "...22..." + Chr$(13)
  6418.     m$ = m$ + "...22..." + Chr$(13)
  6419.     m$ = m$ + "...22..." + Chr$(13)
  6420.     arrTileText(203) = m$
  6421.  
  6422.     m$ = ""
  6423.     m$ = m$ + "22......" + Chr$(13)
  6424.     m$ = m$ + "22......" + Chr$(13)
  6425.     m$ = m$ + "..22...." + Chr$(13)
  6426.     m$ = m$ + "..22...." + Chr$(13)
  6427.     m$ = m$ + "22......" + Chr$(13)
  6428.     m$ = m$ + "22......" + Chr$(13)
  6429.     m$ = m$ + "..22...." + Chr$(13)
  6430.     m$ = m$ + "..22...." + Chr$(13)
  6431.     arrTileText(204) = m$
  6432.  
  6433.     m$ = ""
  6434.     m$ = m$ + "...22..." + Chr$(13)
  6435.     m$ = m$ + "...22..." + Chr$(13)
  6436.     m$ = m$ + "...22..." + Chr$(13)
  6437.     m$ = m$ + "...22..." + Chr$(13)
  6438.     m$ = m$ + "...22..." + Chr$(13)
  6439.     m$ = m$ + "...22..." + Chr$(13)
  6440.     m$ = m$ + "...22..." + Chr$(13)
  6441.     m$ = m$ + "...22..." + Chr$(13)
  6442.     arrTileText(205) = m$
  6443.  
  6444.     m$ = ""
  6445.     m$ = m$ + "..22..22" + Chr$(13)
  6446.     m$ = m$ + "..22..22" + Chr$(13)
  6447.     m$ = m$ + "22..22.." + Chr$(13)
  6448.     m$ = m$ + "22..22.." + Chr$(13)
  6449.     m$ = m$ + "..22..22" + Chr$(13)
  6450.     m$ = m$ + "..22..22" + Chr$(13)
  6451.     m$ = m$ + "22..22.." + Chr$(13)
  6452.     m$ = m$ + "22..22.." + Chr$(13)
  6453.     arrTileText(206) = m$
  6454.  
  6455.     m$ = ""
  6456.     m$ = m$ + "..22..22" + Chr$(13)
  6457.     m$ = m$ + "2..22..2" + Chr$(13)
  6458.     m$ = m$ + "22..22.." + Chr$(13)
  6459.     m$ = m$ + ".22..22." + Chr$(13)
  6460.     m$ = m$ + "..22..22" + Chr$(13)
  6461.     m$ = m$ + "2..22..2" + Chr$(13)
  6462.     m$ = m$ + "22..22.." + Chr$(13)
  6463.     m$ = m$ + ".22..22." + Chr$(13)
  6464.     arrTileText(207) = m$
  6465.  
  6466.     m$ = ""
  6467.     m$ = m$ + "........" + Chr$(13)
  6468.     m$ = m$ + "........" + Chr$(13)
  6469.     m$ = m$ + "........" + Chr$(13)
  6470.     m$ = m$ + "........" + Chr$(13)
  6471.     m$ = m$ + "........" + Chr$(13)
  6472.     m$ = m$ + "........" + Chr$(13)
  6473.     m$ = m$ + "........" + Chr$(13)
  6474.     m$ = m$ + "........" + Chr$(13)
  6475.     arrTileText(208) = m$
  6476.  
  6477.     m$ = ""
  6478.     m$ = m$ + "2222...." + Chr$(13)
  6479.     m$ = m$ + "2222...." + Chr$(13)
  6480.     m$ = m$ + "2222...." + Chr$(13)
  6481.     m$ = m$ + "2222...." + Chr$(13)
  6482.     m$ = m$ + "2222...." + Chr$(13)
  6483.     m$ = m$ + "2222...." + Chr$(13)
  6484.     m$ = m$ + "2222...." + Chr$(13)
  6485.     m$ = m$ + "2222...." + Chr$(13)
  6486.     arrTileText(209) = m$
  6487.  
  6488.     m$ = ""
  6489.     m$ = m$ + "........" + Chr$(13)
  6490.     m$ = m$ + "........" + Chr$(13)
  6491.     m$ = m$ + "........" + Chr$(13)
  6492.     m$ = m$ + "........" + Chr$(13)
  6493.     m$ = m$ + "22222222" + Chr$(13)
  6494.     m$ = m$ + "22222222" + Chr$(13)
  6495.     m$ = m$ + "22222222" + Chr$(13)
  6496.     m$ = m$ + "22222222" + Chr$(13)
  6497.     arrTileText(210) = m$
  6498.  
  6499.     m$ = ""
  6500.     m$ = m$ + "22222222" + Chr$(13)
  6501.     m$ = m$ + "........" + Chr$(13)
  6502.     m$ = m$ + "........" + Chr$(13)
  6503.     m$ = m$ + "........" + Chr$(13)
  6504.     m$ = m$ + "........" + Chr$(13)
  6505.     m$ = m$ + "........" + Chr$(13)
  6506.     m$ = m$ + "........" + Chr$(13)
  6507.     m$ = m$ + "........" + Chr$(13)
  6508.     arrTileText(211) = m$
  6509.  
  6510.     m$ = ""
  6511.     m$ = m$ + "........" + Chr$(13)
  6512.     m$ = m$ + "........" + Chr$(13)
  6513.     m$ = m$ + "........" + Chr$(13)
  6514.     m$ = m$ + "........" + Chr$(13)
  6515.     m$ = m$ + "........" + Chr$(13)
  6516.     m$ = m$ + "........" + Chr$(13)
  6517.     m$ = m$ + "........" + Chr$(13)
  6518.     m$ = m$ + "22222222" + Chr$(13)
  6519.     arrTileText(212) = m$
  6520.  
  6521.     m$ = ""
  6522.     m$ = m$ + "22......" + Chr$(13)
  6523.     m$ = m$ + "22......" + Chr$(13)
  6524.     m$ = m$ + "22......" + Chr$(13)
  6525.     m$ = m$ + "22......" + Chr$(13)
  6526.     m$ = m$ + "22......" + Chr$(13)
  6527.     m$ = m$ + "22......" + Chr$(13)
  6528.     m$ = m$ + "22......" + Chr$(13)
  6529.     m$ = m$ + "22......" + Chr$(13)
  6530.     arrTileText(213) = m$
  6531.  
  6532.     m$ = ""
  6533.     m$ = m$ + "22..22.." + Chr$(13)
  6534.     m$ = m$ + "22..22.." + Chr$(13)
  6535.     m$ = m$ + "..22..22" + Chr$(13)
  6536.     m$ = m$ + "..22..22" + Chr$(13)
  6537.     m$ = m$ + "22..22.." + Chr$(13)
  6538.     m$ = m$ + "22..22.." + Chr$(13)
  6539.     m$ = m$ + "..22..22" + Chr$(13)
  6540.     m$ = m$ + "..22..22" + Chr$(13)
  6541.     arrTileText(214) = m$
  6542.  
  6543.     m$ = ""
  6544.     m$ = m$ + "......22" + Chr$(13)
  6545.     m$ = m$ + "......22" + Chr$(13)
  6546.     m$ = m$ + "......22" + Chr$(13)
  6547.     m$ = m$ + "......22" + Chr$(13)
  6548.     m$ = m$ + "......22" + Chr$(13)
  6549.     m$ = m$ + "......22" + Chr$(13)
  6550.     m$ = m$ + "......22" + Chr$(13)
  6551.     m$ = m$ + "......22" + Chr$(13)
  6552.     arrTileText(215) = m$
  6553.  
  6554.     m$ = ""
  6555.     m$ = m$ + "........" + Chr$(13)
  6556.     m$ = m$ + "........" + Chr$(13)
  6557.     m$ = m$ + "........" + Chr$(13)
  6558.     m$ = m$ + "........" + Chr$(13)
  6559.     m$ = m$ + "22..22.." + Chr$(13)
  6560.     m$ = m$ + "22..22.." + Chr$(13)
  6561.     m$ = m$ + "..22..22" + Chr$(13)
  6562.     m$ = m$ + "..22..22" + Chr$(13)
  6563.     arrTileText(216) = m$
  6564.  
  6565.     m$ = ""
  6566.     m$ = m$ + "22..22.." + Chr$(13)
  6567.     m$ = m$ + "2..22..2" + Chr$(13)
  6568.     m$ = m$ + "..22..22" + Chr$(13)
  6569.     m$ = m$ + ".22..22." + Chr$(13)
  6570.     m$ = m$ + "22..22.." + Chr$(13)
  6571.     m$ = m$ + "2..22..2" + Chr$(13)
  6572.     m$ = m$ + "..22..22" + Chr$(13)
  6573.     m$ = m$ + ".22..22." + Chr$(13)
  6574.     arrTileText(217) = m$
  6575.  
  6576.     m$ = ""
  6577.     m$ = m$ + "......22" + Chr$(13)
  6578.     m$ = m$ + "......22" + Chr$(13)
  6579.     m$ = m$ + "......22" + Chr$(13)
  6580.     m$ = m$ + "......22" + Chr$(13)
  6581.     m$ = m$ + "......22" + Chr$(13)
  6582.     m$ = m$ + "......22" + Chr$(13)
  6583.     m$ = m$ + "......22" + Chr$(13)
  6584.     m$ = m$ + "......22" + Chr$(13)
  6585.     arrTileText(218) = m$
  6586.  
  6587.     m$ = ""
  6588.     m$ = m$ + "...22..." + Chr$(13)
  6589.     m$ = m$ + "...22..." + Chr$(13)
  6590.     m$ = m$ + "...22..." + Chr$(13)
  6591.     m$ = m$ + "...22222" + Chr$(13)
  6592.     m$ = m$ + "...22222" + Chr$(13)
  6593.     m$ = m$ + "...22..." + Chr$(13)
  6594.     m$ = m$ + "...22..." + Chr$(13)
  6595.     m$ = m$ + "...22..." + Chr$(13)
  6596.     arrTileText(219) = m$
  6597.  
  6598.     m$ = ""
  6599.     m$ = m$ + "........" + Chr$(13)
  6600.     m$ = m$ + "........" + Chr$(13)
  6601.     m$ = m$ + "........" + Chr$(13)
  6602.     m$ = m$ + "........" + Chr$(13)
  6603.     m$ = m$ + "....2222" + Chr$(13)
  6604.     m$ = m$ + "....2222" + Chr$(13)
  6605.     m$ = m$ + "....2222" + Chr$(13)
  6606.     m$ = m$ + "....2222" + Chr$(13)
  6607.     arrTileText(220) = m$
  6608.  
  6609.     m$ = ""
  6610.     m$ = m$ + "...22..." + Chr$(13)
  6611.     m$ = m$ + "...22..." + Chr$(13)
  6612.     m$ = m$ + "...22..." + Chr$(13)
  6613.     m$ = m$ + "...22222" + Chr$(13)
  6614.     m$ = m$ + "...22222" + Chr$(13)
  6615.     m$ = m$ + "........" + Chr$(13)
  6616.     m$ = m$ + "........" + Chr$(13)
  6617.     m$ = m$ + "........" + Chr$(13)
  6618.     arrTileText(221) = m$
  6619.  
  6620.     m$ = ""
  6621.     m$ = m$ + "........" + Chr$(13)
  6622.     m$ = m$ + "........" + Chr$(13)
  6623.     m$ = m$ + "........" + Chr$(13)
  6624.     m$ = m$ + "22222..." + Chr$(13)
  6625.     m$ = m$ + "22222..." + Chr$(13)
  6626.     m$ = m$ + "...22..." + Chr$(13)
  6627.     m$ = m$ + "...22..." + Chr$(13)
  6628.     m$ = m$ + "...22..." + Chr$(13)
  6629.     arrTileText(222) = m$
  6630.  
  6631.     m$ = ""
  6632.     m$ = m$ + "........" + Chr$(13)
  6633.     m$ = m$ + "........" + Chr$(13)
  6634.     m$ = m$ + "........" + Chr$(13)
  6635.     m$ = m$ + "........" + Chr$(13)
  6636.     m$ = m$ + "........" + Chr$(13)
  6637.     m$ = m$ + "........" + Chr$(13)
  6638.     m$ = m$ + "22222222" + Chr$(13)
  6639.     m$ = m$ + "22222222" + Chr$(13)
  6640.     arrTileText(223) = m$
  6641.  
  6642.     m$ = ""
  6643.     m$ = m$ + "........" + Chr$(13)
  6644.     m$ = m$ + "........" + Chr$(13)
  6645.     m$ = m$ + "........" + Chr$(13)
  6646.     m$ = m$ + "...22222" + Chr$(13)
  6647.     m$ = m$ + "...22222" + Chr$(13)
  6648.     m$ = m$ + "...22..." + Chr$(13)
  6649.     m$ = m$ + "...22..." + Chr$(13)
  6650.     m$ = m$ + "...22..." + Chr$(13)
  6651.     arrTileText(224) = m$
  6652.  
  6653.     m$ = ""
  6654.     m$ = m$ + "...22..." + Chr$(13)
  6655.     m$ = m$ + "...22..." + Chr$(13)
  6656.     m$ = m$ + "...22..." + Chr$(13)
  6657.     m$ = m$ + "22222222" + Chr$(13)
  6658.     m$ = m$ + "22222222" + Chr$(13)
  6659.     m$ = m$ + "........" + Chr$(13)
  6660.     m$ = m$ + "........" + Chr$(13)
  6661.     m$ = m$ + "........" + Chr$(13)
  6662.     arrTileText(225) = m$
  6663.  
  6664.     m$ = ""
  6665.     m$ = m$ + "........" + Chr$(13)
  6666.     m$ = m$ + "........" + Chr$(13)
  6667.     m$ = m$ + "........" + Chr$(13)
  6668.     m$ = m$ + "22222222" + Chr$(13)
  6669.     m$ = m$ + "22222222" + Chr$(13)
  6670.     m$ = m$ + "...22..." + Chr$(13)
  6671.     m$ = m$ + "...22..." + Chr$(13)
  6672.     m$ = m$ + "...22..." + Chr$(13)
  6673.     arrTileText(226) = m$
  6674.  
  6675.     m$ = ""
  6676.     m$ = m$ + "...22..." + Chr$(13)
  6677.     m$ = m$ + "...22..." + Chr$(13)
  6678.     m$ = m$ + "...22..." + Chr$(13)
  6679.     m$ = m$ + "22222..." + Chr$(13)
  6680.     m$ = m$ + "22222..." + Chr$(13)
  6681.     m$ = m$ + "...22..." + Chr$(13)
  6682.     m$ = m$ + "...22..." + Chr$(13)
  6683.     m$ = m$ + "...22..." + Chr$(13)
  6684.     arrTileText(227) = m$
  6685.  
  6686.     m$ = ""
  6687.     m$ = m$ + "22......" + Chr$(13)
  6688.     m$ = m$ + "22......" + Chr$(13)
  6689.     m$ = m$ + "22......" + Chr$(13)
  6690.     m$ = m$ + "22......" + Chr$(13)
  6691.     m$ = m$ + "22......" + Chr$(13)
  6692.     m$ = m$ + "22......" + Chr$(13)
  6693.     m$ = m$ + "22......" + Chr$(13)
  6694.     m$ = m$ + "22......" + Chr$(13)
  6695.     arrTileText(228) = m$
  6696.  
  6697.     m$ = ""
  6698.     m$ = m$ + "222....." + Chr$(13)
  6699.     m$ = m$ + "222....." + Chr$(13)
  6700.     m$ = m$ + "222....." + Chr$(13)
  6701.     m$ = m$ + "222....." + Chr$(13)
  6702.     m$ = m$ + "222....." + Chr$(13)
  6703.     m$ = m$ + "222....." + Chr$(13)
  6704.     m$ = m$ + "222....." + Chr$(13)
  6705.     m$ = m$ + "222....." + Chr$(13)
  6706.     arrTileText(229) = m$
  6707.  
  6708.     m$ = ""
  6709.     m$ = m$ + ".....222" + Chr$(13)
  6710.     m$ = m$ + ".....222" + Chr$(13)
  6711.     m$ = m$ + ".....222" + Chr$(13)
  6712.     m$ = m$ + ".....222" + Chr$(13)
  6713.     m$ = m$ + ".....222" + Chr$(13)
  6714.     m$ = m$ + ".....222" + Chr$(13)
  6715.     m$ = m$ + ".....222" + Chr$(13)
  6716.     m$ = m$ + ".....222" + Chr$(13)
  6717.     arrTileText(230) = m$
  6718.  
  6719.     m$ = ""
  6720.     m$ = m$ + "22222222" + Chr$(13)
  6721.     m$ = m$ + "22222222" + Chr$(13)
  6722.     m$ = m$ + "........" + Chr$(13)
  6723.     m$ = m$ + "........" + Chr$(13)
  6724.     m$ = m$ + "........" + Chr$(13)
  6725.     m$ = m$ + "........" + Chr$(13)
  6726.     m$ = m$ + "........" + Chr$(13)
  6727.     m$ = m$ + "........" + Chr$(13)
  6728.     arrTileText(231) = m$
  6729.  
  6730.     m$ = ""
  6731.     m$ = m$ + "22222222" + Chr$(13)
  6732.     m$ = m$ + "22222222" + Chr$(13)
  6733.     m$ = m$ + "22222222" + Chr$(13)
  6734.     m$ = m$ + "........" + Chr$(13)
  6735.     m$ = m$ + "........" + Chr$(13)
  6736.     m$ = m$ + "........" + Chr$(13)
  6737.     m$ = m$ + "........" + Chr$(13)
  6738.     m$ = m$ + "........" + Chr$(13)
  6739.     arrTileText(232) = m$
  6740.  
  6741.     m$ = ""
  6742.     m$ = m$ + "........" + Chr$(13)
  6743.     m$ = m$ + "........" + Chr$(13)
  6744.     m$ = m$ + "........" + Chr$(13)
  6745.     m$ = m$ + "........" + Chr$(13)
  6746.     m$ = m$ + "........" + Chr$(13)
  6747.     m$ = m$ + "22222222" + Chr$(13)
  6748.     m$ = m$ + "22222222" + Chr$(13)
  6749.     m$ = m$ + "22222222" + Chr$(13)
  6750.     arrTileText(233) = m$
  6751.  
  6752.     m$ = ""
  6753.     m$ = m$ + ".......2" + Chr$(13)
  6754.     m$ = m$ + "......22" + Chr$(13)
  6755.     m$ = m$ + ".....22." + Chr$(13)
  6756.     m$ = m$ + ".22.22.." + Chr$(13)
  6757.     m$ = m$ + ".2222..." + Chr$(13)
  6758.     m$ = m$ + ".222...." + Chr$(13)
  6759.     m$ = m$ + ".22....." + Chr$(13)
  6760.     m$ = m$ + "........" + Chr$(13)
  6761.     arrTileText(234) = m$
  6762.  
  6763.     m$ = ""
  6764.     m$ = m$ + "........" + Chr$(13)
  6765.     m$ = m$ + "........" + Chr$(13)
  6766.     m$ = m$ + "........" + Chr$(13)
  6767.     m$ = m$ + "........" + Chr$(13)
  6768.     m$ = m$ + "2222...." + Chr$(13)
  6769.     m$ = m$ + "2222...." + Chr$(13)
  6770.     m$ = m$ + "2222...." + Chr$(13)
  6771.     m$ = m$ + "2222...." + Chr$(13)
  6772.     arrTileText(235) = m$
  6773.  
  6774.     m$ = ""
  6775.     m$ = m$ + "....2222" + Chr$(13)
  6776.     m$ = m$ + "....2222" + Chr$(13)
  6777.     m$ = m$ + "....2222" + Chr$(13)
  6778.     m$ = m$ + "....2222" + Chr$(13)
  6779.     m$ = m$ + "........" + Chr$(13)
  6780.     m$ = m$ + "........" + Chr$(13)
  6781.     m$ = m$ + "........" + Chr$(13)
  6782.     m$ = m$ + "........" + Chr$(13)
  6783.     arrTileText(236) = m$
  6784.  
  6785.     m$ = ""
  6786.     m$ = m$ + "...22..." + Chr$(13)
  6787.     m$ = m$ + "...22..." + Chr$(13)
  6788.     m$ = m$ + "...22..." + Chr$(13)
  6789.     m$ = m$ + "22222..." + Chr$(13)
  6790.     m$ = m$ + "22222..." + Chr$(13)
  6791.     m$ = m$ + "........" + Chr$(13)
  6792.     m$ = m$ + "........" + Chr$(13)
  6793.     m$ = m$ + "........" + Chr$(13)
  6794.     arrTileText(237) = m$
  6795.  
  6796.     m$ = ""
  6797.     m$ = m$ + "2222...." + Chr$(13)
  6798.     m$ = m$ + "2222...." + Chr$(13)
  6799.     m$ = m$ + "2222...." + Chr$(13)
  6800.     m$ = m$ + "2222...." + Chr$(13)
  6801.     m$ = m$ + "........" + Chr$(13)
  6802.     m$ = m$ + "........" + Chr$(13)
  6803.     m$ = m$ + "........" + Chr$(13)
  6804.     m$ = m$ + "........" + Chr$(13)
  6805.     arrTileText(238) = m$
  6806.  
  6807.     m$ = ""
  6808.     m$ = m$ + "2222...." + Chr$(13)
  6809.     m$ = m$ + "2222...." + Chr$(13)
  6810.     m$ = m$ + "2222...." + Chr$(13)
  6811.     m$ = m$ + "2222...." + Chr$(13)
  6812.     m$ = m$ + "....2222" + Chr$(13)
  6813.     m$ = m$ + "....2222" + Chr$(13)
  6814.     m$ = m$ + "....2222" + Chr$(13)
  6815.     m$ = m$ + "....2222" + Chr$(13)
  6816.     arrTileText(239) = m$
  6817.  
  6818.     m$ = ""
  6819.     m$ = m$ + "........" + Chr$(13)
  6820.     m$ = m$ + "........" + Chr$(13)
  6821.     m$ = m$ + "........" + Chr$(13)
  6822.     m$ = m$ + "........" + Chr$(13)
  6823.     m$ = m$ + "........" + Chr$(13)
  6824.     m$ = m$ + "........" + Chr$(13)
  6825.     m$ = m$ + "........" + Chr$(13)
  6826.     m$ = m$ + "........" + Chr$(13)
  6827.     arrTileText(240) = m$
  6828.  
  6829.     m$ = ""
  6830.     m$ = m$ + "22222.22" + Chr$(13)
  6831.     m$ = m$ + "22222.22" + Chr$(13)
  6832.     m$ = m$ + "22222.22" + Chr$(13)
  6833.     m$ = m$ + "........" + Chr$(13)
  6834.     m$ = m$ + "22.22222" + Chr$(13)
  6835.     m$ = m$ + "22.22222" + Chr$(13)
  6836.     m$ = m$ + "22.22222" + Chr$(13)
  6837.     m$ = m$ + "........" + Chr$(13)
  6838.     arrTileText(241) = m$
  6839.  
  6840.     m$ = ""
  6841.     m$ = m$ + "........" + Chr$(13)
  6842.     m$ = m$ + "........" + Chr$(13)
  6843.     m$ = m$ + "........" + Chr$(13)
  6844.     m$ = m$ + ".222222." + Chr$(13)
  6845.     m$ = m$ + "........" + Chr$(13)
  6846.     m$ = m$ + "........" + Chr$(13)
  6847.     m$ = m$ + "........" + Chr$(13)
  6848.     m$ = m$ + "........" + Chr$(13)
  6849.     arrTileText(242) = m$
  6850.  
  6851.     m$ = ""
  6852.     m$ = m$ + "........" + Chr$(13)
  6853.     m$ = m$ + "...2...." + Chr$(13)
  6854.     m$ = m$ + "...2...." + Chr$(13)
  6855.     m$ = m$ + "...2...." + Chr$(13)
  6856.     m$ = m$ + "...2...." + Chr$(13)
  6857.     m$ = m$ + "...2...." + Chr$(13)
  6858.     m$ = m$ + "...2...." + Chr$(13)
  6859.     m$ = m$ + "........" + Chr$(13)
  6860.     arrTileText(243) = m$
  6861.  
  6862.     m$ = ""
  6863.     m$ = m$ + "........" + Chr$(13)
  6864.     m$ = m$ + "........" + Chr$(13)
  6865.     m$ = m$ + "........" + Chr$(13)
  6866.     m$ = m$ + "...2222." + Chr$(13)
  6867.     m$ = m$ + "...2...." + Chr$(13)
  6868.     m$ = m$ + "...2...." + Chr$(13)
  6869.     m$ = m$ + "...2...." + Chr$(13)
  6870.     m$ = m$ + "........" + Chr$(13)
  6871.     arrTileText(244) = m$
  6872.  
  6873.     m$ = ""
  6874.     m$ = m$ + "........" + Chr$(13)
  6875.     m$ = m$ + "........" + Chr$(13)
  6876.     m$ = m$ + "........" + Chr$(13)
  6877.     m$ = m$ + ".222...." + Chr$(13)
  6878.     m$ = m$ + "...2...." + Chr$(13)
  6879.     m$ = m$ + "...2...." + Chr$(13)
  6880.     m$ = m$ + "...2...." + Chr$(13)
  6881.     m$ = m$ + "........" + Chr$(13)
  6882.     arrTileText(245) = m$
  6883.  
  6884.     m$ = ""
  6885.     m$ = m$ + "........" + Chr$(13)
  6886.     m$ = m$ + "...2...." + Chr$(13)
  6887.     m$ = m$ + "...2...." + Chr$(13)
  6888.     m$ = m$ + "...2222." + Chr$(13)
  6889.     m$ = m$ + "........" + Chr$(13)
  6890.     m$ = m$ + "........" + Chr$(13)
  6891.     m$ = m$ + "........" + Chr$(13)
  6892.     m$ = m$ + "........" + Chr$(13)
  6893.     arrTileText(246) = m$
  6894.  
  6895.     m$ = ""
  6896.     m$ = m$ + "........" + Chr$(13)
  6897.     m$ = m$ + "...2...." + Chr$(13)
  6898.     m$ = m$ + "...2...." + Chr$(13)
  6899.     m$ = m$ + ".222...." + Chr$(13)
  6900.     m$ = m$ + "........" + Chr$(13)
  6901.     m$ = m$ + "........" + Chr$(13)
  6902.     m$ = m$ + "........" + Chr$(13)
  6903.     m$ = m$ + "........" + Chr$(13)
  6904.     arrTileText(247) = m$
  6905.  
  6906.     m$ = ""
  6907.     m$ = m$ + "........" + Chr$(13)
  6908.     m$ = m$ + "........" + Chr$(13)
  6909.     m$ = m$ + "........" + Chr$(13)
  6910.     m$ = m$ + "........" + Chr$(13)
  6911.     m$ = m$ + "........" + Chr$(13)
  6912.     m$ = m$ + "........" + Chr$(13)
  6913.     m$ = m$ + "........" + Chr$(13)
  6914.     m$ = m$ + "........" + Chr$(13)
  6915.     arrTileText(248) = m$
  6916.  
  6917.     m$ = ""
  6918.     m$ = m$ + "........" + Chr$(13)
  6919.     m$ = m$ + "........" + Chr$(13)
  6920.     m$ = m$ + "........" + Chr$(13)
  6921.     m$ = m$ + "........" + Chr$(13)
  6922.     m$ = m$ + "........" + Chr$(13)
  6923.     m$ = m$ + "........" + Chr$(13)
  6924.     m$ = m$ + "........" + Chr$(13)
  6925.     m$ = m$ + "........" + Chr$(13)
  6926.     arrTileText(249) = m$
  6927.  
  6928.     m$ = ""
  6929.     m$ = m$ + "........" + Chr$(13)
  6930.     m$ = m$ + "........" + Chr$(13)
  6931.     m$ = m$ + "........" + Chr$(13)
  6932.     m$ = m$ + "........" + Chr$(13)
  6933.     m$ = m$ + "........" + Chr$(13)
  6934.     m$ = m$ + "........" + Chr$(13)
  6935.     m$ = m$ + "........" + Chr$(13)
  6936.     m$ = m$ + "........" + Chr$(13)
  6937.     arrTileText(250) = m$
  6938.  
  6939.     m$ = ""
  6940.     m$ = m$ + "........" + Chr$(13)
  6941.     m$ = m$ + "........" + Chr$(13)
  6942.     m$ = m$ + "........" + Chr$(13)
  6943.     m$ = m$ + "........" + Chr$(13)
  6944.     m$ = m$ + "........" + Chr$(13)
  6945.     m$ = m$ + "........" + Chr$(13)
  6946.     m$ = m$ + "........" + Chr$(13)
  6947.     m$ = m$ + "........" + Chr$(13)
  6948.     arrTileText(251) = m$
  6949.  
  6950.     m$ = ""
  6951.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6952.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6953.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6954.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6955.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6956.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6957.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6958.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6959.     arrTileText(252) = m$
  6960.  
  6961.     m$ = ""
  6962.     m$ = m$ + "22222222" + Chr$(13)
  6963.     m$ = m$ + "2......2" + Chr$(13)
  6964.     m$ = m$ + "2......2" + Chr$(13)
  6965.     m$ = m$ + "2......2" + Chr$(13)
  6966.     m$ = m$ + "2......2" + Chr$(13)
  6967.     m$ = m$ + "2......2" + Chr$(13)
  6968.     m$ = m$ + "2......2" + Chr$(13)
  6969.     m$ = m$ + "22222222" + Chr$(13)
  6970.     arrTileText(253) = m$
  6971.  
  6972.     m$ = ""
  6973.     m$ = m$ + "22222222" + Chr$(13)
  6974.     m$ = m$ + "22222222" + Chr$(13)
  6975.     m$ = m$ + "22222222" + Chr$(13)
  6976.     m$ = m$ + "22222222" + Chr$(13)
  6977.     m$ = m$ + "22222222" + Chr$(13)
  6978.     m$ = m$ + "22222222" + Chr$(13)
  6979.     m$ = m$ + "22222222" + Chr$(13)
  6980.     m$ = m$ + "22222222" + Chr$(13)
  6981.     arrTileText(254) = m$
  6982.  
  6983.     m$ = ""
  6984.     m$ = ""
  6985.     m$ = m$ + "22....22" + Chr$(13)
  6986.     m$ = m$ + "2..22..2" + Chr$(13)
  6987.     m$ = m$ + "2..22..2" + Chr$(13)
  6988.     m$ = m$ + "22.....2" + Chr$(13)
  6989.     m$ = m$ + "22222..2" + Chr$(13)
  6990.     m$ = m$ + "2..22..2" + Chr$(13)
  6991.     m$ = m$ + "22....22" + Chr$(13)
  6992.     m$ = m$ + "22222222" + Chr$(13)
  6993.     arrTileText(255) = m$
  6994.  
  6995. End Sub ' GetTileText
  6996.  
  6997. ' ################################################################################################################################################################
  6998. ' END TILE DEFINITIONS
  6999. ' ################################################################################################################################################################
  7000.  
  7001. ' ################################################################################################################################################################
  7002. ' BEGIN COLOR FUNCTIONS
  7003. ' ################################################################################################################################################################
  7004. Function cWhite~& ()
  7005.     cWhite = _RGB32(255, 255, 255)
  7006. End Function ' cWhite~&
  7007.  
  7008. Function cEmpty~& ()
  7009.     cEmpty = _RGB32(0, 0, 0, 0)
  7010. End Function ' cEmpty~&
  7011.  
  7012. Function cBlack~& ()
  7013.     cBlack = _RGB32(0, 0, 0)
  7014. End Function ' cBlack~&
  7015.  
  7016. Function cRed~& ()
  7017.     cRed = _RGB32(255, 0, 0)
  7018.  
  7019. Function cYellow~& ()
  7020.     cYellow = _RGB32(255, 255, 0)
  7021. End Function ' cYellow~&
  7022.  
  7023. Function cLime~& ()
  7024.     cLime = _RGB32(0, 255, 0)
  7025. End Function ' cLime~&
  7026.  
  7027. Function cCyan~& ()
  7028.     cCyan = _RGB32(0, 255, 255)
  7029. End Function ' cCyan~&
  7030.  
  7031. Function cBlue~& ()
  7032.     cBlue = _RGB32(0, 0, 255)
  7033. End Function ' cBlue~&
  7034.  
  7035. Function cPurple~& ()
  7036.     cPurple = _RGB32(128, 0, 255)
  7037. End Function ' cPurple~&
  7038.  
  7039. Function cMagenta~& ()
  7040.     cMagenta = _RGB32(255, 0, 255)
  7041. End Function ' cMagenta~&
  7042.  
  7043. Function cOrange~& ()
  7044.     cOrange = _RGB32(255, 165, 0)
  7045. End Function ' cOrange~&
  7046.  
  7047. Function cGray~& ()
  7048.     cGray = _RGB32(128, 128, 128)
  7049. End Function ' cGray~&
  7050. ' ################################################################################################################################################################
  7051. ' END COLOR FUNCTIONS
  7052. ' ################################################################################################################################################################
  7053.  
  7054. ' ################################################################################################################################################################
  7055. ' BEGIN GENERAL PURPOSE ROUTINES
  7056. ' ################################################################################################################################################################
  7057.  
  7058. ' /////////////////////////////////////////////////////////////////////////////
  7059. ' See also StringTo2dArray
  7060.  
  7061. Function Array2dToString$ (MyArray() As String)
  7062.     Dim MyString As String
  7063.     Dim iY As Integer
  7064.     Dim iX As Integer
  7065.     Dim sLine As String
  7066.     MyString = ""
  7067.     For iY = LBound(MyArray, 1) To UBound(MyArray, 1)
  7068.         sLine = ""
  7069.         For iX = LBound(MyArray, 2) To UBound(MyArray, 2)
  7070.             sLine = sLine + MyArray(iY, iX)
  7071.         Next iX
  7072.         MyString = MyString + sLine + Chr$(13)
  7073.     Next iY
  7074.     Array2dToString$ = MyString
  7075. End Function ' Array2dToString$
  7076.  
  7077. ' /////////////////////////////////////////////////////////////////////////////
  7078.  
  7079. 'Function Array2dToStringTest$ (MyArray() As String)
  7080. '    Dim MyString As String
  7081. '    Dim iY As Integer
  7082. '    Dim iX As Integer
  7083. '    Dim sLine As String
  7084. '    MyString = ""
  7085. '    MyString = MyString + "           11111111112222222222333" + Chr$(13)
  7086. '    MyString = MyString + "  12345678901234567890123456789012" + Chr$(13)
  7087. '    For iY = LBound(MyArray, 1) To UBound(MyArray, 1)
  7088. '        sLine = ""
  7089. '        sLine = sLine + Right$("  " + cstr$(iY), 2)
  7090. '        For iX = LBound(MyArray, 2) To UBound(MyArray, 2)
  7091. '            sLine = sLine + MyArray(iY, iX)
  7092. '        Next iX
  7093. '        sLine = sLine + Right$("  " + cstr$(iY), 2)
  7094. '        MyString = MyString + sLine + Chr$(13)
  7095. '    Next iY
  7096. '    MyString = MyString + "  12345678901234567890123456789012" + Chr$(13)
  7097. '    MyString = MyString + "           11111111112222222222333" + Chr$(13)
  7098. '    Array2dToStringTest$ = MyString
  7099. 'End Function ' Array2dToStringTest$
  7100.  
  7101. ' /////////////////////////////////////////////////////////////////////////////
  7102.  
  7103. Function cstr$ (myValue)
  7104.     'cstr$ = LTRIM$(RTRIM$(STR$(myValue)))
  7105.     cstr$ = _Trim$(Str$(myValue))
  7106. End Function ' cstr$
  7107.  
  7108. ' /////////////////////////////////////////////////////////////////////////////
  7109. ' Simple timestamp function
  7110.  
  7111. Function CurrentDateTime$
  7112.     CurrentDateTime$ = Mid$(Date$, 7, 4) + "-" + _
  7113.         Mid$(Date$, 1, 5) + " " + _
  7114.         Time$
  7115. End Function ' CurrentDateTime$
  7116.  
  7117. ' /////////////////////////////////////////////////////////////////////////////
  7118. ' Receives an {sDelim} delimited list {sInput}
  7119. ' returns the list with all duplicate entries removed.
  7120.  
  7121. Function DedupeDelimList$ (sInput As String, sDelim As String)
  7122.     ReDim arrLines(-1) As String
  7123.     Dim sOutput As String
  7124.     Dim iLoop As Integer
  7125.  
  7126.     split sInput, sDelim, arrLines()
  7127.     sOutput = sDelim
  7128.     For iLoop = LBound(arrLines) To UBound(arrLines)
  7129.         If InStr(1, sOutput, sDelim + arrLines(iLoop) + sDelim) = 0 Then
  7130.             sOutput = sOutput + arrLines(iLoop) + sDelim
  7131.         End If
  7132.     Next iLoop
  7133.  
  7134.     DedupeDelimList$ = sOutput
  7135. End Function ' DedupeDelimList$
  7136.  
  7137. ' /////////////////////////////////////////////////////////////////////////////
  7138. ' Use with timer functions to avoid "after midnight" bug.
  7139.  
  7140. ' Re: how to time something (ie do loop for n seconds)
  7141. ' https://qb64forum.alephc.xyz/index.php?topic=4682.0
  7142.  
  7143. ' SMcNeill, QB64 Developer
  7144. ' « Reply #1 on: Today at 11:26:52 am »
  7145. '
  7146. ' One caveat here:  You *can* experience bugs with this after midnight.
  7147. '
  7148. ' Program starts at 23:59:59.
  7149. ' Add three seconds -- 24:00:02...  (In seconds, and not hours and minutes like this, though hours and minutes are easier to visualize.)
  7150. ' Clock hits midnight:  0:00:00
  7151. '
  7152. ' At no point will you ever have TIMER become greater than t#.
  7153. '
  7154. ' If you're going to have a program which might run into this issue,
  7155. ' I'd suggest just plugging in my ExtendedTimer and use it instead:
  7156. '
  7157. ' Most of us write time code to test little snippets for which method might
  7158. ' be faster for us while we're coding.  The clock resetting on us isn't
  7159. ' normally such a big deal.  When it is, however, all you have to do is
  7160. ' swap to the ExtendedTimer function [below]
  7161. '
  7162. ' Returns a value for you based off DAY + TIME, rather than just time alone!
  7163. ' No midnight clock issues with something like that in our programs.  ;)
  7164.  
  7165. ' Usage:
  7166. '     ' DO SOMETHING FOR 3 SECONDS
  7167. '     t# = ExtendedTimer + 3
  7168. '     Do
  7169. '         '(SOMETHING)
  7170. '     Loop Until Timer > t#
  7171.  
  7172. Function ExtendedTimer##
  7173.     d$ = Date$
  7174.     l = InStr(d$, "-")
  7175.     l1 = InStr(l + 1, d$, "-")
  7176.     m = Val(Left$(d$, l))
  7177.     d = Val(Mid$(d$, l + 1))
  7178.     y = Val(Mid$(d$, l1 + 1)) - 1970
  7179.     For i = 1 To m
  7180.         Select Case i 'Add the number of days for each previous month passed
  7181.             Case 1: d = d 'January doestn't have any carry over days.
  7182.             Case 2, 4, 6, 8, 9, 11: d = d + 31
  7183.             Case 3: d = d + 28
  7184.             Case 5, 7, 10, 12: d = d + 30
  7185.         End Select
  7186.     Next
  7187.     For i = 1 To y
  7188.         d = d + 365
  7189.     Next
  7190.     For i = 2 To y Step 4
  7191.         If m > 2 Then d = d + 1 'add an extra day for leap year every 4 years, starting in 1970
  7192.     Next
  7193.     d = d - 1 'for year 2000
  7194.     s~&& = d * 24 * 60 * 60 'Seconds are days * 24 hours * 60 minutes * 60 seconds
  7195.     ExtendedTimer## = (s~&& + Timer)
  7196. End Function ' ExtendedTimer##
  7197.  
  7198. ' /////////////////////////////////////////////////////////////////////////////
  7199. ' Receives a {sDelimeter} delimited list of numbers {MyString}
  7200. ' and splits it up into an integer array arrInteger()
  7201. ' beginning at index {iMinIndex}.
  7202.  
  7203. Sub GetIntegerArrayFromDelimList (MyString As String, sDelimiter As String, iMinIndex As Integer, arrInteger() As Integer)
  7204.     ReDim arrString(-1) As String
  7205.     Dim CleanString As String
  7206.     Dim iLoop As Integer
  7207.     Dim iCount As Integer: iCount = iMinIndex - 1
  7208.  
  7209.     ReDim arrInteger(-1) As Integer
  7210.  
  7211.     'DebugPrint "GetIntegerArrayFromDelimList " + _
  7212.     '    "MyString=" + chr$(34) + MyString + chr$(34) + ", " + _
  7213.     '    "sDelimiter=" + chr$(34) + sDelimiter + chr$(34) + ", " + _
  7214.     '    "iMinIndex=" + cstr$(iMinIndex) + ", " + _
  7215.     '    "arrInteger()"
  7216.  
  7217.  
  7218.     If Len(sDelimiter) > 0 Then
  7219.         CleanString = MyString
  7220.         If sDelimiter <> " " Then
  7221.             CleanString = Replace$(CleanString, " ", "")
  7222.         End If
  7223.  
  7224.         split CleanString, sDelimiter, arrString()
  7225.         iCount = iMinIndex - 1
  7226.         For iLoop = LBound(arrString) To UBound(arrString)
  7227.             If IsNum%(arrString(iLoop)) = TRUE Then
  7228.                 iCount = iCount + 1
  7229.                 ReDim _Preserve arrInteger(iMinIndex To iCount) As Integer
  7230.                 arrInteger(iCount) = Val(arrString(iLoop))
  7231.                 'DebugPrint "5633 arrInteger(" + cstr$(iCount) + ") = VAL(arrString(" + cstr$(iLoop) + ")) = " + cstr$(arrInteger(iCount))
  7232.  
  7233.             End If
  7234.         Next iLoop
  7235.     Else
  7236.         If IsNum%(MyString) = TRUE Then
  7237.             ReDim _Preserve arrInteger(iMinIndex To iMinIndex) As Integer
  7238.             arrInteger(iMinIndex) = Val(MyString)
  7239.         End If
  7240.     End If
  7241.  
  7242.     'CleanString=""
  7243.     'for iLoop=lbound(arrInteger) to ubound(arrInteger)
  7244.     'CleanString = CleanString + iifstr$(iLoop=lbound(arrInteger), "", ",") + cstr$(arrInteger(iLoop))
  7245.     'next iLoop
  7246.     'DebugPrint "arrInteger=(" + CleanString + ")"
  7247.  
  7248. End Sub ' GetIntegerArrayFromDelimList
  7249.  
  7250. ' /////////////////////////////////////////////////////////////////////////////
  7251.  
  7252. Function IIF (Condition, IfTrue, IfFalse)
  7253.     If Condition Then IIF = IfTrue Else IIF = IfFalse
  7254.  
  7255. ' /////////////////////////////////////////////////////////////////////////////
  7256.  
  7257. Function IIFSTR$ (Condition, IfTrue$, IfFalse$)
  7258.     If Condition Then IIFSTR$ = IfTrue$ Else IIFSTR$ = IfFalse$
  7259.  
  7260. ' /////////////////////////////////////////////////////////////////////////////
  7261. ' By sMcNeill from https://www.qb64.org/forum/index.php?topic=896.0
  7262.  
  7263. Function IsNum% (text$)
  7264.     Dim a$
  7265.     Dim b$
  7266.     a$ = _Trim$(text$)
  7267.     b$ = _Trim$(Str$(Val(text$)))
  7268.     If a$ = b$ Then
  7269.         IsNum% = TRUE
  7270.     Else
  7271.         IsNum% = FALSE
  7272.     End If
  7273. End Function ' IsNum%
  7274.  
  7275. ' /////////////////////////////////////////////////////////////////////////////
  7276. ' Does a _PrintString at the specified row+column.
  7277.  
  7278. ' iRow and iCol are 0-based.
  7279.  
  7280. Sub PrintString (iRow As Integer, iCol As Integer, MyString As String)
  7281.     Dim iX As Integer
  7282.     Dim iY As Integer
  7283.     iX = _FontWidth * iCol
  7284.     iY = _FontHeight * iRow ' (iRow + 1)
  7285.     _PrintString (iX, iY), MyString
  7286. End Sub ' PrintString
  7287.  
  7288. ' /////////////////////////////////////////////////////////////////////////////
  7289. ' Does a _PrintString at the specified row+column.
  7290.  
  7291. ' iRow and iCol are 1-based.
  7292.  
  7293. Sub PrintString1 (iRow As Integer, iCol As Integer, MyString As String)
  7294.     Dim iX As Integer
  7295.     Dim iY As Integer
  7296.     iX = _FontWidth * (iCol - 1)
  7297.     iY = _FontHeight * (iRow - 1)
  7298.     _PrintString (iX, iY), MyString
  7299. End Sub ' PrintString1
  7300.  
  7301. ' /////////////////////////////////////////////////////////////////////////////
  7302. ' FROM: String Manipulation
  7303. ' found at abandoned, outdated and now likely malicious qb64 dot net website
  7304. ' http://www.qb64.[net]/forum/index_topic_5964-0/
  7305. '
  7306. 'SUMMARY:
  7307. '   Purpose:  A library of custom functions that transform strings.
  7308. '   Author:   Dustinian Camburides (dustinian@gmail.com)
  7309. '   Platform: QB64 (www.qb64.org)
  7310. '   Revision: 1.6
  7311. '   Updated:  5/28/2012
  7312.  
  7313. 'SUMMARY:
  7314. '[Replace$] replaces all instances of the [Find] sub-string with the [Add] sub-string within the [Text] string.
  7315. 'INPUT:
  7316. 'Text: The input string; the text that's being manipulated.
  7317. 'Find: The specified sub-string; the string sought within the [Text] string.
  7318. 'Add: The sub-string that's being added to the [Text] string.
  7319.  
  7320. Function Replace$ (Text1 As String, Find1 As String, Add1 As String)
  7321.     ' VARIABLES:
  7322.     Dim Text2 As String
  7323.     Dim Find2 As String
  7324.     Dim Add2 As String
  7325.     Dim lngLocation As Long ' The address of the [Find] substring within the [Text] string.
  7326.     Dim strBefore As String ' The characters before the string to be replaced.
  7327.     Dim strAfter As String ' The characters after the string to be replaced.
  7328.  
  7329.     ' INITIALIZE:
  7330.     ' MAKE COPIESSO THE ORIGINAL IS NOT MODIFIED (LIKE ByVal IN VBA)
  7331.     Text2 = Text1
  7332.     Find2 = Find1
  7333.     Add2 = Add1
  7334.  
  7335.     lngLocation = InStr(1, Text2, Find2)
  7336.  
  7337.     ' PROCESSING:
  7338.     ' While [Find2] appears in [Text2]...
  7339.     While lngLocation
  7340.         ' Extract all Text2 before the [Find2] substring:
  7341.         strBefore = Left$(Text2, lngLocation - 1)
  7342.  
  7343.         ' Extract all text after the [Find2] substring:
  7344.         strAfter = Right$(Text2, ((Len(Text2) - (lngLocation + Len(Find2) - 1))))
  7345.  
  7346.         ' Return the substring:
  7347.         Text2 = strBefore + Add2 + strAfter
  7348.  
  7349.         ' Locate the next instance of [Find2]:
  7350.         lngLocation = InStr(1, Text2, Find2)
  7351.  
  7352.         ' Next instance of [Find2]...
  7353.     Wend
  7354.  
  7355.     ' OUTPUT:
  7356.     Replace$ = Text2
  7357. End Function ' Replace$
  7358.  
  7359. ' /////////////////////////////////////////////////////////////////////////////
  7360. ' Split and join strings
  7361. ' https://www.qb64.org/forum/index.php?topic=1073.0
  7362. '
  7363. ' FROM luke, QB64 Developer
  7364. ' Date: February 15, 2019, 04:11:07 AM
  7365. '
  7366. ' Given a string of words separated by spaces (or any other character),
  7367. ' splits it into an array of the words. I've no doubt many people have
  7368. ' written a version of this over the years and no doubt there's a million
  7369. ' ways to do it, but I thought I'd put mine here so we have at least one
  7370. ' version. There's also a join function that does the opposite
  7371. ' array -> single string.
  7372. '
  7373. ' Code is hopefully reasonably self explanatory with comments and a little demo.
  7374. ' Note, this is akin to Python/JavaScript split/join, PHP explode/implode.
  7375.  
  7376. 'Split in$ into pieces, chopping at every occurrence of delimiter$. Multiple consecutive occurrences
  7377. 'of delimiter$ are treated as a single instance. The chopped pieces are stored in result$().
  7378. '
  7379. 'delimiter$ must be one character long.
  7380. 'result$() must have been REDIMmed previously.
  7381.  
  7382. ' Modified to handle multi-character delimiters
  7383.  
  7384. Sub split (in$, delimiter$, result$())
  7385.     Dim start As Integer
  7386.     Dim finish As Integer
  7387.     Dim iDelimLen As Integer
  7388.     ReDim result$(-1)
  7389.  
  7390.     iDelimLen = Len(delimiter$)
  7391.  
  7392.     start = 1
  7393.     Do
  7394.         'While Mid$(in$, start, 1) = delimiter$
  7395.         While Mid$(in$, start, iDelimLen) = delimiter$
  7396.             'start = start + 1
  7397.             start = start + iDelimLen
  7398.             If start > Len(in$) Then
  7399.                 Exit Sub
  7400.             End If
  7401.         Wend
  7402.         finish = InStr(start, in$, delimiter$)
  7403.         If finish = 0 Then
  7404.             finish = Len(in$) + 1
  7405.         End If
  7406.  
  7407.         ReDim _Preserve result$(0 To UBound(result$) + 1)
  7408.  
  7409.         result$(UBound(result$)) = Mid$(in$, start, finish - start)
  7410.         start = finish + 1
  7411.     Loop While start <= Len(in$)
  7412. End Sub ' split
  7413.  
  7414. ' /////////////////////////////////////////////////////////////////////////////
  7415. ' Converts a chr$(13) delimited string
  7416. ' into a 2-dimensional array.
  7417.  
  7418. ' Usage:
  7419. ' Dim StringArray(1 To 48, 1 To 128) As String
  7420. ' StringTo2dArray StringArray(), GetMap$
  7421.  
  7422. ' Version 2 with indexed array(row, columm)
  7423. ' Renamed StringToArray to StringTo2dArray.
  7424.  
  7425. ' See also: Array2dToString$
  7426.  
  7427. Sub StringTo2dArray (MyArray() As String, MyString As String)
  7428.     Dim sDelim As String
  7429.     ReDim arrLines(0) As String
  7430.     Dim iRow As Integer
  7431.     Dim iCol As Integer
  7432.     Dim sChar As String
  7433.     Dim iDim1 As Integer
  7434.     Dim iDim2 As Integer
  7435.     Dim iIndex1 As Integer
  7436.     Dim iIndex2 As Integer
  7437.  
  7438.     iDim1 = LBound(MyArray, 1)
  7439.     iDim2 = LBound(MyArray, 2)
  7440.     sDelim = Chr$(13)
  7441.     split MyString, sDelim, arrLines()
  7442.     For iRow = LBound(arrLines) To UBound(arrLines)
  7443.         If iRow <= UBound(MyArray, 1) Then
  7444.             For iCol = 1 To Len(arrLines(iRow))
  7445.                 If iCol <= UBound(MyArray, 2) Then
  7446.                     sChar = Mid$(arrLines(iRow), iCol, 1)
  7447.  
  7448.                     If Len(sChar) > 1 Then
  7449.                         sChar = Left$(sChar, 1)
  7450.                     Else
  7451.                         If Len(sChar) = 0 Then
  7452.                             sChar = "."
  7453.                         End If
  7454.                     End If
  7455.  
  7456.                     iIndex1 = iRow + iDim1
  7457.                     iIndex2 = (iCol - 1) + iDim2
  7458.                     MyArray(iIndex1, iIndex2) = sChar
  7459.                     'DebugPrint "MyArray(" + cstr$(iIndex1) + ", " + cstr$(iIndex2) + " = " + chr$(34) + sChar + chr$(34)
  7460.                 Else
  7461.                     ' Exit if out of bounds
  7462.                     Exit For
  7463.                 End If
  7464.             Next iCol
  7465.         Else
  7466.             ' Exit if out of bounds
  7467.             Exit For
  7468.         End If
  7469.     Next iRow
  7470. End Sub ' StringTo2dArray
  7471.  
  7472. ' /////////////////////////////////////////////////////////////////////////////
  7473.  
  7474. Function TrueFalse$ (myValue)
  7475.     If myValue = TRUE Then
  7476.         TrueFalse$ = "TRUE"
  7477.     Else
  7478.         TrueFalse$ = "FALSE"
  7479.     End If
  7480. End Function ' TrueFalse$
  7481.  
  7482. ' ################################################################################################################################################################
  7483. ' END GENERAL PURPOSE ROUTINES
  7484. ' ################################################################################################################################################################
  7485.  
  7486. ' ################################################################################################################################################################
  7487. ' BEGIN HARDWARE IMAGES DEMO #2 (WORKS)
  7488. ' ################################################################################################################################################################
  7489.  
  7490. ' /////////////////////////////////////////////////////////////////////////////
  7491. ' Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
  7492. ' https://qb64forum.alephc.xyz/index.php?topic=4674.0
  7493.  
  7494. ' madscijr
  7495. ' « Reply #5 on: Yesterday at 09:46:53 pm »
  7496.  
  7497. ' Quote from: SMcNeill on Yesterday at 07:56:57 pm:
  7498. ' Hardware images basically get their speed by being a sort of "Write Only"
  7499. ' method for images. You can make them, you can put them on the screen,
  7500. ' but you can't edit them or read information back from them.
  7501. ' ...
  7502. ' 2) You don't have to specify where they show up as a destination with putimage.
  7503. ' ...
  7504. ' If you have any specific questions, feel free to ask them and I'll do my
  7505. ' best to answer for you, if I can.  ;)
  7506. '
  7507. ' Thanks for taking the time to explain all that. When I'm back at the PC,
  7508. ' I'll try out your example.
  7509. '
  7510. ' For now, just one question: if you can't read information from them or even
  7511. ' specify where on the destination they go, how are they even useful?
  7512. ' Maybe it will click when I run your example or read up on it, but I just
  7513. ' don't see what the use of an image would be if you can't control where on
  7514. ' the screen it is drawn? Or how it would help speed up drawing a map of
  7515. ' colored tiles to the screen.
  7516. '
  7517. ' Thanks again...
  7518.  
  7519. ' SMcNeill, QB64 Developer
  7520. ' « Reply #6 on: Today at 01:14:28 am »
  7521. '
  7522. ' Try this out and see if it doesn't help answer your questions:
  7523.  
  7524. Sub HardwareImageDemo2
  7525.     $Color:32
  7526.     Display = _NewImage(1024, 720, 32)
  7527.     Software = _NewImage(1024, 720, 32)
  7528.  
  7529.     Screen Display
  7530.     Print "First, let's create a normal sortware screen and fill it with 40x40 tiles of random colors."
  7531.     Print "Press <ANY KEY> to view this screen."
  7532.     Sleep
  7533.  
  7534.     _Dest Software
  7535.     For y = 0 To 720 Step 40
  7536.         For x = 0 To 1024 Step 40
  7537.             Line (x, y)-Step(40, 40), &HFF000000 + Rnd * &HFFFFFF, BF
  7538.         Next
  7539.     Next
  7540.  
  7541.     _Dest Display
  7542.     _PutImage , Software
  7543.     Print
  7544.     Print "As you can see, this is a simple software screen."
  7545.     Print "Now, I'm going to copy that software screen and make it a hardware screen."
  7546.     Print "Press <ANY KEY> for me to do so!"
  7547.     Sleep
  7548.  
  7549.     Hardware = _CopyImage(Software, 33)
  7550.     Cls
  7551.     Print "Now, I'm back to my blank screen, but I now have a hardware screen to work with."
  7552.     Print
  7553.     Print "To keep things simple, let's showcase the differences between using _putimage with a software screen, and then with the hardware screen."
  7554.     Print
  7555.     Print "First, the software screen!  Press <ANY KEY> to continue."
  7556.     Sleep
  7557.  
  7558.     _PutImage (0, 100)-Step(100, 100), Software, Display, (0, 0)-(40, 40)
  7559.     Print "As you can see, all I did here was copy a single tile from the software screen and then scale it to fit upon the current screen."
  7560.     Print
  7561.     Print "Press <ANY KEY> to continue, as I'll now do the same with a hardware image."
  7562.  
  7563.     _PutImage (200, 100)-Step(100, 100), Hardware, , (0, 0)-(40, 40)
  7564.     Print
  7565.     Print "As you can see from the above, we have the same tile copied and scaled onto the screen, just to the right of the software image."
  7566.     Print
  7567.     Print "Doesn't really seem to be very different at all, now does it?"
  7568.     Print
  7569.     Print "Press <ANY KEY> to continue."
  7570.     _Display
  7571.     Sleep
  7572.  
  7573.     Print
  7574.     Color Red
  7575.     Print "BUT WAIT A MOMENT!!  What the heck happened to our hardware tile??!!??"
  7576.     Color White
  7577.     Print
  7578.     Print "It's no longer on the screen, as it was previously.  Why??"
  7579.     Print
  7580.     Print "Because it was never on the software screen at all, but was instead on it's own hardware layer ABOVE the software screen."
  7581.     Print
  7582.     Print "Hardware images only display ONCE, once _DISPLAY is called, and then they flush from the graphics buffer."
  7583.     Print "Draw.  Display.  Flush.  <-- that's the basic process of how a hardware image works."
  7584.     Print
  7585.     Print "If we want one to remain on the screen, we have to do it either by:"
  7586.     Print "1) Not updating the screen after we draw and display the image, as I did above with the tile I displayed."
  7587.     Print "2) Refresh displaying the image in our main loop (which is what we do even with software images for most games and such)."
  7588.     Print
  7589.     Print "Press <ANY KEY> to continue."
  7590.     Sleep
  7591.  
  7592.     Cls
  7593.     Print
  7594.     Print "So, as you can see, hardware images have a few drawbacks to them, with the most obvious being they only display once,"
  7595.     Print "then flush from memory.  If you want persistant hardware images, they're best used in a loop."
  7596.     Print
  7597.     Print "But, if they've got drawbacks, then one has to ask, 'What's the advantages to using them?'"
  7598.     Print "Press <ANY KEY> to find out!"
  7599.     Sleep
  7600.  
  7601.     't# = ExtendedTimer + 3
  7602.     t# = Timer + 3
  7603.     Do
  7604.         count = count + 1
  7605.         _PutImage (0, 100)-Step(100, 100), Software, Display, (x, y)-Step(40, 40)
  7606.         x = x + 40
  7607.         If x > 1024 Then x = 0: y = y + 40
  7608.         If y > 720 Then x = 0: y = 0
  7609.         _Display
  7610.     Loop Until Timer > t#
  7611.  
  7612.     Print "See lots of flashing tiles on the screen for the last three seconds?"
  7613.     Print "That was us using _PUTIMAGE with the software screen, and we put"; count; "tiles on the screen in those 3 seconds."
  7614.     Print
  7615.     Print "Now press <ANY KEY> and we'll do the exact same thing with hardware images."
  7616.     Sleep
  7617.  
  7618.     count = 0: x = 0: y = 0
  7619.     t# = Timer + 3
  7620.     tempScreen = _CopyImage(Display, 33)
  7621.     Do
  7622.         count = count + 1
  7623.         _PutImage , tempScreen
  7624.         _PutImage (300, 100)-Step(100, 100), Hardware, , (x, y)-Step(40, 40)
  7625.         x = x + 40
  7626.         If x > 1024 Then x = 0: y = y + 40
  7627.         If y > 720 Then x = 0: y = 0
  7628.         _Display
  7629.     Loop Until Timer > t#
  7630.  
  7631.     _FreeImage tempScreen
  7632.     Print
  7633.     Print "Didn't seem very different at the rate of which we were running things, now did it?"
  7634.     Print "Would you be surprised to find out that we put"; count * 2; "hardware images on the screen in those same 3 seconds?"
  7635.     Print
  7636.     Print "And if you look close, I counted each loop twice, as we didn't just put the hardware image to the screen, but also a"
  7637.     Print "complete copy of the original software screen as well!"
  7638.     Print
  7639.     Print "The reason why I did this?"
  7640.     Print
  7641.     Print "So I could completely elimimate all software iamges and JUST work with the much faster hardware layer!"
  7642.     Print
  7643.     Print "Press <ANY KEY> to continue"
  7644.     Sleep
  7645.  
  7646.     Cls
  7647.     Print "So, as you can see, hardware images are multiple times faster to display and render than software images."
  7648.     Print
  7649.     Print "But here's something else for you to notice -- I'm going to update the screen with constant, limitless tile refeshes."
  7650.     Print "To start with, I'm going to do this in a LOOP with the software images."
  7651.     Print "CTRL-TAB out of this demo program, open your task manager, and see how much memory and CPU processing power the program uses."
  7652.     Print "Then TAB back to this program and hit <ESC> to do the same with the hardware images."
  7653.  
  7654.     Do
  7655.         _PutImage (0, 100)-(1024, 720), Software, Display, (x, y)-Step(40, 40)
  7656.         x = x + 40
  7657.         If x > 1024 Then x = 0: y = y + 40
  7658.         If y > 720 Then x = 0: y = 0
  7659.         _Limit 60
  7660.         _Display
  7661.     Loop Until _KeyDown(27)
  7662.  
  7663.     Cls , 0
  7664.     Print "PRESS <SPACE BAR> to stop the hardware iamges!!"
  7665.     tempImage = _CopyImage(Display, 33)
  7666.     x = 0: y = 0
  7667.     Do
  7668.         _PutImage , tempImage
  7669.         _PutImage (0, 100)-(1023, 719), Hardware, , (x, y)-Step(40, 40)
  7670.         x = x + 40
  7671.         If x > 1024 Then x = 0: y = y + 40
  7672.         If y > 720 Then x = 0: y = 0
  7673.         _Limit 60
  7674.         _Display
  7675.     Loop Until _KeyDown(32)
  7676.  
  7677.     Cls
  7678.     Print "On my laptop, these two methods use the following amounts of CPU power:"
  7679.     Print "Software, 60 FPS -- 3% CPU"
  7680.     Print "Hardware, 60 FPS -- 0.1% CPU"
  7681.     Print
  7682.     Print "If I go in and change the limits to something much higher, these are the results (test them for yourselves, please):"
  7683.     Print "Software, 600 FPS -- 10.3% CPU"
  7684.     Print "Hardware, 600 FPS -- 0.1% CPU"
  7685.     Print
  7686.     Print
  7687.     Print "So, as you can see, the disadvantage to hardware images are they display once, then flush from memory."
  7688.     Print
  7689.     Print "While the advantages to their usage is MUCH faster processing times, and an immense reduction on CPU usage.  (The GPU picks up the work for us!)"
  7690.     Print
  7691.     Print
  7692.     Print "You basically use them just like you would any other normal image, though you have to keep in mind that they render"
  7693.     Print "to their own hardware layer, which you can specify to go on below or above your software screen."
  7694.     Print
  7695.     Print "(Or, you can _DISPLAYORDER _HARDWARE and *only* display the hardware layer, removing software rendering completely!)"
  7696.     Print
  7697.     Print "And THAT, my friends, is basically the lowdown on hardware vs software images.  ;)"
  7698.     Print
  7699.     Print
  7700.     Print "And this was another Steve(tm) Tutorial!  Enjoy!!"
  7701. End Sub ' HardwareImageDemo2
  7702.  
  7703. ' ################################################################################################################################################################
  7704. ' END HARDWARE IMAGES DEMO #2 (WORKS)
  7705. ' ################################################################################################################################################################
  7706.  
  7707. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7708. ' BEGIN DEBUGGING ROUTINES #DEBUGGING
  7709. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7710.  
  7711. Sub DebugPrint (MyString As String)
  7712.     If m_bDebug = TRUE Then
  7713.         '_Echo MyString
  7714.  
  7715.         ReDim arrLines(-1) As String
  7716.         Dim iLoop As Integer
  7717.         split MyString, Chr$(13), arrLines()
  7718.         For iLoop = LBound(arrLines) To UBound(arrLines)
  7719.             _Echo arrLines(iLoop)
  7720.         Next iLoop
  7721.     End If
  7722. End Sub ' DebugPrint
  7723.  
  7724. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7725. ' END DEBUGGING ROUTINES @DEBUGGING
  7726. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7727.  
  7728. ' ################################################################################################################################################################
  7729. ' BEGIN MENU HELPER ROUTINES
  7730. ' ################################################################################################################################################################
  7731.  
  7732. ' /////////////////////////////////////////////////////////////////////////////
  7733.  
  7734. Sub ShowInstructions (in$)
  7735.     Dim iLoop As Integer
  7736.     Dim iCount As Integer: iCount = 0
  7737.     Dim iRows As Integer: iRows = _Height(0) '\ _FontHeight ' GET # OF AVAILABLE TEXT ROWS
  7738.     ReDim arrLines(-1) As String
  7739.     Cls
  7740.     split in$, Chr$(13), arrLines() ' SPLIT OUTPUT INTO LINES
  7741.     For iLoop = LBound(arrLines) To UBound(arrLines)
  7742.         Print arrLines(iLoop)
  7743.         iCount = iCount + 1
  7744.         If iCount > (iRows - 5) Then
  7745.             'INPUT "PRESS <ENTER> TO CONTINUE"; in$
  7746.             Sleep
  7747.             iCount = 0
  7748.         End If
  7749.     Next iLoop
  7750.     Print
  7751.     Input "PRESS <ENTER> TO CONTINUE"; in$
  7752. End Sub ' ShowInstructions
  7753.  
  7754. ' ################################################################################################################################################################
  7755. ' END MENU HELPER ROUTINES
  7756. ' ################################################################################################################################################################
  7757.  
  7758.  
  7759. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7760. ' #REFERENCE
  7761.  
  7762. ' =============================================================================
  7763. ' SOME USEFUL STUFF FOR REFERENCE:
  7764.  
  7765. ' Type Name               Type suffix symbol   Minimum value                  Maximum value                Size in Bytes
  7766. ' ---------------------   ------------------   ----------------------------   --------------------------   -------------
  7767. ' _BIT                    `                    -1                             0                            1/8
  7768. ' _BIT * n                `n                   -128                           127                          n/8
  7769. ' _UNSIGNED _BIT          ~`                   0                              1                            1/8
  7770. ' _BYTE                   %%                   -128                           127                          1
  7771. ' _UNSIGNED _BYTE         ~%%                  0                              255                          1
  7772. ' INTEGER                 %                    -32,768                        32,767                       2
  7773. ' _UNSIGNED INTEGER       ~%                   0                              65,535                       2
  7774. ' LONG                    &                    -2,147,483,648                 2,147,483,647                4
  7775. ' _UNSIGNED LONG          ~&                   0                              4,294,967,295                4
  7776. ' _INTEGER64              &&                   -9,223,372,036,854,775,808     9,223,372,036,854,775,807    8
  7777. ' _UNSIGNED _INTEGER64    ~&&                  0                              18,446,744,073,709,551,615   8
  7778. ' SINGLE                  ! or none            -2.802597E-45                  +3.402823E+38                4
  7779. ' DOUBLE                  #                    -4.490656458412465E-324        +1.797693134862310E+308      8
  7780. ' _FLOAT                  ##                   -1.18E-4932                    +1.18E+4932                  32(10 used)
  7781. ' _OFFSET                 %&                   -9,223,372,036,854,775,808     9,223,372,036,854,775,807    Use LEN
  7782. ' _UNSIGNED _OFFSET       ~%&                  0                              18,446,744,073,709,551,615   Use LEN
  7783. ' _MEM                    none                 combined memory variable type  N/A                          Use LEN
  7784.  
  7785. ' div: int1% = num1% \ den1%
  7786. ' mod: rem1% = num1% MOD den1%
  7787.  
  7788. ' @REFERENCE
  7789. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7790.  

Pages: [1] 2 3 ... 20