Comments (7)
Yes, this definitely appears to be in error. I'll have to spend some time diagnosing this; the .zp.bss
prefix should be sufficient to cause the assembler to emit zero page addressing and 8-bit relocations, but for some reason it isn't.
from llvm-mos.
Closing this with a fix for the original issue, since it's more bug-like than the other tack-on issues.
Please do feel free to file separate issues for those, though; some of these may also be relatively easy to improve, but the work would likely be altogether unlike what was done here.
from llvm-mos.
Just for the hell of it, have you tried:
__attribute__((section(".zp"))) static char color = 0;
from llvm-mos.
@johnwbyrd Interesting. That actually fixes it 🤔
00008034 <main>:
8034: a2 00 ldx #$0
8036: ac 02 20 ldy $2002
8039: 10 fb bpl $8036
803b: a0 08 ldy #$8
803d: 8c 01 20 sty $2001
8040: a9 00 lda #$0
8042: 4c 6f 80 jmp $806f
8045: ac 02 20 ldy $2002
8048: 10 fb bpl $8045
804a: e6 03 inc $3
804c: d0 02 bne $8050
804e: e6 02 inc $2
8050: a4 03 ldy $3
8052: e6 02 inc $2
8054: c6 02 dec $2
8056: d0 ed bne $8045
8058: c0 1e cpy #$1e
805a: d0 e9 bne $8045
805c: ac 02 20 ldy $2002
805f: a0 3f ldy #$3f
8061: 8c 06 20 sty $2006
8064: 8d 06 20 sta $2006
8067: a4 20 ldy $20
8069: c8 iny
806a: e6 20 inc $20
806c: 8c 07 20 sty $2007
806f: 86 02 stx $2
8071: 86 03 stx $3
8073: 4c 45 80 jmp $8045
from llvm-mos.
Also another thing, while perhaps not related to the issue above, if I change the loop counter from int
to char
I get this generated code
00008034 <main>:
8034: a9 00 lda #$0
8036: ae 02 20 ldx $2002
8039: 10 fb bpl $8036
803b: a2 08 ldx #$8
803d: 8e 01 20 stx $2001
8040: a0 00 ldy #$0
8042: ae 02 20 ldx $2002
8045: 10 fb bpl $8042
8047: 18 clc
8048: 69 01 adc #$1
804a: c9 1e cmp #$1e
804c: d0 f4 bne $8042
804e: ad 02 20 lda $2002
8051: a2 3f ldx #$3f
8053: 8e 06 20 stx $2006
8056: 8c 06 20 sty $2006
8059: a5 20 lda $20
805b: 18 clc
805c: 69 01 adc #$1
805e: e6 20 inc $20
8060: 8d 07 20 sta $2007
8063: a9 00 lda #$0
8065: 4c 42 80 jmp $8042
Two things to observe there is that the loop counter is now smaller (which makes sense as it's a 8-bit value) but it decides to change the inc
into clc / adc
which is a bit unexpected.
from llvm-mos.
This bug can be addressed by rewriting
. Currently, it only checks to see if the name is contained in the ZeroPageSectionTable, when what we really want to do is check the Name's prefix against the table entries.from llvm-mos.
Thanks, that's exactly the deal.
from llvm-mos.
Related Issues (20)
- Lower mem intrinsics to loops
- G_OR prevents selection of addressing mode HOT 1
- Don't copy single-use strings to the zero page
- rustc crash HOT 2
- Compilation failure on MacOS w. Apple silicon HOT 11
- Builder for Apple Silicon
- mos-sim crash HOT 1
- Triple selection doesn't accommodate mos-<platform>-<type>-<subtype> syntax
- [65C816, 65CE02] Long branch instructions not supported HOT 2
- ld.lld: error: undefined symbol: __rc4 to __rc24 HOT 3
- Missing G_SBC commutation for equality checks HOT 1
- [Assembler] Improved ergonomics for 65816 (and other) subtargets HOT 14
- [Assembler] .byte/.short don't support MOS expression parsing
- [Interrupts] Current interrupt C generation inadequate for CBM machines HOT 2
- Redundant copy and spilling HOT 1
- Compiler crashes when try to access a member variable of a class through inline assembly HOT 5
- Declaration order of member variables has a big impact on code optimization HOT 1
- Surface error messages for inline assembly
- LLD verbose mode should print the command lines of invoked `ld65` steps
- Faster Signed Comparison to Constants HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from llvm-mos.