Closed pinobatch closed 5 years ago
I like ASM6 already. Do we know the percentage of users currently using ASM6 vs. CA65?
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.
100 percent of NESmaker users are using ASM6
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.
pently_resume_music::have_music_playing
becomes pently_set_music_playing
skip_to_row_top::bottom
becomes pently_skip_to_row
pently_play_note::skipAttackPart
becomes pently_play_note_rts
sustain_phase::silenced
becomes silence_out_volume
Anonymous labels should be easier to translate automatically.
:
, increase the counter by 1 and then emit a label of the form @ca65toasm6_anonlabel_1:
.:+
in an expression with the next @ca65toasm6_anonlabel_{n+1}
.:-
in an expression with the next @ca65toasm6_anonlabel_{n}
.As of March 2019, Pokun still rejects NSDL because of ca65.
And right now I'm stuck on what to use to replace .ifblank
and .ifnblank
in a couple macros in pentlyseq.inc
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:
Good news: 63ff9ae got all 10 sample songs playing. The next steps I can see:
pentlyas.py
Answers to some questions have arrived:
dsb
all bytes used in the library. pentlybss.py
could be given this responsibility.
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:
equ
replaces=
;=
instead replaces.set
db
orbyte
replaces.byt
dw
orword
replaces.addr
dsb
replaces.res
rept
(with no second argument) replaces.repeat
; emulate the second argument with=
.rept 1
replaces.scope
.bss
; emulate it with.enum
and= $
. May need host to allocate both zero page and BSS memory..segment
; treat code and read-only data the same..proc
; emulate it by either prefixing the namespace to non-@
labels or perhaps wrapping the body in a.rept 1
..assert
; emulate it withif
..assert
either, but it can be emulated withif
.-
,--
,+foo
), not the ca65 convention (:
). Change them to@
-labels in the source code.