bslathi19
  • Joined on 2025-11-07
bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-30 20:50:27 -07:00
32 Bit address support

Ah we need to use the alu_sr sel to store dimux into the shift register, so that we can use the alu to decrement the stack pointer

bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-29 09:55:33 -07:00
32 Bit address support

when the original cpu pushes the address to the stack, it has already incremented PC once, so if the addresss start at 0x200

JSR LSB MSB, the PC is pointing at MSB when we start writing. This…

bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-29 09:39:54 -07:00
32 Bit address support

we cannot use the ALU to decrease the stack pointer while also using the ALU registers to store the temporary address. What we could do is modify the shift register to take in data from DIMUX…

bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-28 23:12:25 -07:00
32 Bit address support

RTS follows a very similar pattern to JSR, except instead of pushing from the stack we read from the stack. This should be a little bit easier too.

bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-28 23:10:32 -07:00
32 Bit address support

In terms of cycle count, we have added 4 cycles making JSR/RTS take 10 cycles. This is almost double the length, but hey performance was not a goal.

bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-28 22:59:18 -07:00
32 Bit address support

What the 6502 does is use the stack pointer as temporary storage for the LSB of the jump target. We need to store 3 bytes instead of 1 though. We use the ALU to decrement the stack pointer while…

bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-28 22:23:12 -07:00
32 Bit address support

basically we just need 2 more jsr0/jsr1 states, easy as.

bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-28 22:18:31 -07:00
32 Bit address support

thats gonna be boring. One thing that we definitely need to test is JSR, RTS, BRK, and RTI. These involve pushing and popping more bytes to/from the stack.

bslathi19 pushed to 32bit at bslathi19/verilog6502 2026-04-28 22:17:48 -07:00
2338d4c720 Add some more tests
bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-28 21:45:52 -07:00
32 Bit address support

I think we should have tests for every instruction which has those addressing modes. Also, we need to handle the extra cycles if there is a page crossing. Lets start at the top width ADC

bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-27 23:06:25 -07:00
32 Bit address support

Done in 2a9af9e9dcfcde47be772f659a0a8b91d71ee282

We've added all addressing modes, but not all instructions will be functional. For example, the absolute and absolute,x addressing modes are…

bslathi19 pushed to 32bit at bslathi19/verilog6502 2026-04-27 23:00:52 -07:00
2a9af9e9dc Add indirect indexed
bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-27 22:34:55 -07:00
32 Bit address support

ok it still uses the ALU to increment the ZP pointer, so we can use the same extra adder that we added for the other ZP state.

bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-27 22:03:55 -07:00
32 Bit address support

Last one is indexed indirect, which should be easier since we don't have to add to a 32 bit number, only an 8 bit number.

bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-27 22:03:05 -07:00
32 Bit address support

dfe27d4ec783cbc8e3f03a18853f24042a6a0c89

What I ended up doing was adding another signal which could increment the address bus register. This does mean that there are two 32 bit adders, one for…

bslathi19 pushed to 32bit at bslathi19/verilog6502 2026-04-27 21:59:36 -07:00
dfe27d4ec7 Add indexed indirect
bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-27 20:53:29 -07:00
32 Bit address support

So we need to load 4 bytes from zeropage, which means we need to calculate 4 new addresses, but at the same time we also need to add the Y register to what we are reading. We might need to add…

bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-27 07:08:01 -07:00
32 Bit address support

Hmm that plan would not work because we need the ALU to be adding the offset, whereas this instruction also uses the ALU to generate the address.

bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-26 22:33:55 -07:00
32 Bit address support

Lets do Indirect Indexed, since it is apparently the most common indirection mode. according to the state listing, here are the steps that we do https://git.byronlathi.com/bslathi19/verilog6502/s…

bslathi19 commented on issue bslathi19/verilog6502#1 2026-04-26 22:17:33 -07:00
32 Bit address support

Added in b31d7490b2d318d742cdd20a44003655cc565613