0

Tracing the Spaghetti. Simple coding question.

I came across my an old proceedure that my company paid to have written for us some ten years ago that was never used because it was written for standards we don't have or don't use. Money well spent! That aside, I am trying to interpret the original author's scripting and while I hesitate to criticize as I can tell they have had more formal training than me (more than absolutely nothing) this coding seems... horifically overwrought and needlessly complicated. I've reversed engineered most of it but wanted to run a couple things by y'all.

1) This author is putting an inter-byte delay in front of every IEEE statement. Is that nessesary? Can't it be consolidated or globally set for all IEEE statements?

  2.023  IEEE         [S 9]RC[D2999]
  2.024  IEEE         [S 9]H0[D99]
  2.025  IEEE         [S 9]OFD0[D99]
  2.026  IEEE         [S 9]WR4[D99]
  2.027  IEEE         [S 9]SI1[D999]
  2.028  IEEE         [S 9]OF1,1[D99]
  2.029  IEEE         [S 9]DA1[D99]
  2.030  IEEE         [S 9]DB1[D99]
  2.031  IEEE         [S 9]DC1[D99]
  2.032  IEEE         [S 9]EA1[D99]
  2.032  IEEE         [S 9]EB1[D99]
  2.032  IEEE         [S 9]EC1[D99]
  2.033  IEEE         [S 9]MV0,0[D99]
  2.034  IEEE         [S 9]AV0,0[D1999]
  2.035  IEEE         [S 9]OFD1[D99]
 
2) There is a conditional structuring I have never seen before that intrigues me quite a lot. 
  2.014  JMPL         skip_2_channel_a       M[2]==2==0
Does this M[2]==2==0 act as an OR IF? Like, is this saying if M[2] equals 2 or 0 to JMPL? Or does it mean something else?
 
3) What is going on here? If I am reading this correctly, after the proceedure has run, the operator has wait a whole 40 seconds before the proceedure ends while being beeped at? Why would you do this?
 
 29.002  LABEL        verification_complete
 29.003  RSLT         =
 29.004  HEAD         [7]{V e r i f i c a t i o n   C o m p l e t e} ![D999]
 29.005  HEAD         [D499]
 29.006  HEAD         [7]V e r i f i c a t i o n   C o m p l e t e ![D999]
 29.007  HEAD         [D499]
 29.008  HEAD         [7]V e r i f i c a t i o n   C o m p l e t e ![D999]
 29.009  END

 

8 comments

Date Votes
0
Avatar
Dexter
Blast, it messed up the formatting again. Here's the questions again: 1) This author is putting an inter-byte delay in front of every IEEE statement. Is that nessesary? Can't it be consolidated or globally set for all IEEE statements? 2.023 IEEE [S 9]RC[D2999] 2.024 IEEE [S 9]H0[D99] 2.025 IEEE [S 9]OFD0[D99] 2.026 IEEE [S 9]WR4[D99] 2.027 IEEE [S 9]SI1[D999] 2.028 IEEE [S 9]OF1,1[D99] 2.029 IEEE [S 9]DA1[D99] 2.030 IEEE [S 9]DB1[D99] 2.031 IEEE [S 9]DC1[D99] 2.032 IEEE [S 9]EA1[D99] 2.032 IEEE [S 9]EB1[D99] 2.032 IEEE [S 9]EC1[D99] 2.033 IEEE [S 9]MV0,0[D99] 2.034 IEEE [S 9]AV0,0[D1999] 2.035 IEEE [S 9]OFD1[D99] 2) There is a conditional structuring I have never seen before that intrigues me quite a lot. 2.014 JMPL skip_2_channel_a M[2]==2==0 Does this M[2]==2==0 act as an OR IF? Like, is this saying if M[2] equals 2 or 0 to JMPL? Or does it mean something else? 3) What is going on here? If I am reading this correctly, after the proceedure has run, the operator has wait a whole 40 seconds before the proceedure ends while being beeped at? Why would you do this? 29.002 LABEL verification_complete 29.003 RSLT = 29.004 HEAD [7]{V e r i f i c a t i o n C o m p l e t e} ![D999] 29.005 HEAD [D499] 29.006 HEAD [7]V e r i f i c a t i o n C o m p l e t e ![D999] 29.007 HEAD [D499] 29.008 HEAD [7]V e r i f i c a t i o n C o m p l e t e ![D999] 29.009 END
0
Avatar
Michael J.

Hey Dexter, for 2, that formula would basically be a true/false test for M[2] being 2. If M[2] is 2, then the result is true, or 1, so the jump does not occur. If M[2] is not 2, then the result of the first half is false, or 0, so the jump occurs. It's admittedly a strange way to code that.

For 3, after each HEAD statement is a 1 second delay, and between each of them is a half a second delay (the [D###] coding is in milliseconds). So this is a 4 second process with 3 beeps.

0
Avatar
Dexter

@3 Oh right, milliseconds. Sorry. My mind was seeing that differently. I was seeing a full five and ten seconds. Makes more sense now. 

0
Avatar
Dexter

@2 So, is that basically a way of saying "does not equal?" So the JMPL statement occurs if m[2] does not equal 2?

0
Avatar
Michael J.

Exactly.

0
Avatar
Dexter

Ok, I know you can't see the proceedure but I think you are kind of getting the idea of why I think this proceedure is over-wrought. There are so many JMPL statments that... ok, I don't know why there are so many JMPL statements. Even when calling a sub-proceedure, a variable is set to tell the sub-proceedure which JMPL statement within itself to use. I mean, I know instances where this can be useful as I have done it before but in this case, it's not to try to reduce the amount of coding, the number of evaluations statements or, the number of sub-proceedures to deal with because there are two more identical sub-proceedures (and I mean identical in every way, just straight copy-paste) for the other channels so if a test point has to be changed, it needs to be changed three times and... This is all just a mess. I don't get it.

0
Avatar
Dexter

asdfasdfasdfawert THESE UNITS SUPPORT IEEE 488.2!!! Why was it written so using that code?? Why would you ever use IEEE 488.1 when dot two is an option?! Going to have to rewrite this whole blasted... 

 

Thanks, as always, for the help you provide. It is always appreciated. 

0
Avatar
Michael Schwartz

Dextor,

You are looking at some OLDER Intercal code.  I use to be their lead developer before I left and Started Cal Lab Solutions.  The "does not equal" is one of my inventions that was before != was ever added.  Also "MATH MEM=MEM" before jump labels that was used to hold line numbers. 

The coolest one I ever did what checking if a bit was high in a integer.  The one took me about 4 days to write in just one line of code. 

I am not sure what procedure you are looking at, But I will tell you, there are some pretty complex and cool things going on in some of them.  A few actually have a job offer in them.

 

Mike

Please sign in to leave a comment.