20 April 2012, 12:29 | #1 |
Zone Friend
Join Date: Apr 2006
Location: Gothenburg/Sweden
Age: 48
Posts: 339
|
Clearing the X-bit
Is there a way of clearing the X-bit in CCR without manipulating the CCR-register directly?
The 6502 has the "clc"-instruction, 680x0 doesn't have anything similar? |
20 April 2012, 13:16 | #2 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Performing an add that results in no carry would clear the x flag as x == c under those circumstances.
Obviously other flags might be set or cleared in the process so this might not suit your purpose... |
20 April 2012, 13:22 | #3 |
Zone Friend
Join Date: Apr 2006
Location: Gothenburg/Sweden
Age: 48
Posts: 339
|
If I recall correctly, manipulating the CCR directly wasn't very fast in terms of cycles but I guess that's the way to go then..
|
20 April 2012, 14:07 | #4 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
If you have a spare data register just do addx dx,dx this will clear the x flag too.
|
21 April 2012, 19:56 | #5 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
You can get it for free if you can move the instruction that needs it to after an instruction after which the state is known, such as some addq. It doesn't even need to be immediately after, as long as it's before an instruction that could set x (usually math/shift instructions that could set carry). You can also reorder instructions whose order is not important to make that happen, so you might not even have to move the instruction.
|
21 April 2012, 22:16 | #6 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
|
22 April 2012, 02:52 | #7 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Just do "add.w #0, d0" and you don't have to spare a register for it. Clearing the extend flag alone is something like 10/12 cycles in best case/cache case on 020 and up, so it's not too bad.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Clearing out some spares on Amibay! | fitzsteve | MarketPlace | 7 | 10 January 2012 16:59 |
8 bit to optimized 6 bit palette histogram improvements needed | NovaCoder | Coders. General | 0 | 14 April 2011 02:13 |
Clearing out classic system | Stokey | MarketPlace | 6 | 09 January 2010 22:34 |
Clearing A1200 + 500+ | ericmark | MarketPlace | 11 | 27 May 2009 00:50 |
FS: Clearing my Amiga stuff | BiL0 | MarketPlace | 38 | 14 July 2007 18:24 |
|
|