Author Topic: 68xx assembly: Working out ranges from a math tree  (Read 1163 times)

0 Members and 1 Guest are viewing this topic.

Offline metertech58761Topic starter

  • Frequent Contributor
  • **
  • Posts: 271
  • Country: us
68xx assembly: Working out ranges from a math tree
« on: August 04, 2023, 07:56:46 pm »
I've been slowly pecking away at some code I dumped from an EPROM, and I feel if I can work out this section, it will get me that first insight needed to start figuring out another section of code.


nmi_4C1   LDAB  SRM_C6
      BEQ   nmi_50F
      TBA
      LSRA
      LSRA
      LSRA
      LSRA
      BEQ   nmi_516
      SUBA  #$04
      BEQ   nmi_51E
      DECA
      BEQ   nmi_54B
      DECA
      BEQ   nmi_4DB
      DECA
      BEQ   nmi_4E6
      JMP   nms_48F


So, before I pour this shard into an assembler and single-step through it 256 times (which has not always been reliable), I thought I'd ask here.

Obviously this takes the value in SRM_C6 and does some math to break out the value into one of several ranges.

I do know that if SRM_C6 = 0, it branches off to nmi_50F, and if SRM_C6 is < 16, it will branch off at nmi_516

Beyond that, I get a little lost trying to figure out the ranges for the next four branching points

Lastly, nms_48F is the "else" case and a path back into the main interrupt loop.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 6464
  • Country: nz
Re: 68xx assembly: Working out ranges from a math tree
« Reply #1 on: August 04, 2023, 11:53:21 pm »
Code: [Select]
nmi_4C1
      LDAB  SRM_C6 ; why not LDAA ??
      BEQ   nmi_50F ; 0
      TBA
      LSRA
      LSRA
      LSRA
      LSRA
      BEQ   nmi_516 ; 1-15
      SUBA  #$04
      BEQ   nmi_51E ; 64-79
      DECA
      BEQ   nmi_54B ; 80-95
      DECA
      BEQ   nmi_4DB ; 96-111
      DECA
      BEQ   nmi_4E6 ; 112-127
      JMP   nms_48F ; 128-255 or 16-63

No?
« Last Edit: August 05, 2023, 01:48:26 am by brucehoult »
 
The following users thanked this post: metertech58761

Offline metertech58761Topic starter

  • Frequent Contributor
  • **
  • Posts: 271
  • Country: us
Re: 68xx assembly: Working out ranges from a math tree
« Reply #2 on: August 05, 2023, 12:48:58 am »
Bruce: One thing I did before posting here was try and calculate it in Excel, and the values you suggest actually jibe with where the 0s landed in the formulae I worked out.

So, I will take that as a starting point. Thank you!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->