Base de dato2222

Solo disponible en BuenasTareas
  • Páginas : 24 (5809 palabras )
  • Descarga(s) : 0
  • Publicado : 17 de marzo de 2011
Leer documento completo
Vista previa del texto
Assembly Language Lab 9 8088 instructions. -----------------------------------------------------------------

Objective:

1. To Learn the common 8088 instructions. 2. Using sub-routines in a program. 3. How to use branching instructions.

----------------------------------------------------------------There are not that many 8088 instructions to learn in order to write programs, even thoughthere are over 175 of them. Most programs will use only a small handful of the instructions available to the programmer. Listed below is a list of the instructions we will use to do the remaining labs. Data transfer ------------Mov reg,reg Mov mem,reg Mov reg,mem Push Pop In Out Math ---Add Sub Cmp Neg Dec Inc Logical ------And Or Xor Not Shl,Shr Rol,Ror Control ------Jmp Jz and Jnz Jc and JncCall Ret Loop Int

Before we look at the instruction set, we will explain what a program really looks like. All programs are made up of: 1. 2. 3. Program code - Which are the instructions that tell the CPU what to do next. Data Stack The information that is being processed or any messages that will be displayed. A part of the program segment that is used to store data temporally.

The nextfigure box shows what a COM type program looks like in block form.

0000 0100

+----------------------+ ¦Program Segment Prefix¦ +----------------------¦ ¦Start ¦ ¦| Program code ¦ ¦| ¦ ¦End ¦ +----------------------¦ ¦Data (messages, num) ¦ ¦ ¦ ¦ ¦------ 1 Segments FFFF +----------------------¦ (65K) ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ +-Stack Area-----------¦ +----------------------+ FFFE

When yourun a program from the DOS prompt, the operating system will determine where or what segment is to be used for the program. Usually the operating system will find the lowest unused portion of memory for the program. We don't have to be concerned with what memory is being used by our program as long as we understand that it be assigned a segment number between 0000 and 9FFF. Whatever segment isassigned will have 65,535 bytes of memory to be used by the program and each memory location within that segment will have an offset number from 0000 to FFFF. The offset locations from 0000 to 00FF are used by the program segment prefix. The next location (0100) is the offset used for the first instruction of the program. The IP register will always be set to 0100 when the program is executed. Thismeans that the program code must start at offset 0100 and end before the end of the segment (FFFF). A COM program must also contain the data used by the program, so some of these locations must be reserved by the programmer.

Let's say we have a program that will display one of two messages on the screen. Message 1 will display "Hello to you." and message 2 will display "Goodbye to you". All ofthe instructions to do so will be located at 0100 up to the last offset needed by the code. The messages will have to be located after the last memory location used by the code. This assembly listing is a program to do just that. +--------------+ 0100¦MOV AH,0 ¦ 0102¦INT 16 ¦ 0104¦CMP AL,31 ¦ 0106¦JNZ 111 ¦ 0108¦MOV DX,500 ¦ 010B¦MOV AH,9 ¦ 010D¦INT 21 ¦ 010F¦INT 20 ¦ 0111¦MOV AH,9 ¦ 0114¦MOV DX,600¦ 0116¦MOV AH,9 ¦ 0118¦INT 21 ¦ 011A¦INT 20 ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ 0500 ¦Hello to you ¦ ¦ ¦ 0600 ¦Goodbye to you¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ +--------------+ 1.

The program code ends at offset 011A so message1 & message2 can be anywhere within the segment.I just decided to use offsets 0500 and 0600 for data, but I could have used many other locations as long as they weren't in the program codearea. (0100 to 011A)

To assemble this program, use the the following steps. A 0100 (return)

Then enter the instructions of the main program. A 0500 (return) DB 'Hello to you.$' A 0600 (return) DB 'Goodbye to you.$' Continued on next page You will notice that we assemble the main program code at offset 0100 and then we get out of the assemble mode by hitting return after the last...
tracking img