New printer setup

Do you have a Printer connected to a USB port?

It has been reported that previous version of these programs will not work with Hewlett Packard printers 720 and 722. The problem is that, when printing from a DOS program, these printers will only print 59 lines of text per page. (I am assuming that this problem lies with me because Hewlett Packard is a very nice company that makes wonderful printers and it must be I who am too stupid figure out how to get these printers to print 60 lines of text per page like virtually every other printer on earth.)

Anyway. Since I have these programs currently working with line printers, dot matrix printers, laser printers, daisy wheel printers, and every other ink jet printer ever made (and I probably can't get HP to change their printers) it seems that I will have to change the programs to accomodate these printers.

So I did. This required that every part of the programs that printed anything be rewritten. Even then, the user's guide can only be printed using 58 to 66 lines of text per page. All other parts of the programs can print from 51 to 66 lines of text per page.

Previously a program would only allow you so choose between printing on a LINE printer or LASER printer. A LINE printer setting would allow the program to print a page with 60 lines of text and 3 line top and bottom margins. The LASER setting would print 60 lines of text and 0 margin lines.

The current versions of these programs will allow you to choose the number of top margin lines (0 to 3), the number of text lines (51 to 66), and bottom margin lines (0 to 3).

Really important stuff if you are upgrading!
Note: The following only applies to Harris Test, the other programs are not affected.

Version 5.1 (and after) of Harris Test is compatable with question lists and quizzes made with previous versions. However since the new printer setup stores information in the same part of the files as did the old version, and the meaning of that information is totally different, when you load an old file into the new version of this program the printer setup will be very bizzare. Easy fix though. When you load an old question list just choose "Printer setup" to enter the new printer data for margin and text lines.

If your old quizzes printout a score sheet use "Manage a quiz", then "Change quiz parameters" to enter the new printer setup without having to recompile the quiz.

Fatal Error!

Be very careful if you try to load a question or quiz file with a new printer setup into an old version of Harris Test (5.08 or earlier). Since the new printer setup information is way out of the range of the old version the old version of Harris Test will die.

Of course this will only be a problem in a system where many people are using different versions of the program. If you are the only person using the program or if everyone upgrades and overwrites the old versions, then there can be no problem. There is even an easy solution to loading new files into an old version of the program. If you set the top, text, and bottom lines of a new file to 3-51-0 then an old version of the program will think that it is set to LINE, 3-52-0 for LASER.

Technobabble!

There is really no reason to read this unless you are interested in programming or how this program was written. The following has nothing to do with actually using the program.

Harris Test and the other programs offered are written in QuicBasic 4.5. The problem with with upgrading the printer setup had nothing to do with that language but with keeping the files created with the old versions compatable with the new version.

To do this is was necessary to keep the file structure the same for all versions. The part of the question set file that held the password had to be in the same place in the file and use the same number of characters. Same with the part that held the current student instructions, question size, print parameters, etc. In other words, while the program can change, the file structure cannot.

Since the old printer set up could only be either LINE or LASER it only required one byte (think of a byte as one letter) to hold the information. If a 0 was stored then the printer setup was LINE, a 1 was stored for LASER.

For the new printer setup I needed to store 3 numbers. 0-3 for the top margin, 51 - 66 for the number of text lines, and 0-3 for the bottom margin. How do you store 3 different numbers in one byte?

Well, a byte is really more than one letter in the normal alphabet. In binary code a byte is 8 bits. Each bit can be either a 0 or a 1. With 1 bit you can have a two letter alphabet, 0 or 1. With 2 bits you can have 4 letters, 00, 01, 10, or 11. With a byte, or 8 bits you can have a 256 letter alphabet. Now we have some room to manuver.

With a little knowledge you can split a byte into parts. For example you could split it like this...

0000---00---00
Four bits give you a 16 letter alphabet along with the two 2 bit or 4 letter alphabets.

Of course computers are really about storing numbers, not letters or alphabets and really it is the numbers that are actually stored not letters. For example if the computer encounters the number 65 (or 00100001) in a byte it is perfectly happy. It can store it, retrieve it, add it, subtract it or sent it over a modem. If however it has to display it on the screen, and it knows that it is a letter and not a value, it will be displayed as the letter "A".

So what I have done is to divide a byte into 3 "zones" of 4 bits, 2 bits and 2 bits. The 4 bit zone will store a number from 0 to 15, or if you add 51 to the stored number, 51 to 66. Each 2 bit zone will store 0 to 3. So now you know how to store 3 variable numbers into one byte.

So, where did the backward compatability problem come from? In the old version the printer mode was stored as either the LETTER 0 or 1. I could have stored it as the value of 0 (00000000) or 1 (00000001) but that has problems displaying on the screen or printer when the files are viewed directly. The 8 bit alphabet has 256 letters, room for all 26 uppercase and 26 lowercase letters, all the punctuation marks, a bunch of weird stuff, and the numerals 0 to 9. 0 is the 48th letter and 1 is the 49th letter.

So the old version takes the value of the printer setup (either 0 or 1), adds 48 to it, and stores it as either the letter 0 (00110000) or the letter 1 (00110001). However the new printer setup can have a value of from 0 (00000000 or 0 margin lines, 51 text lines, 0 margin lines) to 255 (11111111 or 3 margin lines, 66 text lines, 3 margin lines). If the printer setup value plus 48 is greater than 255 then when you try to store it into one byte the computer has a nervious breakdown because it can't be done.


E-mail

If you have any technical questions or comments about the program or programming in general click on the envelope.


Press [BACK] on your web browser to return to the previous page, or
MAIN PAGE