Search found 277 matches

by Dan Moos
Sat Mar 15, 2025 4:46 pm
Forum: General Discussions
Topic: 65c22 handshakinng
Replies: 1
Views: 2229

65c22 handshakinng

EDIT: I may have been misinterpreting which edge was witch on the scope. Basically, it looks like it works exactly as the timing diagram says it should.

So the timing diagram on the datasheet shows that, with read handshaking, the CA2 signal on the 65c22 is active low (like CA1).

It seems to be ...
by Dan Moos
Sun Oct 01, 2023 2:09 am
Forum: Programming
Topic: Signed addittion/subtraction beyond 8 bits
Replies: 16
Views: 11182

Re: Signed addittion/subtraction beyond 8 bits

I've read the articles. While I'm sure the information is there, some things aren't clear to me. Sounds like it is indeed a 2s complement misunderstanding.

Let me ask this. As soon as I need to represent a number larger than 127, or smaller than -128, do I need to stop using "7 bit + sign bit" and ...
by Dan Moos
Sat Sep 30, 2023 10:19 pm
Forum: Programming
Topic: Signed addittion/subtraction beyond 8 bits
Replies: 16
Views: 11182

Re: Signed addittion/subtraction beyond 8 bits

Let me do a worked example so you can tell me if bi have this correctwhat I want is:

127 -> 01111111 + 1->00000001 =
00000001 00000000

But the answer ADC will give me is 10000000, and the V flag will be set. Thus, it is up to me to interpret the V, C, and N flags after every addition/subtraction ...
by Dan Moos
Sat Sep 30, 2023 8:47 pm
Forum: Programming
Topic: Signed addittion/subtraction beyond 8 bits
Replies: 16
Views: 11182

Signed addittion/subtraction beyond 8 bits

Is there a good tutorial explaining how to do 2s compliment arithmetic on the 6502 when more than a single byte is needed?

Edit: for instance, how do I do 127+1 ?
by Dan Moos
Fri Sep 01, 2023 2:22 am
Forum: General Discussions
Topic: Check my understanding of page crossing w/indexed addressing
Replies: 4
Views: 3368

Re: Check my understanding of page crossing w/indexed addres

Here's the actual code I've come up with:

//LDA Absolute, X. 3 bytes 4 cycles (+1 if page cross)
if (Address_Mode == ABSOLUTE_X) {
uint8_t MSB, LSB, LSB_Temp;
cycle(1);
LSB_Temp = DataBus ;
LSB = DataBus + X;
cycle(1);
MSB = DataBus;
if (LSB < LSB_Temp) { //add cycle if page crossed
MSB ...
by Dan Moos
Thu Aug 31, 2023 1:22 am
Forum: General Discussions
Topic: Check my understanding of page crossing w/indexed addressing
Replies: 4
Views: 3368

Check my understanding of page crossing w/indexed addressing

Working on my emulator. I'm trying to make my instructions require the correct amount of cycles. Tell me if the following is correct.


Let's say the instruction is LDA, Absolute X addressing.

After I ingest the LSB of the address, I just check if (LSB + X) > 0xff, and if it is, I add a cycle ...
by Dan Moos
Wed Aug 30, 2023 3:34 am
Forum: General Discussions
Topic: Does the address bus always reflect the value of the PC?
Replies: 19
Views: 9614

Re: Does the address bus always reflect the value of the PC?

Can't help myself :)

What would you consider the difference between an emulator and a sim BDD?

My plan is that I can run unaltered code meant for my real hardware, and have it not be any different on my software. I am not certain how deep the simulation/emulation will go. At the moment, it's ...
by Dan Moos
Mon Aug 28, 2023 2:36 am
Forum: General Discussions
Topic: Does the address bus always reflect the value of the PC?
Replies: 19
Views: 9614

Re: Does the address bus always reflect the value of the PC?

wait...it just dawned on me. I feel dumb now...
by Dan Moos
Mon Aug 28, 2023 2:35 am
Forum: General Discussions
Topic: Does the address bus always reflect the value of the PC?
Replies: 19
Views: 9614

Re: Does the address bus always reflect the value of the PC?

EDIT: don't listen to me, I just realized my silly mistake
by Dan Moos
Mon Aug 28, 2023 2:04 am
Forum: General Discussions
Topic: Does the address bus always reflect the value of the PC?
Replies: 19
Views: 9614

Does the address bus always reflect the value of the PC?

I'm writing a 6502 emulator for debugging purposes.

I'm curious. Can I treat the program counter and the address bus as basically the same thing? I'm not emulating the inner workings of the cpu. I just want the emulator to to run my real world code, so although I'm sure in the span of a cycle ...
by Dan Moos
Sat Aug 12, 2023 5:41 pm
Forum: Programming
Topic: Looking for some "best practices" advice for 6502 assmbly
Replies: 20
Views: 13943

Re: Looking for some "best practices" advice for 6502 assmbl

I imagine I could use the stack to deal with nested loops sharing variables, but then I would have to add that stack management to any routine that uses loops. Perhaps not a big deal?
by Dan Moos
Sat Aug 12, 2023 5:18 pm
Forum: Programming
Topic: Looking for some "best practices" advice for 6502 assmbly
Replies: 20
Views: 13943

Looking for some "best practices" advice for 6502 assmbly

I learned 6502 assembly "on the fly" whilst creating the monitor/OS for my home-brew. Over 1000 lines of code later, one can likely see that I was at various stages of understanding as I wrote the code over many months. I have working code, but it's almost certainly messy by competent standards.

My ...
by Dan Moos
Thu Aug 10, 2023 2:42 am
Forum: General Discussions
Topic: 6522 handshaking questions
Replies: 16
Views: 9709

Re: 6522 handshaking questions

SOLVED!

Its solved, but I'm surprised at what was happening. Consider the following psudo-code:

SET CA1 = low to indicate DATA READY //this also sets CAS2 HIGH, as per the datasheet
while (CA2 == HIGH) {} //wait for CA2 to trigger LOW
SET CA1 = HIGH // reset CA1


what I saw on the scope was ...
by Dan Moos
Sat Aug 05, 2023 10:56 pm
Forum: General Discussions
Topic: 6522 handshaking questions
Replies: 16
Views: 9709

Re: 6522 handshaking questions

Thanks. I usually start a new one because I worry that my new question will get lost in the shuffle if I don't make it a topic. I'll stop doing that :)