Search found 25 matches

by VBR
Wed Dec 02, 2009 7:22 pm
Forum: General Discussions
Topic: A GCC backend for the 6502?
Replies: 26
Views: 14520

So I hacked on cc65 instead, making some large, obvious improvements. (Note: the maintainer of cc65 did not accept them).

Can you elaborate on what they did and why they were not accepted?


* Static parameter passing (enabled with --static-params): uses fixed memory locations for parameter ...
by VBR
Wed Dec 02, 2009 4:11 pm
Forum: General Discussions
Topic: A GCC backend for the 6502?
Replies: 26
Views: 14520

A straightforward approach would be to treat the 6502 like a 16-bit RISC with a large, uniform register file, implemented as zero page memory. This allows a standard register allocator to be used. Ideally, the register allocation would be global (i.e. whole program) to make best use of the ...
by VBR
Wed Jun 24, 2009 4:14 pm
Forum: General Discussions
Topic: Improving the 6502, some ideas
Replies: 185
Views: 117539

It's possible to use garbage collection with C, although it's a hack. Basically the garbage collector looks for anything that might be a pointer to allocated memory, although it has no way of knowing that it actually is a pointer, so you get some false positives. More dangerously, if a pointer is ...
by VBR
Tue Jun 23, 2009 7:30 pm
Forum: General Discussions
Topic: Improving the 6502, some ideas
Replies: 185
Views: 117539

In all honesty, though, implementing LAS won't offer a significant time advantage to XBA/LDA, since the 6502 has only a single bus inside it.

You don't have to physically move data from one register to another; you can just rename the accumulator. That's why I used the word "toggle", because I ...
by VBR
Tue Jun 23, 2009 6:23 pm
Forum: General Discussions
Topic: Improving the 6502, some ideas
Replies: 185
Views: 117539

Thankfully, what you illustrated above is not toggling, but rather is clearly a "data stack" in the Forth processor parlance. You have, simply, a 2-deep stack.

There's no difference between an exchange of A and B, followed by LDA, and a transfer from A to B, followed by LDA.

However, this, too ...
by VBR
Tue Jun 23, 2009 12:47 am
Forum: General Discussions
Topic: Improving the 6502, some ideas
Replies: 185
Views: 117539

BigEd wrote:
The B register is handy though: XAB/XAB feels better than PHA/PLA.
I was thinking it might be good if LDA toggled between A and B. As in:

lda #1 ; A = 1, B = ?
lda #2 ; A = 2, B = 1
lda #3 ; A = 3, B = 2

The advantage is that you don't need an LDB instruction.
by VBR
Mon Jun 22, 2009 5:22 pm
Forum: General Discussions
Topic: Improving the 6502, some ideas
Replies: 185
Views: 117539

For VBR's original question - what small delta would you make to 65c02 - I'd start with the '816's B accumulator, and then I'd take some other goodies from the '816. I'd prefer separate opcodes for 16-bit operations, if there were any. I don't much like the modes.

A "B" register isn't a bad idea ...
by VBR
Sun Jun 21, 2009 7:37 pm
Forum: General Discussions
Topic: Improving the 6502, some ideas
Replies: 185
Views: 117539

Some other random instruction ideas:

sti #imm, zp
sti #imm, abs
cmpeq #imm, rel8
cmpne #imm, rel8
add #imm (without carry)
sub #imm (without borrow)
lda (ind), #
sta (ind), #
push zp
push abs
push #

Also the HuC6280 has swap instructions, useful or not?

sax
say
sxy

----------------------

What ...
by VBR
Sat Jun 20, 2009 7:50 am
Forum: General Discussions
Topic: Improving the 6502, some ideas
Replies: 185
Views: 117539

Regarding "memory is super cheap now"...when it was a struggle to fit a CPU on a chip, it might have made sense to waste memory in exchange for a simpler CPU. But when the entire system, including memory, is on a single chip, it makes no sense to waste memory, since memory is the biggest cost.

Look ...
by VBR
Thu Jun 18, 2009 2:27 pm
Forum: General Discussions
Topic: Improving the 6502, some ideas
Replies: 185
Views: 117539

Improving the 6502, some ideas

What are the simplest, most useful improvements you could make, taking the WDC65C02 as a base?

1) 24-bit program counter

This would allow 16MB of ROM code without bank switching. RAM, I/O, and ROM data would be located in the lower 64K.

jsr/jmp/rts/rti redefined for 24-bit operation.

New opcodes ...
by VBR
Tue Aug 21, 2007 10:36 am
Forum: Hardware
Topic: Introduction and 1541 problem
Replies: 26
Views: 16222

Simon wrote:
VBR wrote:
Do you know what other famous robot has the same 'brain'?

I'll be back later to check your answer.
No idea? And if I try Googling for it I just get back to my own site!
The Terminator (1984 model)
by VBR
Fri Aug 17, 2007 5:13 pm
Forum: Hardware
Topic: Introduction and 1541 problem
Replies: 26
Views: 16222

Bravo. Well done.

Do you know what other famous robot has the same 'brain'?

I'll be back later to check your answer.
by VBR
Sat Jul 28, 2007 8:04 am
Forum: Emulation and Simulation
Topic: emulator source
Replies: 7
Views: 8493

Re: emulator source

Hyper wrote:
Hello all I have an exciting project started but I need to incorporate an emulator into the project. I am using MSVC6 for the project so the code needs to be c/c++ for that target.
What's the exciting project? There's no shortage of C/C++ 6502 emulators...
by VBR
Sat Jul 07, 2007 1:47 pm
Forum: Programming
Topic: Writing an assembler
Replies: 17
Views: 13037

Are you writing a linker also or just going straight to executable?
by VBR
Fri Jul 06, 2007 7:00 pm
Forum: Programming
Topic: Writing an assembler
Replies: 17
Views: 13037

Just what the world needs, another 6502 assembler. :-)

I'm not trying to spoil your fun, but there are so many already, it's hard to believe that none are suitable. Did you try ca65, for example?