itszor / gcc-6502-bits Goto Github PK
View Code? Open in Web Editor NEWBuild tools, tiny C library, etc. for gcc-6502 port.
Build tools, tiny C library, etc. for gcc-6502 port.
There's incomplete work in the m65x-gcc-virt branch of the gcc-6502 repo. Results so far look promising, though there are still some unresolved codegen bugs relative to the version currently tagged from this repo.
I think the easiest way to print a character here is the kernal CHROUT function at $ffd2 ?
http://sta.c64.org/cbm64krnfunc.html
just a
lda #
jsr $ffd2
should do the job?
The git links in the readme.md did not work for me due to missing access rights.
Had to use the links from the github websit, like
https://github.com/puppeh/gcc-6502-bits.git
(no git@ ...).
Was able to compile the compiler then. Very cool project! Thanks!
static int a[100];
int f(int i, int v) {
a[i] = v;
return *a;
}
Compile with 6502-gcc sample.c -O0 -S -o sample.s
Memory for the a
variable is reserved in BSS
segment.
Memory for the a
variable is reserved in CODE
segment.
.feature at_in_identifiers
.feature dollar_in_identifiers
.autoimport +
.p02
.importzp _sp0, _sp1, _fp0, _fp1
.importzp _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7
.importzp _s0, _s1, _s2, _s3, _s4, _s5, _s6, _s7
.importzp _e0, _e1, _e2, _e3, _e4, _e5, _e6, _e7
.importzp _e8, _e9, _e10, _e11, _e12, _e13, _e14, _e15
.importzp _e16, _e17, _e18, _e19, _e20, _e21, _e22, _e23
.importzp _e24, _e25, _e26, _e27, _e28, _e29, _e30, _e31
.importzp _tmp0, _tmp1
.importzp _sa, _sx, _sy
.segment "CODE"
a$:
.res 200
.export f$
f$:
; frame size 4, pretend size 0, outgoing size 0
lda _sp1
pha
lda _sp0
pha
[...]
Commit 67a23d5 is applied. Without it the same behavior was also observed on non-static variables.
The faulty behavior is also observable if a
is declared in the function:
int f(int i, int v) {
static int a[100];
a[i] = v;
return *a;
}
The compiler should then convert access to "indirect" opcodes
Indirect,X LDA ($44,X) $A1 2 6
Indirect,Y LDA ($44),Y $B1 2 5+
On stage 2 the build fails with
***************************
* Building tiny C library *
***************************
.: compile: exit.c
.: compile: abort.c
.: compile: stdfiles.c
.: compile: semi65x/fputc.c
.: compile: fputs.c
.: compile: putchar.c
.: compile: puts.c
.: compile: vfprintf.c
vfprintf.c: In function 'print_udec':
vfprintf.c:36:1: internal compiler error: Max. number of generated reload insns per insn is achieved (90)
}
^
0x83865b lra_constraints(bool)
../../gcc-src/gcc/lra-constraints.c:4831
0x81e34b lra(_IO_FILE*)
../../gcc-src/gcc/lra.c:2335
0x7b70f7 do_reload
../../gcc-src/gcc/ira.c:5417
0x7b75df execute
../../gcc-src/gcc/ira.c:5588
I have done a fresh install of Ubuntu 17 on x86_64 and installed cc65 as both packages and afrom source.
$ gcc --version
gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406
I have also tried an ARM build on Raspberry Pi from source and that fails with the same error.
pi@raspberrypi ~/code/code/gcc-6502-bits $ gcc --version
gcc (Debian 4.6.3-14+rpi1) 4.6.3
Is it possible to install gcc-6502 under Cygwin?
If yes, how?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.