Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #5736 > unrolled thread
| Started by | mmphosis <mmphosis@macgui.com> |
|---|---|
| First post | 2020-12-30 15:01 +0000 |
| Last post | 2021-03-19 11:14 -0700 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.sys.apple2.programmer
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
| From | mmphosis <mmphosis@macgui.com> |
|---|---|
| Date | 2020-12-30 15:01 +0000 |
| Subject | a 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]
| From | kegs@provalid.com (Kent Dickey) |
|---|---|
| Date | 2020-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]
| From | Michael Pohoreski <michael.pohoreski@gmail.com> |
|---|---|
| Date | 2021-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