Microcomputer systems: introduction to assembly programming

Giuliano Donzellini, Domenico Ponta

Accessing tables in RAM memory

100035

 

v1.71

In this project, you will write and test a DMC8 assembly program and, at the same time, you will gain confidence with memory addressing modes.

a) First step

Write the first part of the program, that stores data on a table of 128 contiguous memory locations, starting at the address 8000h (first RAM location). Data are represented by positive integer numbers. The first table location (at address 8000h) must contain the value 0; the second the value 1, an so on. The table ends with 127 in its last location. We suggest to use indirect addressing, using the register HL as pointer to the table cells.The program should start at the hardware RESET of the processor, and stop with the instruction HALT. When done, save the program and test it in the debugger.

b) Second step

Add to the program the code that stores different data on a table of 128 contiguous memory locations, starting at the address 8080h. Data, in this case, are represented by negative integer numbers (two-complement coded). The first location (at address 8080h) must contain the value 0; the second the value -1, an so on. The table ends with -127 in its last location. Test the new version of the program in the debugger.

c) Third step

Add to the program the code that generates a third table of 128 contiguous memory locations, starting at the address 8100h. The micro computer should calculate and store, in each location of the new table, the sum of the corresponding locations of the first two tables (for example, the location 8100h will contain the sum of the contents of the locations 8000h and 8080h).

Test the final version of the program in the debugger. Two different traces of the code, to be completed, are available here: the first one is more challenging; the second one contains more suggestions. We recommend to add comments to the source code in order to help its understanding.