English Amiga Board


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

 
 
Thread Tools
Old 14 June 2019, 17:35   #1
pushead
Registered User
 
Join Date: May 2019
Location: Norway
Posts: 32
Why can't I check the flag directly?

Hi all,

I've managed to create an interrupt (level 3) either triggered from the vertical blank or the Copper. So far, so good.

But in the interrupt handler I would like to check the source of the interrupt; was the interrupt generated by the copper or the vertical blank. In order to do that I plan to check if the bit #5 (V. blank) or #4 (Copper) is set in $dff01e (INTREQR).

Now, my plan was to use a btst #4,$dff01e to check if the copper was the originator of the interrupt. But if I do that it does not work as expected. Instead, if I first move the content of $dff01e to d0, and then do a btst #4,d0 it works fine. Why? Isn' this in the same?

So then I use this code, it works fine:


irq_level_3:
movem.l d0-d7/a0-a6,-(a7)

;-------------------------------------------------
; Check source of IRQ LEVEL3: COPPER
;-------------------------------------------------

clr.l d0
move.w $dff01e,d0
btst #4,d0
bne exit

; Do some stuff.....

exit:
move.w #$0030,$dff09c
movem.l (a7)+,d0-d7/a0-a6
rte


But if I check, with btst directly, it does not work? It just skips to exit.

irq_level_3:
movem.l d0-d7/a0-a6,-(a7)

;-------------------------------------------------
; Check source of IRQ LEVEL3: COPPER
;-------------------------------------------------

btst #4,$dff01e ; Checking flag directly @$DFF01e
bne exit

; Do some stuff.....

exit:
move.w #$0030,$dff09c
movem.l (a7)+,d0-d7/a0-a6
rte



Ok, I'm quite new to Amiga programming, but this really twisted my mind here....

What am I missing here?
pushead is offline  
Old 14 June 2019, 17:40   #2
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,039
btst and family operate on a byte (if operand is in memory), and bit 4 is part of the next byte ($dff01f).

Last edited by a/b; 14 June 2019 at 17:49.
a/b is offline  
Old 14 June 2019, 17:50   #3
pushead
Registered User
 
Join Date: May 2019
Location: Norway
Posts: 32
Ah! Thanks!
pushead 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
Blitter Busy Flag bloodline Coders. Asm / Hardware 20 08 March 2019 20:49
Plotter / Dot Flag pmc Coders. Tutorials 45 19 January 2011 19:02
Flag by Gremlin BippyM project.aGTW 43 22 December 2010 22:24
Bitmap Flag = 0x00000001? andreas support.Other 2 14 October 2009 22:29
save flag Marcuz HOL suggestions and feedback 1 08 September 2006 01:18

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 11:27.

Top

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