The problem is NEVER with MY code, because I a coding genius
Tony B.
Posts: 356
I have just spent the last 2 1/2 hours trying to get a new little project working and like so many times before I was sure it was my Demo board or bad wiring NOT MY code. I then spent about twenty minutes writing and inserting code into a forum post. Hit preview and was reading though it and I noticed I forgot this line of code, "dira[18] := 1". Man I hate when I do that. Anyone else find themselves thinking they set among the coding gods only to be reminded you are just human and you are not the perfect coder you thought you were? I wish I had back all the time I've lost over the years because I was so sure of myself, code and too proud to look through it with a critical eye. I'm sure I would be at least 100 projects further down the line.
By the way it works fine now.
Tony
PS I know there is a spelling error in the title. Did you notice it?
By the way it works fine now.
Tony
PS I know there is a spelling error in the title. Did you notice it?
Comments
I'm just a coding species.
I've found many errors as I've tried to tiddy up code to post to the forum. I try to remove all the code exept the code I think is causing the problem. I've found once I have the problem code stripped to it fundamentals the error is much easier to find.
Just went through a very similar experience linking a graphics draw COG to a TV signal COG. Image was not complete, draw sequence was not quite right. Of course, I thought, "It can't be the VBLANK flags", because those are easy. Just drop them in at the right place, and go from there.
The following day, I saw I reversed the order of those flags. Change one PASM instruction and it displays perfectly, despite all the code I wrote to "refine" the drawing loop. Most of that code was a good thing, but not necessary. Gotta hate it when that happens. It took perhaps 3 minutes to see this, once I got everything setup, program file loaded, F10 sending it to the Prop. The wrong order instructions were on the screen from the night before, right there in front of me. Saw the poor draw order and thought, "Wonder if it's the VBLANK?", and it was!
Couple of hours just cooked over ONE instruction.
The "#" sign missing off of something is another trouble spot. I don't always see the things (Octothorpes), glossing over them, "Because it's just a JMP."
I like making that mistake as well. It normally happens to me when I write an object and decide I need to launch a method into it's own cog for a while. Of course the start method for the object does the initialization which includes setting the direction of the ports and then does the "cognew"! You would think that after all the hours I've spent on it that I would have learned my lesson.
Not because I'm some kind of super genius....I'm not bragging.
I have mild OCD and errors of any sort drive me up the wall.
So I painstakingly pore over everything a zillion times and test
my code exhaustively. My code is good.. but I am very tired..LoL :-)
Obsessive Coding Disorder?
LoL! That's good.... and in my case correct :-)
Not that I have been getting much chance lately to do any coding.
This is the first day in many weeks that I have had time to even think
of browsing the web, let alone write some code.
And I only have till about noon today free... so I must stop reading the forum
and start answering my backlog of emails. It's fun to come in and see what everyone
here has been posting about the last two months or so.... I want to comment on
so many threads but I will not have the time to do so :-(
Thanks for popping in - be safe.
I just got called to be at a conference at 1045
Now I don't even have till noon :-(
I need a vacation.
-Phil
For this reason, as others have said, it often pays to take a break or work on something else or get drunk. Long enough that you forget how correct it must be. When you get back the error hits you in the face.
Peer review is a good idea. As used extensively on critical projects in medical, avionic, military etc software. And the reason "extreme programming" has become popular. And places like this forum of course.
Tony
P.S. Holly I sure hope you get that vacation soon!
Or, "Programming is imperfect people trying to instruct machines in a perfect way."
Or, "The only people who do not make mistakes are in the graveyard!"
My coding problem is tunnel vision. Given Bug #102, I will correct Bug #102 as described, but never check variations. E.g., a bug is reported and the alpha keypad was used. I fix it. Do I see if it shows up on the GUI keypad? NO-O-O! Of course not!
(I guess it means I am still alive! )
--Rich
*Except one missing comma in 2000 lines of code! :swear:
Jim...
https://www.xkcd.com/323/
Of course you bought a lottery ticket that day? ;-)
Not only do I remember that day, I remember the code!
That was on either my TS-1000 or CoCo2. Both were pre-lowercase!
--Rich
:thumb:
That and never being able to remember how I adbrivated that variable name to the point I give up and just accept it will never, ever, compile the first time.
HA! Wow, that's wrong man. I'll have to remember to use that line.
I remember the program I wrote... was a kind of screen saver written in Quick Basic to bounce 100 balls, circle(x,y),10,1 around on the screen in random directions at random locations. It was written from scratch. I dunno if it's a good thing that I remember that, but I do.
It was in CGA on a 4.77Mhz XT or a 16?Mhz 286 if that tells you anything
I started programming in assembly a few months after learning QB. I thought I was really something..... squeeze every last bit of speed out of that old processor. The first disk access program I made wrote a test file to my old 10Mb MFM hard disk. I went something like this:
MASM disktest.asm
- Compiled with no errors
disktest.exe
<beep>
DIR C:\
-system not found, please insert command.com in drive A:
OH #*&^$!! NOOO!
Ugh! That almost never works!
In fact, after typing in a lengthy block of PASM, the first thing I do is a "Find" for JMP, DJNZ, TJZ, and TJNZ to check them all for the "#" symbol.
-Phil
I wound up writing an AWK program to catch killers like that if(); I also use a macro
#define donothing ;
to alert everyone that I really and truly want to do nothing.
As to variable names, I'm trying to maintain code that has doozies like ENEXCT and ENEXCNT. Then there's always the question of whether or not an underscore is used. And curses upon he who thought putting pages of ASM statements into a C function was cute! Of course, the asmr allows both @^Varble and _Varble to refer to the same variable! Arrrgh!!!!
(Running off, whimpering)
--Rich