Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

neo6502: output runnable .neo files #344

Closed
bcampbell opened this issue Jun 30, 2024 · 2 comments
Closed

neo6502: output runnable .neo files #344

bcampbell opened this issue Jun 30, 2024 · 2 comments

Comments

@bcampbell
Copy link
Contributor

neo6502 has file format for executable files which looks like it should be the default output for llvm-mos:
http://neo6502.com/reference/formats/#neo-load-file-format

I think it's a mostly simple change to the linker script neo6502/link.ld, but I'm a bit stuck on the details.
Here's what I've got so far- the ???? bits are where I'm a bit hazy. I know there are probably some symbols defined somewhere I use to calculate things (_start, _end kind of thing), but I really don't know what the conventions are.

OUTPUT_FORMAT {
    BYTE(0x03)          /* magic cookie (not a valid 65c02 opcode) */
    BYTE(0x4E)          /* 'N' */
    BYTE(0x45)          /* 'E' */
    BYTE(0x4F)          /* 'O' */
    BYTE(0x00)          /* min version - major */
    BYTE(0x00)          /* min version - minor */
    SHORT(????)        /* execute address (start LMA of ram section) */
    BYTE(0x00)          /* ctrl bits. bit 7=another block follows (could load graphics data directly into vram with a second block) */
    SHORT(????)        /* load address (also start LMA of ram section) */
    SHORT(????)        /* size in bytes of the _trimmed_ ram section */
    ????                        /* ASCIIZ string (comment, filename, whatever). Variable length, ideally definable in the C. I'd guess this'd involve adding a special "identifier" memory section and having TRIM(identifier), BYTE(0x00) here? */
    TRIM(ram)
}

Any ideas?

@asiekierka
Copy link
Contributor

asiekierka commented Jun 30, 2024

I followed the standards (particularly in execution format) set by the cc65 example I found when I was working on the code, as I had no physical hardware to access and validate behavior on otherwise.

I agree that if there's an executable file format now, this should be preferred.

I haven't tested this, but the ????s should be, in order:

  • _start
  • ORIGIN(ram)
  • __data_end - ORIGIN(ram)

As for the identifier, you're generally right, though I would probably just stick to BYTE(0x00) for initial attempts as to not complicate things further.

bcampbell added a commit to bcampbell/llvm-mos-sdk that referenced this issue Jul 3, 2024
@mysterymath
Copy link
Member

Fixed by #345

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants