Now what?

steve ravet Steve.Ravet at arm.com
Tue May 25 20:14:28 GMT 1999


This is a disassembly of a PROM image?  What did you use to make it?

Bruce Plecan wrote:
> 
> I have some questions, if you look thru this,
> 
> 0000    L0000   =       0x0000
> 0000    L0010   =       0x0010        Why do the numbers "jump", here??
> 0010    L0011   =       0x0011
> 0011    L0012   =       0x0012
> 0012    L0013   =       0x0013
> 0013    L0014   =       0x0014
> 0014    L0015   =       0x0015
> 0015    L0016   =       0x0016
> 0016    L0017   =       0x0017

The EPROM image is made up of code and data (you knew that).  The
disassembler is smart enough to look at each instruction and see if it
accesses memory.  If it does it creates a label that represents that
address and uses the label in the code.  The above defines labels for
the addresses 0,0x10,0x11,0x12, etc.  The jump is because there is no
instruction that accesses address 0x01 directly.  Here's an instruction
from further down:

> 91DD            stx     L400B

It refers to the label L400B.  When the code was originally written
those labels had meaningful names like "spktable" or something but the
disassembler doesn't know that and so just makes up a label.

> 
> snip
> 
> 0030    L0031   =       0x0031
> 0031    L0033   =       0x0033
> 0033    L0034   =       0x0034
> 0034    L0035   =       0x0035
> 0035    L0036   =       0x0036
> 0036    L0037   =       0x0037
> 0037    L0038   =       0x0038
> 0038    L0039   =       0x0039               What happens here?.
> 0039    L0048   =       0x0048
> 0048    L0058   =       0x0058
> 0058    L0059   =       0x0059
> 0059    L005A   =       0x005A
> 005A    L005B   =       0x005B
> 005B    L005D   =       0x005D

Same as above.

> 
> snip
> 
> 5006    L5009   =       0x5009           Why the jump to the 5 "prefix"
> 5009    L500C   =       0x500C
> 500C    L500F   =       0x500F
> 500F    L5012   =       0x5012
> 5012    L6000   =       0x6000
> 
> 8000            .area   CODE1   (ABS)
> 8000            .org    0x8000
> 8000


You'll have to get the 6811 manual from Moto and look up these
instructions to see what they do.  I don't know much about 6811 assembly
language in particular, but I do know about assembly in general.  The
6811 has two 8 bit registers (A and B) that can also be put together as
a single 16 bit register (d).  These registers are where the processor
stores numbers temporarily while it does arithmetic on them, compares
them to other values, writes/reads them to memory, etc.  There are also
2 16 bit registers called X and Y, and a handful of others.  Here's a
few examples:

9114            ldaa    #0x10
This instruction is located at address 0x9114, and says to load the
value 0x10 into register "A"

 910B    L910B:  subb    0x01,x
This instruction forms an address by taking the value in the "X"
register and adding 1 to it.  Then, get the value stored at that
address, subtract it from the value in the "B" register, and store the
result back in the "B" register.

This is why the labels jump around.  The disassembler doesn't know what
value is in register X at any given time, so it doesn't know what
address this instruction accesses.  Therefore it can't assign a label to
the address.

Other instructions branch to different places, read/write values to
memory, etc.

> 
> FFF4    VECTF4: .word   F4VECT         OK ??
> FFF6    VECTF6: .word   F6VECT
> FFF8    VECTF8: .word   F8VECT
> FFFA    VECTFA: .word   FAVECT
> FFFC    VECTFC: .word   FCVECT
> FFFE    RSTVEC: .word   RESET
> 0000    ;       .end

At the top of memory are vectors that tell the CPU what to do after
reset, power on, etc.  For example, after a reset the CPU grabs 2 bytes
from 0xfffe and 0xffff. This forms a 16 bit address that the CPU jumps
to.  If you look through the code you should find a label called "RESET"
and another called "FCVECT", etc.  The 6811 manual can tell you what the
other vectors do.

> 
> Thanks
> Doc Grumpy Sneezy Sleepy Bashful

-- 
Steve Ravet
steve.ravet at arm.com
Advanced Risc Machines, Inc.
www.arm.com



More information about the Gmecm mailing list