Theoretical article about the possibility make programming for Z80 more difficult by removing the instruction LD A,n (C) sinn/dtr/fdm "So you, beloved, having been warned about this, be careful that you don't get carried away by delusion without lawyers and not fall away from his statement, but grow in grace and knowledge of our Lord and Savior Jesus Christ. To him be glory both now and to day eternal. Amen" 2 Peter, 3:17-18 ───────────────── ───────────────────────── Let's imagine that the LD team was removed from the Z80 A,n. Let's imagine that somehow beautiful In the morning we woke up and it was not in the Z80 discovered. Or are we deliberately introducing this o- limitation. The roots of appearance are not important to us, consequences matter. Let's talk about them. Let's consider howwill become more complicated writing programs for the Z80 (why do I clarified what exactly is for the Z80? Because extracting the command will have no effect writing programs in assembler for i86, PCC). Solutions for this problem can be found several. I'll try to describe a few, I'll leave the rest to you. First solution What immediately comes to mind is complete abandonment of the previous writing style. We'll have to write programs in a new way, with a new approach, with a new style. At first Of course it will be difficult, it will appear psychological barriers, phobias that can have a detrimental effect on the psyche coders. These problems will most likely be avoided side of beginners, because their minds are not yet "clouded" by old styles, old methods. It is on them that everything will rest hope. What will the "new style" be? Difficult of course I can’t even imagine it imagine. It is quite possible that you will have to forget about register A altogether, as such. We'll have to do without it. For example, to reset the carry flag, you will have to apply the following technique: PUSH BC ; save the register ; a couple because we use ; to set the flag ; carry register C, but ; if you don't need ; contents of BC, then you can ;this operation and not ; produce, naturally ; you won't need it and ; restore ; (see below) ; basically, instead of BC ; can be used ; and another 16-bit ; register LD C,%00000000 ; reset carry flag PUSH BC; C => POP AF ; F POP BC; restore reg Comparisons: XOR A = PUSH BC LD C,%00000000 PUSH BC POP AF POP B.C. As you can see, the volume will increase memory used, the amount of beats Since with this solution to the problem it is so called "withdrawal" we refuse register A (I want to say that we cannot completely abandon register A, so how we will need the PUSH AF command, and so the opposite command is POP AF, there is only one reason - we will need access to flag register F. But if you if this bothers you, then give up these commands too this would be a bolder decision), then we do not we can also use the commands CPIR, CPI, DAA, as well as others (see reference book Z80 teams). To do this you will have to write your procedures, do them whenever possible fast so that they also take little places. As you can see, a complete refusal registerA leads to maximum the complexity of programming for the Z80 when removal of the LD A,n command. Second solution This solution is more rational, Unlike the solution described above, so how it doesn't require "rethinking" programming for Z80. Here you can use old coding methods, do not give up completely algorithms. But. There is one "BUT". You can't use the LD A,n command directly, since there is no such "exists". To load into register A constant, it is necessary to carry out approximately the following steps: LD A,10 = PUSH BC PUSH BC LD B,10 or so LD B,10 LD A,B PUSH BC POP BC POP AF POP B.C. As you can see, different options for entering a number into the accumulator, which can contribute to the development of creativity va. By refusing even one command you can diversify programming, what if give up on everyone? But let's not leave from the topic under discussion. Third solution or "Mix" solution The third solution is a hybrid of the first and second solutions. That is, there is a refusal _some_ register instructions associated withregister A. For example, a waiver is entered commands LD A,B, LD A,C. So to put in the battery number 10, you will have to produce the following actions: LD A,10 = PUSH DE LD D,10 LD A,D POP DE But it will not be possible to do this: PUSH BC LD B,10 LD A,C ; error because ; refused ; teams LD A,C POP B.C. Output: ───═══ The first solution is much more difficult than all others discussed in this report. This solution makes it as difficult as possible programming for Z80 upon removal commands LD A,n. The second solution is the easiest and elemental of those considered in this report. It adds minimal complexity programming for Z80 upon withdrawal commands LD A,n. The third solution is average in complexity from discussed in my report. It is in difficulty between first and second solutions. At its core, it is an ideal option for solving the problem of removing the instruction LD A,n from Z80 processor, because you _can_ decide which team you should be from refuse. But here you have to be very attentive. If you give up everyone commands (after all, from the condition"Mix" is possible refuse _any_ number of commands), then the third solution is transformed into first solution. Conclusion - there is only one solution solution "Mix" (third solution) related among themselves, which proves hybridity with first decision. Likewise, if we refuse only from the command LD A,n, we get second solution, which is also proof of hybridity with the second decision. Summary: ───═══ Due to problems while writing programs in Z80 assembler, as a result removing the LD A,n instruction from the Z80 processor, its removal is not recommended, although if you basically refuse this command, then you can become the pioneer of a new trends in programming. You can even give this current its name - after all it is not there, which means there is no name. It's hard to come up with something new now It’s getting harder and harder - progress, after all, gentlemen. Seize the moment!
Z80 - Theoretical article about the possibility of complicating programming for the Z80 by removing the LD A,n command.
Share your thoughts about the article
No comments yet.