home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug162.arc
/
CONVMWB.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1979-12-31
|
3KB
|
115 lines
CONST
key_words: ARRAY[1..107] OF STRING =
('LET','LPRINT','PRINT','IF','NEW','LLIST','LIST','ELSE',
'THEN','FOR','NEXT','DIM','GOTO','OFF','ON','STOP','END',
'GOSUB','READ','DATA','RETURN','INPUT','RUN','RESTORE',
'TO','STOP','TAB','SPC','FN','VAR','POKE','OUT','REM',
'PRMT','ZONE','SD','CLEAR','EDIT','SET','RESET','SPEED',
'NORMAL','UNDERLINE','CSAVE','CLOAD','STRS','INVERSE','PCG',
'CURS','NOT','AND','OR','TRACE','CONT','CLS','HIRES','AUTO',
'INVERT','LORES','INT','IN','PEEK','USR','LEN','SEARCH',
'POINT','ERROR','POS','ASC','USED','NET','MEM','EDASM',
'GX','ABS','RND','FLT','FRE','VAL','FRACT','SGN','SQR','SIN',
'COS','ATAN','LOG','EXP','PLOT','DELETE','RENUM','PLAY',
'EXEC','STR','KEY','CHR','SAVE','LOAD','DIR','GRSAVE',
'GRLOAD','OPEN','CLOSE','NAME','KILL','AS','SYSTEM',
'DISKRESET');
var
oldfile,
newfile : text;
filename,
line : string;
count : integer;
more : boolean;
function translate(old:string):string;
var
t1,t2,
temp : integer;
new : string;
begin
new := ' ';
str(ord(old[2])+ord(old[1])*256,new);
for count := 4 to length(old) do
begin
temp := ord(old[count]);
if temp > 128
then new := new + key_words[temp - 128]
else new := new + old[count];
end;
translate := new;
end;
procedure read_header;
{ read the first block of code and forget it }
var
count : integer;
one_char : char;
begin
count := 0;
repeat
read(oldfile,one_char);
count := count + 1;
until eof(oldfile) or (count = 64);
end;
procedure read_a_line(var the_line:string;var more:boolean);
var
last_char,
k,
one_char : char;
count,
line_len : integer;
begin
line_len := 255;
count := 0;
one_char := ' ';
the_line := '';
repeat
read(oldfile,one_char);
count := count + 1;
the_line := the_line + one_char;
if count = 3
then line_len := ord(one_char);
until (count = line_len+2) or (count > 256);
more := not((the_line[1] = chr($ff)) and (the_line[2] = chr($ff)));
if eof(oldfile) then more := false;
end;
begin
write('Enter Filename -> ');
readln(filename);
assign(oldfile,filename+'.mwb');
assign(newfile,filename+'.asc');
reset(oldfile);
rewrite(newfile);
read_header;
count := 1;
read_a_line(line,more);
while more do
begin
if count = 10
then begin
count := 1;
write('*')
end
else count := count + 1;
writeln(newfile,translate(line));
read_a_line(line,more);
end;
close(oldfile);
close(newfile);
end.