Download Contents
Transcript
ASSEMBLY LANGUAGE 157 S123C100CE00004F5FE600C900088C001826F67F0018C018820025077C001820F59618397B S1030000FC S9 Table 7.3 The absolute S2-S8 machine-code file average.hex. In the MPU world there are many different formats in common use. Although most of these de facto standards are manufacturer-specific, in the main they can be used for any brand of MPU. The format of the machinecode file shown here is known as Motorola S1-S9. Let us look at the first line, or record, which contains the code for the instructions in the program average.s in more detail: Start of data record marker Address of first data byte Machine code S1 23 C100 CE00004F5FE600C900088C001826F67F0018C018820025077C001820F5961839 7B Number of bytes following marker Checksum The loader recognizes that a code record follows when the characters S1 are received. The characters S9 signify the end-of-file line. Code records begin with the tally in hexadecimal of all characters after S1, followed by the four-digit hexadecimal address of the first code byte. The core of the record is the machine code, with typically up to 32 bytes in each line. The final byte is known as a checksum. The checksum is calculated so that a total count of all record bytes, excluding the record start characters, will always give FFh (−1). This is used by the loader program to detect download errors. S1-S9 files are suitable for processors with addresses that can be represented as a 16-bit code (four hexadecimal digits), such as the 6800 MPU. 68000 MPUs have 24-bit Address buses, and need six hexadecimal digit representations. 68020 and higher family members have 32-bit Address buses, and need eight hexadecimal representations. The S2-S8 Motorola format is similar to S1-S9 but with a six-digit address field. In a similar manner, S3-S7 format files support processors with an eight-digit address. An assembler will be very particular that the syntax of the source code