Machine Language Programming
Note: It will help to have a HCS08 Microcontroller data book before following this article!
Let us start by considering a set of four HCS08 instructions. They are the main subset of the load/store instructions. Two involve register A and two the H:X pair as a main participant. The register-A instruction’s operand points to a single byte of memory to load from or store into. The register-H:X instruction’s operand points to a double byte of memory. The operands of all four look identical, we must tell from the opcode whether they will be reading that location or writing to it and whether it reads or writes one byte or two. We also must “know” from the architectural specifications of the computer (the details we need are in Table 7-2) that for the H:X instructions, the operand points to the memory location used with H and that the location used with X is just the next one down in memory (has an address one greater than the one used with H). The instructions are:
load register A (lda) C6 hhll where hh specifies 2-hex-digits
store register A (sta) C7 hhll that form the most significant
load registers HX (ldhx) 32 hhll byte of the 2-byte, 4-hex-digit
store registers HX (sthx) 96 hhll address of the operand
Go find those in the table in your microcontroller data book. Suppose we only have the C6 as would be the case if we were inspecting a program in memory – that we don’t yet know is a load register A instruction. First, look up the C6 in Table 7-3, page 105. The center of the C6 entry tells us it is an lda instruction. We then look up lda in Table 7-2; that entry is near the center of page 100. Note: There are eight lda instructions! We will deal with that issue later. To find the one we want, look in the opcode column to find C6. A glance to the left of it finds EXT. Page 104 tells what these Address mode abbreviations mean! Spend some time getting comfortable with the HCS08 microcontroller book and refer back to this article for a review about machine language programming!
#Machine #Language #Programming
Will be pleased to have you visit my pages on social networking .
Facebook page here.
Twitter account is here.
Linkedin account here
Post byBedewy for info askme VISIT GAHZLY