EE 308 Lab 3 Spring 2003EE 308 – LAB 3Assembly Language ProgrammingIntroduction and ObjectivesThe purpose of this lab is to write a few assembly language programs and test them on thesimulator and on your EVBU.Pre-LabMake sure you have the programs clearly thought out and written down before you come to lab.You should put all your code starting at memory location 0x1000. You are encouraged to bringthe programs in on disk.The LabAs in last week’s lab you will write some programs in assembly language and run the programson the HC12 simulator and the EVBU. To make sure your programs work you will sometimesuse D-Bug 12 op codes as your input data. There is one problem when running programs on thesimulator – D-Bug 12 code which is present in the EVBU is not on the simulator. We can fix thisproblem by loading D-Bug 12 into the simulator. To do this, copy the file n:\ee308\dbug12.h12into your directory, start the ZAP simulator, and load the file dbug12.h12Write and run the following programs:1. Write a program which writes a 0xffff to address 0x0002, and then increments the 16-bitnumber at address 0x0000 indefinitely. (Note: this is about a five-line program.)Test your program both on the simulator and the EVBU. Trace through the program on thesimulator and observe what happens to the data at address 0x0000.Note: This should cause the pins labeled D0-15 on the HC12 to toggle. Use a logic probe toverify that this is happening.2. Write a program to swap the last element of an array with the first element, the next-to-lastelement with the second element, etc. The array should have 0x20 eight-bit numbers andshould start at 0x2000. (This is similar to Problem 5 from the homework due Feb. 10.)Check that your program works both on the simulator and the EVBU. Us the following datafor your test:0 1 2 3 4 5 6 7 8 9 A B C D E F2000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F2010 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F3. Write a program which puts the the exclusive OR of the eight-bit numbers from memorylocations 0x8000 through 0x8FFF into memory location 0x2003. (This operation is often1EE 308 Lab 3 Spring 2003used to generate a check sum to verify data transmission. The sending computer generatesand transmits the check s um along with the data. The receiving computer calculates thecheck sum for the received data and compares it with the check sum sent by the sendingcomputer. If the two values do not match, then there was an error in the transmission. Thelast byte in a line of an S19 file is a check sum used for this
View Full Document