English Amiga Board


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

 
 
Thread Tools
Old 03 August 2014, 19:44   #1
Yulquen74
Registered User
 
Join Date: May 2013
Location: Kleppe / Norway
Posts: 255
bit test

silly and stupid, but I need some help to complete a simple routine.
(I should really study 68k assembler more closely someday).

In the start of a program, I want to test the status of bit
15 of a memory address. If it is set, I want to jump to the exit label.

btst #15,$dd0800 ; (config register 1 of cpld)
beq Exit

looking at the address with q$dd0800 I can see that the bit is not set,
but the programs still exits without doing the rest.

thanks in advance for help.
Yulquen74 is offline  
Old 03 August 2014, 20:31   #2
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 7,000
beq is wrong. It exits when the bit is not set. bne would be right
thomas is offline  
Old 03 August 2014, 20:38   #3
Yulquen74
Registered User
 
Join Date: May 2013
Location: Kleppe / Norway
Posts: 255
thanks, it is.

Quote:
Originally Posted by thomas View Post
beq is wrong. It exits when the bit is not set. bne would be right
Yulquen74 is offline  
Old 03 August 2014, 20:57   #4
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,343
Also, remember that BTST on memory is byte-sized; the bit number is modulo 8. So I suggest you have this in your code instead:
btst.b #15-8,$dd0800

Otherwise it's very easy (assuming there is a 16-bit register at $DD0800) to make the mistake of doing btst #6,$dd0800
with the intention of testing bit 6 of the word register. But that actually tests bit 14 of the register.
mark_k 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
Best Way to Convert 32-bit Signed Value to 16 Bit? AGS Coders. Asm / Hardware 31 29 December 2013 13:58
32-bit access on 16-bit bus? NorthWay Coders. Asm / Hardware 7 04 September 2013 00:46
REQ: 17-Bit Artwork 2 (1988-04)(17-Bit Software) Sea7 request.Demos 5 13 May 2011 01:07
8 bit to optimized 6 bit palette histogram improvements needed NovaCoder Coders. General 0 14 April 2011 02:13
CD32 Frog Feast test available. Test out the final! cdoty News 42 01 April 2008 16:20

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 13:36.

Top

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