No I have not, but I would assume by the functions it calls it would be 8, but It is 16, So I am very confused about how it all works exactly. Looks like it Checks the table 3 times before outputting a value. But I am lost after adding all of the extra code it takes to actually perform a table lookup. Seems very overcomplicated but I am sure I am making it that way in my head..Have you spotted any code for the row count?
Here is the complete Table lookup....I think?
Code: Select all
ROUTINE FOR swTb34EPPH
09756: a1,1c,5d,36 ldw R36,5d1c TMP2L = uuyFn.0x15d1c;
uuyFn.0x15d1c:
15d1c: ff,70 func 255, 112
15d1e: 50,60 func 80, 96
15d20: 28,40 func 40, 64
15d22: 00,00 func 0, 0
15d24: 00,10 func 0, 16
15d26: 00,10 func 0, 16
15d28: 00,10 func 0, 16
15d2a: 00,10 func 0, 16
0975a: b3,01,93,f3,38 ldb R38,[R0+f393] TMP3L = VS_U4_DELTA;
0975f: 10,09 rombk 9
09761: ef,84,93 call 92ae8 SLU92AE8_UUYFn ();
SLU92AE8_UUYFn:
92ae8: f2 pushp push(PSW);
# SJump Loop from L92AF3 until Process Value >= value @ Fn_Addr+2 SLU92AE8_UUYFn
92ae9: 9b,36,02,38 cmpb R38,[R36+2]
92aed: db,06 jc 92af5 if (TMP3L < [Fn_Addr+2]) { # Unsigned Operation
92aef: 65,02,00,36 ad2w R36,2 Fn_Addr += 2; # Increment to Next Row
92af3: 27,f4 sjmp 92ae9 goto 92ae9; }
# JC from L92AED Process Value >= value @ Fn_Addr+2 and PV is Unsigned SLU92AE8_UUYFn
92af5: 71,df,a2 an2b Ra2,df SIGNDSLP = 0; # SIGNDSLP Clear 0
92af8: b2,37,3a ldb R3a,[R36++] TMP4L = [Fn_Addr]; # R3A = X>PV
92afb: b2,37,3c ldb R3c,[R36++] TMP5L = [Fn_Addr]; # R3C = Yx>pv
92afe: 7a,36,3a sb2b R3a,[R36] TMP4L -= [Fn_Addr]; # R3A Xd = X>PV - X<PV
92b01: 7a,37,38 sb2b R38,[R36++] TMP3L -= [Fn_Addr]; # R38 PVd = PV - X<PV
92b04: 7a,36,3c sb2b R3c,[R36] TMP5L -= [Fn_Addr]; # R3C Yxd = Yx>pv - Yx<pv
92b07: db,05 jc 92b0e if (TMP5L < 0) { # Unsigned Operation
# Unsigned CV Increases by Row
92b09: 91,20,a2 orb Ra2,20 SIGNDSLP = 1; # Yxd Negative
92b0c: 13,3c negb R3c TMP5L = -TMP5L; } # Invert Yxd Positive
# Cont from L92B0C CV Increased by Row, Negative Yxd Inverted Positive SLU92AE8_UUYFn
# JC from L92B07 Unsigned Control Value Decreases by Row, Yxd Positive SLU92AE8_UUYFn
92b0e: 7c,38,3c ml2b R3c,R38 TMP5L *= TMP3L; # R3C = Yxd * PVd
92b11: 9c,3a,3c divb R3c,R3a TMP5L /= TMP4L; # R3C CVd = Yxd * PVd / Xd
92b14: 35,a2,02 jnb B5,Ra2,92b19 if (SIGNDSLP = 1) {
92b17: 13,3c negb R3c TMP5L = -TMP5L; } # Revert Negative
# Cont from L92B17 CVd Control Value Delta Reverted to Negative SLU92AE8_UUYFn
# JNB from L92B14 CVd Control Value Delta Positive SIGNDSLP = 0 SLU92AE8_UUYFn
92b19: 76,36,3c ad2b R3c,[R36] TMP5L += [Fn_Addr]; # R3C CV = CVd + Yx<pv
92b1c: 11,3d clrb R3d TMP5H = 0; # CV High Byte Clear 0
92b1e: 71,df,a2 an2b Ra2,df SIGNDSLP = 0; # Clear 0 SIGNDSLP
92b21: 71,ef,a2 an2b Ra2,ef SIGNDY = 0; # Clear 0 SIGNDY
92b24: f3 popp PSW = pop();
92b25: f0 ret return;
09764: ac,3c,34 ldzbw R34,R3c TMP1L = TMP5L;
09767: a1,2c,5d,36 ldw R36,5d2c TMP2L = uuyFn.0x15d2c;
uuyFn.0x15d2c:
15d2c: ff,70 func 255, 112
15d2e: c8,70 func 200, 112
15d30: ac,60 func 172, 96
15d32: 64,00 func 100, 0
15d34: 00,10 func 0, 16
15d36: 00,10 func 0, 16
15d38: 00,10 func 0, 16
15d3a: 00,10 func 0, 16
0976b: b3,e4,fd,38 ldb R38,[Re4+fd] TMP3L = VSBART_RT;
0976f: 10,09 rombk 9
09771: ef,74,93 call 92ae8 SLU92AE8_UUYFn ();
SLU92AE8_UUYFn:
92ae8: f2 pushp push(PSW);
# SJump Loop from L92AF3 until Process Value >= value @ Fn_Addr+2 SLU92AE8_UUYFn
92ae9: 9b,36,02,38 cmpb R38,[R36+2]
92aed: db,06 jc 92af5 if (TMP3L < [Fn_Addr+2]) { # Unsigned Operation
92aef: 65,02,00,36 ad2w R36,2 Fn_Addr += 2; # Increment to Next Row
92af3: 27,f4 sjmp 92ae9 goto 92ae9; }
# JC from L92AED Process Value >= value @ Fn_Addr+2 and PV is Unsigned SLU92AE8_UUYFn
92af5: 71,df,a2 an2b Ra2,df SIGNDSLP = 0; # SIGNDSLP Clear 0
92af8: b2,37,3a ldb R3a,[R36++] TMP4L = [Fn_Addr]; # R3A = X>PV
92afb: b2,37,3c ldb R3c,[R36++] TMP5L = [Fn_Addr]; # R3C = Yx>pv
92afe: 7a,36,3a sb2b R3a,[R36] TMP4L -= [Fn_Addr]; # R3A Xd = X>PV - X<PV
92b01: 7a,37,38 sb2b R38,[R36++] TMP3L -= [Fn_Addr]; # R38 PVd = PV - X<PV
92b04: 7a,36,3c sb2b R3c,[R36] TMP5L -= [Fn_Addr]; # R3C Yxd = Yx>pv - Yx<pv
92b07: db,05 jc 92b0e if (TMP5L < 0) { # Unsigned Operation
# Unsigned CV Increases by Row
92b09: 91,20,a2 orb Ra2,20 SIGNDSLP = 1; # Yxd Negative
92b0c: 13,3c negb R3c TMP5L = -TMP5L; } # Invert Yxd Positive
# Cont from L92B0C CV Increased by Row, Negative Yxd Inverted Positive SLU92AE8_UUYFn
# JC from L92B07 Unsigned Control Value Decreases by Row, Yxd Positive SLU92AE8_UUYFn
92b0e: 7c,38,3c ml2b R3c,R38 TMP5L *= TMP3L; # R3C = Yxd * PVd
92b11: 9c,3a,3c divb R3c,R3a TMP5L /= TMP4L; # R3C CVd = Yxd * PVd / Xd
92b14: 35,a2,02 jnb B5,Ra2,92b19 if (SIGNDSLP = 1) {
92b17: 13,3c negb R3c TMP5L = -TMP5L; } # Revert Negative
# Cont from L92B17 CVd Control Value Delta Reverted to Negative SLU92AE8_UUYFn
# JNB from L92B14 CVd Control Value Delta Positive SIGNDSLP = 0 SLU92AE8_UUYFn
92b19: 76,36,3c ad2b R3c,[R36] TMP5L += [Fn_Addr]; # R3C CV = CVd + Yx<pv
92b1c: 11,3d clrb R3d TMP5H = 0; # CV High Byte Clear 0
92b1e: 71,df,a2 an2b Ra2,df SIGNDSLP = 0; # Clear 0 SIGNDSLP
92b21: 71,ef,a2 an2b Ra2,ef SIGNDY = 0; # Clear 0 SIGNDY
92b24: f3 popp PSW = pop();
92b25: f0 ret return;
09774: ac,3c,36 ldzbw R36,R3c TMP2L = TMP5L;
09777: ad,08,38 ldzbw R38,8 TMP3L = 8; = (Table Width) 8 COLUMNS
0977a: a1,3c,5d,3c ldw R3c,5d3c TMP5L = swTb34EPPH;
swTb34EPPH:
15d3c: 00,fc,00,02,cd,00,9a,00 table 0, 252, 0, 2, 205, 0, 154, 0
15d44: 00,00,00,00,33,00,00,f6 table 0, 0, 0, 0, 51, 0, 0, 246
15d4c: 00,fc,00,00,00,00,00,00 table 0, 252, 0, 0, 0, 0, 0, 0
15d54: 00,00,00,00,33,00,00,f6 table 0, 0, 0, 0, 51, 0, 0, 246
15d5c: 00,fc,00,00,00,00,00,00 table 0, 252, 0, 0, 0, 0, 0, 0
15d64: 00,00,00,00,00,00,00,f6 table 0, 0, 0, 0, 0, 0, 0, 246
15d6c: 00,fc,00,00,00,00,00,00 table 0, 252, 0, 0, 0, 0, 0, 0
15d74: 00,00,00,00,00,fe,00,f6 table 0, 0, 0, 0, 0, 254, 0, 246
15d7c: 00,fc,00,00,00,00,00,00 table 0, 252, 0, 0, 0, 0, 0, 0
15d84: 00,00,00,00,00,fe,00,f6 table 0, 0, 0, 0, 0, 254, 0, 246
15d8c: 00,fc,00,00,00,00,00,00 table 0, 252, 0, 0, 0, 0, 0, 0
15d94: 00,00,00,00,00,f6,00,f6 table 0, 0, 0, 0, 0, 246, 0, 246
15d9c: 00,fc,00,00,00,00,00,00 table 0, 252, 0, 0, 0, 0, 0, 0
15da4: 00,00,00,00,00,f6,00,f6 table 0, 0, 0, 0, 0, 246, 0, 246
15dac: 00,fc,00,00,00,fe,00,f6 table 0, 252, 0, 0, 0, 254, 0, 246
15db4: 00,f6,00,f6,00,f6,00,f6 table 0, 246, 0, 246, 0, 246, 0, 246
0977e: 10,09 rombk 9
09780: ef,b0,96 call 92e33 SLU92E33_Y16SWTb ();
CONTINUED BELOW
#
#################################################################################
# Word Table Lookup with 4 Cell Interpolate. Signed and Unsigned Word Output.
#
# Byte size PVC column and PVR row values are multiplied by 16 on entry.
#
# PVC Process Value Column is Unsigned Byte or Word.
# PVR Process Value Row is Unsigned Byte or Word.
# Tb.CV Control Value is Signed when TblSflg is Set 1
#
# Input: R34 PVC Column to look up. = TMP1L (VS_U4_DELTA)
# Input: R36 PVR Row to look up. = TMP5L (VSBART_RT)
# Input: R38 Cq Quantity of Columns in Table (Table Width) = 8 AS PER LINE 09777 ABOVE
# Input: R3C Tb_Addr Table Address = swTb34EPPH (0x15d3c)
# Output: R3E Tb.CV Control Value (Lookup result Output Value) = TMP6L
##################################################################################
###### Entry Point for PVC & PVR Byte Input / Tb.CV Signed Word Output
# Call from L09780 Sub_0954e
SLU92E33_Y16SWTb:
92e33: f2 pushp push(PSW);
92e34: 91,80,96 orb R96,80 TblSflg = 1; # Signed Table B7 Set 1
92e37: 00 skip goto 92e39;
92e39: 11,35 clrb R35 TMP1H = 0; # yPVC^
92e3b: 09,04,34 shlw R34,4 TMP1L <<= 4; # wPVC * 16
92e3e: 11,37 clrb R37 TMP2H = 0; # yPVR^
92e40: 09,04,36 shlw R36,4 TMP2L <<= 4; # wPVR * 16
92e43: 20,06 sjmp 92e4b goto 92e4b;
92e4b: 5c,37,38,3e ml3b R3e,R38,R37 TMP6L = TMP3L * TMP2H; # wR3E = Cq * PVR^
92e4f: b0,34,3a ldb R3a,R34 TMP4L = TMP1L; # yR3A = yPVC
92e52: b0,36,3b ldb R3b,R36 TMP4H = TMP2L; # yR3B = yPVR
92e55: ac,35,34 ldzbw R34,R35 TMP1L = TMP1H; # wR34 = yPVC^
92e58: 64,34,3e ad2w R3e,R34 TMP6L += TMP1L; # wR3E = (Cq * PVR^) + PVC^
92e5b: 09,01,3e shlw R3e,1 TMP6L <<= 1; # wR3E = ((Cq * PVR^) + PVC^) * 2
92e5e: 64,3e,3c ad2w R3c,R3e Tb_Addr += TMP6L; # Tb_Addr = Tb_Addr + ((Cq * PVR^) + PVC^) * 2
92e61: a2,3d,34 ldw R34,[R3c++] TMP1L = [Tb_Addr]; # CV1 (Word Size)
92e64: a2,3c,36 ldw R36,[R3c] TMP2L = [Tb_Addr]; # CV2 (Word Size)
92e67: 28,25 scall 92e8e SLU92E8E_wTb.Interpolate (); # Pass 1
##################################################################################
# Word Table 4 Cell Interpolate. Signed and Unsigned Word Output.
#
##################################################################################
# SCall from L92E67 Pass 1; Lo Row, Lo & Hi Column values SLU92E4A_WUWTb SLU92E8E_wTb.Interpolate:
92e8e: ac,3a,3e ldzbw R3e,R3a TMP6L = TMP4L; # wR3E = yPVC Pass 1
92e91: 37,96,01 jnb B7,R96,92e95 if (TblSflg = 1) { # Jump FE if Interpolate Unsigned
92e94: fe,4c,36,3e,44 sml3w R44,R3e,R36 TMP9L = TMP6L * TMP2L; # lR44 = wPVC * wCV2 Pass 1
92e99: 37,96,01 jnb B7,R96,92e9d if (TblSflg = 1) { # Jump FE if Interpolate Unsigned
92e9c: fe,4c,34,3e,40 sml3w R40,R3e,R34 TMP7L = TMP6L * TMP1L; # lR40 = wPVC * wCV1 Pass 1
# JNB from L92E99 TblSflg = 0 SLU92E8E_wTb.Interpolate
92ea1: 68,40,44 sb2w R44,R40 TMP9L -= TMP7L; # wR44 = wR44 - wR40
92ea4: a8,42,46 sbbw R46,R42 TMP0L -= TMP8L - CY; # wR44^^ = wR44^^ - wR40^^ - cy
92ea7: c4,36,44 stb R44,R36 TMP2L = TMP9L; # yR36 = y(wR44 - wR40)
92eaa: 0c,08,44 shrdw R44,8 TMP9L >>= 8; # lR44 = (lR44 - lR40) / 256
92ead: 44,34,44,3e ad3w R3e,R44,R34 Tb.CV = TMP9L + TMP1L; # Tb.CV = w(l)R44 - CV1 Pass 1
92eb1: 37,96,03 jnb B7,R96,92eb7 if (TblSflg = 1) { # Is Interpolate Signed
92eb4: 3f,3f,05 jb B7,R3f,92ebc if (B7_TMP6H = 1) return; } # Is Tb.CV Negative
# Cont from L92EB4 Tb.CV Signed value positive SLU92E8E_wTb.Interpolate
# JNB from L92EB1 Tb.CV Unsigned value TblSflg = 0 SLU92E8E_wTb.Interpolate
92eb7: 37,36,02 jnb B7,R36,92ebc if (B7_TMP2L = 1) { # Is y(wR44 - wR40) < x80
92eba: 07,3e incw R3e Tb.CV++; } }
# JB from L92EB4 Tb.CV Signed value negativeB7_TMP6H = 1 SLU92E8E_wTb.Interpolate
# JNB from L92EB7 y(wR44 - wR40) < x80 B7_TMP2L = 0 SLU92E8E_wTb.Interpolate
92ebc: f0 ret return;
92e69: 09,01,38 shlw R38,1 TMP3L <<= 1; # Cq = Cq * 2 (Word Width)
92e6c: 64,38,3c ad2w R3c,R38 Tb_Addr += TMP3L; # Tb_Addr = Tb_Addr + Cq
92e6f: a2,3c,36 ldw R36,[R3c] TMP2L = [Tb_Addr]; # CV4 (Word Size)
92e72: 05,3c decw R3c Tb_Addr--; # Tb_Addr = Tb_Addr - 1
92e74: 05,3c decw R3c Tb_Addr--; # Tb_Addr = Tb_Addr - 1
92e76: a2,3c,34 ldw R34,[R3c] TMP1L = [Tb_Addr]; # CV3 (Word Size)
92e79: a0,3e,38 ldw R38,R3e TMP3L = TMP6L; # R38 = wCV1|2
92e7c: 28,10 scall 92e8e SLU92E8E_wTb.Interpolate (); # Pass 2
#
##################################################################################
# Word Table 4 Cell Interpolate. Signed and Unsigned Word Output.
#
##################################################################################
# SCall from L92E7C Pass 2; Hi Row, Lo & Hi Column values SLU92E4A_WUWTb
SLU92E8E_wTb.Interpolate:
92e8e: ac,3a,3e ldzbw R3e,R3a TMP6L = TMP4L;
# wR3E = yPVC Pass 2
92e91: 37,96,01 jnb B7,R96,92e95 if (TblSflg = 1) { # Jump FE if Interpolate Unsigned
92e94: fe,4c,36,3e,44 sml3w R44,R3e,R36 TMP9L = TMP6L * TMP2L;
# lR44 = wPVC * wCV4 Pass 2
# JNB from L92E91 TblSflg = 0 SLU92E8E_wTb.Interpolate
92e99: 37,96,01 jnb B7,R96,92e9d if (TblSflg = 1) { # Jump FE if Interpolate Unsigned
92e9c: fe,4c,34,3e,40 sml3w R40,R3e,R34 TMP7L = TMP6L * TMP1L;
# lR40 = wPVC * wCV3 Pass 2
# JNB from L92E99 TblSflg = 0 SLU92E8E_wTb.Interpolate
92ea1: 68,40,44 sb2w R44,R40 TMP9L -= TMP7L; # wR44 = wR44 - wR40
92ea4: a8,42,46 sbbw R46,R42 TMP0L -= TMP8L - CY; # wR44^^ = wR44^^ - wR40^^ - cy
92ea7: c4,36,44 stb R44,R36 TMP2L = TMP9L; # yR36 = y(wR44 - wR40)
92eaa: 0c,08,44 shrdw R44,8 TMP9L >>= 8; # lR44 = (lR44 - lR40) / 256
92ead: 44,34,44,3e ad3w R3e,R44,R34 Tb.CV = TMP9L + TMP1L;
# Tb.CV = w(l)R44 - CV3 Pass 2
92eb1: 37,96,03 jnb B7,R96,92eb7 if (TblSflg = 1) { # Is Interpolate Signed
92eb4: 3f,3f,05 jb B7,R3f,92ebc if (B7_TMP6H = 1) return; } # Is Tb.CV Negative
# Cont from L92EB4 Tb.CV Signed value positive SLU92E8E_wTb.Interpolate
# JNB from L92EB1 Tb.CV Unsigned value TblSflg = 0 SLU92E8E_wTb.Interpolate
92eb7: 37,36,02 jnb B7,R36,92ebc if (B7_TMP2L = 1) { # Is y(wR44 - wR40) < x80
92eba: 07,3e incw R3e Tb.CV++; } }
# JB from L92EB4 Tb.CV Signed value negativeB7_TMP6H = 1 SLU92E8E_wTb.Interpolate
# JNB from L92EB7 y(wR44 - wR40) < x80 B7_TMP2L = 0 SLU92E8E_wTb.Interpolate
92ebc: f0 ret return;
92e7e: a0,3e,36 ldw R36,R3e TMP2L = TMP6L; # R36 = wCV3|4
92e81: a0,38,34 ldw R34,R38 TMP1L = TMP3L; # R34 = wCV1|2
92e84: b0,3b,3a ldb R3a,R3b TMP4L = TMP4H; # R3A = yPVR
92e87: 28,05 scall 92e8e SLU92E8E_wTb.Interpolate (); # Pass 3
#
##################################################################################
# Word Table 4 Cell Interpolate. Signed and Unsigned Word Output.
#
##################################################################################
# SCall from L92E87 Pass 3; Interpolated Lo Row & Hi Row values SLU92E4A_WUWTb
SLU92E8E_wTb.Interpolate:
92e8e: ac,3a,3e ldzbw R3e,R3a TMP6L = TMP4L;
# wR3E = yPVR Pass 3
92e91: 37,96,01 jnb B7,R96,92e95 if (TblSflg = 1) { # Jump FE if Interpolate Unsigned
92e94: fe,4c,36,3e,44 sml3w R44,R3e,R36 TMP9L = TMP6L * TMP2L;
# lR44 = wPVR * wCV3|4 Pass 3
# JNB from L92E91 TblSflg = 0 SLU92E8E_wTb.Interpolate
92e99: 37,96,01 jnb B7,R96,92e9d if (TblSflg = 1) { # Jump FE if Interpolate Unsigned
92e9c: fe,4c,34,3e,40 sml3w R40,R3e,R34 TMP7L = TMP6L * TMP1L;
# lR40 = wPVR * wCV1|2 Pass 3
# JNB from L92E99 TblSflg = 0 SLU92E8E_wTb.Interpolate
92ea1: 68,40,44 sb2w R44,R40 TMP9L -= TMP7L; # wR44 = wR44 - wR40
92ea4: a8,42,46 sbbw R46,R42 TMP0L -= TMP8L - CY; # wR44^^ = wR44^^ - wR40^^ - cy
92ea7: c4,36,44 stb R44,R36 TMP2L = TMP9L; # yR36 = y(wR44 - wR40)
92eaa: 0c,08,44 shrdw R44,8 TMP9L >>= 8; # lR44 = (lR44 - lR40) / 256
92ead: 44,34,44,3e ad3w R3e,R44,R34 Tb.CV = TMP9L + TMP1L;
# Tb.CV = w(l)R44 - CV1|2 Pass 3
92eb1: 37,96,03 jnb B7,R96,92eb7 if (TblSflg = 1) { # Is Interpolate Signed
92eb4: 3f,3f,05 jb B7,R3f,92ebc if (B7_TMP6H = 1) return; } # Is Tb.CV Negative
# Cont from L92EB4 Tb.CV Signed value positive SLU92E8E_wTb.Interpolate
# JNB from L92EB1 Tb.CV Unsigned value TblSflg = 0 SLU92E8E_wTb.Interpolate
92eb7: 37,36,02 jnb B7,R36,92ebc if (B7_TMP2L = 1) { # Is y(wR44 - wR40) < x80
92eba: 07,3e incw R3e Tb.CV++; } }
# JB from L92EB4 Tb.CV Signed value negativeB7_TMP6H = 1 SLU92E8E_wTb.Interpolate
# JNB from L92EB7 y(wR44 - wR40) < x80 B7_TMP2L = 0 SLU92E8E_wTb.Interpolate
92ebc: f0 ret return;
92e89: 71,7f,96 an2b R96,7f TblSflg = 0; # Reset B7 Clear 0
92e8c: f3 popp PSW = pop();
92e8d: f0 ret return;
CONTINUED FROM ABOVE
09783: a0,3e,3c ldw R3c,R3e TMP5L = TMP6L; = (Lookup result Output Value)