Thread: Anyone familiar with 68xx assembly AND C?

  1. #16
    Registered User
    Join Date
    Apr 2021
    Posts
    29
    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.

  2. #17
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,106
    Quote Originally Posted by etech58761 View Post
    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

  3. #18
    Registered User
    Join Date
    May 2010
    Posts
    4,633
    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.

  4. #19
    Registered User
    Join Date
    Apr 2021
    Posts
    29
    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.

  5. #20
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > 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.

  6. #21
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,106
    Quote Originally Posted by etech58761 View Post
    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.
    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".

  7. #22
    Registered User
    Join Date
    Apr 2021
    Posts
    29
    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.

  8. #23
    Registered User
    Join Date
    May 2010
    Posts
    4,633
    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.
    Well both of these chips can probably be replaced with a simple micro-controller.

    As far as a fresh rewrite goes, my plan of attack is to get code for a 4x4 matrix keyboard written
    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.

    followed by code to drive an I2C LCD,
    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.

    then a proper delay routine
    Again there are simple micro-controllers that have built in timing, interrupt modes, and timer subsystems that make delay routines quite simple.

    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.

  9. #24
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    >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:
    Code:
    void Apple(int *banana)
    {
        if(banana == NULL)
        {
            return;
        }
    
        ....
    }
    Or
    Code:
    int Apple(int *banana)
    {
        if(banana == NULL)
        {
            return 0;
        }
    
        ....
    }

  10. #25
    Registered User
    Join Date
    Apr 2021
    Posts
    29
    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.

  11. #26
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    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.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  12. #27
    Registered User
    Join Date
    Apr 2021
    Posts
    29
    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.

  13. #28
    Registered User
    Join Date
    Apr 2021
    Posts
    138
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Anyone familiar with Qt?
    By Al3 in forum C++ Programming
    Replies: 4
    Last Post: 03-04-2015, 10:34 AM
  2. Need someone familiar with DLLs
    By Kurisu33 in forum Windows Programming
    Replies: 9
    Last Post: 09-14-2006, 02:01 AM
  3. Anyone here familiar with FIRST?
    By KingDubya in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 12-02-2005, 02:37 PM
  4. Familiar with AnsiString??
    By tegwin in forum C++ Programming
    Replies: 3
    Last Post: 02-28-2002, 01:20 PM
  5. Anybody Familiar with A.L.I.C.E. bot?
    By blackwyvern in forum C++ Programming
    Replies: 6
    Last Post: 01-23-2002, 10:53 PM

Tags for this Thread