Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Disassembly Listing file

Status
Not open for further replies.

PA3040

Advanced Member level 3
Joined
Aug 1, 2011
Messages
883
Helped
43
Reputation
88
Reaction score
43
Trophy points
1,308
Activity points
6,936
Dear All
reference MCU is 16f877a

Please see picture
This picture fraction of Disassembly Listing file. as I know the red cycle area is OBJECT CODE
please explain, what is represent this codes

please advice

list.GIF
 

this is "object code" or "machine language", it is a list of codes for the assembly language commands. for example the command "movlw 0xFF" translates to 30FF.
you can see the entire list of codes for all assembly language on your MCU datasheet on the "instruction set summary" chapter, under "14-bit opcode" column.
 
  • Like
Reactions: PA3040

    PA3040

    Points: 2
    Helpful Answer Positive Rating
this is "object code" or "machine language", it is a list of codes for the assembly language commands. for example the command "movlw 0xFF" translates to 30FF.
you can see the entire list of codes for all assembly language on your MCU datasheet on the "instruction set summary" chapter, under "14-bit opcode" column.

Dear Yuvko,
Thank you very much for reply
Please see picture

as per you movlw = 30 in machine code
30.GIF

In the above picture where we can see 30

Please advice
 

hi,
please notice that the opcode is 14 bit, while 30FF is 16 bit, so if you pad the movlw code with 00, you will get 0011 00xx kkkk kkkk, which give you 30 when xx=00 (for the meaning of x,k etc. look at the beginning of the instruction set summary chapter.
 

From reading these and other posts from PA3040 I think I can see where the confusion is coming from:

It's all to do with the number radix we normally use. In normal life we use decimal (base 10), but in programming this is not efficient because the underlying numbers are binary and to keep referring to long strings of 1 and 0 would be confusing and take a lot of typing. We could use the binary numbers for zero to 9 like this:
0 = 0000
1 = 0001
2 = 0010
3 = 0011
4 = 0100
5 = 0101
6 = 0110
7 = 0111
8 = 1000
9 = 1001

It is sometimes used like that and we call it BCD (Binary Coded Decimal). For example 123 in decimal would be 0001 0010 0011 in BCD. Note how many bits are needed though.

In programming that is not efficient and you will see the reason is that some of the possible binary combinations are not utilized. To make best use of binary, instead of decimal we use hexadecimal (base 16) which adds these extra 'numbers':
A = 1010
B = 1011
C = 1100
D = 1101
E = 1110
F = 1111

For example 3AF in hexadecimal would be 0011 1010 1111 in binary. As there could be confusion over the radix, we usually indicate hexadecimal by adding 'H' or '0x' in front of the number. Also to make it easier to read, we group the binary bits into groups of four, starting from the right (least significant bit) and working to the right.

Now going back to your original question
The opcode you saw for "movlw 0xff" (note the 0x) was converted by the assembler to 30FF.
Split the 30FF into individual characters 3 0 F F and convert each into binary, you get: 0011 0000 1111 1111 which is the bit pattern of the PIC opcode for that instruction. The first two zeros are not physically present in the PIC because it only has a 14 bit instruction set, thats why the first hex number in any PIC16 instruction is never greater than 3.

Does that explain.

Brian.
 
  • Like
Reactions: PA3040

    PA3040

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top