[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cc65 / ca65: how to interface C and assembly?



> the solution I gave above seems to be ideal, provided
> you use an absolute address, not some expression that has to be
> calculated at runtime (which will compile into an y-indexed indirect store)

Note that for the switch to write mode in your disk write code:
(B83D)  LDA #$FF     ;(a) = sync byte.
        STA Q7H,X    ;Write 1 sync byte.
that STA abs,X (with no page crossing) is pretty much essential.
It syncs with the Woz Machine. You can't replace it with a STA abs.

This is covered in obscene detail in Sather's Understanding the Apple
II.

Just to expand on the double write issue, various 6502 ops
perform from 1 to 4 reads and writes to the given address.
Read-modify-write ops always perform two writes.
Read-modify-write,X ops perform two reads, two writes.

65C02 ops perform 1 to 3 reads and writes to the address,
and the read-modify-write ops only perform one write.

Ah, the Apple II. The more you look, the more there is.
It's like Natural Philosophy, or something. ;-)

Cheers,
Nick.