Flags and Decision Making As described in Chapter 6, the Z80 architecture includes six flags, which are flip-flops that are set or reset after the execution of arithmetic and logic operations, with some exceptions. Four of the flags (S, Z, P/V, and CY) can be used by the programmer for decision making in conjunction with […]
Continue reading…
Posts by Farahat
ARITHMETIC OPERATIONS
ARITHMETIC OPERATIONS The Z80 microprocessor performs various arithmetic operations such as addition, subtraction, increment/decrement, and I’s and 2’s complement. Most of these operations are concerned, with 8-bit operands. The instruction set also includes some 16-bit operations that will be discussed in later chapters. (See Appendix A for a complete alphabetical listing of the Z80 instruction […]
Continue reading…
Data Copy Between Accumulator and I/Os
Data Copy Between Accumulator and I/Os In the Z80 instruction set, input and output devices are identified by 8-bit addresses, The set includes several instructions that can read data from an in put device (also known as input port) and write data into an output device (or output port). Two of these I/O instructions are […]
Continue reading…
DATA COPY (LOAD) OPERATIONS
DATA COPY (LOAD) OPERATIONS In this section, we focus on three types of data copy operations: data copy related to microprocessor registers, memory, and I/Os. Instructions frequently used are illustrated below, and the Z80 block transfer instruction will be discussed later in the chapter. In addition, one machine control instructionــــHALTــــis introduced; this instruction is necessary […]
Continue reading…
Introduction to Z80 Instructions and Programming Techniques
Introduction to Z80 Instructions and Programming Techniques When a microcomputer is asked to execute a program stored in its memory, it reads one instruction at a time and performs the task specified by the instruction. Each instruction in the program is a command, in binary, to the microprocessor to perform an operation. In […]
Continue reading…
Problems on Moving Data
Problems Write programs that will accomplish the desired tasks listed below, using as few lines of code as possible. Use only opcodes that have been covered up to this chapter. Comment on each line of code. 1. Place the number 3Bh in internal RAM locations 30h to 32h. 2. Copy the data at internal RAM […]
Continue reading…
Summary of Moving Data
Summary The opcodes that move data between locations within the 8051 and between the 8051 and external memory have been discussed. The general form and results of these instructions are as follows. Instruction Type Result MOV destination, source Copy data from the internal RAM source address to the internal RAM destination address MOVC A, source […]
Continue reading…
Example Programs
Example Programs Programming is at once a skill and an art. Just as anyone may learn to play a musical instrument after sufficient instruction and practice. so may anyone learn to program a computer. Some individuals. however. have a gift for programming that sets them apart from their peers with the same level of experience. […]
Continue reading…
Data Exchanges
Data Exchanges MOV, PUSH, and POP opcodes all involve copying the data found in the source address to the destination address; the original data in the source is not changed. Exchange instructions actually move data in two directions: from source to destination and from destination to source. All addressing modes except immediate may be used […]
Continue reading…
PUSH and POP Opcodes
PUSH and POP Opcodes The PUSH and POP opcodes specify the direct address of the data. The data moves between an area of internal RAM, known as the stack, and the specified direct address. The stack pointer special-function register (SP) contains the address in RAM where data from the source address will be PUSHed, or […]
Continue reading…