Repository navigation
Add Cx4 support - #415
Add Cx4 support#415Ersanio wants to merge 3 commits into
Conversation
|
feels kinda smelly that the IR0-15 shorthands only accept 6-digit hex. i think you should probably call into the math parser if the input starts with #. (if you need to disambiguate it from other immediate operands, check if some of the smaller auxiliary frozen::unordered_maps are probably slower than a cascade of do sub/subr and cmp/cmpr need to be separate instructions? i assume the difference is which way around the subtraction happens, but in asm we can represent that with argument order. it looks like the only case where you can't tell which way around it's supposed to be is somewhat shallow review bc i'm reading the code on my phone. i'm so overwhelmed with everything idk if i'll get around to doing a proper review in the next 6 months, but maybe after that |
|
also what's with the gitignore diff? iirc i spent quite a while getting dotnet to not spew its bullshit everywhere, is it still broken? |
I think we can take the liberty of simplifying these four opcodes by combining SUB/SUBR and CMP/CMPR. Based on the argument order ( I'm liking your idea, it'll remove a bit of complexity from Cx4 assembly. Considering there's no official documentation for this chip, I think we can get real creative with the remaining syntax as well to make Cx4 more accessible. Regarding
This is also the case for other opcodes in bsnes (e.g. The Mega Man X3 source never uses any form of
This quirk about
One document basically claims that:
And that's assuming this document is correct It's unfortunate that I can't find any documentation regarding Maybe I'll close this PR and continue developing on my own asar cx4 fork until I feel it's ready again. What are your thoughts on this as a maintainer for asar?
I don't remember when exactly I got the files there, it has a bunch of "interface-tests" related files:
|
This update adds
arch cx4which assembles code for the Capcom Cx4 coprocessor (Hitachi HG51B169).Assembler
See
src/asar/arch-cx4.cpp. The convention for instructions with commas (e.g.LD A, R0) is<dest>, <src>."pending hardware confirmation"
arch-cx4.cppmentions a lot of "pending hardware confirmation" in the comment. I do not know how the HG51B169 emulator core was developed, and what kind of test ROMs were used, so I based all of the logic and quirks on the bsnes emulator (78474e5) which I treated as the "source of truth".I do eventually plan to make my own Cx4 development board to confirm these quirks, myself. Until then, the Cx4 assembler is "bsnes-compliant" (perhaps to a fault, see the quirk about storing into
MACH).Unusual syntax
P:Awithin the operation (e.g.ADD A << 8, #$42)WRRAMandRDRAMexpect aRAMB+<value>and aDPR+<value>INC MARis the only documented INCIR0-IR15, can also be written as their#$xxxxxxvaluesCMP/SUBand their reversed variantCMPR/SUBRin both cases read as "left minus right"; The assembler takes care of the parameter reversingErrors, warnings and other quirks
The assembler tries to hold the user's hand with warnings and errors for parameter combinations that don't make sense or simply won't work. e.g.
ST A, A, is syntactically valid, but doesn't make sense semantically.The assembler also warns the user about certain Cx4 quirks that are more obscure, such as writing a 24-bit value to
MACHonly storing the lower 8 bits (which might be due to a bsnes bug), or a shift count higher than 24 resulting in no shifting.Docs and editor support
See
docs/src/arch-cx4.md. It shows what registers you can work with, and what opcodes are available. A full documentation involving hardware registers, timings, pinout etc. is out of scope for asar. The syntax highlighters have also been updated. The only exception is Sublime Text; it supports 65c816 only, so I kept it that way.Example project
I have an example project over at one of my own repositories. It's meant to run on bsnes along with the
.bmlfile. It improves the level loading times by optimizing the LC_LZ2 decompression, so you'll know the patch applied successfully if level loads are faster.