GithubHelp home page GithubHelp logo

Comments (7)

mysterymath avatar mysterymath commented on July 25, 2024 1

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.

mysterymath avatar mysterymath commented on July 25, 2024 1

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.

johnwbyrd avatar johnwbyrd commented on July 25, 2024

Just for the hell of it, have you tried:

__attribute__((section(".zp"))) static char color = 0;

from llvm-mos.

nolemor avatar nolemor commented on July 25, 2024

@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.

nolemor avatar nolemor commented on July 25, 2024

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.

johnwbyrd avatar johnwbyrd commented on July 25, 2024

This bug can be addressed by rewriting

bool MOSAsmBackend::isZeroPageSectionName(StringRef Name) {
. 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.

mysterymath avatar mysterymath commented on July 25, 2024

Thanks, that's exactly the deal.

from llvm-mos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.