View of the Machine Code ??
John Kauffman
Posts: 653
I am trying to provide for students demos for each step of the programming process.
·
As I understand the process:
SX/B code in .SXB file >> Compiler >> Assembly Code in .SRC file >> Assembler >> Machine Code in ??? file >> load into the EEFlash
·
I can show students the SXB and SRC files. Is there any way to complete the story with a view of the machine code?
·
Specific questions follow:
·
1 ·Does the machine code persist or is it sent straight to the EEFlash?
2 ·If it persists what is the file name, extension and path?
3· I assume if I can open the machine code file it will be a string of 1 & 0s. I also assume it can’t be opened in Notepad. Is there any way to get a peek at that machine code just for the educational purpose of demonstrating what it is that actually goes into the chip?
·
Much thanks.
·
As I understand the process:
SX/B code in .SXB file >> Compiler >> Assembly Code in .SRC file >> Assembler >> Machine Code in ??? file >> load into the EEFlash
·
I can show students the SXB and SRC files. Is there any way to complete the story with a view of the machine code?
·
Specific questions follow:
·
1 ·Does the machine code persist or is it sent straight to the EEFlash?
2 ·If it persists what is the file name, extension and path?
3· I assume if I can open the machine code file it will be a string of 1 & 0s. I also assume it can’t be opened in Notepad. Is there any way to get a peek at that machine code just for the educational purpose of demonstrating what it is that actually goes into the chip?
·
Much thanks.
Comments
Ray
Example: shows SXB command and below the op codes as well as the machine code in hex format
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!
Just to be clear, if you look at the snippet in the previous post by Metron9, the machine code are the numbers following the line number. For example line number 173 is followed by 0042 and 0010, and on the next line below it are 0043 0A5A. These are the machine code values for the assembly source line "JMP @Initialize_8255. Machine code is simply the actual number used by the CPU for a given instruction. They can be expressed in decimal, hex, binary, octal, or whatever. The number base is unimportant.
Thanks, PeterM
Click on "assembler" and check box the "SASM Output" dir.
Compile the code, and keep the IDE up.
You can then go to the \SX-Key v3.2\SASM Output directory, and there is the obj file that has the machine code. I use UltraEdit to view it, as it gives the address, as well.
Also, don't forget flowcharting! [noparse]:o[/noparse])
[noparse][[/noparse]edit] To clarify, it appears when you compile, and the IDE·deletes the file after you close the IDE...Sneaky, eh?
Rodney
Post Edited (Yendor) : 10/25/2006 3:23:46 AM GMT
Instead of showing the students the object file, it might be better to show them the list file, as Metron9 had suggested, as it contains all the information: The assembly instructions, the generated machine code, and the addresses, where the code goes. As Peter had mentioned, the machine code can be found in the third column (1st is the line number in decimal, 2nd is the address in hex, and 3rd is the machine code in hex).
The sample, Metron9 had posted also nicely shows, how the assembler has generated two instruction codes for each of the JMP @.... instructions, the codes for a PAGE, and a JMP instruction. This is also hepful to understand compound instructions, like MOV fr1, fr2, Here, the assembler generates two instruction codes for MOV w, fr2 and MOV fr1, w.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
The obj file becomes more relavent when you have to burn your own EPROMS on other uc's. Or at least, it was to me! It should match what's on the window, with what Ray pointed out, I would imagine after the SX is programmed.
Rodney