Search found 19 matches

by Meterman58761
Mon Nov 08, 2021 7:57 pm
Forum: Programming
Topic: General question re: interrupts
Replies: 5
Views: 789

Re: General question re: interrupts

Thank you! It just amazes me the code I've been looking at even works with all the cruft and inefficient coding I've dug out so far.
by Meterman58761
Mon Nov 08, 2021 5:37 pm
Forum: Programming
Topic: General question re: interrupts
Replies: 5
Views: 789

General question re: interrupts

If the only interrupt I'm working with is driven by the NMI pin on the CPU, are any SEI / CLI instructions therefore meaningless?

Or are there internal IRQs within the processor that are not otherwise addressed by the user's code?
by Meterman58761
Mon Nov 08, 2021 5:34 pm
Forum: Programming
Topic: 16-bit Subtraction
Replies: 9
Views: 1497

Re: 16-bit Subtraction

I'm curious as to how your .receieveBits routine works.

I have some code I'm working on that also involves converting a serial stream into bytes:


lda piaPortA
ror A
rol presentSIByte
; piaPortA is port A on a MC6821 PIA
; roll bit 0 to carry, then into current byte being received

(test status ...
by Meterman58761
Sat Oct 16, 2021 12:55 am
Forum: Programming
Topic: Question on conditional branch
Replies: 18
Views: 2709

Re: Question on conditional branch

There we go. Looks like that was the last bit that needed cleaning.

Now that I got the last of the spaghetti picked out and the one 'test byte' ($B9) documented in regards to which conditionals are tripped by which values, I can focus on the interrupt section.

I guess from seeing CMP and BEQ / BNE ...
by Meterman58761
Fri Oct 15, 2021 5:32 am
Forum: Programming
Topic: Question on conditional branch
Replies: 18
Views: 2709

Re: Question on conditional branch

I guess I'm a bit confused on the proper use of AND in conjunction with BEQ / BNE versus in conjunction with CMP.

So, if I do the AND with 6, leaving 0, then the Z flag goes up, at which point BEQ kicks in, right?

Whereas my thinking of BEQ has centered on whether the remainder after being ANDed ...
by Meterman58761
Thu Oct 14, 2021 11:00 pm
Forum: Programming
Topic: Question on conditional branch
Replies: 18
Views: 2709

Re: Question on conditional branch

Barry: I grabbed the wrong bit of code before posting (it was a too-quick copy / clean / paste from the original 68xx code). I made a correction that should help.
by Meterman58761
Thu Oct 14, 2021 4:13 am
Forum: Programming
Topic: Question on conditional branch
Replies: 18
Views: 2709

Question on conditional branch

So, I've got the bit of code I've been working on mostly cleaned up and reorganized to flow more efficiently and logically, but there's still one bit that has me scratching my head.

Perhaps it's a bit of leftover cruft that was never tidied up (wouldn't be surprised, given the inefficient use of ...
by Meterman58761
Tue Aug 24, 2021 1:27 am
Forum: Programming
Topic: Odd / useless bit of code?
Replies: 8
Views: 3024

Re: Odd / useless bit of code?

cjs: $D8 / $D9 is a fixed offset with value $0083 that gets nudged up to $0084, then back.

This is just one of many bits of 'cruft' in the code... given certain aspects of the original unit's hardware design (it has a #$?!?!! hot chassis - even when the power switch is OFF) I'm not entirely ...
by Meterman58761
Sun Aug 22, 2021 8:12 am
Forum: Programming
Topic: Odd / useless bit of code?
Replies: 8
Views: 3024

Re: Odd / useless bit of code?

Still picking at the code to see how it works, particularly the interrupt code, and I wound up making a chart by RAM address to see which locations are read and written and where in the code they are called on.

I just now noticed that the TST $00CC conditional when called, drops down to another ...
by Meterman58761
Thu Jul 29, 2021 6:16 am
Forum: Programming
Topic: BIT instruction?
Replies: 13
Views: 6204

Re: BIT instruction?

As for using BIT to wait for one line to change state, that's actually not a bad idea. Will have to see if that would work better than the existing approach.

Anyway, coming back to the original part of my post, for the post-test relay check routine I did end up using BIT rather than LSR paired with ...
by Meterman58761
Sat Jul 24, 2021 5:44 pm
Forum: Programming
Topic: BIT instruction?
Replies: 13
Views: 6204

Re: BIT instruction?

This successive bit-shifting is done in several places in the code.

The most common use is to interpret the relay status nybble to determine whether the four relays opened or closed as directed, and to set the pass / fail conditions as appropriate.

It is also used within the main loop; at various ...
by Meterman58761
Sat Jul 24, 2021 3:15 pm
Forum: Programming
Topic: BIT instruction?
Replies: 13
Views: 6204

Re: BIT instruction?

Currently working in 6801 assembly, yes, so if / when this gets translated over to 6502, the B accumulator in this example would end up being substituted with the Y index.
by Meterman58761
Sat Jul 24, 2021 2:30 pm
Forum: Programming
Topic: BIT instruction?
Replies: 13
Views: 6204

Re: BIT instruction?

Here's a snippet showing what I mean about using the carry bit to evaluate a number and if I understand BIT based on what you guys say:


Relay status nybble: 0 = contacts closed, 1 = contacts open

Existing code:

LB_ECC0 LDA A $C3 // fetch status nybble
LSR A // shift Relay A bit into carry
BCS ...
by Meterman58761
Sat Jul 24, 2021 4:59 am
Forum: Programming
Topic: BIT instruction?
Replies: 13
Views: 6204

BIT instruction?

So, I've never really been clear on the BIT instruction, as I so seldom encountered this opcode when poking around in assembly language back in my C64 days.

Are there any real-world code examples that would illustrate how this works?

I have at hand some code that could stand a slight rewrite, and ...
by Meterman58761
Sun Jun 20, 2021 1:17 pm
Forum: Programming
Topic: Odd / useless bit of code?
Replies: 8
Views: 3024

Re: Odd / useless bit of code?

Long story short, the code pertaining to $D8 can pretty much go at this point, but the TST $CC stays.

I have found a fair number of 'make it work' kludges and programming inconsistencies so far, and $D8 and $DE go into this pile as well. $D8 looks to be an offset that apparently allowed the main ...