pinobatch / pently

Scalable music engine for NES games
zlib License
72 stars 4 forks source link

Port to ASM6 #9

Closed pinobatch closed 5 years ago

pinobatch commented 8 years ago

Pently is made for ca65. But loopy wrote in the README file for his ASM6 assembler that ca65 "took too much work to set up", and several users of NESdev BBS agree.

In a forum post about MML processors, Pokun considers a requirement of ca65 to be a disadvantage for NSDL. In a forum post about music engines used by a ROM hacker turned original game programmer, dougeff expressed a bit of frustration about upstream (us) being ahead of his port to ASM6.

So consider ways to accommodate ASM6 users without having to Write Everything Twice (WET). This may involve a preprocessor of some sort to turn ca65 assembly source code to something ASM6 accepts. (I wrote a similar preprocessor for NESASM years ago as part of Action 53.) Steps I know I'll need to take:

Qix- commented 8 years ago

I like ASM6 already. Do we know the percentage of users currently using ASM6 vs. CA65?

darkhog commented 5 years ago

Actually, dots before directives like byte in ASM6 are optional, but legal. So you don't have to remove them. I'm using them for consistency & readability anyway. This would simplify the converter.

pinobatch commented 5 years ago

100 percent of NESmaker users are using ASM6

pinobatch commented 5 years ago

I may not want to bother making the tool translate the scope resolution operator, which allows referring to labels inside a different .proc. If we use rept 1 to replace .scope, we can't do this. Fortunately, most of the over 80 uses of scope resolution are .if :: to force use of the top-level scope as a workaround for cc65 issue #796 in order to prove to ca65 that a constant isn't redefined later in the same scope. For the others, break out a separate .proc with a fallthrough.

Anonymous labels should be easier to translate automatically.

pinobatch commented 5 years ago

As of March 2019, Pokun still rejects NSDL because of ca65.

pinobatch commented 5 years ago

And right now I'm stuck on what to use to replace .ifblank and .ifnblank in a couple macros in pentlyseq.inc

pinobatch commented 5 years ago

Right now I'm stuck on trying to get pentlyseq.inc macros like sfxdef to work in ASM6. Here's an MCVE for what I'm seeing, heavily reduced from the definition of sfxdef. It gives an Illegal instruction error in ASM6, but no error if I remove the include guard or remove the use of addy within the macro.

; include guard mcve
; changing dw addy to dw 0 causes no error
; removing the ifndef/endif causes no error
ifndef INCLUDE_GUARD
INCLUDE_GUARD = 1
macro hello addy
dw addy
endm
endif
base $C000
hi:
hello data1
hello data2
data1:
data2:
pinobatch commented 5 years ago

Good news: 63ff9ae got all 10 sample songs playing. The next steps I can see:

pinobatch commented 5 years ago

Answers to some questions have arrived: