This preview shows page 1. Sign up to view the full content.
Unformatted text preview: l execution of the SWI instruction to avoid an extra branch. Note also the use of a zero byte to mark the end of the string (following the linefeed and carriage return special characters). Whenever you use a looping structure, make sure it has a terminating condition. 70 ARM Assembly Language Programming In order to run this program you will need the following tools, all of which are available within the ARM software development toolkit: A text editor to type the program into. An assembler to turn the program into ARM binary code. An ARM system or emulator to execute the binary on. The ARM system must have some text output capability. (The ARM development board, for example, sends text output back up to the host for output onto the host's display.) Once you have this program running you are ready to try something more useful. From now on, the only thing that changes is the program text. The use of the editor, the assembler, and the test system or emulator will remain pretty similar to what you have done already, at least up to the point where your program refuses to do what you want and you can't see why it refuses. Then you will need to use a debugger to see what is happening inside your program. This means learning how to use another complex tool, so we will put off that moment for as long as possible. For the next example, we can now complete the block copy program developed partially earlier in the text. To ensure that we know it has worked properly, we will use a text source string so that we can output it from the destination address, and we will initialize the destination area to something different: Writing simple assembly language programs 71 This program uses word loads and stores to copy the table, which is why the tables must be word-aligned. It then uses byte loads to print out the result using a routine which is the same as that used in the 'Hello World' program. Note the use of 'BLT' to control the loop termination. If TABLE1 contains a number of bytes which is not a multipl...
View Full Document
This document was uploaded on 10/30/2011 for the course CSE 378 380 at SUNY Buffalo.
- Spring '09