Search found 34 matches

by Snial
Fri Jun 27, 2025 2:35 pm
Forum: Forth
Topic: Vorth (unexpanded VIC-20 Forth) design considerations
Replies: 6
Views: 3317

Re: Vorth (unexpanded VIC-20 Forth) design considerations

Wow! It's really great to see my ideas behind uxForth being taken up and it being able to generate a real application!
by Snial
Tue Feb 15, 2022 8:36 am
Forum: General Discussions
Topic: Comparisons and contrasts
Replies: 162
Views: 138241

Re: Comparisons and contrasts

Calculating dest = constant - signed byte? Z80:


ld hl,(S1) ;don't care about h, contains garbage.
ld a,l
rla
sbc a,a ;=> a-a-0 or a-a-1 ie. 0 or 0xff.
ld h,a ;hl now sign extended.
ld de,258
or a ;clears carry.
sbc hl,de ;hl=258-S1
ld (dest),hl ;saved


So, z80 is quite straight forward ...
by Snial
Tue Dec 08, 2020 8:26 am
Forum: Programming
Topic: Elon Musks's Blastar (Unexpanded VIC-20 Conversion)
Replies: 3
Views: 3076

Re: Elon Musks's Blastar (Unexpanded VIC-20 Conversion)

Nice work! I'm sure you'll be a multi-billionaire any day now.

Thanks! Feel free to convert it to the microcomputer of your choice! Remember, Blastar, it's the secret of success!

How did you generate the listing? Is it just a series of screen caps glued together? (And kinda low on readability ...
by Snial
Sun Dec 06, 2020 11:10 am
Forum: Programming
Topic: Elon Musks's Blastar (Unexpanded VIC-20 Conversion)
Replies: 3
Views: 3076

Elon Musks's Blastar (Unexpanded VIC-20 Conversion)

Back in 1984, the 12 year old Elon Musk wrote a rudimentary video game for his SpectraVideo SV-328 (a Z80 Microcomputer)

https://www.theverge.com/2015/6/9/8752333/elon-musk-blastar-pc-game

Then about 5 years ago someone turned it into an HTML-5 version of the game which you can play here:

http ...
by Snial
Fri Dec 04, 2020 7:43 am
Forum: General Discussions
Topic: A Hypothetical C Friendly 6502
Replies: 74
Views: 7755

Re: A Hypothetical C Friendly 6502

With the y reg optimisation...about 27% faster.
Well, so long as the function you're calling is not using the Y register. If it is, you now need to save and restore it
with every call

I would tend to favour callee-saved conventions. I once wrote a blog post about that:

http://oneweekwonder ...
by Snial
Thu Dec 03, 2020 10:41 pm
Forum: General Discussions
Topic: A Hypothetical C Friendly 6502
Replies: 74
Views: 7755

Re: A Hypothetical C Friendly 6502

Think about something like this: while (*ptr) func(*ptr++);

How might a 65T2 C compiler handle this? It's likely it wouldn't use the Y register.


:Foo ;ptr is at s+3:s+2
Bra Foo1
:Foo2
Lda *s+2;
Jsr Func
Inc s+2
Bne Foo3
Inc s+3
:Foo3
:Foo1
Lda *s+2
Bne Foo2
Rts


This sequence takes ...
by Snial
Thu Dec 03, 2020 1:18 pm
Forum: General Discussions
Topic: A Hypothetical C Friendly 6502
Replies: 74
Views: 7755

Re: A Hypothetical C Friendly 6502

(Thanks for reappearing, snial! I'd still recommend a new thread, especially as further different avenues have opened up. But also nice to see KDF-9 and Magic-1 referenced! It seems you have the technical background, so might you write an emulator or HDL model of 65T2? Or indeed a C compiler for it ...
by Snial
Wed Dec 02, 2020 1:40 pm
Forum: General Discussions
Topic: A Hypothetical C Friendly 6502
Replies: 74
Views: 7755

Re: A Hypothetical C Friendly 6502


Redesigning the 6502 to make it more suitable for high-level languages is problematic. The most important criteria is to be able to support an indexed stack addressing mode.


I was with you until this point. While you can obviously choose whatever design criteria that you want, it's not ...
by Snial
Tue Dec 01, 2020 10:34 pm
Forum: General Discussions
Topic: A Hypothetical C Friendly 6502
Replies: 74
Views: 7755

Re: A Hypothetical C Friendly 6502

Hello Garth,

Snial, I don't know much about C compilers' innards; but I think you'll want to look into the 816's stack-relative addressing modes...

Thanks, I'm aware of the 65C816 and it's very extensive addressing modes, including stack addressing modes and its DP register which can function ...
by Snial
Tue Dec 01, 2020 1:48 pm
Forum: General Discussions
Topic: A Hypothetical C Friendly 6502
Replies: 74
Views: 7755

Re: A Hypothetical C Friendly 6502

Hi Everyone,

Thanks for all the replies to the idea of the 65T2. Sorry it's taken me so long to reply in turn. I looked at the thread the morning (UK time) after I'd posted it; didn't seem to see any replies at the time and it's taken me a little while to get back to answering. And there's far more ...
by Snial
Thu Nov 26, 2020 10:51 pm
Forum: General Discussions
Topic: A Hypothetical C Friendly 6502
Replies: 74
Views: 7755

Re: A Hypothetical C Friendly 6502

The 65T2.


A while back as a thought exercise I worked on a high-level language friendly 6502 alternative I called the 65T2.

65T2.

The 65T2 has the following objectives:

• An 8-bit 6502 type architecture.
• The equivalent MOS transistor and resource budget as a 6502 (or 65C02).
• Better ...
by Snial
Sat Nov 14, 2015 10:13 am
Forum: Programming
Topic: Shuffling a portion of a ring buffer
Replies: 10
Views: 1872

Re: Shuffling a portion of a ring buffer

Let's say you have a list of 52 cards and you want to in-place shuffle cards n to m-1 inclusive. Array index is assumed to be from 0

limit=m-n
for l=0 to limit-1
s=rnd(limit-l)+l+n:rem dest is always at l+n
if s>=52 then s=s-52:rem wrap.
d=l+n
if d>=52 then d=d-52:rem wrap.
c=card[s]
card[s ...
by Snial
Wed Nov 11, 2015 10:58 pm
Forum: Programming
Topic: Byte Parallel Crc16
Replies: 30
Views: 7336

Re: Byte Parallel Crc16

Hi folks,

So, here's the answer, let's start with the worst case:

115200 = 347 clock cycles between received characters less 285 clock cycles worst case = 62 free clock cycles between characters


The only acceptable criteria for the software is whether our code will always work; not work on ...
by Snial
Wed Nov 11, 2015 6:56 pm
Forum: Programming
Topic: Byte Parallel Crc16
Replies: 30
Views: 7336

Re: Byte Parallel Crc16

then the byte parallel algorithm still requires too many cycles.

And yet - you may be quite surprised to discover this, but further analysis will show there should be plenty of time for my byte parallel routine within your interrupt code at 115200 baud.

For the moment, I'll leave it for our avid ...
by Snial
Wed Nov 11, 2015 8:15 am
Forum: Programming
Topic: Byte Parallel Crc16
Replies: 30
Views: 7336

Re: Byte Parallel Crc16

Using the OP's Byte Parallel routine would be on the edge every 256 days for 115200 baud rate

Gosh-thank you for spending the time to work out whether my routine could be used!

It looks like it's fairly close. It's worth noting, the timings for my routine are based on evaluating a whole packet ...