home *** CD-ROM | disk | FTP | other *** search
/ Outlet 35 / outlet-35.mgt / TEXT < prev    next >
Text File  |  2021-04-18  |  7KB  |  1 lines

  1. Well Hello there,<I typed this text in using Tasword II for the main part with word wrap and justify switched off.<<That's most important that.If you don't switch them both off then my program gets a bit confused with the end of line etc. I don't count the number of characters in the text so I don't know when I reach character 64 and thus two words would be printed as one.<< I didn't write this bit of code to be used with Tasword II originally but I found with a bit of jiggery pokery I was able to use Tasword 2 fairly well.It's not quite as flexible as I want but it's a damn sight quicker than LET a$=etc. then poking that lot in.<  <That's not to say that you can't use LET a$=etc.That works as well.<<Up to now I have not told you what this program does. Well as you can see it prints your text onto the screen (with word wrap)  a page at a time from a text file stored in memory.<<Not very impressive so far I grant you<<The fancy bit comes in when you realise that the text can be compressed<<I can see that I have grabbed your attention! <<Well,that's the idea of this demo program after all isn't it?< <The extent to which the text can be compressed is entirely up to the user. By that I mean that there is a list of words at the end of the code that the user inputs which gives a certain amount of lee-way as to how much the text is compressed. If for example you only want to save a little memory then you need only supply a few words.<<The manner in which the text is input saves memory in itself.   To see what I mean load the file TEXT into Tasword II and take a decko.<<NOT NOW!<<later.<<I hope that I have made this program fairly simple to use and reasonably user-friendly. Its difficult, you see, I know whats going on and that makes it hard for me to see it from the point of view of a beginner for example.  I did get my wife to have a go and she found it fairly straightforward.  Mind you she dosn't program at all so I had to tutor her as far as entering the word list etc so I suppose it wasn't that good a test.<<I'm sure that you'll have a better idea than me as far as that side goes and you will be able to do (or suggest) something with it if it proves to be to awkward to use.<<Right well, I'll give you a brief history of the program and tell you a bit more about it and how to use it and then toodle off. OK?<<<I wrote the program originally as a text routine for adventure programs. It stores "pages" of compressed text which can be called up as required by poking a location (64261 in this version) with the page number and then calling the main routine. I left the compress routine in memory as it only takes up about 140 bytes. The word list is common to both compress and uncompress so I felt it was unnecessary to dob it out. Of course if memory is very tight then you could take out the uncompress routine and use it seperately. You will still need the word list though.<<How it works:-<<<The program works by searching through the text looking for a match in the word list. If it finds one it inserts a token (chr$ 94) and then the value of the word (2 bytes).  The compressed text overwrites the original text in memory so there is no need to have any spare room to make up your compressed text. I have not tried it yet, but I see no reason why you can't use all of the spare memory available for text (something like 39000 to 40000 bytes if the routine is in high RAM)<If you want to you are able to join two or more compressesed files together. You must have used the same word list how ever otherwise you will have problems when you come to uncompressing and printing. You are able to do this by compressing the first file and saving it. Then compressing the next file and saving it (and so on). To have two or more files in memory you load the first file into the start of your text area the next file into memory after the first file minus one byte. You need to load over the last byte of the first files as this holds 255. (end of text marker)<That brings me to the first point of difficulty for the new computer user. You need to poke 255 into memory after the last byte of uncompressed text. With LET a$=etc that is no problem. With Tasword II however the user will need to save the text file re-set the computer load in the text file and manually find the end of the text and poke 255 in as the last byte. Then the text should either be compressed and saved or saved as a Tasword II file for future use.<I found it was always a good idea to save the original text as if you needed to edit it later you will have a real job with the compressed stuff.< On to the word list.<<The program can store up to 253 different words or short sentences (up to a maximum of 32 chars per entry including spaces).They are numbered from zero to 254. The only numbers you can't use are <<94 used as token<<64 used as end of page marker<<and 255 used for end of text, end of word list (and one or two other things)<<I have found from experience that the use of a leading or trailing space can add to the memory saved<for example " the"<<I have included in the program the ability to use control characters for INK PAPER FLASH and BRIGHT I have not trapped the AT or chr$ 6 or chr$ 9 and if they are used they will throw out the word wrap routine.<<The length of this text file is at present 7168 bytes and it is uncompressed at present. After you have read this letter try RANDOMIZE USR 64338 and the value given will tell you by how much the text has been compressed. I have only used about 38 words for this demo so the saving will not be all that much. Its a good idea not to compress a word that you only use once in the text as this will have the opposite effect and actually increase the amount of memory you use.<<The other use that this program can be put to (the one I originally wrote it for) is demonstrated next. Its run from BASIC but could equally easily be run from a machine code routine.<<PRESS ANY KEY<@You are in a dark room.<You hear a funny noise<<WHAT NEXT?<<@HELP<<@Help? you must be joking.<<@WHAT NEXT?<<PRESS ANY KEY<<@As you will have seen the messages can be printed by poking the page number into address 64261 and calling the print routine (at 64000) <There is no CLS routine unless the page is larger that 704 characters long. In this way you could display any page you want at any time in any order.<@I'll give you an example.<<@This is page 8<<@This is page 9<<@This is page 10. And now for page 4<<@  PRESS ANY KEY<@All you need to do to get these effects is to poke character 64 at the end of you page and the program will find it by searching through your text and keeping a count of the pages it finds. If you tell it to print a page that isn't there it will simply come back to you having printed nothing as the 255 (end of text) will send the routine back to BASIC if it is found before the count reaches the page you have specified. You must remember to put at least one chr$ 64 at the end of your text as this will be looked for.<<No chr$ 64, No page printed.<<I think thats everything for now. See what you think to it and let me know.<<All the best<<BoB (late again) Smith.@