IzhNews #05
09 мая 2000 |
|
Nonsense in BASIC - programmirrovanie calculator Citizen SPR-145.
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ \ -= Nonsense in BASIC =- / / \ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / (C) PIXel / BrC __________________________________________ Zdravstvuyte my dear fans our rag. The word keeps constant Leading this column - P! He1 (well, I broke switch to Russian). Today, we again We (we is me and another one who is not broke) write programs, and as the name implies column, not on BASIC'e. CITIZEN SRP-145. Yes, yes my dear we programirovat calculator. Like any programmer, I once saw in the instruction Calculator word "programiruemmy" immediately decided that it must be pre-programmed. PROGRAMMING Saving made mathematical operations in the calculator memory. With the aid of the calculator can maintain a sequence of calculations containing no more than 40 steps. These "steps" can be either the actual steps, such as math functions or values (for example, numbers). Each function is one step. Stored program even if then turn off the calculator. When calculations can be used by more than one variable. This calculator remembers the mathematical operations or program mode Program (PGM) Mode .... Everything! Tired of my instructions rewriting. If you do not lose yourself read. I schaz Tell you boring the story of how I zaprogramil. Sit means, do nothing, so I took Calculator, and they decided to write to him prog which considers the roots of the quadratic equations and all that jazz. From the most instructions I found out that for all of all withdrawn 40 steps. Well, for such simple problem that is quite enough, Think you, I thought so too at first, and began programa. To begin with we recall formula by which these roots Search: __________ __________ -B + √ b ¤ -4 ∙ a ∙ c-b-√ b ¤ -4 ∙ a ∙ c x1 = x2 = 2 2 ∙ a ∙ a Perhaps omit the story of how all this is not fit into 40 steps, then it ka optimized to the desired tsyfry as it, vlezshee in 40 steps, and how not raboralo I zaoptimizilos to such a size that shit work, but only describe the final Answer: Davie is this: [On / c] included [1] a = 1 [Shift] [Ka] entered a value in RAM [2] b = 2 [Shift] [Kb] -------//----- b - / - [3] c = 3 [X-> m] -------//----- c - / - [On / c] Now sobsvenno itself prog: [Shift] [pgm] Program Mode [Kb] [x2 ][-][ 4] [X] [Ka] [x] [MR] b2-4ac [V] root of the discriminant [¡The] [2] [¡The] [Ka] divided by 2a [=] [X-> m] we put together with (it no longer needed) [-] [Kb] [¡The] [2] [¡The] [Ka] [=] Here it is - the first root. [Halt] will shine on screen. [-] [MR] restore (b2-4ac) / 2a [-] [MR] [=] the second root [Halt], too, lit. [Shift] [pgm] yield [Run] see the first root [Run] --/-- second --/--. Now you are proud of their steep bear Calculator and show your friends this miracle ... Colorno daub. Well nazvnie. Oh well. Êàî is what now will be a speech you can see pressing the pedal <V>. Pressed? if someone More intersnyh, then read on. In one demo I saw chunks Colorno and decided that I, too, one is able to chtolibo like. Immediately warn that sources today will not be. Particularly Enthusiasts can certainly break listalku and vudernut it (source) from there, but once warn that effect is made on the basis of sings and right without any attempt to optimization, etc. The main loop looks like this as follows: 1. change the buffer. 2. print buffer. 3. Jump to 1 if not pressed anything. Similarly, the head looks like the cycle of fire, but more on that another time. Buffer contains the bytes describing familiarity each screen, and they look as follows: % Hrrrcccc > Number of chunks (0Ў15) > Paper (1 bolshii Inc.) > I do not use. My prtsedura change buffer toko increases each value of 1 (inc). The printing process uses the procedure Print symbol (chunk-a 8x8). Inc. as above for 1 more papera. For Procedure (my) need a font of 16 characters from empty to filled with chunks. Well, the basic idea pushed now all who enter can do it. I ask all of whom is broken sorry for the lack of source (was ashamed of such code). More naveno not very pleasant to read my senility, Well, I can not better, and want to write, although I'm not forcing anyone to read. And I write I will continue because no one has yet vysskazal opinions (negative) about my writings. I also want to remind that All articles are designed for the novice coder (Like me), and therefore, blame me lamerstve should not and then ... ogogo .... and ..... in ..... shtob longer .... otherwise him ......... SBC HL, HL PUSH HL RET > Assemble > Run
Other articles:
Similar articles:
В этот день... 3 December