- Aug
- 2,808
- 144
Here's some ANSI art displayed on the TCC Console.
The image was created using the theDraw MS-DOS program from 1999,
with the image saved in the file shuttle2.ans
C# Code was then used to display the image from the shuttle2.ans file onto the TCC console.
I am using dotnet version 10.0.303 from the TCC command line.
The shuttle2.ans file is from theDraw MS-DOS program.
Download The Draw 4.x from WinWorld
Yes, there are 64-bit clones of "The Draw" available to use,
but I am using the program I have previously used.
I extracted "disk1.img" from "The Draw 4.63 (3.5).7z"
to my r:\ drive.
NOTE: For this example,
all that is needed is the SHUTTLE2.ANS file
from the EXAMPLE folder in disk1.img
You can extract the SHUTTLE2.ANS file
from the EXAMPLE folder in disk1.img
using 7-Zip from
The TCC 7unzip will NOT work,
as it does not recognize the old format of disk1.img
If you do not want to install theDraw into DosBox-X,
skip past the following instructions for installing
theDraw into DosBox-X.
I extracted the contents of "The Draw 4.63 (3.5).7z"
to "R:\The Draw 4.63 (3.5)"
From DosBox-X (I'm using version 0.83.21)
Copy the contents of drive A: to c:\theDraw
including sub-directories.
You will need the SHUTTLE2.ANS file
from the c:\theDraw\Examples folder.
From a folder on my system
(I used my r:\ folder)
I created a dotnet console project called AnsiScreenDemo.
Put the SHUTTLE2.ANS file in the same folder as Program.cs
The following will replace the existing Program.cs
Add the following to the .csproj file
so that shuttle2.ans is copied to the output folder;
This will (hopefully) become a future function in my jlcUtils plugin that will load an .ans file for display on the TCC console.
Joe
The image was created using the theDraw MS-DOS program from 1999,
with the image saved in the file shuttle2.ans
C# Code was then used to display the image from the shuttle2.ans file onto the TCC console.
I am using dotnet version 10.0.303 from the TCC command line.
Code:
R:\AnsiScreenDemo>dotnet --version
10.0.303
The shuttle2.ans file is from theDraw MS-DOS program.
Download The Draw 4.x from WinWorld
The Draw 4.x
TheDraw, from Ian E. Davis of TheSoft Programming Service, was a popular shareware ANSI graphics and animation editor used to make graphics for BBSes and DOS programs. It supported drawing lines, shapes, animations, and large fonts on to a text screen using colorful IBM PC drawing characters and...
winworldpc.com
Yes, there are 64-bit clones of "The Draw" available to use,
but I am using the program I have previously used.
I extracted "disk1.img" from "The Draw 4.63 (3.5).7z"
to my r:\ drive.
NOTE: For this example,
all that is needed is the SHUTTLE2.ANS file
from the EXAMPLE folder in disk1.img
You can extract the SHUTTLE2.ANS file
from the EXAMPLE folder in disk1.img
using 7-Zip from
The TCC 7unzip will NOT work,
as it does not recognize the old format of disk1.img
Code:
R:\>7unzip /c disk1.img
TCC: Error in archive R:\disk1.img :
Sevenzip signature is bad.
If you do not want to install theDraw into DosBox-X,
skip past the following instructions for installing
theDraw into DosBox-X.
I extracted the contents of "The Draw 4.63 (3.5).7z"
to "R:\The Draw 4.63 (3.5)"
From DosBox-X (I'm using version 0.83.21)
Code:
IMGMOUNT A "r:\The Draw 4.63.img" -t floppy
MD c:\theDraw
Copy the contents of drive A: to c:\theDraw
including sub-directories.
You will need the SHUTTLE2.ANS file
from the c:\theDraw\Examples folder.
From a folder on my system
(I used my r:\ folder)
I created a dotnet console project called AnsiScreenDemo.
Code:
dotnet new console -n AnsiScreenDemo
cd AnsiScreenDemo
dotnet add package System.Text.Encoding.CodePages
Put the SHUTTLE2.ANS file in the same folder as Program.cs
Code:
AnsiScreenDemo/
├── Program.cs
└── shuttle2.ans
The following will replace the existing Program.cs
Code:
using System;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
if (OperatingSystem.IsWindows())
{
EnableVirtualTerminalProcessing();
}
Console.OutputEncoding = Encoding.UTF8;
Console.CursorVisible = false;
try
{
// TheDraw commonly uses the IBM PC CP437 character set.
byte[] bytes = File.ReadAllBytes("shuttle2.ans");
string screen = Encoding.GetEncoding(437).GetString(bytes);
Console.Write(screen);
}
finally
{
Console.CursorVisible = true;
Console.ResetColor();
Console.Write("\x1b[0m");
}
static void EnableVirtualTerminalProcessing()
{
const int STD_OUTPUT_HANDLE = -11;
const uint ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004;
IntPtr handle = GetStdHandle(STD_OUTPUT_HANDLE);
if (GetConsoleMode(handle, out uint mode))
{
SetConsoleMode(
handle,
mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
}
}
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr GetStdHandle(int nStdHandle);
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool GetConsoleMode(
IntPtr hConsoleHandle,
out uint lpMode);
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool SetConsoleMode(
IntPtr hConsoleHandle,
uint dwMode);
Add the following to the .csproj file
so that shuttle2.ans is copied to the output folder;
Code:
<ItemGroup>
<None Update="shuttle2.ans">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
Code:
dotnet run
This will (hopefully) become a future function in my jlcUtils plugin that will load an .ans file for display on the TCC console.
Joe