Advertisement

Editing the ascii code

Started by January 19, 2002 03:26 AM
7 comments, last by Jeff D 22 years, 9 months ago
I know there is a way to edit the ascii code, ive used programs that allowed you. But how do you do it?? Thx in advance. Jeff D Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton
Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton
Perhaps you could expand a bit on what exactly you mean by ''edit the ascii code'' ...
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
Advertisement
Well mainly to change the characters of the ascii code. Like for a text-based game I could make the plus sign look like a shaded in ball instead.. A little better explanation?

Jeff D


Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton
Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton
You can''t "edit the ascii code" - but you can change how each code gets represented on the screen - just change the font.

‘But truth's a menace, science a public danger.’ Brave New World, Aldous Huxley
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
As has been said, you can''t edit the ascii code. Perhaps what you mean is to edit the text itself? Like this:

char text[5] = "Cat";
cout << text << endl;
text[0] = 66;
cout << text << endl;

That would change Cat to read Bat instead. You''re not changing the ascii code, just the text itself. If that''s what you meant, just look up an ascii chart, and use that.

-Arek the Absolute
-Arek the Absolute"The full quartet is pirates, ninjas, zombies, and robots. Create a game which involves all four, and you risk being blinded by the sheer level of coolness involved." - Superpig
Give me some time to look it up but there IS a way to change the ascii characters graphics(I''ve done it before), however this requires direct editing of dos mode video memory, it will NOT work in windowed mode , and may not even work under WIN32 at all (I can almost assure you it will not work under NT, 2000 and XP since these OS do not allow the direct hardware manipulation required to modify the ascii set).
Advertisement
Original Document is at http://www.bsdg.org/swag/CHARS/0006.PAS.html

Here's a copy: (ARGG! If the butchered tabs are annoying just visit the original link)

{
From: MICHAEL HOENIE
Subj: CHARACTER UNIT.
----------------------------------------------------------------------
here is some revised code to allow users to change the standard ASCII
font in EGA or VGA. I don't know if it will work in standard CGA, but
it works well on VGA. }

unit graphics;

interface uses dos, crt;

const
numnewchars=9; { # of chars available }

{1 2 4 8 1 3 6 1
³ ³ ³ ³ 6 2 4 2
³ ³ ³ ³ ³ ³ ³ 8
³ ³ ³ ³ ³ ³ ³ ³ Character.
1 2 3 4 5 6 7 8 8x16
ÚÄÂÄÂÄÂÄÂÄÂÄÂÄÂÄ¿
1³ ³ ³ ³ ³ ³ ³ ³ ³=
2³ ³ ³ ³ ³ ³ ³ ³ ³= This is a BYTE mapper.
3³ ³ ³ ³ ³ ³ ³ ³ ³= Fill in the blanks, then add
4³ ³ ³ ³ ³ ³ ³ ³ ³= the numbers together on a calculator.
5³ ³ ³ ³ ³ ³ ³ ³ ³= The # should never be greater than 255.
6³ ³ ³ ³ ³ ³ ³ ³ ³=
7³ ³ ³ ³ ³ ³ ³ ³ ³= The #'s are as follows:
8³ ³ ³ ³ ³ ³ ³ ³ ³=
9³ ³ ³ ³ ³ ³ ³ ³ ³= 1,2,4,8,16,32,64,128
10³ ³ ³ ³ ³ ³ ³ ³ ³=
11³ ³ ³ ³ ³ ³ ³ ³ ³= So if you had:
12³ ³ ³ ³ ³ ³ ³ ³ ³=
13³ ³ ³ ³ ³ ³ ³ ³ ³= X X X X X X
14³ ³ ³ ³ ³ ³ ³ ³ ³= 1 2 4 16 32 128 = 183
15³ ³ ³ ³ ³ ³ ³ ³ ³=
16³ ³ ³ ³ ³ ³ ³ ³ ³=
ÀÄÁÄÁÄÁÄÁÄÁÄÁÄÁÄÙ}

procedure loadchar; { this is the procedure to change the characters }

implementation

procedure loadchar;
type
bytearray=array[0..15] of byte;
chararray=array[1..numnewchars] of record
charnum:byte;
chardata:bytearray;
end;
const { these are the characters outlined 9 = chr(9), 176 = chr(176) }
newchars:chararray=(
(charnum:9; chardata: (24,0,66,0,0,024,165,24,60,102,66,66,66,
102,60,0)),
(charnum:10; chardata: (24,126,255,231,231,255,255,255,255,255,
191,255,255,255,255,255)),
(charnum:24; chardata: (24,24,24,24,24,24,24,24,24,24,126,24,24,
24,60,24)),
(charnum:231; chardata: (8,42,28,127,27,42,8,8,8,8,8,8,8,8,8,0)),
(charnum:235; chardata: (0,0,102,60,24,24,24,60,60,126,126,126,
60,24,0,0)),
(charnum:239; chardata: (255,171,213,171,213,171,213,171,213,171,
213,171,213,171,213,171)),
(charnum:225; chardata: (24,60,102,102,102,60,24,24,24,24,120,120,
24,120,120,0)),
(charnum:176; chardata: (9,64,4,33,0,136,2,32,1,136,0,66,0,8,64,18)),
(charnum:177; chardata: (119,119,119,0,238,238,238,0,119,119,119,0,
238,238,238,0)));

var
regs:registers;
i:byte;
begin
for i:=1 to numnewchars do
begin
with regs do
begin
ah:=$11; { video sub-Function $11 }
al:=$0; { Load Chars to table $1 }
bh:=$10; { number of Bytes per Char $10 }
bl:=0; { Character table to edit }
cx:=1; { number of Chars we're definig }
dx:=newchars.charnum;
es:=seg(newchars.chardata);<br> bp:=ofs(newchars.chardata);<br> intr($10,regs);<br> end;<br> end;<br> end;<br><br> begin<br> end.<br><br><br>Edited by - Michalson on January 19, 2002 5:59:30 PM </i> <br><br>Edited by - Michalson on January 19, 2002 6:00:32 PM
That''s pretty neat - it''s a throw back - but still pretty neat.

‘But truth's a menace, science a public danger.’ Brave New World, Aldous Huxley
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
If you are doing it in Windows, just download a font editor. There are a lot of free ones.

---
Make it work.
Make it fast.

"Commmmpuuuuterrrr.." --Scotty Star Trek IV:The Voyage Home
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]

This topic is closed to new replies.

Advertisement