Thread: Interrupt code

  1. #1
    Registered User
    Join Date
    Apr 2021
    Posts
    29

    Interrupt code

    I previously posted some questions about porting some 6801 assembly over to C++...

    I found a solution that may allow me to use the original code mostly as-is (but not without some rewrites for consistency and clarity - there were a lot of ugly kludges throughout the code!).

    Anyway, I realized that the process of translating the assembly code to C++ helped me understand the code, and on a few occasions I have spotted ways I could go back and rewrite / optimize the original assembly code.

    But to make any REAL progress, I need to master the interrupt routine.

    What I have so far in regards to translating the code is attached, and those remaining original opcodes that I do not yet know how to rewrite are commented out and marked with &&.

    One of the biggest stumbling blocks to getting my mind around this routine is that it contains an EXTENSIVE amount of math.

    I don't have much hope that others may even begin to understand the code (although I did run it through a checker to confirm it is syntactically valid C++), but I have to give it a try.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Apr 2021
    Posts
    29
    Here's my attempt at rewriting it into C++.

    Critique welcomed.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    May 2012
    Location
    Arizona, USA
    Posts
    948
    I noticed you have a lot of lines like this:

    Code:
    	if ((BCHchk && 64) != 0)
    What was the original assembly instruction for that statement? A bitwise "and" (&) would make a lot more sense to me than a logical "and" (&&).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trying to get the 1 second interrupt into my code. Help!
    By runhard33 in forum C Programming
    Replies: 1
    Last Post: 04-07-2014, 11:27 AM
  2. Code for hcs12 towerw/ lcd and interrupt question???
    By runhard33 in forum C Programming
    Replies: 5
    Last Post: 11-10-2013, 12:27 PM
  3. ASM interrupt and others
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 06-08-2002, 07:18 PM
  4. interrupt
    By juandy in forum C++ Programming
    Replies: 4
    Last Post: 05-21-2002, 08:24 AM
  5. Interrupt???
    By GiSH in forum C++ Programming
    Replies: 1
    Last Post: 11-15-2001, 12:27 PM

Tags for this Thread