Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #5736 > unrolled thread

a simple 6502 compiler

Started bymmphosis <mmphosis@macgui.com>
First post2020-12-30 15:01 +0000
Last post2021-03-19 11:14 -0700
Articles 3 — 3 participants

Back to article view | Back to comp.sys.apple2.programmer


Contents

  a simple 6502 compiler mmphosis <mmphosis@macgui.com> - 2020-12-30 15:01 +0000
    Re: a simple 6502 compiler kegs@provalid.com (Kent Dickey) - 2020-12-30 17:22 -0600
      Re: a simple 6502 compiler Michael Pohoreski <michael.pohoreski@gmail.com> - 2021-03-19 11:14 -0700

#5736 — a simple 6502 compiler

Frommmphosis <mmphosis@macgui.com>
Date2020-12-30 15:01 +0000
Subjecta simple 6502 compiler
Message-ID<mmphosis-1609340460@macgui.com>
A 6502 compiler specializing in 16-bit integer math and brute force loop
unrolling

https://github.com/glouw/ctl/blob/master/examples/6502.c

[toc] | [next] | [standalone]


#5737

Fromkegs@provalid.com (Kent Dickey)
Date2020-12-30 17:22 -0600
Message-ID<JbidnQFcTeknlnDCnZ2dnUU7-VXNnZ2d@giganews.com>
In reply to#5736
In article <mmphosis-1609340460@macgui.com>,
mmphosis  <mmphosis@macgui.com> wrote:
>A 6502 compiler specializing in 16-bit integer math and brute force loop
>unrolling
>
>https://github.com/glouw/ctl/blob/master/examples/6502.c

It looks like it compiles something to 6502 code.  But I'm not sure what.
Can you provide a source example and the 6502 output as an example?
It looks like "boids()" calls compile on some C-like code, but it's not C.

Kent

[toc] | [prev] | [next] | [standalone]


#5767

FromMichael Pohoreski <michael.pohoreski@gmail.com>
Date2021-03-19 11:14 -0700
Message-ID<f6be4c0b-6af1-4e99-a486-cbf9ed70c7cbn@googlegroups.com>
In reply to#5737
On Wednesday, December 30, 2020 at 3:22:40 PM UTC-8, Kent Dickey wrote:
> It looks like it compiles something to 6502 code. But I'm not sure what. 
> Can you provide a source example and the 6502 output as an example? 
> It looks like "boids()" calls compile on some C-like code, but it's not C. 

It's C with extensions.
e.g.
https://github.com/glouw/ctl/blob/master/examples/6502.c#L1068
setup(void)
    keytype("i16", DEFAULT_WORD_SIZE);
    keytype("u16", DEFAULT_WORD_SIZE);
    keytype("u8", DEFAULT_BYTE_SIZE);
    keytype("i8", DEFAULT_BYTE_SIZE);
    keyword("unroll");
    keyword("if");

The data type are just typedefs / aliases for  standard "int16_t", "uint16_t", etc.

What makes it non-standard is that the for-loop command, "unroll", is using a custom macro mark-up with $ for variables:
            "unroll($X, $I : x)\n"

m.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.apple2.programmer


csiph-web