Files
José Luis Oliveros HernándezandClaude Opus 5.5 8aa120967a ca65: Fix '*' in operands of bit branch, block transfer and LDM
PutBitBranch, PutBitBranch_m740, PutBlockTransfer and PutLDM_m740 emitted
the opcode (and the zero page byte) before reading the remaining operands.
Since '*' is evaluated while the operand is read, it pointed one or two
bytes into the instruction instead of at its start:

    bbr0 $12,*          ; was 0F 12 FF, now 0F 12 FD (loops on itself)
    tii  *,$2000,1      ; source address was off by one
    ldm  $12,#<*        ; immediate was off by two

The usual "wait for a port bit" idiom `bbr0 port,*` therefore jumped into
the middle of the next instruction. Branches to labels were not affected.

Now all operands are read first and emitted afterwards, as for every other
instruction.

In addition, the m740 accumulator form `bbs/bbc i,a,rel` is a 2 byte
instruction, but its offset was computed relative to the end of a 3 byte
one, so it was off by one even with labels. da65 had the matching error
(PC+3 instead of PC+2) in OH_AccumulatorBitBranch, which is why the
round trip test did not catch it. Both are fixed.

Reference binaries that encoded the old offsets are regenerated: the only
differences are the 16 bit branch offsets in each file. The 65C02 da65
test used `bbrN $12,*+2` meaning "next instruction"; with correct '*'
that is `*+3`.

New test: test/asm/listing/313-bitbranch-star.s, with hand-computed bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 04:41:05 +00:00
..
2022-02-19 12:44:20 +01:00
2025-06-28 18:18:39 +02:00
2022-02-19 12:44:20 +01:00
2022-02-19 12:44:20 +01:00
2022-02-19 12:44:20 +01:00
2022-02-19 12:44:20 +01:00
2022-02-19 12:44:20 +01:00
2022-02-19 12:44:20 +01:00
2022-02-19 12:44:20 +01:00
2022-02-19 12:44:20 +01:00
2022-02-19 12:44:20 +01:00
2022-02-19 12:44:20 +01:00
2022-02-20 11:20:20 +01:00
2025-06-28 18:18:39 +02:00

Opcode Tests:
-------------

These testcases are inspired by the ones now removed from test/assembler.
The main purpose is to have each possible opcode generated at least once,
either by an Assembly instruction or a ".byte"-placeholder. Typically
generated by disassembling a binary dump that contains data in the form
of the pattern that each opcode is stated once in order followed by easy
to recognise:

00 00 EA 00
01 00 EA 00
02 00 EA 00
[...]
fe 00 EA 00
ff 00 EA 00

The disassembly is then put in a better readable form by replacing the
leftover dummy opcode parameters with something more recognizable.

The testcases for 6502, 6502x, 65sc02, 65c02, 4510, and huc6280 have been
put together by Sven Oliver ("SvOlli") Moll, as well as a template for the
m740 instructions set. Later 6502dtv support was also added.

Still to do is to find a way to implement an opcode testcase for the 65816
processor, since it's capable of executing instructions with an 8-bit and
a 16-bit operator alike, distinguished by only one processor flag.