0

So right now I'm trying to understand how object code is generated but thse two lines really confuse me, anyone want explain it to me?

RSUB is 4C0000, I understand RSUB is 4C Mnemonic, but where did 0000 came from?
EOF BYTE C'EOF'  Object code is 454F46, how did they get that?

INPUT BYTE X'F1'      F1
how did generate F1 in the object code?

STCH BUFFER, X        549039

BUFFER is 1039, and STCH in mnemonic is 54, but shouldn't it be 541039?


also after a few lines,

LDCH BUFFER, X       509039?
Peter Cordes
  • 328,167
  • 45
  • 605
  • 847

1 Answers1

4

All of these should be answered in the instruction set reference of your architecture and the manual of your assembler.

RSUB is 4C0000, I understand RSUB is 4C Mnemonic, but where did 0000 came from?

SIC seems to use 24 bit words and a fixed length instruction encoding. Since this instruction apparently takes no operands, hence the zeroes. Maybe the cpu ignores the address field, so you could use anything you wanted, or maybe it has to be zero. Couldn't find a definite answer to that.

EOF BYTE C'EOF' Object code is 454F46, how did they get that?

45, 4F and 46 are just the ascii codes for E, O and F, respectively. Presumably the C operator of your assembler instructs it to emit the ascii code of the following characters.

INPUT BYTE X'F1' F1 how did generate F1 in the object code?

Presumably the X operator of your assembler means emit the byte with the given hex value.

STCH BUFFER, X 549039 BUFFER is 1039, and STCH in mnemonic is 54, but shouldn't it be 541039?

The address is the low 15 bits only. Bit #15 is used as a flag indicating indexed addressing mode, hence 1039 becomes 9039.

Jester
  • 56,577
  • 4
  • 81
  • 125
  • Thank you so much. can you please explain bit more detail of STCH BUFFER, still bit confused. how did they get 549039? what do you mean bit 15, can you show me the object code process(how it beomce 549039? –  Apr 04 '15 at 03:23
  • Keep the low 15 bits of the address, that is `1039` then set the next bit to 1 (that is bit value `8000`) to indicate indexed address mode so you get `9039`. – Jester Apr 04 '15 at 12:38
  • sorry still confused, why is 1 equal 8000? is it because binary value 2 to the third power? and do you mean low 15 bits of address? is just the the last 4 value of the number, like 1039? –  Apr 04 '15 at 16:33
  • Convert them to binary and back if you have trouble counting bits. `1039=001 0000 0011 1001` (this is 15 bits). Prepend a `1` to indicate the indirect mode, so you have `1001 0000 0011 1001` which is `9039` in hex. – Jester Apr 04 '15 at 16:47
  • I understand now, thank you! 1.so do I automcatially preend a 1 if it always start with a 001? I mean how do I know when to set next bit to 1? 2.and lastly buffer, X. X doesn't do anything, then why is it in the line? STCH BUFFER, X –  Apr 04 '15 at 17:50
  • You set the bit to `1` if the addressing mode uses `,X` If the addressing doesn't have the `,X` you add a `0` bit. – Jester Apr 04 '15 at 18:07
  • and also the final line of the code is MAXLEN WORD 4096, the object code is 001000. is it because 1000 is the beginning of the code? and MAXLEN just simply shows the maximum length? –  Apr 04 '15 at 18:12
  • No, that just declares a word with value 4096 which is `001000` in hex, and assigns it the label `MAXLEN`. – Jester Apr 04 '15 at 18:14
  • also do you have a email address I can contact? since I can't ask more questions now. I ran into some confusions about object code invovles FIRST STL RETDAR 172063 –  Apr 04 '15 at 18:17