Code Monkey home page Code Monkey logo

Comments (8)

informedcitizenry avatar informedcitizenry commented on May 14, 2024

Can you share a snippet of your code? I am not able to reproduce this issue. If I run this

THEBOOL			= true

				.ifdef THEBOOL
					lda #0
				.else
					lda #56
				.endif

I get the expected output (lda #0)

from 6502.net.

svallee-dev avatar svallee-dev commented on May 14, 2024

I responded by email, but I'm thinking maybe the proper way is to write an answer here in the thread. So here it is:

I wrote a tiny project to repro it, but could not. It built just fine. I tried to repro as closely to my real project as possible, but no success. So instead I started cutting down my real project, until I got to a mere few files, while still getting the build error. I zipped and attached it to this post.

Just assemble src/main.a and that should do it. If you don’t get the error, then maybe it’s a problem that’s specific to my computer.

First64.zip

from 6502.net.

informedcitizenry avatar informedcitizenry commented on May 14, 2024

thanks I'll take a look

from 6502.net.

informedcitizenry avatar informedcitizenry commented on May 14, 2024

from 6502.net.

svallee-dev avatar svallee-dev commented on May 14, 2024

Ok I updated my project with your new code, at the same time removing all my previous custom changes, and added the "--ignore-colons" flag and... it worked! Everything built fine!

... except that when I try to build a second (and more time) I then get these errors:

vblank.a(113,1): error: Symbol "true" is not defined.
vblank.a(133,1): error: Symbol "true" is not defined.
gameloop.a(13,1): error: Symbol "true" is not defined.
gameloop.a(23,1): error: Symbol "true" is not defined.

Now, a little context is needed: I'm not running the 6502.Net code from a command line, in which the entire runtime state would be reset every time it is run. Instead, the code is run inside a persistant iOS app. I make sure to recreate a fresh new state every time I assemble, but I noticed in the code there's quite a few static data. I'm wondering if that data linger around after a first assembly, causing issues on subsequent assembling.

This is how I invoke 6502.Net every time:

				// Assemble
				var compiler = new C64Hub.Compiler(project);
				if (compiler.IsReady)
				{
					compiler.Assemble();
				}

That C64Hub.Compiler class is mostly:

	public class Compiler
	{
        public bool IsReady { get; private set; }

        AssemblerBase cpuAssembler = null;
        AssemblyController controller = null;

		public Compiler(Project project)
		{
            Assembler.Initialize(GenerateProjectArgs(project));

            if (Assembler.Options.CPU.Equals("z80"))
            {
                Assembler.BinaryFormatProvider = new Z80FormatProvider();
                cpuAssembler = new Z80Asm();
            }
            else
            {
                if (Assembler.Options.Format.Equals("d64"))
                    Assembler.BinaryFormatProvider = new D64FormatProvider();
                else
                    Assembler.BinaryFormatProvider = new M6502FormatProvider();
                cpuAssembler = new Asm6502();
            }
            controller = new AssemblyController(cpuAssembler);

            IsReady = (cpuAssembler != null && controller != null);
        }

        public void Assemble()
        {
            if (!IsReady)
            {
                throw new Exception("Not ready to assemble.");
            }
            controller.Assemble();
        }

I'm going to investigate if any static data in 6502.Net doesn't get reset properly. But hopefully you already have an idea of what's going on :)

from 6502.net.

informedcitizenry avatar informedcitizenry commented on May 14, 2024

Ahh! I see, your use case is slightly different. I honestly never thought of using this app in such a context, only a one-run kind of scenario. My assumption is that the static Assembler initialization is tied to construction of some of the main classes, like the Evaluator, the Options class, and the SymbolManager. You may have to implement some sort of state reset.

from 6502.net.

svallee-dev avatar svallee-dev commented on May 14, 2024

Oh wow I just realized I posted in the wrong bug thread my previous responses.. sorry about that!

But I think both can be closed now!

from 6502.net.

svallee-dev avatar svallee-dev commented on May 14, 2024

This was resolved. Thanks!

from 6502.net.

Related Issues (15)

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.