wimoos wrote: ↑Wed Dec 12, 2012 4:27 amRemove NOP’s
[...]
This list could be extended by
Hold flag in bit 7 of a location, so you can check the flag by "BIT flag" followed by "BMI/BPL destination" keeping A untouched, clear the flag with "LSR flag". If carry is set by an condition before, use "ROR flag" to set the flag.
Operations without temporarily save the accumulator to memory:
To subtract the value in A from location's value ( (mem)-A ) use EOR #$FF; SEC; ADC mem (negate A with two's complement and simply add).
Merge some bits from A into a memory location using EOR mem; AND #mask_bits_taken_from_acc; EOR mem; STA mem.
Last edited by Mike on Sat Oct 24, 2020 2:34 pm, edited 1 time in total.
Reason:(near) full-quote shortened. Please refer to the OP by following the blue arrow link.
Sometimes you want to toggle a memory location between two values. This can be done using EOR. The value to use for EOR can be constructed with eor in the assembler (operator ^ in this example).
bjonte wrote: ↑Mon Jul 04, 2022 2:34 pm
Sometimes you want to toggle a memory location between two values. This can be done using EOR. The value to use for EOR can be constructed with eor in the assembler (operator ^ in this example)
To elaborate on this, consider the following code snippet that I used in WimBasic:
The code is entered with a tokenized value in A, that needs to be checked against three possible values. The code, following the selection benefits from having a value of zero in A (or could benefit from the carry-flag not having been changed).
Regards,
Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic