Results 1 to 15 of 15

Thread: $4D table mangling

  1. #1
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,040

    $4D table mangling

    just a thread so i can get some help in trying to play with table lookups in $4d, or at least so you can all watch me fail miserably

    first time trying to mess with table lookups, so chances of me doing the obvious and failing miserably are high.

    my goal is, want both tables to be re-ranged from 20kpa to 100kpa. i do a LOT of decel and very light crusing, and spend a ton of time 20-40kpa, so i want more fine grained control in that range, and there is NO way to force an LO3 above 100kpa.

    i'd like to increase VE resolution too, but maybe that's next, since there's very little free space to shove stuff around with only a 4k bin.

    relavent code;

    Code:
    ;~~~~~~~~~~~~~~~~
    ;-Main %VE table
    ;~~~~~~~~~~~~~~~~
    ;
    LD278   FCB       0		;row offset
            FCB      16		;Col offset
            FCB       8		;# of cols
    
    ;    RPM/1k  .4   .8  1.2  1.6  2.0  2.4  2.8  3.2 ;kPa
    ;              
            FCB  50,  49,  54,  57,  60,  62,  63,  65 ; 30
            FCB  51,  52,  55,  63,  69,  76,  86,  90 ; 40
            FCB  53,  54,  61,  65,  79,  88,  99, 103 ; 50
            FCB  55,  59,  75,  82,  86,  94, 101, 108 ; 60
            FCB  65,  71,  88,  91,  93,  99, 110, 116 ; 70
            FCB  95, 107, 112, 108, 103, 103, 111, 120 ; 80
            FCB  98, 106, 121, 121, 119, 119, 122, 127 ; 90
            FCB  99, 107, 121, 125, 124, 125, 125, 129 ;100
            FCB  99, 106, 120, 127, 126, 124, 126, 130 ;110
    
    ;~~~~~~~~~~~~~~~~
    ;main %VE lookup
    ;~~~~~~~~~~~~~~~~
    ;
    LD596   LDAB    L001B		;RPM/25
            BPL     LD59C		;bra if <3200
    ;
            LDAB    #$0080		;3200 rpm
    ;
    LD59C   LDX     #LD278		;%VE table
            JSR     LFB99		;Do 3D lookup
            ADDA    L00AC		;add %VE in
            BCC     LD5A8		;Bra if overflow
    ;
            LDAA    #$00FF		;clr overflow
    ;
    LD5A8   STAA    L00AC		;Store it, %VE
    
    ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ;>
    ;>3D lookup routine
    ;>
    ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ;
    LFB99   SUBA    $0000,X		;Subtract row offset from A
            BCC     LFB9E		;Bra if > offset
    ;
            CLRA 			;Clr A 
    ;  
    LFB9E   SUBB    $0001,X		;Subtract column offset from B
    ;
            BCC     LFBA3		;Bra if > offset
    ;
            CLRB			;Clr B
    ;    
    LFBA3   STAB    L004B		;tmp storage
            LDAB    #$0010		;
            MUL  			;Calc column offset   
            PSHB			;Push the leftovers to the stack
    ;    
            LDAB    $0002,X		;Load in # of cols. into B
            PSHB  			;Push that to the stack too  
            MUL 			;Offset in A x # cols.      
            ABX 			;Add in offset to X
    ;   
            INX			;Addr +1     
            INX 			; "    
            INX 			; "   
            PSHX 			;Addr of column ----> stack   
            LDAA    L004B		;Load row offset into A
            BSR     LFB7B		;Go do 2D lookup
    ;
            STAA    L004A		;tmp storage
            LDAA    L004B		;load row offset into B
            PULX    		;Get column address off the stack
            PULB  			;Get # of columns from stack  
            ABX 			;Add # of columns to X, go over one row    
            BSR     LFB7B		;2D lookup, get value next to it
            TAB			;Value ----> B     
            LDAA    L004A		;Get that value back into A
            BRA     LFB83		;Go interpolate it and return

  2. #2
    Fuel Injected! jim_in_dorris's Avatar
    Join Date
    Dec 2011
    Posts
    803
    Steveo, I have never played with $4d, but I do understand assembly language programming really well, so maybe I can help out. Changing the table itself isn't too difficult, but what values are you going to want for the 20 kpa row? And as far as increasing resolution, do you mean making the table bigger? In a 4k bin that might be a problem. You also will have to make sure to check boundary values at the high and low end of the table to ensure you don't exceed them in the call.
    Square body stepsides forever!!!

  3. #3
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,040
    oh this too, most important part ..

    Code:
    ;-Check if use Baro/Raw map is flagged, else use SD MAP for %VE lookup
    ;
            LDAA    L0024		;Load SD map
            LSRA 			;/2   
            LDAB    LD006		;opt word
            BITB    #$0008		;Test b3, do baro fuel corr.
            BEQ     LD596		;Bra if ==0
    ;
    ;-Do raw map conv. and use for %VE lookup, takes baro press. into account.
    ;
            LDAA    L0027		;Raw map
            CMPA    L00FE		;Baro pressure
            BCS     LD58C		;Bra if < baro pressure
    ;
            LDAA    #$007F		;127		
            BRA     LD596		;Bra
    ;
    LD58C   LSRA  			;Raw Map /2  		
            ADDA    #$000E		;15, offset
            LDAB    L002F		;factor from Baro lookup
            MUL  			;(MAP val. x factor)   
            ASLD			;x2    
            ASLD 			;x2   
            SUBA    #$0020		;-32

  4. #4
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,040
    Quote Originally Posted by jim_in_dorris View Post
    Steveo, I have never played with $4d, but I do understand assembly language programming really well, so maybe I can help out. Changing the table itself isn't too difficult, but what values are you going to want for the 20 kpa row?
    basically i just want to shift the entire table -10kpa in range, so instead of being 30kpa-110kpa i get 20kpa-100kpa.

    (obviously this is a lookup thing instead of modifying the table itself...)

  5. #5

  6. #6
    Fuel Injected! jim_in_dorris's Avatar
    Join Date
    Dec 2011
    Posts
    803
    I will take a look at it. Again, the only thing you probably need to change is a couple of bytes in the lookups and putting the values you want in the 20kpa row. Do you see 20kpa that often?
    Square body stepsides forever!!!

  7. #7
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,040
    never really looked at it too hard, but it's interesting that there are two SD lookup modes, one with barometric pressure compensation and one without.... and that bit isn't set in ANY factory calibrations...

  8. #8
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,040
    Quote Originally Posted by jim_in_dorris View Post
    Do you see 20kpa that often?
    well, yeah. cruising range is ~30kpa and decel is 20kpa. i'd really like to be able to manipulate spark and fuel @20-30kpa a bit more effectively. especially since i never hit 110kpa, so that entire row is useless.... it'd be nice to lose it in favor of better low end tuning.

  9. #9
    Fuel Injected! jim_in_dorris's Avatar
    Join Date
    Dec 2011
    Posts
    803
    Does Decel use the VE table or a DFCO table? You need to pay attention to what happens in decel before you go changing the table.
    Square body stepsides forever!!!

  10. #10

  11. #11
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,040
    on an initial glance, it doesn't seem to 'use' the ve table at all; it seems to be straight up coolant temp lookup that's multiplied into BPW. and it's controlled by a status bit set by a threshold.

    ;BPW = BPWC x AFR x VE x MAP x Cool corr. x BLM corr. x DFCO x decel. x FPV corr.
    ; +/- INT prop. term

    i think the author of this program intended anything below 30kpa to start nearing decel mode, and just run a multiplier to start enleanment

    i dont want to have a ve table that runs over decel or anything, but i do think there's quite a bit of territory JUST UNDER 30kpa that i play around in that i could fine tune for driveability.

  12. #12
    Fuel Injected! jim_in_dorris's Avatar
    Join Date
    Dec 2011
    Posts
    803
    Well, I will take a look at it and make a guess, but right now I think that it might be doable without too much effort.
    Square body stepsides forever!!!

  13. #13

  14. #14
    Fuel Injected! jim_in_dorris's Avatar
    Join Date
    Dec 2011
    Posts
    803
    Steveo, I looked at the code a little tonight, and the only thing I am not sure about is the use of the raw map signal. Other than that, It should be just as simple as changing the table. If the code does what I think, the map/ raw baro merely gives one of the offsets into the table. RPM is the other. I am not 100% sure what the boundary values are for RAW/ baro, and MAP, but so long as the value doesn't resolve outside the table boundaries you should be ok. What you might want to do is to look at the MAP conversion routine and see what values are possible coming out of the a/d converter reading the MAP.
    Square body stepsides forever!!!

  15. #15
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,040
    yeah it does look that easy; doesn't it. i'll try a few approaches tonight and see if it runs. im lucky; i have a nice chunk of unused code there (the barometric compensation branch) that i can use for my own purposes.

Similar Threads

  1. VE table in $5B ?
    By Playtoy_18 in forum TunerPro Tuning Talk
    Replies: 6
    Last Post: 02-25-2014, 08:21 AM
  2. VE2 table question
    By Sla90lx in forum GM EFI Systems
    Replies: 7
    Last Post: 08-24-2013, 12:51 AM
  3. add % change across the whole table
    By xtreamvette69 in forum GM EFI Systems
    Replies: 5
    Last Post: 08-20-2013, 02:29 PM
  4. $EE O2 table help
    By lt4dave in forum TunerPro Tuning Talk
    Replies: 3
    Last Post: 07-11-2012, 01:40 AM
  5. $8D VE Correction Table
    By dave w in forum GM EFI Systems
    Replies: 1
    Last Post: 04-26-2012, 01:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •