English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 20 April 2012, 12:29   #1
oRBIT
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?
oRBIT is offline  
Old 20 April 2012, 13:16   #2
pmc
gone
 
pmc's Avatar
 
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...
pmc is offline  
Old 20 April 2012, 13:22   #3
oRBIT
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..
oRBIT is offline  
Old 20 April 2012, 14:07   #4
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
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.
StingRay is offline  
Old 21 April 2012, 19:56   #5
Photon
Moderator
 
Photon's Avatar
 
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.
Photon is offline  
Old 21 April 2012, 22:16   #6
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
Quote:
Originally Posted by StingRay View Post
If you have a spare data register just do addx dx,dx this will clear the x flag too.
But only if the result doesn't overflow, which can still happen. Just use sub dx,dx. No overflow or underflow possible.
Thorham is offline  
Old 22 April 2012, 02:52   #7
Leffmann
 
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.
Leffmann is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 15:46.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.16354 seconds with 15 queries