PASM headscratcher with user defined counter
So I am modifying my E1.31 receiver code in the W6100 driver to add counters for received packets and discards. I have a real head scratcher with what is happening here. This section of code is where the E1.31 configuration structure is scanned for a matching universe. This structure is located in the LUT. When a value of zero is pulled from the LUT, that indicates that the entire structure was scanned and no matching E1.31 universe was found. That functions correctly. However, when the conditional ADD occurs, I would have expected the value of lE131Discards to start incrementing starting from the initial 0, but it increments to a very large number. At most it should increment by 25 every one second in my test scenario. Am I doing something stupid here and not realizing it?
e131lutenum RDLUT tE131ENUM, E131ENUM wz ' Read the E1.31 Universe in the config if_z ADD lE131Discards, 1 ' Increment E131 discard counter debug(uhex(lE131Discards)) if_z jmp #lskipit ' End of the config. Skip decoding this packet. CMP tE131ENUM, tE131ADDR wz ' Compare the received E1.31 Universe with the one in the config. if_nz ADD E131ENUM, #4 ' Increment to the next E1.31 Universe in the config if_nz jmp #e131lutenum ' Go fish again to find a match ADD E131ENUM, #1 RDLUT tpixlen,E131ENUM ADD E131ENUM, #1 RDLUT lrxptr, E131ENUM REP #1, #3 ADD pixlen, tpixlen
PS: Tried with both ADD lE131Discards, 1 and ADD lE131Discards, #1