25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more...
Zero the parity bit of all bytes in a file, Microsoft MBASIC, Heathkit H-89 computer
Early modem programs operated only in text mode, and had the option of saving the entire session to a disk file. This was known as the "capture buffer".
There are only 128 ASCII characters, numbered 0 through 127. The number 127 can be stored in only 7 bits, leaving the 8th bit of each byte unused. Modem programs often used the 8th bit for error checking.
In the capture buffer text file, however, which faithfully recorded all the characters transmitted, any character with the 8th bit set to 1 instead of 0 was not a legitimate ASCII character because its numeric value would be greater than 127, and it could be displayed as garbage.
The solution was to go through the file and turn off (set to 0) the 8th bit of every character, restoring them to legitimate ASCII.
That's what this program does.
10 'MAPDOWN.BAS 11-29-83 11 'COPYRIGHT (C)1983 BY STEVEN WHITNEY. 12 'Initially published by http://25yearsofprogramming.com. 13 'Published under GNU GPL (General Public License) Version 3,with ABSOLUTELY NO WARRANTY. 14 'STRIPS THE PARITY BITS FROM ALL CHARACTERS IN A FILE, SO 15 'ALL CHARS ARE TRUE ASCII 0-127. 16 'USEFUL FOR MODEM SESSIONS CAPTURED TO A TEXT BUFFER. 17 'I DON'T RECALL IF THIS WAS FOR THE H89 OR H100. 18 'THE ONLY DIFFERENCE SHOULD BE THE SCREEN STATEMENT, 19 'WHICH ONLY CHANGES THE DISPLAY TO REVERSE VIDEO. 20 INPUT "WHAT IS THE NAME OF THE SOURCE FILE";FILE$ 30 INPUT "WHAT FILE DO YOU WANT TO CREATE?";FILE1$ 40 OPEN "I",1,FILE$ 50 OPEN "O",2,FILE1$ 60 WHILE NOT EOF(1) 70 A$=INPUT$(1,#1) 80 IF ASC(A$)>128 THEN SCREEN ,1:A$=CHR$(ASC(A$)-128) 90 PRINT A$; 100 SCREEN ,0 110 PRINT #2,A$; 120 WEND 130 END
Copyright ©2012 Steven Whitney. Last modified Sun 07/29/2012 11:41:39 -0700.