Category : Assembly Language Source Code
Archive   : TASMSWAN.ZIP
Filename : STR.PAS

 
Output of file : STR.PAS contained in archive : TASMSWAN.ZIP
PROGRAM StringConversion;

{ Convert ASCIIZ strings and Turbo Pascal strings }

TYPE ASCIIZString = ARRAY[ 0 ... 255 ] OF Char;
ASCIIZptr = ASCIIZString;

VAR a : ASCIIZString;
s : String;

{$L STR.OBJ}

{ Convert an ASCIIZ string (a) to a Pascal string (s) }

PROCEDURE ASCIIZtoStr( a: ASCIIZString; VAR s : String );
EXTERNAL;
(*
VAR len : Integer;
BEGIN
len := 0;
WHILE ( len < 255 ) AND ( a[ len ] <> Chr( 0 ) ) DO
BEGIN
len := len + 1;
s[ len ] := a[ len - 1]
END; {while}
s[ 0 ] := Chr( len )
END; {ASCIIZtoStr }
*)


{ Convert a Pascal string (s) to an ASCIIZ string (a) }

PROCEDURE StrToASCIIZ( s : String; VAR a : ASCIIZString );
EXTERNAL;
(*
VAR len, i : Integer;
BEGIN
len := Length( s);
FOR i := 1 TO len DO
a[ i - 1 ] := s[ i ];
a[ len ] := Chr( 0 )
END; {StrToASCIIZ }
*)


{ Display an ASCIIZ string }

PEOCEDURE ShowASCIIZ( a : ASCIIZString );
VAR i : Integer;
BEGIN
i := 0;
WHILE ( i < 255 ) AND ( a[ i ] <> Chr(0) ) DO
BEGIN
Write( a[ i ] );
i := i + 1
END { while }
END; { ShowASCIIZ }

BEGIN
s := 'This is a test';
StrtoASCIIZ( s, a );
ShowASCIIZ( a );
Writeln;
s := '';
ASCIIZtoStr( a, s );
Writeln( s )
END.


  3 Responses to “Category : Assembly Language Source Code
Archive   : TASMSWAN.ZIP
Filename : STR.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/