--- title: "Save Memory: Use Buried Color Codes Instead of Color Commands" type: "article" slug: "save-memory-use-buried-color-codes-instead-of-color-commands" url: "http://localhost/article/save-memory-use-buried-color-codes-instead-of-color-commands/" markdown_url: "http://localhost/article/save-memory-use-buried-color-codes-instead-of-color-commands.md" published_at: "2022-10-07T12:24:38+00:00" modified_at: "2026-07-31T00:35:08+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "Many of you have purchased commercial programs that appear to be unlistable, yet they run fine. One of the ways to accomplish this is to use 'buried' color codes in the listing. What are buried color codes and how do I use them? They are the equivalent of the color commands you are used to…" category: - name: "The Plotter" slug: "the-plotter" taxonomy: "category" url: "http://localhost/category/periodicals/the-plotter/" post_tag: - name: "Best of Timex/Sinclair 2068 Articles and Documents" slug: "ts2068best" taxonomy: "post_tag" url: "http://localhost/tag/ts2068best/" - name: "Reference" slug: "reference" taxonomy: "post_tag" url: "http://localhost/tag/reference/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" - name: "Tutorial" slug: "tutorial" taxonomy: "post_tag" url: "http://localhost/tag/tutorial/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Syd Wyncoop" slug: "syd-wyncoop" taxonomy: "indiv" url: "http://localhost/indiv/syd-wyncoop/" publication_r: id: 21216 title: "The Plotter" type: "periodical" url: "http://localhost/periodical/the-plotter/" authors: "Syd Wyncoop" authors_r: - name: "Syd Wyncoop" slug: "syd-wyncoop" taxonomy: "indiv" url: "http://localhost/indiv/syd-wyncoop/" volume: "5" issue: "1" issues_articles: - id: 39444 title: "The Plotter v5 n1" type: "issue" url: "http://localhost/issue/the-plotter-v5-n1/" pages: "4-5" pubdate: "January 1987" archive_link: false --- # Save Memory: Use Buried Color Codes Instead of Color Commands Many of you have purchased commercial programs that appear to be unlistable, yet they run fine. One of the ways to accomplish this is to use ‘buried’ color codes in the listing. What are buried color codes and how do I use them? They are the equivalent of the color commands you are used to using in BASIC, however they do not appear in the listing. This hidden appearance or non-appearance, if you prefer, is due to the use of the color control codes instead of the commands. For the moment, Look at your Sinclair manual, page 240. “Nothing exciting here, you say, “just the character set. I’ve seen that before!” What we are interested in is the attribute control control characters, codes 16-20. You can see these codes are refered to as INK control, PAPER control, etc. Now look at page 244, character codes 217-222. These are merely labled INK, PAPER, etc. The difference is how they are interpreted by the basic interpreter and where they are used. The commands, codes 217-222, are interpreted directly and appear as statements in a BASIC line. They require an argument and will affect the entire screen unless immediately after a PRINT command. The color control codes are interpreted in the same manner however, they do not have a key dedicated to them, as does INK, PAFER and the rest. About now you are probably saying, “Here comes the catch. I’m going to have to POKE something somewhere. The last time I did that, I got worms crawling up my screen!” The truth is that you could use the control codes by POKEng them in however, that would not be much of an improvement. These codes would be really useful if you could access them from the keyboard direct. All of the control codes 16-20 can be generated from the keyboard. This is accomplished from E-mode, as shown in the chart. You will find that use of the control codes will lead to some odd program listings. The major difference is that buried codes will cause the listing to have the same attributes as the last encountered control code. For example, if the last control code was to turn on FLASH, the entire screen will be flashing. This can be very annoying. This can be avoided by listing the program from a line after the flash code. You could also use a FLASH off control code however, this wastes memory. Why use attribute control codes? There are two good reasons. First, there is a tremendous savings of memory. Secondly, they allow easy formatting of print lines as they will read on the screen. This makes the listing somewhat easier to read, in most cases. This example will demonstrate formatting and memory savings. Type in a line 10 as: PRINT/”/E-mode shift/F/l/a/s/h/E-mode shift 8/ /me/ / E-mode Shift 2/R/e/d/”/Enter. The / mark is to separate keystrokes and should not be typed. Your line 10 should look like this: ``` 10 PRINT "Flash me Red" ``` Not very exciting, but run it and see what happens. Now, I claim a savings in memory as well as ‘neat’. The normal equivalent in BASIC line to accomplish our simple test would look like this: ``` 10 PRINT Flash 1; "FLash"; FLASH 0; " me "; INK 2; "Red" ``` Assuming each of these lines are the only basic lines in our computer, we will find the line length stored in address 26712. If you don’t know why, take my word on this as the explanation would make for another discussion. PEEKing this address will tell us that the test line occupies 22 bytes, while the normal line occupies 49 bytes. Obviously not a large savings, particularly when there are other ways of conserving memory, but I think you can see that there would be a tremendous saving over the entire length of a large program. Also, don’t forget the additional formatting ease. Try some experiments with these control codes and see if you get the same results you expect. I think you will be pleased. Be aware however, some of these codes will cause odd listings. You may have to run the program to test it. I should also mention that the same type of results can be achieved with control codes 21-23. I have not discussed them here as I am unaware of a way to enter them from the keyboard (like above). Those of you that understand POKEing will find them useful and do not need an explanation from me. The rest of you? Try to find a friend that will show you in person what is needed. I hope this is of some help.