Search found 10 matches

by richard.broadhurst
Thu Jul 22, 2021 8:09 pm
Forum: Programming
Topic: LLVM 6502 Codegen
Replies: 154
Views: 43549

Re: LLVM 6502 Codegen

I'm looking forward to seeing where this goes, as it looks like it is off to a great start.
It will also be interesting to compare to http://4corn.co.uk/articles/gccforbbc/.
by richard.broadhurst
Wed Nov 13, 2019 9:17 pm
Forum: General Discussions
Topic: Announce: Acheron VM
Replies: 64
Views: 10872

Re: Announce: Acheron VM

I enjoyed the presentation; I was expecting a VM for a "known" 16 bit processor and was very pleasantly surprised.
I was also wondering about it being the target of a compiler, as I have tried a few times to write a Cish compiler for 6502, but always end up half inventing a new 6502ish language ...
by richard.broadhurst
Sat Nov 14, 2015 10:45 am
Forum: Programming
Topic: JeffSort on the 6502
Replies: 25
Views: 12026

Re: JeffSort on the 6502

Since RetroSoftware is down and has been for a while, here is a copy of my original article:

Linear time bucket sort

I have been going through some of the old stuff on my BBC disks and found this - I used it for some demos to sort sprites to allow them to be rendered top-down to chase/run ahead ...
by richard.broadhurst
Fri Nov 13, 2015 7:02 pm
Forum: Programming
Topic: Shuffling a portion of a ring buffer
Replies: 10
Views: 1888

Re: Shuffling a portion of a ring buffer

Here is what I use "in-game"

.rand
LDA seed
ASL A
ASL A
CLC
ADC seed
CLC
ADC #&45
STA seed
RTS

This is about the fastest random number generator you can get although it is really just a sequence of 256 unique numbers using 14 bytes (code and data if seed is in ZP).
Each call of rand will ...
by richard.broadhurst
Fri Nov 13, 2015 6:40 pm
Forum: Programming
Topic: Poll - how much assembly programming do you do?
Replies: 22
Views: 3202

Re: Poll - how much assembly programming do you do?

I only write assembler for the BBC Micro, and most of it over the last year has been simulators for bits of arcade hardware to allow the original game ROMs to run on the BBC Micro.
I do quite often find myself reading x86 when trying to debug various issues in windows, but would never bother writing ...
by richard.broadhurst
Wed Nov 11, 2015 8:46 am
Forum: Programming
Topic: JeffSort on the 6502
Replies: 25
Views: 12026

Re: JeffSort on the 6502

Thanks RichTW, that is exactly what it does.
Since it only uses the high byte, or high byte >> N, the effective range is usually 12..32. The range can be further reduced to save space and setup cost while still getting good enough sorting for racing the raster beam.
by richard.broadhurst
Wed Nov 11, 2015 8:35 am
Forum: Programming
Topic: beebasm - an assembler with BBC BASIC-like features
Replies: 7
Views: 2956

Re: beebasm - an assembler with BBC BASIC-like features

One minor missing feature in the released version is global labels, so if you have "local" code, you can't jump into the middle of it without some hackery:

.routine
{
.loop
...
dex
bne loop
.would_like_to_jump_here ; for no apparent reason
dey
bne loop
rts
}
by richard.broadhurst
Sun Apr 05, 2015 8:27 pm
Forum: Newbies
Topic: Is there any rule to produce OPCODE of 6502?
Replies: 13
Views: 2791

Re: Is there any rule to produce OPCODE of 6502?

I wrote a BBC micro simulator including the 6502 years ago in C and later converted it to java. If you fancy a challenge, you could try approaching it in a similar way to the way the hardware works, where the instruction takes several clock cycles to execute. There is basically a table of opcodes ...
by richard.broadhurst
Thu Feb 12, 2015 10:36 pm
Forum: Programming
Topic: beebasm - an assembler with BBC BASIC-like features
Replies: 7
Views: 2956

Re: beebasm - an assembler with BBC BASIC-like features

I've used it for a couple of complete BBC games and another couple of incomplete ones, I find it works, just the way I want it to :wink:
I just dropped it into my favourite dev environment and perfect combo, my favourite editor and 6502 code :D
by richard.broadhurst
Sun Jan 20, 2013 6:52 pm
Forum: Programming
Topic: JeffSort on the 6502
Replies: 25
Views: 12026

Re: JeffSort on the 6502

Hi, very late to the party here, but thought I would mention my post http://www.retrosoftware.co.uk/wiki/index.php/Linear_time_bucket_sort which I did use in the 80s for sorting sprites to race the scan line. It cheats even more that the other posts here as it uses ZP for the "buckets" but is very ...