Skip to content

Conversation

@Phillip-May
Copy link

Here's an initial draft for a snes target, based my snes xc libraries, so registers are named with REG_ for example REG_INIDISP, the example provided is an input test that changes the screens colour. I've already used essentially this target for my demake/port of c celeste.

@@ -0,0 +1,301 @@
; SNES Interrupt Vector Handlers for LLVM-MOS (6502 compatible)
; Based on vectors.asm reference from wdc816cc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't really "base" code on WDC's, unfortunately. I assume the licenses are not compatible.

However, what little potentially copyrightable material I see in this file requires a rework anyway...

pha
php
; Save zero page registers that LLVM-MOS might use
lda $00
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... because this isn't how we do things here. We mark the IRQ function with __attribute__((interrupt)), which then takes care of saving and restoring registers and everything. Study, for example, the PC Engine target's examples.

; Entry point - called by SNES reset vector
.global _start
_start:
; Call LLVM-MOS crt0 initialization functions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, we don't really do jsr calls here; we expect the linker to put these functions in order in the. See common/ldscripts/text-sections.ld.

@asiekierka
Copy link
Contributor

Overall, this is a solid proof of concept, but as discussed in #general, I would not wish to merge any of this until proper 65816 support exists. People may end up depending on the quirks of using the 65816 in 16-bit address/8-bit data mode, which will cause us support headaches later on.

@@ -0,0 +1,2 @@
-mlto-zp=224
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-mcpu=mosw65816 will enable some 65816-specific optimizations.




union uOAMCopy{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh?

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

Successfully merging this pull request may close these issues.

2 participants