DIY PROM Do It Yourself PROM chip burning help. No PROM begging. No PROMs for sale. No commercial exchange. Not a referral service.

What does this section of code do?!?!

Old Oct 14, 2010 | 05:18 PM
  #1  
bl85c's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: May 2007
Posts: 2,574
Likes: 0
From: right behind you
Car: '85 maro
Engine: In the works...
Transmission: TH700 R4
Axle/Gears: 3.73 posi
What does this section of code do?!?!

Like the title says. It looks like what's stored to A and B is either overwritten or not used at all. Enlightenment, please?

Code:
 
 ;-------------------------------------------------
 ;
 ;
 ;
 ;-------------------------------------------------
D8D8:            BRCLR   L0036,#$08,LD8F2  ; BR IF NOT b3, ALDL MODE 4
 
D8DC:            LDAA    L0160
D8DF:            BITA    #$04    ; b2
D8E1:            BEQ     LD8F2
                                            ; ... Else                 
D8E3:            LDAB    L0162
D8E6:            CLRA    
D8E7:            PSHB    
D8E8:            PSHA    
D8E9:            PULX    
D8EA:            LDD     #$FFFF
D8ED:            IDIV    
D8EE:            STX     L00D5
D8F0:            BRA     LD95A

Last edited by bl85c; Oct 14, 2010 at 06:04 PM.
Reply
Old Oct 14, 2010 | 07:30 PM
  #2  
tequilaboy's Avatar
Member
15 Year Member
Liked
 
Joined: Sep 2007
Posts: 350
Likes: 15
Re: What does this section of code do?!?!

It is a routine to modify the target AFR directly via ALDL Mode 4 and bypass the normal PE AFR calculation.

The value that is loaded into A (L0160) is a status bit that is checked before proceeding.

The value that is loaded into B (L0162) is the new AFR from the Mode 4 command message.

Last edited by tequilaboy; Oct 15, 2010 at 07:47 PM.
Reply
Old Oct 14, 2010 | 09:25 PM
  #3  
alvanwie's Avatar
Member
 
Joined: Oct 2005
Posts: 330
Likes: 0
From: Dyer, In
Car: 91 Camaro RS
Engine: 355 Vortec
Transmission: 700r4
Axle/Gears: 3.42
Re: What does this section of code do?!?!

Originally Posted by bl85c
Like the title says. It looks like what's stored to A and B is either overwritten or not used at all. Enlightenment, please?

Code:
 
 ;-------------------------------------------------
 ;
 ;
 ;
 ;-------------------------------------------------
D8D8:            BRCLR   L0036,#$08,LD8F2  ; BR IF NOT b3, ALDL MODE 4
 
D8DC:            LDAA    L0160
D8DF:            BITA    #$04    ; b2
D8E1:            BEQ     LD8F2
                                            ; ... Else                 
D8E3:            LDAB    L0162
D8E6:            CLRA    
D8E7:            PSHB    
D8E8:            PSHA    
D8E9:            PULX    
D8EA:            LDD     #$FFFF
D8ED:            IDIV    
D8EE:            STX     L00D5
D8F0:            BRA     LD95A
The value in the A and B registers (which is the 16 bit D register) is pushed onto the stack and then popped off of the stack into the X register. Then the D register is loaded with FFFFh and divided by the X register (this is the value that was originally loaded in A,B). Then the result is stored at L00D5.

So.....
L00D5 = ffffh/L0162

Hope that makes sense.

Last edited by alvanwie; Oct 15, 2010 at 07:29 PM.
Reply
Old Oct 14, 2010 | 11:16 PM
  #4  
bl85c's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: May 2007
Posts: 2,574
Likes: 0
From: right behind you
Car: '85 maro
Engine: In the works...
Transmission: TH700 R4
Axle/Gears: 3.73 posi
Re: What does this section of code do?!?!

Ah, I'm reading it wrong then. Looks to me like what was loaded onto A was subsequently cleared then commanded to push to the stack. So why is there a clear A command before A is put on the stack?
Reply
Old Oct 15, 2010 | 07:28 PM
  #5  
alvanwie's Avatar
Member
 
Joined: Oct 2005
Posts: 330
Likes: 0
From: Dyer, In
Car: 91 Camaro RS
Engine: 355 Vortec
Transmission: 700r4
Axle/Gears: 3.42
Re: What does this section of code do?!?!

Sorry, looks like i got that slightly wrong.

B is loaded with the value from L0162 and A is cleared to zero. These 8 bit values are pushed onto the stack B first then A. They are then popped off of the stack into the 16 bit X register (high byte first) so effectively X (16 bit) contains the value from L0162.

So,,,

L00D5 (16 bit) = ffffh/L0162
Reply
Old Oct 15, 2010 | 09:01 PM
  #6  
bl85c's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: May 2007
Posts: 2,574
Likes: 0
From: right behind you
Car: '85 maro
Engine: In the works...
Transmission: TH700 R4
Axle/Gears: 3.73 posi
Re: What does this section of code do?!?!

Thanks, that helps me with what I'm writing. Finding enough space for this hack is getting tedious.
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
89-IROCZ-5.0TPI
TPI
10
Feb 22, 2022 09:26 PM
Falcon50
DFI and ECM
81
Aug 22, 2020 03:26 PM
racereese
Tech / General Engine
14
Oct 3, 2015 03:46 PM
Luigytico09
TPI
0
Oct 1, 2015 08:46 AM
FormulaEngland
Interior
2
Sep 30, 2015 01:50 PM


Thread Tools
Search this Thread

All times are GMT -5. The time now is 10:11 PM.