Coder Social home page Coder Social logo

Comments (2)

JohnEarnest avatar JohnEarnest commented on May 21, 2024 1

The new :macro facility resolves this nicely, as I'd hoped when I originally suggested it. The following program:

:macro foo { 0xAA }
:macro bar { 0xBB }

: main
	foo
	bar

Will compile as the bytes 0xAA 0xBB.

from octo.

JohnEarnest avatar JohnEarnest commented on May 21, 2024

I replied to your email, but just for the purposes of keeping things documented I'll summarize here:

Constants declared with :const are treated exactly like labels when used outside of instructions. The difference between the patterns here is that the constant references are compiled into calls to subroutines. This functionality is already used for building jump tables and by the disassembler for various reasons. It would be possible to alter the semantics of :const to get the desired behavior, but I think a better resolution would be to create a new construct with this type of purpose in mind.

One proposal is the addition of a :macro operative which would allow you to assign a name to a pattern of bytes which would be inlined wherever the name of the macro was used. A particularly nice aspect of this system is it could serve to simplify some parts of the existing assembler and make it easier to experiment with custom extended instruction sets. I'll give the precise syntax and semantics some thought and update this issue when I come to a final decision.

from octo.

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.