assembly

The Two Pass Assembler - Creating The Object Program


Was wondering how the length of the object code in each text record is determined. I do know that the length is represented as hexadecimal in bytes, however, the size is not known to be specified particularly anywhere. Is this arbitrarily chosen by the assembler?

Here's an example of the object program I've taken from the book

“System Software – An Introduction to Systems Programming”, By Leland L. Beck

H COPY 001000 00107A
T 001000 1E 141033 482039 001036 281030 301015 482061 3C1003 00102A 0C1039 00102D
T 00101E 15 0C1036 482061 081044 4C0000 454F46 000003 000000
T 002039 1E 041030 001030 E0205D 30203F D8205D 281030 302057 549039 2C205E 38203F
T 002057 1C 101036 4C0000 F1 001000 041030 E02079 302064 509039 DC2079 2C1036
T 002073 07 382064 4C0000 05
E 001000

My doubt lies in how these lengths - 1E, 15, 1E, 1C and 07 - are chosen and not in how it's calculated. Thanks!


Solution

  • First, notice "There is no object code corresponding to addresses 1033-2038. This storage is simply reserved by the loader for use by the program during execution."

    Next, realize that the output buffer is a maximum of 1E bytes.

    So the first line is 1E because the entire output buffer is used.

    But the next line is only 15 because the reserved memory doesn't generate op-codes, so the buffer isnt filled all the way.

    The next line is a full 1E buffer of opcodes, but note its starting address is not contiguous with the previous code, instead it starts after the reserved memory.

    The next line has an inline single byte (F1) so there isn't room in the 1E sized buffer for the last full opcode, so the line is cut at 1C. (since 1E-1C=2 and the next opcode needs 3 bytes)

    The last line just has the last 7 bytes of the program.