Good deal! I'll be back when I'm ready to start coding for real. Will get a "C++ for Dummies" or other similar entry-level treatise in the meantime.
Really appreciate everyone's patience with my newbie questions.
Good deal! I'll be back when I'm ready to start coding for real. Will get a "C++ for Dummies" or other similar entry-level treatise in the meantime.
Really appreciate everyone's patience with my newbie questions.
Instead of "C++ for Dummies", you really need to study a good book on the C Programming Language, cover to cover, and do all the exercises at the end of each chapter! Choose one of the three listed below:
C Programming, A Modern Approach
Author: K. N. King
C Primer Plus, 6th Edition
Stephen Prata
C How to Program, 8/e
Deitel & Deitel
If your microprocessor is no longer obtainable you will probably need to update the rest of the chips you mentioned. Depending on the purpose of that embedded system it may be easier to go with either an embedded/industrial PC or a more current micro-controller that has most of the functionality built into the chip.
Just dropping in for a bit... picked up a C++ book a few hours ago (I didn't see the recommendations until too late; wound up with C++ all in one for Dummies) and now have the CodeBlocks compiler installed on my Mac.
Figured out another bit of the overall design... and jimblumberg, you may be correct on my need to find updated ICs after all - the MC6821 is no problem (W65C21), but I find the MC6840 generates both the output carrier timing AND the ~NMI signal for the CPU.
Even as I prepare to delve into the basics of C++, there's one bit of code (7 instances of it, actually) that bugs me a bit, even though I won't be ready to get to that portion for a while yet.
Within several subroutines, there's a conditional test that, when met, leads to a graceful exit from the subroutine back to where it had been called from.
If the conditional falls through (in other words, the 'else' case), there are instructions to discard the subroutine address from the stack and then jump to a completely different part of the program.
Is there a similar way to do this in C or am I thinking that it might just be better to move that conditional OUT of the subroutine completely and put it just after the call?
As far as a fresh rewrite goes, my plan of attack is to get code for a 4x4 matrix keyboard written (or if available out there, adapted for my needs), followed by code to drive an I2C LCD, then a proper delay routine - all three items figure prominently in the code, so I see those parts as a priority.
> If the conditional falls through (in other words, the 'else' case), there are instructions to discard the subroutine address from the stack
> and then jump to a completely different part of the program.
If all else fails, you have setjmp() and longjmp() to do this.
But mostly you should be able to do this using the normal function call / return status approach.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
You have made the same mistake that many beginners make, Code::Blocks is an IDE, NOT a compiler. Please read the entire Code::Blocks FAQ, especially the second link under "General".
The instructions in the C++ book for fetching and installing CodeBlocks DID include instructions for fetching and installing gcc as well, which I just now confirmed was present.
Well both of these chips can probably be replaced with a simple micro-controller.Figured out another bit of the overall design... and jimblumberg, you may be correct on my need to find updated ICs after all - the MC6821 is no problem (W65C21), but I find the MC6840 generates both the output carrier timing AND the ~NMI signal for the CPU.
Decoding a 4x4 matrix keyboard is also fairly easy to decode with a simple micro-controller. IMO, it's trickier to properly wire the matrix than decode it.As far as a fresh rewrite goes, my plan of attack is to get code for a 4x4 matrix keyboard written
Again there are many many simple micro-controllers that have an I2C interface capable of driving a simple LCD. What kind of LCD will you be trying to use? Does it use any kind of graphics or is it a simple single/multiple line display, like a 1 x 16, 2 x 20, etc.followed by code to drive an I2C LCD,
Again there are simple micro-controllers that have built in timing, interrupt modes, and timer subsystems that make delay routines quite simple.then a proper delay routine
You also need to realize that the hardware you have is all geared to that outdated micro-controller. The 6800 series of controllers were fairly primitive without much of anything available internally. Almost all the functionality is contained in separate chips.
If you go for a complete redesign of the hardware you may be able to reduce the chip count significantly with the side benefit of added simplicity in both chip count and software.
>Within several subroutines, there's a conditional test that, when met, leads to a graceful exit from the subroutine back to where it had been called from.
That sounds normal - Did you mean something like this:
OrCode:void Apple(int *banana) { if(banana == NULL) { return; } .... }
Code:int Apple(int *banana) { if(banana == NULL) { return 0; } .... }
Tossing in the towel for now.
I got CodeBlocks and gcc installed, but even though I followed the instructions and installed the latest available for Mac (17.12; they don't have resources to commit to get 20.03 released for macOS), I still wind up with a bunch of 'Manager failed to load XRC resource...' errors, and several sections of the GUI are missing buttons or are simply blank. Worse, even though I clearly see gcc in /usr/bin/, and Terminal displays what is expected when gcc is invoked (version info etc.) CodeBlocks doesn't recognize it.
My next step, of course, would be the CodeBlocks forums, but I only get a 'database error' when clicking any link on that site, while I can see the site perfectly through a proxy.
One setback after another (on the hardware side as well with my previous design), and I've run out of enthusiasm. Maybe later. Sorry for the waste of time.
You don't have to use Code Blocks if you're having trouble getting ot installed; just use something else of your choice that's updated and works with gcc or whatever compiler you choose.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
laserlight: I found an online c++ debugger, have already taken a few functions through it and got them to the "it'll compile" stage, so I have a tentative start. Will post snippets hopefully soon to make sure i'm doing it right.
etech,
Have you considered posting your assembly and C translations on github or gitlab or some other place? Seeing the whole thing laid out could be helpful, and this is kind of a fun problem.