03 August 2014, 19:44 | #1 |
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. |
03 August 2014, 20:31 | #2 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,000
|
beq is wrong. It exits when the bit is not set. bne would be right
|
03 August 2014, 20:38 | #3 |
Registered User
Join Date: May 2013
Location: Kleppe / Norway
Posts: 255
|
|
03 August 2014, 20:57 | #4 |
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. |
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 |
|
|