История одного байта
Save article ToRead Archive Delete · Log in Log out
29 min read · View original · wasm.in
History of one byte - Archive WASM.RU
I was missing a byte. Just one. Yes Yes. The one that consists of eight bits. What? No, I'm not crazy, although only God knows how thin the border was that separated me from this state. But everything is in order.
I'm a programmer. But not just a programmer. I belong to a caste that is sometimes called systemists, sometimes chrystals. Do you know what it is? I'll explain, if you bear with me. I cannot do without specifics, but otherwise you will not be able to understand further.
We program single-chip chips, roughly speaking, this is when the whole computer is in one chip. Program memory and data memory are separated and do not interact with each other. The program cannot be run in the RAM. The depth of the software stack is limited. The maximum I can count on is eight levels of nesting, and I cannot change the maximum stack depth. Oh, don't you think of anything! I have an abundance of resources. RAM is already 128 bytes! This is all about everything. Variables, there is something and that .. Imagine, right? The program memory is not bad either. As much as eight kilobytes. And it's not difficult to use it. First, you need to programmatically cut in the desired memory bank, start the necessary procedure in it, and upon exiting it, do not forget to return where you were. And you also need to keep in mind that within the bank I can only navigate by jumps and procedure calls, and transitions by conditions are possible only within one page, i.e. 256 bytes.
This means, if I compare two bytes and need to branch, but if the label is not within 256 bytes, then this is a letter to the village of grandfather, and the compiler will only warn you half of the cases, they say, the guy is walking widely, he would keep his pants. And these are just flowers! I'll lay out the berries for you now so that you can enjoy them to the fullest. I don't have a subtraction command. Generally! only add. Already about such a luxury as multiplication or division, I generally keep quiet, this is for lazy people. But I need to provide decimal mathematics. Are you infiltrating on the sly? The codes of such toys are licked out in such a way that you never dreamed of, especially if you have to solve problems at the limit of RAM and program memory. Source codes are rewritten more than once. It's not enough for me to just solve the problem. I have to shove her into this damn crystal! Restriction on variables, on the size of the code as a whole, on the size of each procedure and on the number of calls. The slightest oversight and .. the stack is pushed through, and you are kicked out to god knows where. And the compiler won't help. He doesn't catch such things .. Do you think that's all? ;-) H-oh, my dears. My toy works in real time .. This is when, opposite each tiny procedure in my code, you need to calculate and put down the time of its execution in milliseconds. My modules should not work more rigidly fixed time, because I also need to scan the cybord and the display, keep up with the sensors and issue control signals, and everything else should work without interfering with scanning, otherwise I miss pressing a button, or the display will flicker unpleasantly by changing the brightness. But that's not all! I have an interface.
The usual writing RS232C, the so-called comport. But if you think that this is a separate chip, they say, shoved a byte into it, received a byte from the buffer, then you are mistaken. Cost price. I do all this with pens, tweaking a single bit of the port. I use handles to twist the chart of starts, stops and data. So:
If I dashed off the code for the solving task, but it does not fit into memory, the task is not solved. If at the same time I created a larger number of variables, and they do not fit into the RAM, the problem is not solved.
If all Oki-docks, but the procedures are too long, the real-time diagram is destroyed - the problem is not solved. If the procedures are too short, there are many of them, the stack is exhausted - the problem is not solved.
Any average programmer, put him in such conditions, will shoot himself on the second day. In general, in my opinion, the guys working in this field have nerves of steel and an indomitable will to win. We rarely communicate with ordinary programmers - we generally have nothing to talk about. And not because we are snobs or proud. Not at all necessary. It is difficult for us to imagine programming under inexhaustible resources in high-level languages. Not enough screw? Buy another, what's the problem? Small frame? Buy more, push into the slot. Mega codes? And what do I have to do with it? It's the compiler's fault. Buy a bigger car. They are like different planets and I hope you understand why.
It's like a beautiful white ocean cruiser in the vast ocean expanses, sail wherever you want. And you try to steer on it in the Finnish skerries. ;-) Or threading a needle in the middle of the night. Moreover, a black thread.
Of course, we also have sets of crystals and choose them before developing them with greater meticulousness than the groom, the bride, and guess on the coffee grounds and other improvised means, but will it be enough? But, if the choice is made .. Backward, usually not.
Well then. I introduced you to the subject area and I can continue my story.
I didn't like the crystal right away. I knew right away that it was a bit tight. Everything is at the limit. Legal 20% of the resource reserve, for possible errors - do not comply. However, the rest of the candidates were highly redundant, and therefore expensive and irrational. The prime cost decided everything, I finally gave my consent and the powerful and proud handsome Intel and Motorola of the latest models were left behind.
At first everything went well. A couple of months of work and the crystals were stuffed with a code, the tests went well, the boards were divorced and worked out, the gears slowly turned and, gaining speed, spun, driving a complex and cumbersome production machine. And only my heart occasionally burned, because everything was done very tightly! Three at most five percent of the resources remained free. And that's pretty damn small, take my word for it.
Although the work was done quite well, and I received my rightful reward in the form of a portion of the pleasure of what I did. Of course, a couple of places are quite adventurous, loose in places, but on the other hand, there are a few highlights.
And then .. This is where it all began. A very important function of the device is missing, which the directors missed. And not even they, but the customer. It was he who suddenly remembered that, they say, guys, there should still be such a trifle. Well, sheer nonsense, honestly, but without it in any way. Well, they forgot about her when staging, who doesn't happen to? But this is not difficult to add at all, in comparison with the rest of your bells and whistles? Again, thank God the sensor was not forgotten. It's just a program!
These directors !!! Their karma is to understand what the customer needs! Even if for this you need to cut his skull and sift all its contents through a sieve!
But shouting will not help matters. And I sat at home for two weeks, forbidding me to bother. A small siren and a traffic light went off in my brain. Beep! Flash of red! The first program bank is exhausted! Repacking. Optimization of the placement of code across pages and memory banks. Beep! The RAM is exhausted! Revision of the functionality of the procedures. This variable is nafig. And you can do without these if you take a different path here.
Beep! Stack Failure! Straight with a muzzle to the bottom. Like this!? Am I already at level eight !?
Beep! Exit of labels beyond the visibility of in-page transitions!
Beep! Violation of real-time conditions, procedures gobble up too much time!
Beep! The second memory bank is exhausted!And so many, many times. Painstakingly, byte by byte, I pushed in the body of this Damn
new function, continuously repackaging the placement of the code across pages, banks, optimizing the code size, real-time graph, RAM usage,
or even simply rewriting modules from scratch.
Maybe you think eight kilograms of binary code is not enough? Ha! The instructions are one and two-byte. This is not a three-byte zalog or even an Intel eighties. From time to time a friend ran up to me, like, they say, and what, but I was not very disposed to chatter "for life."After a week and a half, I realized that things were bad. I had more than half a dozen solutions at my disposal and was already standing still. I knew every procedure and function by heart, and every byte in person! It was all wasted. The picture froze .. She didn't want to come to life!
I was missing one byte. This was shown by all the solutions. Just one byte!I ran into a friend's house, threw him all the solutions with time diagrams and bank plans, and returned to my den. Sleep. Sleep by all means. You need a clear head. We need a new idea. I'm devastated. The next few days gave nothing. I collected and disassembled the code, stringing it like sparkling beads, and wrapping it in various shapes of figurines, trying to find a shape in which all these pieces of the puzzle would fit together without a single gap and also without a gap will fit into the place prepared for them.
There was not enough space .. One byte .. I crumpled the code like clay, I made anything with it, but .. one, only one byte !
Probably something similar is experienced by a musician writing a symphony, trying to find one single note that would make his work sound. Or the artist is looking for the very, unique brushstroke that will revive the picture. And without this, everything is dead and all the work is good only for the trash ...Somehow, half asleep, I dressed and went out into the street. Snow screeched disgustingly underfoot. Everything around was gray and somehow dull. I no longer needed a computer or printouts. The whole scheme was in me .. Or outside of me? She winked with multi-colored mallets, having the form of bizarre and even beautiful three-dimensional figures, or is it some kind of openwork designs?
The control markers of time stamps, hanging close to these crystals of strange, some bewitching shapes, squeaked subtly. And all this flew, moving and rotating somewhere, in some strangely changing channel? Pipe? It sweeps close to all its walls, as if at the command of an invisible navigator, at the right moment, unfolding according to an incomprehensible intuition, so that the protruding edge does not catch on an obstacle. But what is his captain or who is there? Navigator? After all, it will not work! You can't go there! But no! Miraculously, the whole structure somehow gracefully dodges, exactly at the right moment and silently slips through .. no!
Majestically passes the obstacle .. And ahead of the next .. And suddenly, the edge of the openwork structure with its tiny ledge clings. Screeching and crashing! The sparkling threads burst and crumple, and everything is crushed into millions of fragments ..Lord! It's a stack! It bypasses the stack! This is what it looks like!
When I exhaust the depth, it apparently clings and collapses with a crash, breaking its openwork structures ..In some place I notice a bench with some lonely old woman on it. I need to sit too .. Opposite is a flower saleswoman, dancing from the cold. I don’t like old women .. And this one .. Some kind of unpleasant, almost disgusting. Why is she staring at me? Who is she? What is sitting here? I suppose there’s nothing to do. They are the ones who always crowd in the store, and because of them you don't have time to buy anything. And they screech in the trolleybus to make way for them. I suppose he is watching these idiotic newfangled TV shows, how are they there? Maria? And who else is crying there?
What do they all understand !? Who can understand how much knowledge and labor is needed to build such a thing? How many sleepless nights should you spend? How much to read? And every day and not at all an idiotic novel about love and friendship?Who is even able to understand this !? These newbie dudes calling themselves programmers? Sloppy writing on Foxspra, Clippers and BASICs? And everywhere asking questions: tell me, what command should I type? And what help to read? And when will the manual be translated into Russian? And what about their so-called "software"? Great one hundred thousand-variant ever-living warehouses and accounting departments? Imperishable creations. Everything looks the same. If there are differences, it is in the clumsy and glitchy code. A glitch sits on a glitch and drives them with a bug ..
That would make them carve their codes in stone, like ancient stonecutters, so that they would at least think a little about what they write .. Or these technocrats? Well it is necessary, viruses to write, what would mean muck to people made to become famous! Ugh!No. I don't want to sit on this bench, in the company of this .. Where did I go? I remembered. I'm going to a friend. Can tell me what? Damn byte! Why am I so angry? Everyone is doing their own thing, why would it be worse than me? There are enough talented people everywhere. Something really hot to see me .. A
friend, opening the door, silently looks at me. "Well?" "Well what?"
"Tell me just one thing," I say gloomily, walking into the apartment. "Can you give me one byte ? Just one. I’m ready to give you anything for it. I don’t have enough byte, you know? Well, I don’t fit into the crystal!"The friend is silent for a while. "I looked at your codes."
"So what? Did you find anything?"
"No." He says quietly, and after a pause, continued: "Immaculately knitted lace. Not a single loop. No seams are visible. Filigree work. Piecework. Straight molding. You can put a quality mark on each line. And carve in marble. And everything is uniform, no seals , no voids. Monolithic, but elastic. But .. "
"What 'but'? .. Don't pull the cat by the tail! Don't shake your soul! And it's sick without you!" I explode.
"Most of the places I can’t understand .. I don’t understand .. I just see how it is .. beautiful. Somehow intangible. Not grabbed by consciousness .. It seems like this, but it flies away .. It's like a snowflake when you try to take it in hand. Or as the sounds of not yet understood, but already comprehensible music .. "
"What the hell are you talking about !? What the hell is a snowflake ?! What kind of music !? Can you help me or not !?" I rumble. "You are my friend. Help, huh? You just tell me where to squeeze this byte .." I look at him with hope. "After all, a fresh, clean eye. After all, there is one, only one operator, without which you can do without and that's it! EVERYTHING! The problem is solved, you know? And I’m up to the grave of your life .. forever .." I whisper grabbing his sleeve, "After all, there to hell with lines, but I'm just a person, I made a mistake, I missed it, I didn't notice .. huh? And I don't need anything. No fame, no praise. I just want it to fly away .. What would let me go .. and ? Well, I don’t have more strength. Well, let's go, let’s take a look at the codes .. "
" Give it up, "he says. "To give up? From what?" I do not understand. Take another crystal.
"Are you out of your mind !! ?? How is that - different !! ?? Heaps of finished boards, installers, adjusters, salaries, details !? Is that a joke !! ?? You think it's on your computer, I want to add a couple of lines, and no one will notice !! ?? The costs are zero, but add at least megabytes of code !? And people? They believe me! I said - "Yes!" I did agree, although I saw that the resource reserve would be almost zero! And they already have everything ready! Cases, metal, power supply. They are only waiting for the code! Do you know what the change of the crystal can lead to? You know how much this byte will cost! One byte !! "
I myself have become deaf from my screaming ..
"Fool." the word slaps to the ground like a bale of wet laundry. "Back off! Forget it! The guys and I have been looking at these codes for three days. I gathered everyone I could. I immediately realized that something was wrong with you. You have NO mistakes! None. Moreover, we do not understand how you feel at all. managed to stuff it. "
My knees buckled and I either sat down or slid into a chair.
Deep down I knew it. And then I began to speak .. It was a strange monologue ..
As if someone was shouting, whispering and yelling again in my voice:".. I thought all this time. I realized that this project is not so important as the measure of my responsibility. Well, he will not dare, well, everything will be altered there somehow. Damn him! It's not that important. Shame there is mine .. The point is different. In me. You know that I have not been a slave for a long time, who does what they say, justifying it, we earn money for the family. For a very long time I am a mercenary. My services, my programs are very expensive. you know, I do not undertake simple things. Let them at least get rich. I am for myself and for myselfworking. I don’t care about money for a long time! They practically have no power over me! I need something else! And I hide it carefully. Because I'm ready to do an interesting task for free, otherwise I'll pay for it. You yourself know how it feels !? Well?! You're not doing this for money either! There is only one thing that I have never said to anyone. When I do, I fly .. And don’t lie to me that you don’t know what it is! Everyone knows this! They just prefer not to remember or not to believe! You know that too! It's like in children's dreams. Do you remember? We soar high, high and rush, screeching with overwhelming delight! Forests, mountains and seas are sweeping under us! Do you think it was a dream !? Not! And I realized this a long time ago! I was only afraid to say. Ashamed, you fool! But now I don't care! It is our soul that flies! For real! And the mind says that we are asleep. Do you understand? Why do we stop flying when we grow up? AND!? Why?! Why do we stop dreaming about this dream? Do not you know? I know! Because our soul grows heavy, because the values, money, conventions of this society seize power over us and our soul is no longer able to lift this burden! How! We are straight, we spread ourselves out to become a rug on which they will wipe our feet! Oh, what good reasons, such well-reasoned explanations, why it was necessary to bend that way, and how we do it for the sake of someone. we spread out to become a rug on which we wipe our feet! Oh, what good reasons, such well-reasoned explanations, why it was necessary to bend that way, and how we do it for the sake of someone. we spread out to become a rug on which we will wipe our feet! Oh, what good reasons, such well-reasoned explanations, why it was necessary to bend that way, and how we do it for the sake of someone.
We have time to ourselves every day, convincing ourselves that we are living correctly. I don’t want to, I can’t lie anymore! Do you understand how this relates to this devilish byte !? Everything is very simple. I can fly for a long time! And work helps me in this. Yes Yes! I take off into the peaks of the highest tension in solving my problems. It’s impossible to describe!
But I cannot fly all the time. I go down again .. And so on until the new code in which you need to put something. I do not know what. Some kind of a piece of yourself, or something. But this time I got caught. I was ruined by pride. Well, of course! I’m a guru who knows how to condescendingly poke teapots with their noses and solve their problems in a casual way! I love their views of me as a deity so much. After all, we are vain and I am no exception.
But now it’s not like that! Do you think the problem is in this one byte and how to shove it? Not! I can't shove it! But it’s not me who can do it ! Do you understand?There is a solution! I can feel it! Only I am not able to find it! For this I must become different! Not yourself! And someone or something clearly caught me, for that one byte !
You know very well that I am smart and cunning! If the problem had not been solved, I would have left, slipped away, off the hook! But I thought that it was being solved, and I got hooked! Caught on this byte, as in the network. And this byte is the size of the grid cell, through which I cannot escape. I've gone too far .. And I won't be able to leave and be free again if I don't change something in myself! Completely change yourself, you know? Become a different person! And then maybe a door will open in front of me ... I don't know where .. I don't know what's behind it .. And I don't know how and what I should do for this .. Yes .. And also the price .. I and I realized it .. I won't be able to be as before .. I won't be able to fly anymore .. It will be over .. "
I slowly got up and, hunched over, went to the door .." Goodbye .. "I said dully into emptiness ..
"... Nerd!" rushed after me, "“You're going to die over this program! You will die! Look at yourself in the mirror! The asylum is a mercy for you! Do something! Go to the women, get drunk to smithereens ... ”
But I can no longer hear anything. "Lord, if you exist - help .." Only on the street I realize that I forgot my gloves and a hat. Why do I need them? Is this the main thing? What's the main thing? Why is it all? Who needs all this? People? They don't give a damn! This I have to! Personally to me! I myself have driven myself into a trap and I myself cannot get out of it. What is it? Punishment? A lesson that would not be asked in the future? Yes, rather so. I have more than enough honor. Stop, stop .. How did he say? "To the women?"The office is warm and cozy. Heater. Clean. Computers are buzzing. Daddies, racks. The girls give me coffee, put in buns, which I devour greedily, smeared with chocolate. They add and add, looking compassionately at their colleague who has sunk down. The girls are also programmers, they stuff office stuff there, to the delight of personnel and accounting. They are neat, with make-up, excellent, in a word, they look, especially in contrast to my many-day stubble, and maybe already a beard? I briefly and reluctantly answer the questions, what, they say, brought me to such a life. "Not resolved. Assembler. Stack problems. Byte not enough." One of them, Oksana, it seems her name is, speaks with a pleasantly rounded Ukrainian accent: "What kind of stack? Why do you need it? Olya and I, she's on a clipper, I don't have any stack on Fox." Maybe you don’t need it either? You guys are always a dirty trick you can think of. You yourself are tormented, but you are tormenting us, tell Olya? "
"What?!" Only the chair prevents me from falling to the floor. Some nasty, croaking scream bursts out of me .. "You write without a stack !?"But this is already hysterical ..
I'm on the street again. Our lovely, lovely ladies. How pleasant you are in your ignorance. And how great it is that you do not know this. You don't need to know that. Going crazy with unsolved problems, like philosophical questions, is the privilege of men. There are, of course, exceptions. But they are more likely to confirm the rules. If women still come across in upper-level languages, they practically disappear by themselves and assemblers, then in our area I have not heard of them at all. And it is right! There is also no need to blame women for these problems.
And my legs carry me somewhere, thoughts flow by themselves. They are not interesting to me, I am a finished man. I can't live with it. I will drag out my existence, no matter who, but I will not approach computers with these, a cannon shot, that's for sure. Seriously. There was nothing to pretend to be cool. And this indulgence of my snob? Like, I know everything, I can handle everything .. Hmm. Got it .. goat? I am delirious in this absolutely alien world for me, in which not a single living soul is able to understand me. A friend and he could not .. And no one cares about me ..
But what is this? Did I seem to be here? Flowers. Bench. And the grandmother is on it. As if she hadn't left. After all, frost is it? Hesitantly, I sit down on the edge of the bench. Whoa! hands are frozen and fish soup too. And then, as if something pushed me, I got up, went up to the flower saleswoman and for the last three rubles, (why should I?) Bought roses and went up to my grandmother. In my head the thought was convulsively beating: what am I doing? What for? She waited with her face up to me. And I forced myself out: "Sorry. Can I give you flowers? I .. thought badly about you .. then .."
She was not surprised at all. And she said .. "Where have you been for so long, son? I'm frozen to wait for you .." !!! ??? To say that I was surprised is to say nothing .. I was shocked, stunned, crushed! And she continued: "You feel bad, sonny?" She looked at me sympathetically. Wisdom, kindness and ... love shone in her eyes. You understand!? Love to me .. And then I said: "Yes! I feel bad. I feel very bad .." I was not afraid or ashamed. Something seemed to fall off me, bouncing off like a husk. And I began to tell ... Confused, hurrying and choking.
I was telling my grandmother how I program single-chip microprocessors ..
She attentively, without interrupting, listened to me. She understood everything! My every word! I saw it in her eyes. I spoke and spoke. And she took me somewhere and I ate something very tasty, and then we drank tea, with some extraordinary jam, in a tiny but so cozy kitchen.
It must have been a very strange picture. A half-crazy programmer and an old woman listening to him attentively .. And then she spoke. I don't remember what. I only remember that it was very important and necessary for me, that I drew from this storehouse of wisdom that can be gained only by losing so much, but having found love ..And suddenly ... A strange, weightless and at the same time solid structure began to unfold inside me. She unfolded powerfully and gracefully, surrounded by the splendor of lights. Every facet of it, every element was perfect and unique! And vibrating lightly, she gave birth to music. And all this together filled me with extraordinary awe and delight! It's me! I created it! It was me who polished all its edges! Why doesn't anyone see this !? Well, look! Share my happiness with me! Now I was not afraid. I knew she would fly! And she will help me to get off the ground. With her, I will fly to the stars!
...And I walked down the street again. But in a completely different way. Or rather, just in another world. Because this one was beautiful! Snow splashed with multi-colored sparks of thousands of unique colors and such unique music sounded underfoot. It's as if your old computer with a CGA monitor suddenly started showing millions of colors. However, what the hell am I talking about? This is much, much better.
Create your ships. And let them travel in extraordinary worlds. I was wrong. Each of us can travel and live in these worlds. It doesn't matter how or where you create them. We create programs as much as they create us. And real programs are not created by cunning and for this there is little reason, knowledge and ingenuity. They must go through the heart, because they are a product of our love.
Because the programs we create are pure creative products. This is why they are so attractive. You don't need a hammer, a chisel, or brushes or paints to express the main thing in it - yourself! And it doesn't matter that maybe not so many people will be able to understand the beauty of your codes. If by writing our program we have become better, then this is a correct and good program! But if you think that less labor is needed, then you are wrong. And if you are not ready, or do not want to leave a part of your soul and love in your creation, are not ready to change yourself, then it is better .. do not write programs. Look for yourself, in something else ...
© Dmitry Galuscenko