OK, here's some elaboration of exactly the form of replies I need to see.
I want to identify the registers and memory of interest for the example 9code fragment),
and I want to see the contents of each register before and after each instruction.
The relevant registers here are
Code: Select all
PC the Program Counter
SP the Stack Pointer
REG_32
REG_33
REG_34
REG_35
REG_36
REG_37
memory address ZZZZ
At the start of our example, the PC contains 353B and the SP contains ZZZZ, a 16 bit quantity whose value is unknown. Even though this value is not known, how it changes is important. It is important also because we want to know what data is at address ZZZZ and above.
XX is used to signify a value which is unknown and which we don't care about.
Here's the previous example. I've changed the call destination to L45A9 so I don't have to deal with the code between L459E and L45A9 just yet.
Code: Select all
3F3B EF6006 call L45A9
3F3E 8E00 word $008E
3F40 B600 word $00B6
or maybe we have
3F3B EF6006 call L45A9
3F3E 8E byte $8E
3F3F 00 byte $00
3F40 B6 byte $B6
3F41 00 byte $00
depending on whether we used word or byte for the directives. That didn't matter when we did it, because our goal was just to disassemble code as code. Now we're going to look at the data.
The code at $45A9 is
Code: Select all
45A9 CC36 L45A9 popw REG_36
45AB B23732 ldb REG_32,[REG_36]+
45AE B23733 ldb REG_33,[REG_36]+
45B1 AC3334 ldzbw REG_34,REG_33
45B4 710F33 an2b REG_33,#$0F
45B7 080434 shrw REG_34,#$04
45BA 6735F00032 ad2w REG_32,$00F0[REG_34]
45BF B23734 ldb REG_34,[REG_36]+
45C2 B23735 ldb REG_35,[REG_36]+
45C5 C836 pushw REG_36
45C7 B23434 ldb REG_34,[REG_34]
45CA 9B320234 L45CA cmpb REG_34,$02[REG_32]
45CE 3D9D04 jb REG_9D,BIT_05,L45D5
45D1 DB0A jc L45DD
45D3 2002 sjmp L45D7
45D5 D606 L45D5 jge L45DD
45D7 65020032 L45D7 ad2w REG_32,#$0002
45DB 27ED sjmp L45CA
45DD 71DF9D L45DD an2b REG_9D,#$DF
45E0 B23336 ldb REG_36,[REG_32]+
45E3 B23338 ldb REG_38,[REG_32]+
45E6 7A3236 sb2b REG_36,[REG_32]
45E9 7A3334 sb2b REG_34,[REG_32]+
45EC 7A3238 sb2b REG_38,[REG_32]
So here's what I wanted to see prior to the instruction at 3F3B
Code: Select all
PC contains 3F3B
SP contains ZZZZ
ZZZZ contains XXXX
REG_32 contains XX
REG_33 contains XX
REG_34 contains XX
REG_35 contains XX
REG_36 contains XX
REG_37 contains XX
Then we execute
3F3B EF6006 call L45A9
Then the relevant register template or block becomes
Code: Select all
PC contains 45A9
SP contains ZZZZ-2
ZZZZ contains XXXX
ZZZZ-2 contains 353E
REG_32 contains XX
REG_33 contains XX
REG_34 contains XX
REG_35 contains XX
REG_36 contains XX
REG_37 contains XX
Then we execute
45A9 CC36 L45A9 popw REG_36
Then the relevant register template or block becomes
So please continue this.
Take the provided template of relevant registers and memory location, and fill it in, instruction by instruction.
Like this, except that YY or YYYY means YOU need to fill this in:
Code: Select all
PC contains YYYY
SP contains YYYY
ZZZZ contains YYYY
ZZZZ-2 contains YYYY
REG_32 contains YY
REG_33 contains YY
REG_34 contains YY
REG_35 contains YY
REG_36 contains YY
REG_37 contains YY
This is what you need to do to UNDERSTAND what is going on, and to show others that you do understand it, ad allow them to understand it. I'll just have to hope I got it right so far :-)
Michael