simonowen / pyz80

pyz80 - a Z80 cross assembler
GNU General Public License v2.0
18 stars 8 forks source link

Multiple opcodes on a line #23

Open stefandrissen opened 3 years ago

stefandrissen commented 3 years ago

I'm not sure how feasible this is, but I found the look of this as implemented in sjasmplus (see https://spectrumcomputing.co.uk/forums/viewtopic.php?p=78268#p78268) rather pleasant.

simonowen commented 3 years ago

It shouldn't be too difficult to add overall but I can imagine some awkward cases like ld a,':' : ld b,1 or ld a,1 : defb ":" due to the way pyz80 processes each line. There is some support for tracking inside/outside quotes, which may help avoid unwanted matching against a : in a string, but I can't remember if that understands single quotes too.

I actually found the code in that screenshot to be really hard to read. I don't know if it was the multi-level indentation or the over-use of multi-instruction lines, or a mix of both. I can see the appeal of multi-instruction lines for unrolled loops where there are patterns of a few instructions per processed byte, where it makes the code easier to scan. Though a pyz80 FOR loop might be simpler still, and closer to a macro approach.

I'll probably hold off adding this until solutions are found for the problem cases above.